Brozy123 commited on
Commit
d6b67ad
·
verified ·
1 Parent(s): 74a3cb0

Update lineup_persistence.js

Browse files
Files changed (1) hide show
  1. lineup_persistence.js +33 -26
lineup_persistence.js CHANGED
@@ -19,20 +19,22 @@ let guildCustomFormations = new Map();
19
  let guildCustomFormationNames = new Map();
20
  let guildPingType = new Map();
21
  let guildFriendlyPingType = new Map();
 
22
 
23
  function save() {
24
- try {
25
- const data = {
26
- guildLineups: {},
27
- guildSelectedFormation: Object.fromEntries(guildSelectedFormation),
28
- lineupOwners: Object.fromEntries(lineupOwners),
29
- activeLineupMessages: Object.fromEntries(activeLineupMessages),
30
- managerBoards: Object.fromEntries(managerBoards),
31
- guildCustomFormations: Object.fromEntries(guildCustomFormations),
32
- guildCustomFormationNames: Object.fromEntries(guildCustomFormationNames),
33
- guildPingType: Object.fromEntries(guildPingType),
34
- guildFriendlyPingType: Object.fromEntries(guildFriendlyPingType)
35
- };
 
36
 
37
  for (const [guildId, lineupMap] of guildLineups) {
38
  data.guildLineups[guildId] = Object.fromEntries(lineupMap);
@@ -89,11 +91,15 @@ function load() {
89
  for (const [k, v] of Object.entries(data.guildPingType)) guildPingType.set(k, v);
90
  }
91
 
92
- if (data.guildFriendlyPingType) {
93
- for (const [k, v] of Object.entries(data.guildFriendlyPingType)) guildFriendlyPingType.set(k, v);
94
- }
 
 
 
 
95
 
96
- console.log('[LINEUP PERSISTENCE] Data loaded successfully.');
97
  } catch (e) {
98
  console.error('[LINEUP PERSISTENCE] Load failed:', e.message);
99
  }
@@ -103,14 +109,15 @@ function load() {
103
  load();
104
 
105
  module.exports = {
106
- guildLineups,
107
- guildSelectedFormation,
108
- lineupOwners,
109
- activeLineupMessages,
110
- managerBoards,
111
- guildCustomFormations,
112
- guildCustomFormationNames,
113
- guildPingType,
114
- guildFriendlyPingType,
115
- save
 
116
  };
 
19
  let guildCustomFormationNames = new Map();
20
  let guildPingType = new Map();
21
  let guildFriendlyPingType = new Map();
22
+ let guildScrimMode = new Map(); // Track if lineup is in scrim mode
23
 
24
  function save() {
25
+ try {
26
+ const data = {
27
+ guildLineups: {},
28
+ guildSelectedFormation: Object.fromEntries(guildSelectedFormation),
29
+ lineupOwners: Object.fromEntries(lineupOwners),
30
+ activeLineupMessages: Object.fromEntries(activeLineupMessages),
31
+ managerBoards: Object.fromEntries(managerBoards),
32
+ guildCustomFormations: Object.fromEntries(guildCustomFormations),
33
+ guildCustomFormationNames: Object.fromEntries(guildCustomFormationNames),
34
+ guildPingType: Object.fromEntries(guildPingType),
35
+ guildFriendlyPingType: Object.fromEntries(guildFriendlyPingType),
36
+ guildScrimMode: Object.fromEntries(guildScrimMode)
37
+ };
38
 
39
  for (const [guildId, lineupMap] of guildLineups) {
40
  data.guildLineups[guildId] = Object.fromEntries(lineupMap);
 
91
  for (const [k, v] of Object.entries(data.guildPingType)) guildPingType.set(k, v);
92
  }
93
 
94
+ if (data.guildFriendlyPingType) {
95
+ for (const [k, v] of Object.entries(data.guildFriendlyPingType)) guildFriendlyPingType.set(k, v);
96
+ }
97
+
98
+ if (data.guildScrimMode) {
99
+ for (const [k, v] of Object.entries(data.guildScrimMode)) guildScrimMode.set(k, v === "true" || v === true);
100
+ }
101
 
102
+ console.log('[LINEUP PERSISTENCE] Data loaded successfully.');
103
  } catch (e) {
104
  console.error('[LINEUP PERSISTENCE] Load failed:', e.message);
105
  }
 
109
  load();
110
 
111
  module.exports = {
112
+ guildLineups,
113
+ guildSelectedFormation,
114
+ lineupOwners,
115
+ activeLineupMessages,
116
+ managerBoards,
117
+ guildCustomFormations,
118
+ guildCustomFormationNames,
119
+ guildPingType,
120
+ guildFriendlyPingType,
121
+ guildScrimMode,
122
+ save
123
  };