-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHighlander.cs
More file actions
353 lines (288 loc) · 13.4 KB
/
Copy pathHighlander.cs
File metadata and controls
353 lines (288 loc) · 13.4 KB
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
using Highlander.Common.Players;
using Highlander.Common.Systems;
using Highlander.Items;
using Highlander.Items.Armor;
using Highlander.Items.Armor.Halloween;
using Highlander.Items.Armor.VanityHats;
using Highlander.Items.Armor.VanityHats.Series2;
using Highlander.Items.SeaDog;
using Highlander.UnusualLayerEffects;
using Highlander.Utilities;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
namespace Highlander
{
public class Highlander : Mod
{
private static int LogCounter = 0;
public Highlander()
{
Instance = this;
RollTable.MakeTable();
UnusualLayer.dust = new List<FauxDust>();
FauxDust.mod = this;
}
public override void Load()
{
AbnormalEffect effect = AbnormalEffect.Unknown;
// Series 1
AbnormalItem item = new Anger(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/Anger_Head");
item = new HongKongCone(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/HongKongCone_Head");
item = new Hotrod(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/Hotrod_Head");
item = new KillerExclusive(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/KillerExclusive_Head");
item = new LegendaryLid(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/LegendaryLid_Head");
item = new OlSnaggletooth(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/OlSnaggletooth_Head");
item = new PithyProfessional(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/PithyProfessional_Head");
item = new PyromancerMask(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/PyromancerMask_Head");
item = new SamurEye(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/SamurEye_Head");
item = new StainlessPot(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/StainlessPot_Head");
item = new StoutShako(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/StoutShako_Head");
item = new TeamCaptain(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series1/TeamCaptain_Head");
// Series 2
item = new DeadCone(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/DeadCone_Head");
item = new FruitShoot(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/FruitShoot_Head");
item = new FuriousFukaamigasa(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/FuriousFukaamigasa_Head");
item = new HeroHachimaki(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/HeroHachimaki_Head");
item = new HotDogger(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/HotDogger_Head");
item = new JanissaryKetche(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/JanissaryKetche_Head");
item = new Law(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/Law_Head");
item = new MediMask(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/MediMask_Head");
item = new SurgeonStahlhelm(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/SurgeonStahlhelm_Head");
item = new ToughStuffMuffs(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Series2/ToughStuffMuffs_Head");
// Winter
item = new BrassBucket(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/BrassBucket_Head");
item = new ColdfrontCommander(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/ColdfrontCommander_Head");
item = new CondorCap(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/CondorCap_Head");
item = new Globetrotter(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/Globetrotter_Head");
item = new MightyMitre(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/MightyMitre_Head");
item = new PatriotPeak(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/PatriotPeak_Head");
item = new SinnerShade(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/SinnerShade_Head");
item = new SurgeonShako(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/SurgeonShako_Head");
item = new TartanTyrolean(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/TartanTyrolean_Head");
item = new ToySoldier(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Winter/ToySoldier_Head");
// Halloween
item = new CroneDome(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/CroneDome_Head");
item = new Executioner(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/Executioner_Head");
item = new Hellmet(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/Hellmet_Head");
item = new InfernalImpaler(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/InfernalImpaler_Head");
item = new MacabreMask(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/MacabreMask_Head");
item = new OneWayTicket(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/OneWayTicket_Head");
item = new SearedSorcerer(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/SearedSorcerer_Head");
item = new SirPumpkinton(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Halloween/SirPumpkinton_Head");
// Orignal Hats
item = new AutonomousOrb(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/AutonomousOrb_Head");
item = new BloodWarriorMask(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/BloodWarriorMask_Head");
item = new GuerrillaRebel(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/GuerrillaRebel_Head");
item = new Headless(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/Headless_Head");
item = new ImpregnableHelm(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/ImpregnableHelm_Head");
item = new MedicalMask(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/MedicalMask_Head");
item = new NinjaHeadband(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/NinjaHeadband_Head");
item = new OpenMind(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/OpenMind_Head");
item = new PaperBag(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/PaperBag_Head");
item = new SkiMask(effect);
AddContent(item);
AddEquipTexture(item, EquipType.Head, "Highlander/Items/Armor/VanityHats/SkiMask_Head");
}
public override void Unload()
{
RollTable.AbnormalRollTable = null;
UnusualLayer.dust = null;
FauxDust.mod = null;
Instance = null;
}
private void AddEquipTexture(ModItem item, EquipType type, string texpath)
{
EquipLoader.AddEquipTexture(Instance, texpath, type, item);
}
public override void HandlePacket(BinaryReader reader, int whoAmI)
{
HighlanderMessageType msgType = (HighlanderMessageType)reader.ReadByte();
switch (msgType)
{
case HighlanderMessageType.HighlanderPlayerSyncPlayer:
byte playernumber = reader.ReadByte();
HighlanderPlayer modPlayer = Main.player[playernumber].GetModPlayer<HighlanderPlayer>();
int unboxed = reader.ReadInt32();
modPlayer.unboxed = unboxed;
// SyncPlayer will be called automatically, so there is no need to forward this data to other clients.
break;
default:
Logger.WarnFormat("Highlander: Unknown Message type: {0}", msgType);
break;
}
}
public override void PostSetupContent()
{
// Boss Checklist Support
if (ModLoader.TryGetMod("BossChecklist", out Mod bossChecklist))
{
bossChecklist.Call(
"AddBoss",
4.99f,
ModContent.NPCType<NPCs.HauntedHatter.HauntedHatter>(),
this, // Mod
"Haunted Hatter",
(Func<bool>)(() => HighlanderWorld.downedHauntedHatter),
ModContent.ItemType<Items.HauntedHatter.SpookyHeadwear>(),
new List<int> { ModContent.ItemType<Items.HauntedHatter.HauntedHatterTrophy>(), ModContent.ItemType<Items.HauntedHatter.GhostlyGibus>() },
new List<int> { ModContent.ItemType<Items.HauntedHatter.HauntedHatterBag>(), ModContent.ItemType<Items.HauntedHatter.EnchantedNeedleHook>()
, ModContent.ItemType<Items.HauntedHatter.SpiritShears>(), ModContent.ItemType<Items.Weapons.AncientStoneBlaster>()},
$"Use [i:{ModContent.ItemType<Items.HauntedHatter.SpookyHeadwear>()}] which can be crafted or dropped once after defeating the Eater of Worlds or the Brain of Cthulu.",
"Haunted Hatter spirited away the challengers");
// Additional bosses here
bossChecklist.Call(
"AddBoss",
9.1f,
ModContent.NPCType<NPCs.EnlightenmentIdol.EnlightenmentIdol>(),
this, // Mod
"Idol of Enlightenment",
(Func<bool>)(() => HighlanderWorld.downedEnlightenmentIdol),
ModContent.ItemType<Items.EnlightenmentIdol.StoneIdol>(),
new List<int> { ModContent.ItemType<Items.EnlightenmentIdol.EnlightenmentIdolTrophy>(), ModContent.ItemType<Items.EnlightenmentIdol.EnlightenedMask>() },
new List<int> { ModContent.ItemType<Items.EnlightenmentIdol.EnlightenmentIdolBag>(), ModContent.ItemType<Items.EnlightenmentIdol.DivinePresence>()
, ModContent.ItemType<Items.EnlightenmentIdol.BlitzFist>(), ModContent.ItemType<Items.EnlightenmentIdol.CommanderBlessing>()},
$"Use [i:{ModContent.ItemType<Items.EnlightenmentIdol.StoneIdol>()}] which can be crafted with [i:{ItemID.SoulofLight}] and [i:{ItemID.StoneBlock}].",
"Idol of Enlightenment helped the challengers pass on",
"Highlander/NPCs/EnlightenmentIdol/EnlightenmentIdolBossChecklist");
bossChecklist.Call(
"AddBoss",
0.8f,
ModContent.NPCType<NPCs.SeaDog.SeaDog>(),
this, // Mod
"Sea Dog",
(Func<bool>)(() => HighlanderWorld.downedSeaDog),
ModContent.ItemType<Items.SeaDog.GlowingTreasure>(),
new List<int> { ModContent.ItemType<Items.SeaDog.SeaDogTrophy>(), ModContent.ItemType<Items.SeaDog.SeaDogMask>() },
new List<int> { ModContent.ItemType<Items.SeaDog.SeaDogBag>(), ModContent.ItemType<BarnacleBarrier>(),
ModContent.ItemType<FeralFrenzy>(), ModContent.ItemType<BrokenBlunderbuss>(), ItemID.GoldOre, ItemID.SpelunkerPotion, ItemID.GillsPotion},
$"Use [i:{ModContent.ItemType<Items.SeaDog.GlowingTreasure>()}] at a beach.",
"Sea Dog devoured the challengers");
}
// Census Support
if (ModLoader.TryGetMod("Census", out Mod censusMod))
{
// Here I am using Chat Tags to make my condition even more interesting.
// If you localize your mod, pass in a localized string instead of just English.
censusMod.Call("TownNPCCondition", ModContent.NPCType<NPCs.HatSalesman.HatSalesman>(),
$"When the Haunted Hatter has been defeated");
censusMod.Call("TownNPCCondition", ModContent.NPCType<NPCs.VeteranExplorer.VeteranExplorer>(),
$"When Skeletron has been defeated");
}
}
internal static Highlander Instance { get; private set; }
public static void Log(string text)
{
Instance.Logger.Debug(LogCounter + ": " + text);
LogCounter++;
}
internal enum HighlanderMessageType : byte
{
HighlanderPlayerSyncPlayer,
}
}
}