This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChallengeRunes.cs
103 lines (96 loc) · 3.14 KB
/
ChallengeRunes.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
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace ChallengeRunes
{
public class ChallengeRunes : Mod
{
public ChallengeRunes()
{
Properties = new ModProperties()
{
Autoload = true,
AutoloadGores = true,
AutoloadSounds = true
};
}
public static Dictionary<Player, string> armageddon = new Dictionary<Player, string>();
public static Dictionary<Player, string> defiled = new Dictionary<Player, string>();
public static Dictionary<Player, string> frozen = new Dictionary<Player, string>();
public static Dictionary<Player, string> scorched = new Dictionary<Player, string>();
public static void NewText(Player player, string text, byte r, byte g, byte b)
{
if (player.whoAmI == Main.myPlayer)
{
Main.NewText(text, r, g, b);
}
}
public static bool AntiCheese(Player player)
{
foreach (NPC npc in Main.npc)
{
if (npc.boss && npc.active)
{
PlayerDeathReason runeDeath = PlayerDeathReason.ByCustomReason(player.name + " defied the runes.");
Main.PlaySound(SoundID.NPCDeath59.WithVolume(0.5f), player.Center);
player.KillMe(runeDeath, 1.0, 0, false);
return true;
}
}
return false;
}
public static bool CheckRune(Player p, string runeKey)
{
switch (runeKey)
{
case "armageddon":
return armageddon.TryGetValue(p, out _);
case "defiled":
return defiled.TryGetValue(p, out _);
case "frozen":
return frozen.TryGetValue(p, out _);
case "scorched":
return scorched.TryGetValue(p, out _);
}
return false;
}
public static void SetRune(Player p, string runeKey)
{
switch (runeKey)
{
case "armageddon":
armageddon.Add(p, runeKey);
break;
case "defiled":
defiled.Add(p, runeKey);
break;
case "frozen":
frozen.Add(p, runeKey);
break;
case "scorched":
scorched.Add(p, runeKey);
break;
}
}
public static void RemoveRune(Player p, string runeKey)
{
switch (runeKey)
{
case "armageddon":
armageddon.Remove(p);
break;
case "defiled":
defiled.Remove(p);
break;
case "frozen":
frozen.Remove(p);
break;
case "scorched":
scorched.Remove(p);
break;
}
}
}
}