Elin Decompiled Documentation EA 23.247 Stable Patch 1
Loading...
Searching...
No Matches
HotbarManager.cs
Go to the documentation of this file.
1using Newtonsoft.Json;
2
3public class HotbarManager : EClass
4{
5 [JsonProperty]
6 public Hotbar[] bars = new Hotbar[8];
7
8 public void ResetHotbar(int id)
9 {
10 WidgetHotbar widgetHotbar = bars[id]?.actor ?? null;
11 Hotbar hotbar = null;
12 switch (id)
13 {
14 case 0:
15 hotbar = SetHobar(0, 4);
16 break;
17 case 1:
18 hotbar = SetHobar(1, 4);
19 hotbar.SetItem(new HotItemContext
20 {
21 id = "system"
22 }, 0);
23 hotbar.SetItem(new HotItemToggleLog(), 1);
24 hotbar.SetItem(new HotItemContext
25 {
26 id = "mapTool"
27 }, 2);
28 hotbar.SetItem(new HotItemToggleWidget(), 3);
29 break;
30 case 2:
31 hotbar = SetHobar(2, 7);
32 hotbar.SetItem(new HotItemLayer
33 {
34 id = "stash"
35 });
36 hotbar.SetItem(new HotItemLayer
37 {
38 id = "LayerAbility"
39 });
40 hotbar.SetItem(new HotItemLayer
41 {
42 id = "LayerChara"
43 });
44 hotbar.SetItem(new HotItemLayer
45 {
46 id = "LayerJournal"
47 });
49 {
51 {
52 hotbar.SetItem(new HotItemActionMode
53 {
54 id = "Inspect"
55 });
56 }
58 {
59 hotbar.SetItem(new HotItemLayer
60 {
61 id = "LayerTravel"
62 });
63 }
65 {
66 hotbar.SetItem(new HotItemActionExitMap());
67 }
68 }
69 break;
70 case 3:
71 {
72 hotbar = SetHobar(3, 12);
74 {
75 return;
76 }
77 bool flag = EClass.debug.godBuild || EClass.debug.ignoreBuildRule;
78 if (flag || EClass.Branch != null)
79 {
80 if (flag || EClass.Branch.elements.Has(4006))
81 {
82 hotbar.SetItem(new HotItemActionMode
83 {
84 id = "Inspect"
85 }).always = true;
86 }
87 if (flag || EClass.Branch.elements.Has(4000))
88 {
89 hotbar.SetItem(new HotItemActionMode
90 {
91 id = "Cut"
92 });
93 }
94 if (flag || EClass.Branch.elements.Has(4001))
95 {
96 hotbar.SetItem(new HotItemActionMode
97 {
98 id = "Mine"
99 });
100 }
101 if (flag || EClass.Branch.elements.Has(4001))
102 {
103 hotbar.SetItem(new HotItemActionMode
104 {
105 id = "Dig"
106 });
107 }
108 if (flag || EClass.Branch.elements.Has(4002))
109 {
110 hotbar.SetItem(new HotItemActionMode
111 {
112 id = "Terrain"
113 });
114 }
115 if (flag)
116 {
117 hotbar.SetItem(new HotItemActionMode
118 {
119 id = "Copy"
120 });
121 }
122 if (flag)
123 {
124 hotbar.SetItem(new HotItemActionMode
125 {
126 id = "Populate"
127 });
128 }
129 if (flag || EClass.Branch.elements.Has(4004))
130 {
131 hotbar.SetItem(new HotItemActionMode
132 {
133 id = "Deconstruct"
134 });
135 }
136 }
137 else if (EClass._zone is Zone_Tent)
138 {
139 if (flag || EClass.pc.homeBranch.elements.Has(4006))
140 {
141 hotbar.SetItem(new HotItemActionMode
142 {
143 id = "Inspect"
144 }).always = true;
145 }
146 if (flag || EClass.pc.homeBranch.elements.Has(4000))
147 {
148 hotbar.SetItem(new HotItemActionMode
149 {
150 id = "Cut"
151 });
152 }
153 if (flag || EClass.pc.homeBranch.elements.Has(4001))
154 {
155 hotbar.SetItem(new HotItemActionMode
156 {
157 id = "Mine"
158 });
159 }
160 if (flag || EClass.pc.homeBranch.elements.Has(4001))
161 {
162 hotbar.SetItem(new HotItemActionMode
163 {
164 id = "Dig"
165 });
166 }
167 if (flag || EClass.pc.homeBranch.elements.Has(4004))
168 {
169 hotbar.SetItem(new HotItemActionMode
170 {
171 id = "Deconstruct"
172 });
173 }
174 hotbar.SetItem(new HotItemActionMode
175 {
176 id = "Terrain"
177 });
178 }
179 hotbar.SetItem(new HotItemActionMode
180 {
181 id = "ExitBuild"
182 });
183 break;
184 }
185 case 4:
186 {
187 hotbar = SetHobar(4, 9);
189 {
190 return;
191 }
192 FactionBranch factionBranch = ((EClass._zone is Zone_Tent) ? EClass.pc.homeBranch : EClass.Branch);
193 if (EClass.debug.godBuild || factionBranch != null)
194 {
195 hotbar.SetItem(new HotItemActionMode
196 {
197 id = "Cinema"
198 });
199 hotbar.SetItem(new HotItemActionMode
200 {
201 id = "FlagCell"
202 });
203 if (EClass.debug.godBuild || factionBranch.elements.Has(4006))
204 {
205 hotbar.SetItem(new HotItemActionMode
206 {
207 id = "Visibility"
208 });
209 }
211 {
212 hotbar.SetItem(new HotItemActionMode
213 {
214 id = "EditMarker"
215 });
216 }
217 if (EClass.debug.godBuild || factionBranch.elements.Has(4005))
218 {
219 hotbar.SetItem(new HotItemActionMode
220 {
221 id = "Picker"
222 });
223 }
225 {
226 hotbar.SetItem(new HotItemContext
227 {
228 id = "mapTool",
229 autoExpand = false
230 });
231 }
232 }
233 break;
234 }
235 case 5:
236 hotbar = SetHobar(5, 9);
237 hotbar.SetItem(new HotItemLayer
238 {
239 id = "LayerHelp"
240 }, 0);
241 hotbar.SetItem(new HotItemWidget
242 {
243 id = "Codex"
244 }, 1);
245 hotbar.SetItem(new HotItemWidget
246 {
247 id = "Memo"
248 }, 2);
249 hotbar.SetItem(new HotItemWidget
250 {
251 id = "QuestTracker"
252 }, 3);
253 hotbar.SetItem(new HotItemActionSleep(), 4);
254 break;
255 case 6:
256 hotbar = SetHobar(6, 9);
257 break;
258 case 7:
259 hotbar = SetHobar(7, 7);
260 hotbar.SetItem(new HotItemToggle
261 {
262 type = HotItemToggle.Type.SnapFreepos
263 });
264 hotbar.SetItem(new HotItemToggle
265 {
266 type = HotItemToggle.Type.ToggleRoof
267 });
268 hotbar.SetItem(new HotItemToggle
269 {
270 type = HotItemToggle.Type.ToggleSlope
271 });
272 hotbar.SetItem(new HotItemToggle
273 {
274 type = HotItemToggle.Type.ToggleBuildLight
275 });
276 break;
277 }
278 hotbar.actor = widgetHotbar;
279 if ((bool)widgetHotbar)
280 {
281 widgetHotbar.Rebuild();
282 }
283 }
284
285 public Hotbar SetHobar(int id, int slots, WidgetHotbar actor = null)
286 {
287 Hotbar hotbar = new Hotbar();
288 hotbar.itemsPerPage = slots;
289 bars[id] = hotbar;
290 hotbar.AddPage();
291 hotbar.AddPage();
292 hotbar.id = id;
293 return hotbar;
294 }
295
296 public void OnCreateGame()
297 {
298 ResetHotbar(0);
299 ResetHotbar(1);
300 ResetHotbar(2);
301 ResetHotbar(3);
302 ResetHotbar(4);
303 ResetHotbar(5);
304 ResetHotbar(6);
305 ResetHotbar(7);
306 }
307}
FactionBranch homeBranch
Definition: Chara.cs:1066
bool godBuild
Definition: CoreDebug.cs:304
bool ignoreBuildRule
Definition: CoreDebug.cs:185
bool IsGameStarted
Definition: Core.cs:84
Definition: EClass.cs:6
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static FactionBranch Branch
Definition: EClass.cs:23
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
bool Has(int ele)
ElementContainerZone elements
Hotbar[] bars
Definition: HotbarManager.cs:6
void OnCreateGame()
Hotbar SetHobar(int id, int slots, WidgetHotbar actor=null)
void ResetHotbar(int id)
Definition: HotbarManager.cs:8
Definition: Hotbar.cs:5
void AddPage()
Definition: Hotbar.cs:126
HotItem SetItem(HotItem item, int index=-1, int pageIndex=-1, bool refreshActor=false)
Definition: Hotbar.cs:173
WidgetHotbar actor
Definition: Hotbar.cs:91
virtual bool IsRegion
Definition: Spatial.cs:515
void Rebuild()
virtual bool IsUserZone
Definition: Zone.cs:271
bool CanEnterBuildModeAnywhere
Definition: Zone.cs:458