-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
CheatSheetPlayer.cs
64 lines (56 loc) · 2.05 KB
/
CheatSheetPlayer.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
using System.Linq;
using Terraria;
using Terraria.GameInput;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CheatSheet
{
internal class CheatSheetPlayer : ModPlayer
{
public static int MaxExtraAccessories = 6;
public Item[] ExtraAccessories = new Item[MaxExtraAccessories];
public int numberExtraAccessoriesEnabled = 0;
public override void UpdateEquips() {
for (int i = 0; i < numberExtraAccessoriesEnabled; i++) {
//Player.VanillaUpdateEquip(ExtraAccessories[i]);
Item item = ExtraAccessories[i];
if (!item.IsAir /*&& Player.IsItemSlotUnlockedAndUsable(k)*/ && (!item.expertOnly || Main.expertMode) /*&& UpdateEquips_CanItemGrantBenefits(k, item)*/) {
if (item.accessory)
Player.GrantPrefixBenefits(item);
Player.GrantArmorBenefits(item);
}
}
//VanillaUpdateAccessory is now ApplyEquipFunctional
for (int i = 0; i < numberExtraAccessoriesEnabled; i++) {
Player.ApplyEquipFunctional(ExtraAccessories[i], false);
}
}
public override void Initialize() {
ExtraAccessories = new Item[MaxExtraAccessories];
for (int i = 0; i < MaxExtraAccessories; i++) {
ExtraAccessories[i] = new Item();
ExtraAccessories[i].SetDefaults(0, true);
}
}
public override void SaveData(TagCompound tag) {
tag.Add("ExtraAccessories", ExtraAccessories.Select(ItemIO.Save).ToList());
tag.Add("NumberExtraAccessoriesEnabled", numberExtraAccessoriesEnabled);
}
public override void LoadData(TagCompound tag) {
tag.GetList<TagCompound>("ExtraAccessories").Select(ItemIO.Load).ToList().CopyTo(ExtraAccessories);
numberExtraAccessoriesEnabled = tag.GetInt("NumberExtraAccessoriesEnabled");
}
public override void ProcessTriggers(TriggersSet triggersSet) {
if (CheatSheet.ToggleCheatSheetHotbarHotKey.JustPressed) {
// Debug refresh UI elements
// CheatSheet.instance.paintToolsUI = new Menus.PaintToolsUI(CheatSheet.instance);
if (CheatSheet.instance.hotbar.hidden) {
CheatSheet.instance.hotbar.Show();
}
else {
CheatSheet.instance.hotbar.Hide();
}
}
}
}
}