-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAvailableApplianceOptionsSystem.cs
230 lines (198 loc) · 7.8 KB
/
AvailableApplianceOptionsSystem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
using System.Collections.Generic;
using Kitchen;
using KitchenData;
using KitchenMods;
namespace KitchenOverstocked
{
public class AvailableApplianceOptionsSystem : GameSystemBase, IModSystem
{
public static List<int> LoadedAvailableApplianceIds = new List<int> { };
public static List<string> LoadedAvailableApplianceNames = new List<string> { };
public static Dictionary<string, Dictionary<int, string>> LoadedAvailableAppliances =
new Dictionary<string, Dictionary<int, string>>();
private static readonly int[] applianceIds =
{
1551609169, // Bin
-571205127, // BlueprintCabinet
1139247360, // BlueprintUpgradeDesk
1648733244, // CoffeeTable
-1906799936, // Combiner
-1248669347, // Countertop
434150763, // DirtyPlateStack
532998682, // Dumbwaiter
-1817838704, // ExtraLife
1351951642, // FloorBufferStation
1765889988, // FloorProtector
-1813414500, // FoodDisplayStand
1921027834, // GasLimiter
-770041014, // GasSafetyOverride
862493270, // Hob
-63118559, // HostStand
1329097317, // Mixer
-1993346570, // MopBucket
-1610332021, // OrderingTerminal
-1068749602, // Oven
1313469794, // PlateStack
-1462602185, // Portioner
1656358740, // PrepStation
-2147057861, // RobotMop
1083874952, // SinkNormal
209074140, // TableLarge
-26827118, // UpgradeKit
};
private static readonly int[] coffeeAppliances =
{
-1609758240, // CoffeeMachine
801015432, // IceDispenser
-557736569, // MilkDispenser
143484231, // SourceCakeStand
};
private static readonly int[] tools =
{
-2070005162, // Clipboard Stand.
1286554202, // FireExtinguisherHolder
1738351766, // RollingPinProvider
624465484, // ScrubbingBrushProvider
2023704259, // SharpKnifeProvider
723626409, // ShoeRackTrainers
1796077718, // ShoeRackWellies
230848637, // ShoeRackWorkBoots
1129858275, // TrayStand
};
private static readonly int[] consumables =
{
639111696, // BreadstickBox
1358522063, // CandleBox
221442949, // FlowerPot
1528688658, // NapkinBox
2080633647, // SharpCutlery
446555792, // SpecialsMenuBox
-1013770159, // SupplyCabinet
-940358190, // Leftover Bags Station
};
private static readonly int[] decorations =
{
668664567, // Painting
756364626, // Plant
-648349801, // Rug
};
private static readonly int[] bakingTrays =
{
-660310536, // Big Cake Tin
-2135982034, // Brownie Tray
-1723125645, // Cookie Tray
-315287689, // Cupcake tray
2136474391, // Doughnut Tray
};
private static readonly int[] cooking =
{
-957949759, // PotStack
235423916, // ServingBoardStack
314862254, // WokStack
};
private static readonly int[] magic =
{
-292467039, // Enchanting Desk
782648278, // Cauldron
-1992638820, // Enchanted Broom
540526865, // Enchanted Plates
-1946127856, // Ghostly Clipboard
1313278365, // Ghostly Knife
689268680, // Ghostly Rolling Pin
-560953757, // Ghost Scrubber
-1780646993, // Illusion Wall
1150470926, // Instant Wand
2044081363, // Levitation Line
119166501, // Levitation Station
267288096, // Magic Apple Tree
744482650, // Magic Mirror
-1696198539, // Magic Spring
29164230, // Pouch of Holding
423254987, // Preserving Station
-1688921160, // Table - Sharing Cauldron
2000892639, // Table - Stone
1492264331, // Vanishing Circle
};
protected override void Initialise()
{
base.Initialise();
}
protected override void OnUpdate()
{
if (!(Has<CSceneFirstFrame>()))
{
return;
}
DiscoverAppliances();
}
private void DiscoverAppliances()
{
Mod.LogInfo("Loading available appliances...");
LoadedAvailableAppliances.Clear();
foreach (int applianceId in applianceIds)
{
Appliance appliance = GameData.Main.Get<Appliance>(applianceId);
if (appliance == null)
{
continue;
}
var variants = new Dictionary<int, string> { { applianceId, appliance.Name } };
LoadedAvailableAppliances.Add(appliance.Name, variants);
foreach (var upgrade in appliance.Upgrades)
{
Mod.LogInfo($"{appliance.Name} - {upgrade.Name}");
// The deconstructor mod causes an issue because it loops the blueprint cabinet to a deconstructor and back
if (!variants.ContainsKey(upgrade.ID))
{
variants.Add(upgrade.ID, upgrade.Name);
}
}
}
// Belts
var belts = new Dictionary<int, string>();
Appliance belt = GameData.Main.Get<Appliance>(1973114260); // Basic Bitch Belt
belts.Add(belt.ID, belt.Name);
LoadedAvailableAppliances.Add(belt.Name, belts);
foreach (var upgrade in belt.Upgrades)
{
Mod.LogInfo($"{belt.Name} - {upgrade.Name}");
if (!belts.ContainsKey(upgrade.ID))
{
belts.Add(upgrade.ID, upgrade.Name);
}
var upgradeAppliance = GameData.Main.Get<Appliance>(upgrade.ID);
foreach (var nestedUpgrade in upgradeAppliance.Upgrades)
{
if (!belts.ContainsKey(nestedUpgrade.ID))
{
belts.Add(nestedUpgrade.ID, nestedUpgrade.Name);
}
}
}
LoadedAvailableAppliances.Add("Baking", CreateApplianceDictionary(bakingTrays));
LoadedAvailableAppliances.Add("Coffee", CreateApplianceDictionary(coffeeAppliances));
LoadedAvailableAppliances.Add("Cooking", CreateApplianceDictionary(cooking));
LoadedAvailableAppliances.Add("Consumables", CreateApplianceDictionary(consumables));
LoadedAvailableAppliances.Add("Decorations", CreateApplianceDictionary(decorations));
LoadedAvailableAppliances.Add("Magic", CreateApplianceDictionary(magic));
LoadedAvailableAppliances.Add("Tools", CreateApplianceDictionary(tools));
Mod.LogInfo("Found all appliances");
}
private static Dictionary<int, string> CreateApplianceDictionary(int[] applianceIds)
{
var appliances = new Dictionary<int, string>();
foreach (var applianceId in applianceIds)
{
Appliance appliance = GameData.Main.Get<Appliance>(applianceId);
if (!appliances.ContainsKey(appliance.ID))
{
appliances.Add(
appliance.ID,
appliance.Name.Replace("Source -", "").Replace("Provider", "")
);
}
}
return appliances;
}
}
}