forked from blushiemagic/MagicStorage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MagicStorage.cs
294 lines (259 loc) · 11.2 KB
/
MagicStorage.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
using System;
using System.Collections.Generic;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI;
using Microsoft.Xna.Framework;
using Terraria.Localization;
namespace MagicStorage
{
public class MagicStorage : Mod
{
public static MagicStorage Instance;
public static Mod bluemagicMod;
public static Mod legendMod;
public static readonly Version requiredVersion = new Version(0, 9, 2, 2);
public override void Load()
{
if (ModLoader.version < requiredVersion)
{
throw new Exception("Magic storage requires a tModLoader version of at least " + requiredVersion);
}
Instance = this;
InterfaceHelper.Initialize();
legendMod = ModLoader.GetMod("LegendOfTerraria3");
bluemagicMod = ModLoader.GetMod("Bluemagic");
AddTranslations();
}
private void AddTranslations()
{
ModTranslation text = CreateTranslation("SetTo");
text.SetDefault("Set to: X={0}, Y={1}");
text.AddTranslation(GameCulture.Polish, "Ustawione na: X={0}, Y={1}");
text.AddTranslation(GameCulture.French, "Mis à: X={0}, Y={1}");
text.AddTranslation(GameCulture.Spanish, "Ajustado a: X={0}, Y={1}");
AddTranslation(text);
text = CreateTranslation("SnowBiomeBlock");
text.SetDefault("Snow Biome Block");
text.AddTranslation(GameCulture.French, "Bloc de biome de neige");
text.AddTranslation(GameCulture.Spanish, "Bloque de Biomas de la Nieve");
AddTranslation(text);
text = CreateTranslation("DepositAll");
text.SetDefault("Deposit All");
text.AddTranslation(GameCulture.Russian, "Переместить всё");
text.AddTranslation(GameCulture.French, "Déposer tout");
text.AddTranslation(GameCulture.Spanish, "Depositar todo");
AddTranslation(text);
text = CreateTranslation("Search");
text.SetDefault("Search");
text.AddTranslation(GameCulture.Russian, "Поиск");
text.AddTranslation(GameCulture.French, "Rechercher");
text.AddTranslation(GameCulture.Spanish, "Buscar");
AddTranslation(text);
text = CreateTranslation("SearchName");
text.SetDefault("Search Name");
text.AddTranslation(GameCulture.Russian, "Поиск по имени");
text.AddTranslation(GameCulture.French, "Recherche par nom");
text.AddTranslation(GameCulture.Spanish, "búsqueda por nombre");
AddTranslation(text);
text = CreateTranslation("SearchMod");
text.SetDefault("Search Mod");
text.AddTranslation(GameCulture.Russian, "Поиск по моду");
text.AddTranslation(GameCulture.French, "Recherche par mod");
text.AddTranslation(GameCulture.Spanish, "búsqueda por mod");
AddTranslation(text);
text = CreateTranslation("SortDefault");
text.SetDefault("Default Sorting");
text.AddTranslation(GameCulture.Russian, "Стандартная сортировка");
text.AddTranslation(GameCulture.French, "Tri Standard");
text.AddTranslation(GameCulture.Spanish, "Clasificación por defecto");
AddTranslation(text);
text = CreateTranslation("SortID");
text.SetDefault("Sort by ID");
text.AddTranslation(GameCulture.Russian, "Сортировка по ID");
text.AddTranslation(GameCulture.French, "Trier par ID");
text.AddTranslation(GameCulture.Spanish, "Ordenar por ID");
AddTranslation(text);
text = CreateTranslation("SortName");
text.SetDefault("Sort by Name");
text.AddTranslation(GameCulture.Russian, "Сортировка по имени");
text.AddTranslation(GameCulture.French, "Trier par nom");
text.AddTranslation(GameCulture.Spanish, "Ordenar por nombre");
AddTranslation(text);
text = CreateTranslation("SortStack");
text.SetDefault("Sort by Stacks");
text.AddTranslation(GameCulture.Russian, "Сортировка по стакам");
text.AddTranslation(GameCulture.French, "Trier par piles");
text.AddTranslation(GameCulture.Spanish, "Ordenar por pilas");
AddTranslation(text);
text = CreateTranslation("FilterAll");
text.SetDefault("Filter All");
text.AddTranslation(GameCulture.Russian, "Фильтр (Всё)");
text.AddTranslation(GameCulture.French, "Filtrer tout");
text.AddTranslation(GameCulture.Spanish, "Filtrar todo");
AddTranslation(text);
text = CreateTranslation("FilterWeapons");
text.SetDefault("Filter Weapons");
text.AddTranslation(GameCulture.Russian, "Фильтр (Оружия)");
text.AddTranslation(GameCulture.French, "Filtrer par armes");
text.AddTranslation(GameCulture.Spanish, "Filtrar por armas");
AddTranslation(text);
text = CreateTranslation("FilterTools");
text.SetDefault("Filter Tools");
text.AddTranslation(GameCulture.Russian, "Фильтр (Инструменты)");
text.AddTranslation(GameCulture.French, "Filtrer par outils");
text.AddTranslation(GameCulture.Spanish, "Filtrar por herramientas");
AddTranslation(text);
text = CreateTranslation("FilterEquips");
text.SetDefault("Filter Equipment");
text.AddTranslation(GameCulture.Russian, "Фильтр (Снаряжения)");
text.AddTranslation(GameCulture.French, "Filtrer par Équipement");
text.AddTranslation(GameCulture.Spanish, "Filtrar por equipamiento");
AddTranslation(text);
text = CreateTranslation("FilterPotions");
text.SetDefault("Filter Potions");
text.AddTranslation(GameCulture.Russian, "Фильтр (Зелья)");
text.AddTranslation(GameCulture.French, "Filtrer par potions");
text.AddTranslation(GameCulture.Spanish, "Filtrar por poción");
AddTranslation(text);
text = CreateTranslation("FilterTiles");
text.SetDefault("Filter Placeables");
text.AddTranslation(GameCulture.Russian, "Фильтр (Размещаемое)");
text.AddTranslation(GameCulture.French, "Filtrer par placeable");
text.AddTranslation(GameCulture.Spanish, "Filtrar por metido");
AddTranslation(text);
text = CreateTranslation("FilterMisc");
text.SetDefault("Filter Misc");
text.AddTranslation(GameCulture.Russian, "Фильтр (Разное)");
text.AddTranslation(GameCulture.French, "Filtrer par miscellanées");
text.AddTranslation(GameCulture.Spanish, "Filtrar por otros");
AddTranslation(text);
text = CreateTranslation("CraftingStations");
text.SetDefault("Crafting Stations");
text.AddTranslation(GameCulture.Russian, "Станции создания");
text.AddTranslation(GameCulture.French, "Stations d'artisanat");
text.AddTranslation(GameCulture.Spanish, "Estaciones de elaboración");
AddTranslation(text);
text = CreateTranslation("Recipes");
text.SetDefault("Recipes");
text.AddTranslation(GameCulture.Russian, "Рецепты");
text.AddTranslation(GameCulture.French, "Recettes");
text.AddTranslation(GameCulture.Spanish, "Recetas");
AddTranslation(text);
text = CreateTranslation("SelectedRecipe");
text.SetDefault("Selected Recipe");
text.AddTranslation(GameCulture.French, "Recette sélectionnée");
text.AddTranslation(GameCulture.Spanish, "Receta seleccionada");
AddTranslation(text);
text = CreateTranslation("Ingredients");
text.SetDefault("Ingredients");
text.AddTranslation(GameCulture.French, "Ingrédients");
text.AddTranslation(GameCulture.Spanish, "Ingredientes");
AddTranslation(text);
text = CreateTranslation("StoredItems");
text.SetDefault("Stored Ingredients");
text.AddTranslation(GameCulture.French, "Ingrédients Stockés");
text.AddTranslation(GameCulture.Spanish, "Ingredientes almacenados");
AddTranslation(text);
text = CreateTranslation("RecipeAvailable");
text.SetDefault("Show available recipes");
text.AddTranslation(GameCulture.French, "Afficher les recettes disponibles");
text.AddTranslation(GameCulture.Spanish, "Mostrar recetas disponibles");
AddTranslation(text);
text = CreateTranslation("RecipeAll");
text.SetDefault("Show all recipes");
text.AddTranslation(GameCulture.French, "Afficher toutes les recettes");
text.AddTranslation(GameCulture.Spanish, "Mostrar todas las recetas");
AddTranslation(text);
}
public override void PostSetupContent()
{
}
public override void AddRecipeGroups()
{
RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + " Chest",
ItemID.Chest,
ItemID.GoldChest,
ItemID.ShadowChest,
ItemID.EbonwoodChest,
ItemID.RichMahoganyChest,
ItemID.PearlwoodChest,
ItemID.IvyChest,
ItemID.IceChest,
ItemID.LivingWoodChest,
ItemID.SkywareChest,
ItemID.ShadewoodChest,
ItemID.WebCoveredChest,
ItemID.LihzahrdChest,
ItemID.WaterChest,
ItemID.JungleChest,
ItemID.CorruptionChest,
ItemID.CrimsonChest,
ItemID.HallowedChest,
ItemID.FrozenChest,
ItemID.DynastyChest,
ItemID.HoneyChest,
ItemID.SteampunkChest,
ItemID.PalmWoodChest,
ItemID.MushroomChest,
ItemID.BorealWoodChest,
ItemID.SlimeChest,
ItemID.GreenDungeonChest,
ItemID.PinkDungeonChest,
ItemID.BlueDungeonChest,
ItemID.BoneChest,
ItemID.CactusChest,
ItemID.FleshChest,
ItemID.ObsidianChest,
ItemID.PumpkinChest,
ItemID.SpookyChest,
ItemID.GlassChest,
ItemID.MartianChest,
ItemID.GraniteChest,
ItemID.MeteoriteChest,
ItemID.MarbleChest);
RecipeGroup.RegisterGroup("MagicStorage:AnyChest", group);
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Language.GetTextValue("Mods.MagicStorage.SnowBiomeBlock"), ItemID.SnowBlock, ItemID.IceBlock, ItemID.PurpleIceBlock, ItemID.PinkIceBlock);
if (bluemagicMod != null)
{
group.ValidItems.Add(bluemagicMod.ItemType("DarkBlueIce"));
}
RecipeGroup.RegisterGroup("MagicStorage:AnySnowBiomeBlock", group);
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Diamond), ItemID.Diamond, ItemType("ShadowDiamond"));
if (legendMod != null)
{
group.ValidItems.Add(legendMod.ItemType("GemChrysoberyl"));
group.ValidItems.Add(legendMod.ItemType("GemAlexandrite"));
}
RecipeGroup.RegisterGroup("MagicStorage:AnyDiamond", group);
if (legendMod != null)
{
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Amethyst), ItemID.Amethyst, legendMod.ItemType("GemOnyx"), legendMod.ItemType("GemSpinel"));
RecipeGroup.RegisterGroup("MagicStorage:AnyAmethyst", group);
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Topaz), ItemID.Topaz, legendMod.ItemType("GemGarnet"));
RecipeGroup.RegisterGroup("MagicStorage:AnyTopaz", group);
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Sapphire), ItemID.Sapphire, legendMod.ItemType("GemCharoite"));
RecipeGroup.RegisterGroup("MagicStorage:AnySapphire", group);
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Emerald), legendMod.ItemType("GemPeridot"));
RecipeGroup.RegisterGroup("MagicStorage:AnyEmerald", group);
group = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Ruby), ItemID.Ruby, legendMod.ItemType("GemOpal"));
RecipeGroup.RegisterGroup("MagicStorage:AnyRuby", group);
}
}
public override void HandlePacket(BinaryReader reader, int whoAmI)
{
NetHelper.HandlePacket(reader, whoAmI);
}
public override void ModifyInterfaceLayers(List<GameInterfaceLayer> layers)
{
InterfaceHelper.ModifyInterfaceLayers(layers);
}
public override void PostUpdateInput()
{
StorageGUI.Update(null);
CraftingGUI.Update(null);
}
}
}