Elin Modding Docs Doc
Loading...
Searching...
No Matches
HotbarManager.cs
1using System;
2using Newtonsoft.Json;
3
4// Token: 0x02000601 RID: 1537
5public class HotbarManager : EClass
6{
7 // Token: 0x06002AB3 RID: 10931 RVA: 0x000F0B7C File Offset: 0x000EED7C
8 public void ResetHotbar(int id)
9 {
10 Hotbar hotbar = this.bars[id];
11 WidgetHotbar widgetHotbar = ((hotbar != null) ? hotbar.actor : null) ?? null;
12 Hotbar hotbar2 = null;
13 switch (id)
14 {
15 case 0:
16 hotbar2 = this.SetHobar(0, 4, null);
17 break;
18 case 1:
19 hotbar2 = this.SetHobar(1, 4, null);
20 hotbar2.SetItem(new HotItemContext
21 {
22 id = "system"
23 }, 0, -1, false);
24 hotbar2.SetItem(new HotItemToggleLog(), 1, -1, false);
25 hotbar2.SetItem(new HotItemContext
26 {
27 id = "mapTool"
28 }, 2, -1, false);
29 hotbar2.SetItem(new HotItemToggleWidget(), 3, -1, false);
30 break;
31 case 2:
32 hotbar2 = this.SetHobar(2, 7, null);
33 hotbar2.SetItem(new HotItemLayer
34 {
35 id = "stash"
36 }, -1, -1, false);
37 hotbar2.SetItem(new HotItemLayer
38 {
39 id = "LayerAbility"
40 }, -1, -1, false);
41 hotbar2.SetItem(new HotItemLayer
42 {
43 id = "LayerChara"
44 }, -1, -1, false);
45 hotbar2.SetItem(new HotItemLayer
46 {
47 id = "LayerJournal"
48 }, -1, -1, false);
49 if (EClass.core.IsGameStarted && EClass._zone.CanEnterBuildModeAnywhere)
50 {
51 hotbar2.SetItem(new HotItemActionMode
52 {
53 id = "Inspect"
54 }, -1, -1, false);
55 }
56 if (EClass.core.IsGameStarted && EClass._zone.IsRegion)
57 {
58 hotbar2.SetItem(new HotItemLayer
59 {
60 id = "LayerTravel"
61 }, -1, -1, false);
62 }
63 break;
64 case 3:
65 {
66 hotbar2 = this.SetHobar(3, 12, null);
67 if (!EClass.core.IsGameStarted)
68 {
69 return;
70 }
71 bool flag = EClass.debug.godBuild || EClass.debug.ignoreBuildRule;
72 if (flag || EClass.Branch != null)
73 {
74 if (flag || EClass.Branch.elements.Has(4006))
75 {
76 hotbar2.SetItem(new HotItemActionMode
77 {
78 id = "Inspect"
79 }, -1, -1, false).always = true;
80 }
81 if (flag || EClass.Branch.elements.Has(4000))
82 {
83 hotbar2.SetItem(new HotItemActionMode
84 {
85 id = "Cut"
86 }, -1, -1, false);
87 }
88 if (flag || EClass.Branch.elements.Has(4001))
89 {
90 hotbar2.SetItem(new HotItemActionMode
91 {
92 id = "Mine"
93 }, -1, -1, false);
94 }
95 if (flag || EClass.Branch.elements.Has(4001))
96 {
97 hotbar2.SetItem(new HotItemActionMode
98 {
99 id = "Dig"
100 }, -1, -1, false);
101 }
102 if (flag || EClass.Branch.elements.Has(4002))
103 {
104 hotbar2.SetItem(new HotItemActionMode
105 {
106 id = "Terrain"
107 }, -1, -1, false);
108 }
109 if (flag)
110 {
111 hotbar2.SetItem(new HotItemActionMode
112 {
113 id = "Copy"
114 }, -1, -1, false);
115 }
116 if (flag)
117 {
118 hotbar2.SetItem(new HotItemActionMode
119 {
120 id = "Populate"
121 }, -1, -1, false);
122 }
123 if (flag || EClass.Branch.elements.Has(4004))
124 {
125 hotbar2.SetItem(new HotItemActionMode
126 {
127 id = "Deconstruct"
128 }, -1, -1, false);
129 }
130 hotbar2.SetItem(new HotItemActionMode
131 {
132 id = "ExitBuild"
133 }, -1, -1, false);
134 }
135 break;
136 }
137 case 4:
138 hotbar2 = this.SetHobar(4, 9, null);
139 if (!EClass.core.IsGameStarted)
140 {
141 return;
142 }
143 if (EClass.debug.godBuild || EClass.Branch != null)
144 {
145 hotbar2.SetItem(new HotItemActionMode
146 {
147 id = "Cinema"
148 }, -1, -1, false);
149 hotbar2.SetItem(new HotItemActionMode
150 {
151 id = "FlagCell"
152 }, -1, -1, false);
153 if (EClass.debug.godBuild || EClass.Branch.elements.Has(4006))
154 {
155 hotbar2.SetItem(new HotItemActionMode
156 {
157 id = "Visibility"
158 }, -1, -1, false);
159 }
160 if (EClass.debug.godBuild)
161 {
162 hotbar2.SetItem(new HotItemActionMode
163 {
164 id = "EditMarker"
165 }, -1, -1, false);
166 }
167 if (EClass.debug.godBuild || EClass.Branch.elements.Has(4005))
168 {
169 hotbar2.SetItem(new HotItemActionMode
170 {
171 id = "Picker"
172 }, -1, -1, false);
173 }
174 if (EClass.debug.godBuild)
175 {
176 hotbar2.SetItem(new HotItemContext
177 {
178 id = "mapTool",
179 autoExpand = false
180 }, -1, -1, false);
181 }
182 }
183 break;
184 case 5:
185 hotbar2 = this.SetHobar(5, 9, null);
186 hotbar2.SetItem(new HotItemLayer
187 {
188 id = "LayerHelp"
189 }, 0, -1, false);
190 hotbar2.SetItem(new HotItemWidget
191 {
192 id = "Codex"
193 }, 1, -1, false);
194 hotbar2.SetItem(new HotItemWidget
195 {
196 id = "Memo"
197 }, 2, -1, false);
198 hotbar2.SetItem(new HotItemWidget
199 {
200 id = "QuestTracker"
201 }, 3, -1, false);
202 hotbar2.SetItem(new HotItemActionSleep(), 4, -1, false);
203 break;
204 case 6:
205 hotbar2 = this.SetHobar(6, 9, null);
206 break;
207 case 7:
208 hotbar2 = this.SetHobar(7, 7, null);
209 hotbar2.SetItem(new HotItemToggle
210 {
211 type = HotItemToggle.Type.SnapFreepos
212 }, -1, -1, false);
213 hotbar2.SetItem(new HotItemToggle
214 {
215 type = HotItemToggle.Type.ToggleRoof
216 }, -1, -1, false);
217 hotbar2.SetItem(new HotItemToggle
218 {
219 type = HotItemToggle.Type.ToggleSlope
220 }, -1, -1, false);
221 hotbar2.SetItem(new HotItemToggle
222 {
223 type = HotItemToggle.Type.ToggleBuildLight
224 }, -1, -1, false);
225 break;
226 }
227 hotbar2.actor = widgetHotbar;
228 if (widgetHotbar)
229 {
230 widgetHotbar.Rebuild();
231 }
232 }
233
234 // Token: 0x06002AB4 RID: 10932 RVA: 0x000F1130 File Offset: 0x000EF330
235 public Hotbar SetHobar(int id, int slots, WidgetHotbar actor = null)
236 {
237 Hotbar hotbar = new Hotbar();
238 hotbar.itemsPerPage = slots;
239 this.bars[id] = hotbar;
240 hotbar.AddPage();
241 hotbar.AddPage();
242 hotbar.id = id;
243 return hotbar;
244 }
245
246 // Token: 0x06002AB5 RID: 10933 RVA: 0x000F1167 File Offset: 0x000EF367
247 public void OnCreateGame()
248 {
249 this.ResetHotbar(0);
250 this.ResetHotbar(1);
251 this.ResetHotbar(2);
252 this.ResetHotbar(3);
253 this.ResetHotbar(4);
254 this.ResetHotbar(5);
255 this.ResetHotbar(6);
256 this.ResetHotbar(7);
257 }
258
259 // Token: 0x04001814 RID: 6164
260 [JsonProperty]
261 public Hotbar[] bars = new Hotbar[8];
262}