-
Notifications
You must be signed in to change notification settings - Fork 5
/
ForgottenMemories.cs
141 lines (128 loc) · 4.95 KB
/
ForgottenMemories.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
using Terraria;
using Terraria.ModLoader;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.DataStructures;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using Terraria.UI;
using System;
namespace ForgottenMemories
{
public class ForgottenMemories : Mod
{
internal static ForgottenMemories instance;
internal bool songsLoaded = false;
public ForgottenMemories()
{
Properties = new ModProperties()
{
Autoload = true,
AutoloadBackgrounds = true,
AutoloadSounds = true,
AutoloadGores = true
};
}
public static ModHotKey InGameWikiHotkey;
public override void Load()
{
InGameWikiHotkey = RegisterHotKey("In-Game Wiki Hotkey", "f");
if (!Main.dedServ)
{
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Acheron"), ItemType("AcheBox"), TileType("AcheBox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Arterius"), ItemType("ArterBox"), TileType("ArterBox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Forests_Army"), ItemType("ForestBox"), TileType("ForestBox"));
}
instance = this;
Mod yabhb = ModLoader.GetMod("FKBossHealthBar");
if (yabhb != null)
{
Func<NPC, int, int, Color> customColour = CustomHealthBarColour;
Func<Texture2D> fill = () => GetTexture("UI/YABHB/AcheFill");
Func<Texture2D> start = () => GetTexture("UI/YABHB/AcheBarStart");
Func<Texture2D> mid = () => GetTexture("UI/YABHB/AcheBarMiddle");
Func<Texture2D> end = () => GetTexture("UI/YABHB/AcheBarEnd");
yabhb.Call("RegisterCustomMethodHealthBar",
NPCType("Acheron"),
false,
null,
fill,
start, mid, end,
null, null, null, null, null, null, null, null, null, null, null, null,
customColour
);
}
}
private Color CustomHealthBarColour(NPC npc, int life, int lifeMax)
{
float percent = (float)life / lifeMax;
float R = 1f - percent;
return new Color(R, 0.75f, 1f);
}
public override void ModifyInterfaceLayers(List<GameInterfaceLayer> layers)
{
if (TGEMWorld.forestInvasionUp)
{
int index = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Inventory"));
LegacyGameInterfaceLayer CustomProgress = new LegacyGameInterfaceLayer("ForgottenMemories: ProgressLayer",
delegate
{
ProgressBar.DrawCustomInvasionProgress();
return true;
},
InterfaceScaleType.UI);
layers.Insert(index, CustomProgress);
}
}
public override void AddRecipeGroups()
{
RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + " Iron Bar" + Lang.GetItemNameValue(ItemType("Iron Bar")), new int[]
{
22,
704
});
RecipeGroup.RegisterGroup("AnyIron", group);
RecipeGroup wood = new RecipeGroup (() => Lang.misc[37] + (" Wood"), new int[]
{
9,
620,
619,
911,
621,
2503,
2504,
2260,
1729
});
RecipeGroup.RegisterGroup("AnyWood", wood);
RecipeGroup copper = new RecipeGroup(() => Lang.misc[37] + " Copper Bar" + Lang.GetItemNameValue(ItemType("Copper Bar")), new int[]
{
20,
703
});
RecipeGroup.RegisterGroup("AnyCopper", copper);
}
public override void PostSetupContent()
{
Mod bossChecklist = ModLoader.GetMod("BossChecklist");
if(bossChecklist != null)
{
// To include a description JK MEME TAG:
bossChecklist.Call("AddBossWithInfo", "Acheron", 5.999f, (Func<bool>)(() => TGEMWorld.downedAcheron), "Use a [i:" + ItemType("Unstable_Wisp") + "] in the Underworld");
bossChecklist.Call("AddBossWithInfo", "Magnoliac", 5.12f, (Func<bool>)(() => TGEMWorld.downedMag), "Summon the forest's army using [i:" + ItemType("AncientLog") + "] or use a [i:" + ItemType("MagnoliacSummoner") + "]");
bossChecklist.Call("AddEventWithInfo", "Forest's Army", 5.11f, (Func<bool>)(() => TGEMWorld.downedForestInvasion), "Summon the forest's army using [i:" + ItemType("AncientLog") + "]");
bossChecklist.Call("AddBossWithInfo", "Ghastly Ent", 9.4f, (Func<bool>)(() => TGEMWorld.downedGhastlyEnt), "Summon the forest's army using [i:" + ItemType("AncientLog") + "] and defeat it during hardmode, or use a [i:" + ItemType("GhastlySummon") + "]");
bossChecklist.Call("AddBossWithInfo", "Arterius", 6.3f, (Func<bool>)(() => TGEMWorld.downedArterius), "Use a [i:" + ItemType("BloodClot") + "] at night");
bossChecklist.Call("AddBossWithInfo", "Titan Rock", 7.1f, (Func<bool>)(() => TGEMWorld.downedTitanRock), "Use a [i:" + ItemType("anomalydetector") + "]");
}
Mod btfaSongs = ModLoader.GetMod("BTFASongs");
if (btfaSongs != null)
{
songsLoaded = true;
}
}
}
}