Elin Decompiled Documentation EA 23.130 Nightly
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 {
50 hotbar.SetItem(new HotItemActionMode
51 {
52 id = "Inspect"
53 });
54 }
56 {
57 hotbar.SetItem(new HotItemLayer
58 {
59 id = "LayerTravel"
60 });
61 }
62 break;
63 case 3:
64 {
65 hotbar = SetHobar(3, 12);
67 {
68 return;
69 }
70 bool flag = EClass.debug.godBuild || EClass.debug.ignoreBuildRule;
71 if (flag || EClass.Branch != null)
72 {
73 if (flag || EClass.Branch.elements.Has(4006))
74 {
75 hotbar.SetItem(new HotItemActionMode
76 {
77 id = "Inspect"
78 }).always = true;
79 }
80 if (flag || EClass.Branch.elements.Has(4000))
81 {
82 hotbar.SetItem(new HotItemActionMode
83 {
84 id = "Cut"
85 });
86 }
87 if (flag || EClass.Branch.elements.Has(4001))
88 {
89 hotbar.SetItem(new HotItemActionMode
90 {
91 id = "Mine"
92 });
93 }
94 if (flag || EClass.Branch.elements.Has(4001))
95 {
96 hotbar.SetItem(new HotItemActionMode
97 {
98 id = "Dig"
99 });
100 }
101 if (flag || EClass.Branch.elements.Has(4002))
102 {
103 hotbar.SetItem(new HotItemActionMode
104 {
105 id = "Terrain"
106 });
107 }
108 if (flag)
109 {
110 hotbar.SetItem(new HotItemActionMode
111 {
112 id = "Copy"
113 });
114 }
115 if (flag)
116 {
117 hotbar.SetItem(new HotItemActionMode
118 {
119 id = "Populate"
120 });
121 }
122 if (flag || EClass.Branch.elements.Has(4004))
123 {
124 hotbar.SetItem(new HotItemActionMode
125 {
126 id = "Deconstruct"
127 });
128 }
129 }
130 else if (EClass._zone is Zone_Tent)
131 {
132 if (flag || EClass.pc.homeBranch.elements.Has(4006))
133 {
134 hotbar.SetItem(new HotItemActionMode
135 {
136 id = "Inspect"
137 }).always = true;
138 }
139 if (flag || EClass.pc.homeBranch.elements.Has(4000))
140 {
141 hotbar.SetItem(new HotItemActionMode
142 {
143 id = "Cut"
144 });
145 }
146 if (flag || EClass.pc.homeBranch.elements.Has(4001))
147 {
148 hotbar.SetItem(new HotItemActionMode
149 {
150 id = "Mine"
151 });
152 }
153 if (flag || EClass.pc.homeBranch.elements.Has(4001))
154 {
155 hotbar.SetItem(new HotItemActionMode
156 {
157 id = "Dig"
158 });
159 }
160 if (flag || EClass.pc.homeBranch.elements.Has(4004))
161 {
162 hotbar.SetItem(new HotItemActionMode
163 {
164 id = "Deconstruct"
165 });
166 }
167 hotbar.SetItem(new HotItemActionMode
168 {
169 id = "Terrain"
170 });
171 }
172 hotbar.SetItem(new HotItemActionMode
173 {
174 id = "ExitBuild"
175 });
176 break;
177 }
178 case 4:
179 {
180 hotbar = SetHobar(4, 9);
182 {
183 return;
184 }
185 FactionBranch factionBranch = ((EClass._zone is Zone_Tent) ? EClass.pc.homeBranch : EClass.Branch);
186 if (EClass.debug.godBuild || factionBranch != null)
187 {
188 hotbar.SetItem(new HotItemActionMode
189 {
190 id = "Cinema"
191 });
192 hotbar.SetItem(new HotItemActionMode
193 {
194 id = "FlagCell"
195 });
196 if (EClass.debug.godBuild || factionBranch.elements.Has(4006))
197 {
198 hotbar.SetItem(new HotItemActionMode
199 {
200 id = "Visibility"
201 });
202 }
204 {
205 hotbar.SetItem(new HotItemActionMode
206 {
207 id = "EditMarker"
208 });
209 }
210 if (EClass.debug.godBuild || factionBranch.elements.Has(4005))
211 {
212 hotbar.SetItem(new HotItemActionMode
213 {
214 id = "Picker"
215 });
216 }
218 {
219 hotbar.SetItem(new HotItemContext
220 {
221 id = "mapTool",
222 autoExpand = false
223 });
224 }
225 }
226 break;
227 }
228 case 5:
229 hotbar = SetHobar(5, 9);
230 hotbar.SetItem(new HotItemLayer
231 {
232 id = "LayerHelp"
233 }, 0);
234 hotbar.SetItem(new HotItemWidget
235 {
236 id = "Codex"
237 }, 1);
238 hotbar.SetItem(new HotItemWidget
239 {
240 id = "Memo"
241 }, 2);
242 hotbar.SetItem(new HotItemWidget
243 {
244 id = "QuestTracker"
245 }, 3);
246 hotbar.SetItem(new HotItemActionSleep(), 4);
247 break;
248 case 6:
249 hotbar = SetHobar(6, 9);
250 break;
251 case 7:
252 hotbar = SetHobar(7, 7);
253 hotbar.SetItem(new HotItemToggle
254 {
255 type = HotItemToggle.Type.SnapFreepos
256 });
257 hotbar.SetItem(new HotItemToggle
258 {
259 type = HotItemToggle.Type.ToggleRoof
260 });
261 hotbar.SetItem(new HotItemToggle
262 {
263 type = HotItemToggle.Type.ToggleSlope
264 });
265 hotbar.SetItem(new HotItemToggle
266 {
267 type = HotItemToggle.Type.ToggleBuildLight
268 });
269 break;
270 }
271 hotbar.actor = widgetHotbar;
272 if ((bool)widgetHotbar)
273 {
274 widgetHotbar.Rebuild();
275 }
276 }
277
278 public Hotbar SetHobar(int id, int slots, WidgetHotbar actor = null)
279 {
280 Hotbar hotbar = new Hotbar();
281 hotbar.itemsPerPage = slots;
282 bars[id] = hotbar;
283 hotbar.AddPage();
284 hotbar.AddPage();
285 hotbar.id = id;
286 return hotbar;
287 }
288
289 public void OnCreateGame()
290 {
291 ResetHotbar(0);
292 ResetHotbar(1);
293 ResetHotbar(2);
294 ResetHotbar(3);
295 ResetHotbar(4);
296 ResetHotbar(5);
297 ResetHotbar(6);
298 ResetHotbar(7);
299 }
300}
FactionBranch homeBranch
Definition: Chara.cs:894
bool godBuild
Definition: CoreDebug.cs:303
bool ignoreBuildRule
Definition: CoreDebug.cs:184
bool IsGameStarted
Definition: Core.cs:84
Definition: EClass.cs:5
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static FactionBranch Branch
Definition: EClass.cs:22
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
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:501
void Rebuild()
bool CanEnterBuildModeAnywhere
Definition: Zone.cs:449