forked from gardenappl/WMITF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WMITF.cs
86 lines (77 loc) · 2.82 KB
/
WMITF.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
using System;
using Terraria;
using Terraria.ModLoader;
namespace WMITF
{
public class WMITF : Mod
{
static public ModKeybind ToggleTooltipsHotkey;
static public ModKeybind TechnicalNamesHotkey;
static public int unloadedItemType;
static public int aprilFoolsItemType;
static public int unloadedTileType1;
static public int unloadedTileType2;
static public int unloadedTileType3;
public WMITF()
{
LegacyConfig.Load();
}
public override void Load()
{
ToggleTooltipsHotkey = KeybindLoader.RegisterKeybind(this, "Tile/NPC Mod Tooltip", "OemQuestion");
TechnicalNamesHotkey = KeybindLoader.RegisterKeybind(this, "Technical Names", "N");
}
public override void PostSetupContent()
{
bool success;
ModLoader.TryGetMod("ModLoader", out Mod modLoaderMod);
success = modLoaderMod.TryFind<ModItem>("UnloadedItem", out ModItem unloadedItem);
if (success)
unloadedItemType = unloadedItem.Type;
success = modLoaderMod.TryFind<ModItem>("AprilFools", out ModItem aprilFoolsItem);
if (success)
aprilFoolsItemType = aprilFoolsItem.Type;
success = modLoaderMod.TryFind<ModTile>("UnloadedSolidTile", out ModTile unloadedTile1);
if (success)
unloadedTileType1 = unloadedTile1.Type;
success = modLoaderMod.TryFind<ModTile>("UnloadedNonSolidTile", out ModTile unloadedTile2);
if (success)
unloadedTileType2 = unloadedTile2.Type;
success = modLoaderMod.TryFind<ModTile>("UnloadedSemiSolidTile", out ModTile unloadedTile3);
if (success)
unloadedTileType3 = unloadedTile3.Type;
}
public override void Unload()
{
ToggleTooltipsHotkey = null;
TechnicalNamesHotkey = null;
}
public static bool CheckAprilFools()
{
var date = DateTime.Now;
return date.Month == 4 && date.Day <= 2;
}
public static bool IsUnloadedTile(Tile tile)
{
if (tile.HasTile)
{
if (tile.TileType == unloadedTileType1 || tile.TileType == unloadedTileType2 || tile.TileType == unloadedTileType3)
{
return true;
}
else
return false;
}
else
return false;
}
public static void Log(object message)
{
ModContent.GetInstance<WMITF>().Logger.Info(message);
}
// Hamstar's Mod Helpers integration
public static string GithubUserName { get { return "goldenapple3"; } }
public static string GithubProjectName { get { return "WMITF"; } }
}
}