-
Notifications
You must be signed in to change notification settings - Fork 0
/
DotScp.cs
207 lines (180 loc) · 7.34 KB
/
DotScp.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
using System;
using CommandSystem;
using Exiled.API.Features;
using System.Linq;
using System.Collections.Generic;
namespace SCPSwap
{
public class DotScp : ICommand
{
Player SenderPlayer;
/// <inheritdoc/>
public string Command { get; } = "request";
public static DotScp Instance { get; } = new DotScp();
/// <inheritdoc/>
public string[] Aliases { get; } = new string[] { "req" };
/// <inheritdoc/>
public string Description { get; } = "Swaps SCPs.";
/// <inheritdoc/>
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
CommandSender cmd_sender = (CommandSender)sender;
IEnumerable<Player> player_list = Player.List;
string hint = "An exchange request has been sent to you!Enter.scp accept or .scp yes in console to accept.";
string fail_response = "Use .scpswap request <SCP Number>";
SenderPlayer = Player.Get(cmd_sender.SenderId);
if (arguments.Count == 0 || arguments.Count > 1)
{
response = fail_response;
return false;
}
else if (!Globals.allowed)
{
response = "Too late for changing SCP";
return false;
}
else if (!SenderPlayer.IsScp)
{
response = "You need to be an SCP to execute this command";
return false;
}
else if (arguments.ElementAt(0) == "079")
{
foreach (Player player in player_list)
{
if (SenderPlayer.Role == RoleType.Scp079)
{
response = "You are already this type of SCP";
return false;
}
if (player.Role == RoleType.Scp079)
{
player.ShowHint(hint, duration: 15);
Globals.Requests.Add(player, SenderPlayer);
response = "There is already an SCP of this type present! Sending Exchange Request...";
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp079);
response = "Changing roles...";
return true;
}
else if (arguments.ElementAt(0) == "096")
{
foreach (Player player in player_list)
{
if (SenderPlayer.Role == RoleType.Scp096)
{
response = "You are already this type of SCP";
return false;
}
if (player.Role == RoleType.Scp096)
{
player.ShowHint(hint, duration: 15);
response = "There is already an SCP of this type present! Sending Exchange Request...";
Globals.Requests.Add(player, SenderPlayer);
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp096);
response = "Changing roles...";
return true;
}
else if (arguments.ElementAt(0) == "049")
{
foreach (Player player in player_list)
{
if (SenderPlayer.Role == RoleType.Scp049)
{
response = "You are already this type of SCP";
return false;
}
if (player.Role == RoleType.Scp049)
{
player.ShowHint(hint, duration: 15);
Globals.Requests.Add(player, SenderPlayer);
response = "There is already an SCP of this type present! Sending Exchange Request...";
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp049);
response = "Changing roles...";
return true;
}
else if (arguments.ElementAt(0) == "106")
{
foreach (Player player in player_list)
{
if (SenderPlayer.Role == RoleType.Scp106)
{
response = "You are already this type of SCP";
return false;
}
if (player.Role == RoleType.Scp106)
{
player.ShowHint(hint, duration: 15);
Globals.Requests.Add(player, SenderPlayer);
response = "There is already an SCP of this type present! Sending Exchange Request...";
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp106);
response = "Changing roles...";
return true;
}
else if (arguments.ElementAt(0) == "939")
{
foreach (Player player in player_list)
{
if (SenderPlayer.Role.Is939())
{
response = "You are already this type of SCP";
return false;
}
if (player.Role == RoleType.Scp93989 || player.Role == RoleType.Scp93953)
{
foreach (Player scp in player_list)
{
if (scp.Role.Is939() && scp != player)
{
response = "There are already SCPs of this type present! Sending Exchange Request...";
Globals.Requests.Add(player, SenderPlayer);
player.ShowHint(hint, duration: 15);
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp93953);
response = "Changing roles...";
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp93953);
response = "Changing roles...";
return true;
}
else if (arguments.ElementAt(0) == "173")
{
foreach (Player player in player_list)
{
if (SenderPlayer.Role == RoleType.Scp173)
{
response = "You are already this type of SCP";
return false;
}
if (player.Role == RoleType.Scp173)
{
response = "There is already an SCP of this type present! Sending Exchange Request...";
Globals.Requests.Add(player, SenderPlayer);
player.ShowHint(hint, duration: 15);
return true;
}
}
SenderPlayer.SetRole(RoleType.Scp173);
response = "Changing roles...";
return true;
}
response = fail_response;
return false;
}
}
}