-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMain.cs
225 lines (216 loc) · 12.4 KB
/
Main.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
using System;
using System.Linq;
using System.Reflection;
using Rocket.API;
using Rocket.Unturned.Player;
using UnityEngine;
using SDG.Unturned;
using Rocket.Core.Plugins;
using Rocket.Core.Logging;
using Rocket.API.Collections;
using Rocket.Unturned.Chat;
using Rocket.Core;
using System.Collections.Generic;
using Steamworks;
using Rocket.Unturned.Events;
namespace coolpuppy24.simpledeathmessages
{
public class Main : RocketPlugin<Configuration>
{
public static Main Instance = null;
protected override void Load()
{
Instance = this;
UnturnedPlayerEvents.OnPlayerDeath += OnPlayerDeath;
Rocket.Core.Logging.Logger.LogWarning("[SimpleDeathMessages] Made by: Coolpuppy24");
Rocket.Core.Logging.Logger.LogWarning("------------------------------------------------------");
Rocket.Core.Logging.Logger.LogWarning("[SimpleDeathMessages] Death Message Color: " + Configuration.Instance.DeathMessagesColor);
Rocket.Core.Logging.Logger.LogWarning("[SimpleDeathMessages] Show Suicide Messages: " + Configuration.Instance.ShowSuicideMSG);
Rocket.Core.Logging.Logger.Log("Successfully Loaded!");
}
protected override void Unload()
{
Instance = null;
UnturnedPlayerEvents.OnPlayerDeath -= OnPlayerDeath;
Rocket.Core.Logging.Logger.Log("Unload");
}
public override TranslationList DefaultTranslations
{
get
{
return new TranslationList()
{
{"gun_headshot","{0} [GUN - {3}] {2} {1}"},
{"gun","{0} [GUN - {2}] {1}"},
{"food","[FOOD] {0}"},
{"arena","[ARENA] {0}"},
{"shred","[SHRED] {0}"},
{"punch_headshot","{0} [PUNCH] {2} {1}"},
{"punch","{0} [PUNCH] {1}"},
{"bones","[BONES] {0}"},
{"melee_headshot","{0} [MELEE - {3}] {2} {1}"},
{"melee","{0} [MELEE- {2}] {1}"},
{"water","[WATER] {0}"},
{"breath","[BREATH] {0}"},
{"zombie","[ZOMBIE] {0}"},
{"animal","[ANIMAL] {0}"},
{"grenade","[GRENADE] {0}"},
{"vehicle","[VEHICLE] {0}"},
{"suicide","[SUICIDE] {0}"},
{"burning","[BURNING] {0}"},
{"headshot","+ [HEADSHOT]" },
{"landmine","[LANDMINE] {0}"},
{"roadkill","{0} [ROADKILL] {1}"},
{"bleeding","[BLEEDING] {0}"},
{"freezing","[FREEZING] {0}"},
{"sentry","[SENTRY] {0}"},
{"charge","[CHARGE] {0}"},
{"missile","[MISSILE] {0}"},
{"splash","[SPLASH] {0}"},
{"acid","[ACID] {0}"},
{"spark", "[SPARK] {0}"},
{"infection", "[INFECTION] {0}"},
{"spit","[SPIT] {0}"},
{"kill","[ADMIN KILL] {0}"},
{"boulder","[BOULDER] {0}"},
};
}
}
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, Steamworks.CSteamID murderer)
{
UnturnedPlayer killer = UnturnedPlayer.FromCSteamID(murderer);
string headshot = Translate("headshot");
{
if (cause.ToString() == "GUN")
{
if (limb == ELimb.SKULL)
UnturnedChat.Say(Translate("gun_headshot", killer.DisplayName, player.DisplayName, headshot, Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString()), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
else
UnturnedChat.Say(Translate("gun", killer.DisplayName, player.DisplayName, Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString()), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "MELEE")
{
if (limb == ELimb.SKULL)
UnturnedChat.Say(Translate("melee_headshot", killer.DisplayName, player.DisplayName, headshot, Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString()), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
else
UnturnedChat.Say(Translate("melee", killer.DisplayName, player.DisplayName, Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString()), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "PUNCH")
{
if (limb == ELimb.SKULL)
UnturnedChat.Say(Translate("punch_headshot", killer.DisplayName, player.DisplayName, headshot), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
else
UnturnedChat.Say(Translate("punch", killer.DisplayName, player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "SHRED")
{
UnturnedChat.Say(Translate("shred", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "ZOMBIE")
{
UnturnedChat.Say(Translate("zombie", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "ANIMAL")
{
UnturnedChat.Say(Translate("animal", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "ROADKILL")
{
UnturnedChat.Say(Translate("roadkill", killer.DisplayName, player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "SPARK")
{
UnturnedChat.Say(Translate("spark", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "VEHICLE")
{
UnturnedChat.Say(Translate("vehicle", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "FOOD")
{
UnturnedChat.Say(Translate("food", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "WATER")
{
UnturnedChat.Say(Translate("water", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "INFECTION")
{
UnturnedChat.Say(Translate("infection", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "BLEEDING")
{
UnturnedChat.Say(Translate("bleeding", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "LANDMINE")
{
UnturnedChat.Say(Translate("landmine", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "BREATH")
{
UnturnedChat.Say(Translate("breath", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "KILL")
{
UnturnedChat.Say(Translate("kill", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "FREEZING")
{
UnturnedChat.Say(Translate("freezing", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "SENTRY")
{
UnturnedChat.Say(Translate("sentry", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "CHARGE")
{
UnturnedChat.Say(Translate("charge", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "MISSILE")
{
UnturnedChat.Say(Translate("missile", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "BONES")
{
UnturnedChat.Say(Translate("bones", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "SPLASH")
{
UnturnedChat.Say(Translate("splash", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "ACID")
{
UnturnedChat.Say(Translate("acid", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "SPIT")
{
UnturnedChat.Say(Translate("spit", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "BURNING")
{
UnturnedChat.Say(Translate("burning", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "BURNER")
{
UnturnedChat.Say(Translate("burner", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "BOULDER")
{
UnturnedChat.Say(Translate("boulder", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "ARENA")
{
UnturnedChat.Say(Translate("arena", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "SUICIDE" && Configuration.Instance.ShowSuicideMSG)
{
UnturnedChat.Say(Translate("suicide", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
else if (cause.ToString() == "GRENADE")
{
UnturnedChat.Say(Translate("grenade", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.DeathMessagesColor, Color.green));
}
}
}
}
}