Skip to content

Commit

Permalink
Fix: Event checking, sd cancel guns, dodgeball slay, countdown restri…
Browse files Browse the repository at this point in the history
…ct, Add: t_heal
  • Loading branch information
destoer committed Jun 1, 2024
1 parent a2647fb commit cae1705
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 12 deletions.
2 changes: 1 addition & 1 deletion WardenService/WardenService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.233" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.239" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
"warden.countdown_usage": "!countdown: <time> <msg>",
"warden.countdown_restrict": "You must be the warden to call a countdown",
"warden.countdown_abort": "Warden aborted the countdown",
"warden.countdown_max_delay": "The maximum time is 200 seconds!",

"warden.heal_t_cmd": "heal_t",

"logs.ct": "CT",
"logs.t": "T",
Expand Down Expand Up @@ -167,6 +169,7 @@
"lr.req_ct": "Your partner is not a CT",
"lr.too_many": "There are too many t's alive to start an lr {0}",
"lr.player_rebel": "{0} is a rebel!",
"lr.rebel_name": "{0} started rebel",
"lr.knife_rebel": "{0} is knife a rebel!",
"lr.ready": "Last request is available! Type !lr",
"lr.wait": "Please wait 15 seconds into the round before starting an lr",
Expand Down
1 change: 1 addition & 0 deletions lang/lv.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"warden.countdown_restrict": "Jums jābūt cietuma priekšniekam, lai sāktu atskaiti",
"warden.countdown_abort": "Cietuma Priekšnieks pārtrauca atskaiti",

"warden.heal_t_cmd": "heal_t",

"logs.ct": "CT",
"logs.t": "T",
Expand Down
2 changes: 2 additions & 0 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"warden.countdown_restrict": "Musisz być wardenem, aby ogłosić odliczanie",
"warden.countdown_abort": "Warden anulował odliczanie",

"warden.heal_t_cmd": "heal_t",

"logs.ct": "CT",
"logs.t": "T",
"logs.logs_cmd": "logs",
Expand Down
9 changes: 9 additions & 0 deletions lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
"warden.give_pardon": "{0} был помилован",
"warden.give_freeday": "{0} получил свободный день",

"warden.countdown_cmd": "countdown",
"warden.countdown_abort_cmd": "countdown_abort",
"warden.countdown_usage": "!countdown: <time> <msg>",
"warden.countdown_restrict": "You must be the warden to call a countdown",
"warden.countdown_abort": "Warden aborted the countdown",
"warden.countdown_max_delay": "The maximum time is 200 seconds!",

"warden.heal_t_cmd": "heal_t",

"logs.ct": "CT",
"logs.t": "T",
"logs.logs_cmd": "logs",
Expand Down
9 changes: 9 additions & 0 deletions lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
"warden.give_pardon": "{0} nın isyancılığı kaldırıldı",
"warden.give_freeday": "{0} ya özgür gün verildi",

"warden.countdown_cmd": "countdown",
"warden.countdown_abort_cmd": "countdown_abort",
"warden.countdown_usage": "!countdown: <time> <msg>",
"warden.countdown_restrict": "You must be the warden to call a countdown",
"warden.countdown_abort": "Warden aborted the countdown",
"warden.countdown_max_delay": "The maximum time is 200 seconds!",

"warden.heal_t_cmd": "heal_t",

"logs.ct": "CT",
"logs.t": "T",
"logs.logs_cmd": "logs",
Expand Down
2 changes: 1 addition & 1 deletion src/Cs2Jailbreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>

<PackageReference Include="CounterStrikeSharp.API" Version="1.0.233" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.239" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.1" />
<PackageReference Include="MySqlConnector" Version="2.3.1" />

Expand Down
4 changes: 3 additions & 1 deletion src/Jail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ void RegisterCommands()

AddLocalizedCmd("warden.mute_cmd","do a warden mute",warden.WardenMuteCmd);

AddLocalizedCmd("warden.heal_t_cmd","Heal t's",warden.HealTCmd);

// reg lr commands
AddLocalizedCmd("lr.start_lr_cmd","start an lr",lr.LRCmd);
AddLocalizedCmd("lr.cancel_lr_cmd","admin : cancel lr",lr.CancelLRCmd);
Expand All @@ -356,7 +358,7 @@ void RegisterCommands()
AddLocalizedCmd("sd.cancel_cmd","cancel an sd",sd.CancelSDCmd);

AddLocalizedCmd("logs.logs_cmd", "show round logs", logs.LogsCommand);

// debug
if(Debug.enable)
{
Expand Down
2 changes: 1 addition & 1 deletion src/LastRequest/LRBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public void FailSafeActivate()
public void DelayFailSafe(float delay)
{
Chat.Announce(LastRequest.LR_PREFIX,$"fail-safe active in {delay} seconds");
JailPlugin.globalCtx.AddTimer(delay,FailSafeActivate,CSTimer.TimerFlags.STOP_ON_MAPCHANGE);
failsafeTimer = JailPlugin.globalCtx.AddTimer(delay,FailSafeActivate,CSTimer.TimerFlags.STOP_ON_MAPCHANGE);
}

public void LaserTick()
Expand Down
2 changes: 1 addition & 1 deletion src/LastRequest/Rebel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void RebelGuns(CCSPlayerController player, ChatMenuOption option)

rebelType = RebelType.REBEL;

Chat.LocalizeAnnounce(LR_PREFIX,"lr.player_name",player.PlayerName);
Chat.LocalizeAnnounce(LR_PREFIX,"lr.rebel_name",player.PlayerName);
}

