forked from SamsonAllen13/ClickerClass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClickerClass.cs
122 lines (106 loc) · 3.27 KB
/
ClickerClass.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
using ClickerClass.Core.Netcode;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using System.Collections.Generic;
using System.IO;
using Terraria;
using Terraria.ModLoader;
namespace ClickerClass
{
public class ClickerClass : Mod
{
public static ModKeybind AutoClickKey;
public static ModKeybind AimAssistKey;
internal static ClickerClass mod;
/// <summary>
/// Populated by the buffs themselves, includes all buffs that bosses should be immune to (so no more manual npc.buffImmune)
/// </summary>
internal static HashSet<int> BossBuffImmunity;
public override void Load()
{
mod = this;
BossBuffImmunity = new HashSet<int>();
AutoClickKey = KeybindLoader.RegisterKeybind(this, "ClickerAccessory", "G");
AimAssistKey = KeybindLoader.RegisterKeybind(this, "ClickerAimAssist", "Mouse3");
NetHandler.Load();
if (!Main.dedServ)
{
LoadClient();
}
}
public override void Unload()
{
ClickEffect.Unload();
NetHandler.Unload();
AutoClickKey = null;
AimAssistKey = null;
BossBuffImmunity = null;
mod = null;
}
private void LoadClient()
{
}
public override object Call(params object[] args)
{
return ClickerModCalls.Call(args);
}
public override void PostSetupContent()
{
DoWikithisSupport();
DoColoredDamageTypesSupport();
//Only clicker weapons
RecipeBrowser_AddToCategory("Clickers", "Weapons", "UI/RecipeBrowser_Clickers", (Item item) =>
{
return ClickerSystem.IsClickerWeapon(item);
});
//Every other clicker item
RecipeBrowser_AddToCategory("Clicker Items", "Other", "UI/RecipeBrowser_ClickerItems", (Item item) =>
{
return ClickerSystem.IsClickerItem(item) && !ClickerSystem.IsClickerWeapon(item);
});
}
public override void HandlePacket(BinaryReader reader, int whoAmI)
{
NetHandler.HandlePackets(reader, whoAmI);
}
private static void DoWikithisSupport()
{
if (!Main.dedServ && ModLoader.TryGetMod("Wikithis", out Mod wikithis))
{
wikithis.Call("AddModURL", mod, "https://terrariamods.wiki.gg/wiki/Clicker_Class/{}");
}
}
private static void DoColoredDamageTypesSupport()
{
if (!Main.dedServ && ModLoader.TryGetMod("ColoredDamageTypes", out Mod coloreddamagetypes))
{
var tooltipColor = (130, 143, 242);
var damageColor = (172, 189, 246);
var critColor = (88, 92, 222);
coloreddamagetypes.Call("AddDamageType", ModContent.GetInstance<ClickerDamage>(), tooltipColor, damageColor, critColor);
}
}
/// <summary>
/// Attempts to add a subcategory to Recipe Browser
/// </summary>
/// <param name="name">The displayed subcategory name</param>
/// <param name="category">The parent category</param>
/// <param name="texture">The 24x24 path to texture within the mod</param>
/// <param name="predicate">The condition at which an item is listed in this subcategory</param>
private void RecipeBrowser_AddToCategory(string name, string category, string texture, Predicate<Item> predicate)
{
if (!Main.dedServ && ModLoader.TryGetMod("RecipeBrowser", out Mod recipeBrowser))
{
recipeBrowser.Call(new object[5]
{
"AddItemCategory",
name,
category,
this.Assets.Request<Texture2D>(texture, AssetRequestMode.ImmediateLoad).Value, // 24x24 icon
predicate
});
}
}
}
}