-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSource.cs
149 lines (124 loc) · 5.26 KB
/
Source.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
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Exiled.API.Features;
using Exiled.API.Interfaces;
using CommandSystem;
using CommandSystem.Commands;
using Exiled.Events.EventArgs.Warhead;
namespace Anti_nuke_camp
{
public class AntiNukeCamp : Plugin<Config>
{
public static int activationCount = 0; // Make this public and static
public static bool IsWarheadLocked = false;
public override string Name => "AntiNukeCamp";
public override string Author => "Joseph_fallen";
public override Version RequiredExiledVersion => new Version(5, 0, 0);
public override string Prefix => "antinukecamp";
public override Version Version => new Version(2, 0, 2);
public override void OnEnabled()
{
Log.Info("AntiNukeCamp has been loaded successfully!");
Log.Info("This Plugin is under heavy development");
Exiled.Events.Handlers.Warhead.Stopping += OnWarheadStopping;
Exiled.Events.Handlers.Warhead.Starting += OnWarheadStarting;
Exiled.Events.Handlers.Warhead.Detonating += OnWarheadDetonating;
Exiled.Events.Handlers.Warhead.ChangingLeverStatus += OnWarheadChangingLeverStatus;
Exiled.Events.Handlers.Server.RoundStarted += OnRoundStart;
base.OnEnabled();
}
public override void OnDisabled()
{
Exiled.Events.Handlers.Warhead.Stopping -= OnWarheadStopping;
Exiled.Events.Handlers.Warhead.Starting -= OnWarheadStarting;
Exiled.Events.Handlers.Warhead.Detonating -= OnWarheadDetonating;
Exiled.Events.Handlers.Warhead.ChangingLeverStatus -= OnWarheadChangingLeverStatus;
Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStart;
base.OnDisabled();
}
private void OnWarheadStopping(StoppingEventArgs ev)
{
activationCount++;
if (activationCount <= 3)
{
IsWarheadLocked = false;
ev.IsAllowed = true;
}
else
{
IsWarheadLocked = true;
ev.IsAllowed = false;
Log.Info("Nuke has been disabled.");
Log.Info("Playing CASSIE Announcement");
SendCassieMessage("ALPHA WARHEAD EMERGENCY DETONATION SEQUENCE LOCKED");
Log.Info("Announcement Played");
}
}
private void OnWarheadStarting(StartingEventArgs ev)
{
Log.Info("Warhead is starting...");
// Handle the warhead starting event if needed
}
private void OnWarheadDetonating(DetonatingEventArgs ev)
{
Log.Info("Warhead is detonating...");
// Handle the warhead detonating event if needed
}
private void OnWarheadChangingLeverStatus(ChangingLeverStatusEventArgs ev)
{
Log.Info("Warhead lever status is changing...");
// Handle the warhead lever status changing event if needed
}
private void OnRoundStart()
{
activationCount = 0;
IsWarheadLocked = false;
Log.Info("Round started, activation count reset.");
}
public static void SendCassieMessage(string message)
{
// Send the message using Cassie.Message without subtitles
Cassie.Message(message, true, true, true);
}
// Command implementations
public class ResetActivationCountCommand : ICommand
{
public string Command => "resetactivationcount";
public string[] Aliases => new string[] { "rac" };
public string Description => "Resets the activation count of the nuke";
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
// Use the static fields directly
if (AntiNukeCamp.IsWarheadLocked)
{
AntiNukeCamp.activationCount = 0;
response = "Activation count has been reset.";
return true;
}
response = "Plugin instance not found.";
return false;
}
}
public class CheckStatusCommand : ICommand
{
public string Command => "checkstatus";
public string[] Aliases => new string[] { "status" };
public string Description => "Checks the current status of the nuke";
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
// Use the static fields directly
response = AntiNukeCamp.IsWarheadLocked ? "The nuke is currently locked." : "The nuke is not locked.";
return true;
}
}
}
public class Config : IConfig
{
public bool IsEnabled { get; set; } = true;
public string CommandPrefix { get; set; } = "!";
// Implement the Debug property from IConfig
public bool Debug { get; set; } = false;
}
}