public void StartRebel(CCSPlayerController? player, ChatMenuOption option)
Expand Down
8 changes: 7 additions & 1 deletion src/Lib/Lib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static public void SwapAllCT()
static public void RespawnPlayers()
{
// 1up all dead players
foreach(CCSPlayerController player in Lib.GetPlayers())
foreach(CCSPlayerController player in Lib.GetActivePlayers())
{
if(!player.IsLegalAlive())
{
Expand Down Expand Up @@ -193,6 +193,12 @@ static public List<CCSPlayerController> GetAliveT()
return players.FindAll(player => player.IsLegalAlive() && player.IsT());;
}

static public List<CCSPlayerController> GetActivePlayers()
{
List<CCSPlayerController> players = Lib.GetPlayers();
return players.FindAll(player => player.IsT() || player.IsCt());;
}

static public int AliveTCount()
{
return GetAliveT().Count;
Expand Down
4 changes: 3 additions & 1 deletion src/Lib/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ static public void GiveArmour(this CCSPlayerController? player)

static public void Slay(this CCSPlayerController? player)
{
if(player.IsLegalAlive())
// Why does slay now count as damage, but doesn't set the kill state fast enough?
if(player.IsLegalAlive() && player.GetHealth() > 0)
{
player.PlayerPawn.Value?.CommitSuicide(true, true);
player.SetHealth(0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Lib/Timer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static public void RemoveDelay(this CEntityInstance? entity, float delay, String

static public void GiveEventNadeDelay(this CCSPlayerController? target,float delay, String name)
{
if(!target.IsLegalAlive())
if(!target.IsLegalAlive() || !JailPlugin.EventActive())
{
return;
}
Expand Down
13 changes: 12 additions & 1 deletion src/SpecialDay/SpecialDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public void EndSD(bool forced = false)
// restore all players if from a cancel
if(forced)
{
foreach(CCSPlayerController player in Lib.GetAliveCt())
{
player.GiveWeapon("m4a1");
player.GiveWeapon("deagle");
}

Chat.Announce(SPECIALDAY_PREFIX,"Special day cancelled");
}

Expand Down Expand Up @@ -208,8 +214,13 @@ public void SDCmdInternal(CCSPlayerController? player,CommandInfo command)
if(Int32.TryParse(command.ArgByIndex(1),out int delayOpt))
{
delay = delayOpt;
}

if(delayOpt > 200)
{
player.LocalizePrefix(SPECIALDAY_PREFIX, "warden.countdown_max_delay");
return;
}
}

var sdMenu = new ChatMenu("Specialday");

Expand Down
15 changes: 12 additions & 3 deletions src/Warden/Warden.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ void PurgeRound()
void SetWardenIfLast(bool onDeath = false)
{
// dont override the warden if there is no death removal
if(!Config.wardenForceRemoval)
// also don't do it if an event is running because it's annoying
if(!Config.wardenForceRemoval || JailPlugin.EventActive())
{
return;
}
Expand All @@ -143,14 +144,22 @@ void SetWardenIfLast(bool onDeath = false)

if(ctPlayers.Count == 1)
{
int slot = ctPlayers[0].Slot;

if(onDeath)
{
// play sfx for last ct
// TODO: this is too loud as there is no way to control volume..
//Lib.PlaySound_all("sounds/vo/agents/sas/lastmanstanding03");
//Lib.PlaySoundAll("sounds/vo/agents/sas/lastmanstanding03");
var player = Utilities.GetPlayerFromSlot(slot);

// Give last warden an extra bit of hp
if(player.IsLegalAlive())
{
player.SetHealth(150);
}
}

int slot = ctPlayers[0].Slot;
SetWarden(slot);
}
}
Expand Down
30 changes: 30 additions & 0 deletions src/Warden/WardenCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public void WardayCmd(CCSPlayerController? player, CommandInfo command)
if(Int32.TryParse(command.ArgByIndex(2),out int delayOpt))
{
delay = delayOpt;

if(delayOpt > 200)
{
player.LocalizePrefix(WARDEN_PREFIX, "warden.countdown_max_delay");
return;
}
}
}

Expand Down Expand Up @@ -136,6 +142,13 @@ public void CountdownCmd(CCSPlayerController? player, CommandInfo command)
if(Int32.TryParse(command.ArgByIndex(1),out int delayOpt))
{
delay = delayOpt;

// Thanks TICHO
if(delayOpt > 200)
{
player.LocalizePrefix(WARDEN_PREFIX, "warden.countdown_max_delay");
return;
}
}

else
Expand Down Expand Up @@ -253,6 +266,23 @@ public void WardenMuteCmd(CCSPlayerController? invoke, CommandInfo cmd)
tmpMuteTimer = JailPlugin.globalCtx.AddTimer(10.0f,UnmuteTmp,CSTimer.TimerFlags.STOP_ON_MAPCHANGE);
}

public void HealTCmd(CCSPlayerController? invoke, CommandInfo cmd)
{
// make sure we are actually the warden
if(!IsWarden(invoke))
{
invoke.Announce(WARDEN_PREFIX,"you must be warden to heal t's");
return;
}

Chat.Announce(WARDEN_PREFIX,"Warden healed t's");

foreach(CCSPlayerController player in Lib.GetAliveT())
{
player.SetHealth(100);
}
}


public void UnmuteTmp()
{
Expand Down

0 comments on commit cae1705

Please sign in to comment.