diff --git a/Cs2Jailbreak.csproj b/Cs2Jailbreak.csproj index 9d18261..1156460 100644 --- a/Cs2Jailbreak.csproj +++ b/Cs2Jailbreak.csproj @@ -7,7 +7,7 @@ - + diff --git a/README.md b/README.md index d50b8d7..7183769 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,11 @@ Download the latest release from the releases tab and copy it into the counterst NOTE: this plugin only operates correctly on linux -windows has a couple of places where a !is_windows() check wraps buggy code +windows has a couple of places where a !IsWindows() check wraps buggy code +namely OnTakeDamage # Warden TODO -Warden Laser and T laser +T laser Auto unstuck @@ -29,8 +30,6 @@ Handicap Warden Ring -Refactor stat API - # LR TODO Port crash, sumo @@ -40,7 +39,7 @@ Add beacons # SD TODO -Waiting on player colour and respawn issues fixed for these +Waiting on no block issues being fixed, and trace for laser wars Zombie, Gun game, Laser wars diff --git a/gamedata/Cs2Jailbreak.json b/gamedata/Cs2Jailbreak.json index 23f33a3..0e0dcd2 100644 --- a/gamedata/Cs2Jailbreak.json +++ b/gamedata/Cs2Jailbreak.json @@ -1,9 +1,3 @@ { - "CBasePlayerController_SetPawn": { - "signatures": { - "library": "server", - "windows": "\\x44\\x88\\x4C\\x24\\x2A\\x55\\x57", - "linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x89\\xF3\\x48\\x81\\xEC\\xC8\\x00\\x00\\x00" - } - } + } \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index 4511c15..632d174 100644 --- a/lang/en.json +++ b/lang/en.json @@ -53,6 +53,9 @@ "warden.give_freeday_cmd": "give_freeday", "warden.give_pardon_cmd": "give_pardon", "warden.colour_cmd": "colour", + "warden.warden_prefix": "{green}[Warden]: {white}", + "warden.door_prefix": "{green}[Door]: {white}", + "warden.team_prefix": "{green}[Team]: {white}", "warden.give_pardon": "{0} has been pardoned", "warden.give_freeday": "{0} has been given a freeday", @@ -78,11 +81,14 @@ "mute.thirty": "All t's are muted for the first 30 seconds", "mute.speak_quietly": "T's may now speak quietly", "mute.end_round": "You are muted until the end of the round", + "mute.mute_prefix": "{green}[Mute]: {white}", "warday.live": "Weapons live!", "warday.location": "warday at {0}", + "warday.warday_prefix": "{green}[Warday]: {white}", "rebel.kill": "{0} killed the rebel {1}", + "rebel.rebel_prefix": "{green}[Rebel]: {white}", "block.enable": "Block enabled", "block.disable": "Block disabled", @@ -118,6 +124,7 @@ "sd.start_cmd": "sd", "sd.start_ff_cmd": "sd_ff", "sd.cancel_cmd": "sd_cancel", + "sd.sd_prefix": "{green}[Special Day]: {white}", "lr.rebel_last": "You must be the last player alive to rebel", @@ -137,5 +144,6 @@ "lr.cancel_lr_cmd": "cancel_lr", "lr.start_lr_cmd": "lr", - "lr.stats_cmd": "lr_stats" + "lr.stats_cmd": "lr_stats", + "lr.lr_prefix": "{green}[LR]: {white}" } diff --git a/src/Jail.cs b/src/Jail.cs index b8197b5..d670804 100644 --- a/src/Jail.cs +++ b/src/Jail.cs @@ -138,7 +138,7 @@ public class JailConfig : BasePluginConfig // main plugin file, controls central hooking // defers to warden, lr and sd -[MinimumApiVersion(141)] +[MinimumApiVersion(163)] public class JailPlugin : BasePlugin, IPluginConfig { // Global event settings, used to filter plugin activits @@ -184,7 +184,7 @@ public static void PurgePlayerStats(CCSPlayerController? player) public override string ModuleName => "CS2 Jailbreak - destoer"; - public override string ModuleVersion => "v0.3.5"; + public override string ModuleVersion => "v0.3.6"; public override void Load(bool hotReload) { @@ -197,6 +197,8 @@ public override void Load(bool hotReload) RegisterListeners(); + LocalizePrefix(); + JailPlayer.SetupDB(); Console.WriteLine("Sucessfully started JB"); @@ -205,6 +207,21 @@ public override void Load(bool hotReload) } + void LocalizePrefix() + { + LastRequest.LR_PREFIX = Chat.Localize("lr.lr_prefix"); + Entity.DOOR_PREFIX = Chat.Localize("warden.door_prefix"); + + SpecialDay.SPECIALDAY_PREFIX = Chat.Localize("sd.sd_prefix"); + JailPlayer.REBEL_PREFIX = Chat.Localize("rebel.rebel_prefix"); + + Mute.MUTE_PREFIX = Chat.Localize("mute.mute_prefix"); + Warden.TEAM_PREFIX = Chat.Localize("warden.team_prefix"); + + Warday.WARDAY_PREFIX = Chat.Localize("warday.warday_prefix"); + Warden.WARDEN_PREFIX = Chat.Localize("warden.warden_prefix"); + } + void StatDBReload() { Task.Run(async () => @@ -524,48 +541,20 @@ HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info) CCSPlayerController? killer = @event.Attacker; // NOTE: have to check IsConnected incase this is tripped by a dc - + // hide t killing ct if(Config.hideKills && victim.IsConnected() && killer.IsConnected() && killer.IsT() && victim.IsCt()) { - //@event.Attacker = player; - // fire event as is to T - foreach(CCSPlayerController? player in Utilities.GetPlayers()) - { - if(player.IsLegal()) - { - if(player.IsT()) - { - // T gets full event - @event.Userid = victim; - @event.Attacker = killer; - - @event.FireEventToClient(player); - } - - else - { - // ct gets a suicide - @event.Userid = victim; - @event.Attacker = victim; - @event.Assister = victim; - - @event.FireEventToClient(player); - } - } - } - + killer.Announce(Warden.WARDEN_PREFIX,$"You killed: {victim.PlayerName}"); info.DontBroadcast = true; } - - + if(victim.IsLegal() && victim.IsConnected()) { warden.Death(victim,killer); lr.Death(victim); sd.Death(victim,killer); } - return HookResult.Continue; } diff --git a/src/LastRequest/Dodgeball.cs b/src/LastRequest/Dodgeball.cs index 1c44feb..f9826f4 100644 --- a/src/LastRequest/Dodgeball.cs +++ b/src/LastRequest/Dodgeball.cs @@ -46,6 +46,11 @@ public override void InitPlayer(CCSPlayerController player) } } + public override void PairActivate() + { + DelayFailSafe(35.0f); + } + public override void PlayerHurt(int damage, int health, int hitgroup) { CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot); @@ -59,7 +64,18 @@ public override void PlayerHurt(int damage, int health, int hitgroup) public override void GrenadeThrown() { CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot); - GiveLRNadeDelay(1.4f,"weapon_flashbang"); + + if(!failSafe) + { + GiveLRNadeDelay(1.4f,"weapon_flashbang"); + } + + // failsafe timer is up give a he grenade + else + { + weaponRestrict = "hegrenade"; + GiveLRNadeDelay(1.4f,"weapon_hegrenade"); + } } public override void EntCreated(CEntityInstance entity) diff --git a/src/LastRequest/Grenade.cs b/src/LastRequest/Grenade.cs index 23896db..4b9bfcf 100644 --- a/src/LastRequest/Grenade.cs +++ b/src/LastRequest/Grenade.cs @@ -45,7 +45,25 @@ public override void InitPlayer(CCSPlayerController player) } } } + + public override void PairActivate() + { + DelayFailSafe(35.0f); + } + + + public override void PlayerHurt(int damage, int health, int hitgroup) + { + CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot); + // instantly drop the player if the failsafe is active + if(player.IsLegalAlive() && failSafe) + { + player.Announce(LastRequest.LR_PREFIX,"Boom!"); + player.Slay(); + } + } + public override void GrenadeThrown() { CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot); diff --git a/src/LastRequest/LRBase.cs b/src/LastRequest/LRBase.cs index 5cf2261..eaa16f8 100644 --- a/src/LastRequest/LRBase.cs +++ b/src/LastRequest/LRBase.cs @@ -64,6 +64,9 @@ public void Cleanup() // clean up laser Lib.KillTimer(ref laserTimer); + // killthe fail safe timer + Lib.KillTimer(ref failsafeTimer); + laser.Destroy(); countdown.Kill(); @@ -278,6 +281,21 @@ public void CountdownStart() countdown.Start(lrName,5,this,PrintCountdown,manager.ActivateLR); } + public void FailSafeActivate() + { + // clean up timer + failsafeTimer = null; + + failSafe = true; + Chat.Announce(LastRequest.LR_PREFIX,$"{lrName} fail-safe active"); + } + + 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); + } + public void LaserTick() { // get both players and check they are valid @@ -350,6 +368,10 @@ public virtual void WeaponZoom() {} Line laser = new Line(); + CSTimer.Timer? failsafeTimer = null; + public bool failSafe = false; + + CSTimer.Timer? laserTimer = null; // managed timer diff --git a/src/LastRequest/LastRequest.cs b/src/LastRequest/LastRequest.cs index 8babb3b..0482b86 100644 --- a/src/LastRequest/LastRequest.cs +++ b/src/LastRequest/LastRequest.cs @@ -402,15 +402,14 @@ public void LRCmdInternal(CCSPlayerController? player,bool bypass, CommandInfo c { lrMenu.AddMenuOption("Knife rebel",StartKnifeRebel); lrMenu.AddMenuOption("Rebel",StartRebel); - /* + if(Config.riotEnable) { - lrMenu.AddMenuOption("Riot",start_riot); + lrMenu.AddMenuOption("Riot",StartRiot); } - */ } - ChatMenus.OpenMenu(player, lrMenu); + MenuManager.OpenChatMenu(player, lrMenu); } public void LRCmd(CCSPlayerController? player, CommandInfo command) @@ -526,5 +525,5 @@ internal class LRChoice long startTimestamp = 0; - public static readonly String LR_PREFIX = $" {ChatColors.Green}[LR]: {ChatColors.White}"; + public static String LR_PREFIX = $" {ChatColors.Green}[LR]: {ChatColors.White}"; } \ No newline at end of file diff --git a/src/LastRequest/LastRequestMenu.cs b/src/LastRequest/LastRequestMenu.cs index dc6cbb8..218d930 100644 --- a/src/LastRequest/LastRequestMenu.cs +++ b/src/LastRequest/LastRequestMenu.cs @@ -101,7 +101,7 @@ public void PickOption(CCSPlayerController? player, ChatMenuOption option) lrMenu.AddMenuOption("High speed", PickedOption); lrMenu.AddMenuOption("One hit", PickedOption); - ChatMenus.OpenMenu(player, lrMenu); + MenuManager.OpenChatMenu(player, lrMenu); break; } @@ -112,7 +112,7 @@ public void PickOption(CCSPlayerController? player, ChatMenuOption option) lrMenu.AddMenuOption("Vanilla", PickedOption); lrMenu.AddMenuOption("Low gravity", PickedOption); - ChatMenus.OpenMenu(player, lrMenu); + MenuManager.OpenChatMenu(player, lrMenu); break; } @@ -123,7 +123,7 @@ public void PickOption(CCSPlayerController? player, ChatMenuOption option) lrMenu.AddMenuOption("Awp", PickedOption); lrMenu.AddMenuOption("Scout", PickedOption); - ChatMenus.OpenMenu(player, lrMenu); + MenuManager.OpenChatMenu(player, lrMenu); break; } @@ -134,7 +134,7 @@ public void PickOption(CCSPlayerController? player, ChatMenuOption option) lrMenu.AddMenuOption("Vanilla", PickedOption); lrMenu.AddMenuOption("Low gravity", PickedOption); - ChatMenus.OpenMenu(player, lrMenu); + MenuManager.OpenChatMenu(player, lrMenu); break; } @@ -149,7 +149,7 @@ public void PickOption(CCSPlayerController? player, ChatMenuOption option) lrMenu.AddMenuOption("Five seven",PickedOption); lrMenu.AddMenuOption("Dual Elite",PickedOption); - ChatMenus.OpenMenu(player, lrMenu); + MenuManager.OpenChatMenu(player, lrMenu); break; } diff --git a/src/LastRequest/Rebel.cs b/src/LastRequest/Rebel.cs index b16cba8..e8c7f67 100644 --- a/src/LastRequest/Rebel.cs +++ b/src/LastRequest/Rebel.cs @@ -99,7 +99,6 @@ public void RiotRespawn() { if(player.IsLegal() && !player.IsLegalAlive()) { - Server.PrintToChatAll($"Respawn {player.PlayerName}"); player.Respawn(); } } diff --git a/src/Lib/Entity.cs b/src/Lib/Entity.cs index 134e7f6..ae0de3a 100644 --- a/src/Lib/Entity.cs +++ b/src/Lib/Entity.cs @@ -119,7 +119,7 @@ static public int DrawLaser(Vector start, Vector end, float width, Color colour) return (int)laser.Index; } - static String DOOR_PREFIX = $" {ChatColors.Green}[Door control]: {ChatColors.White}"; + public static String DOOR_PREFIX = $" {ChatColors.Green}[Door control]: {ChatColors.White}"; public static void ForceClose() { diff --git a/src/Lib/Lib.cs b/src/Lib/Lib.cs index 91023a5..832a898 100644 --- a/src/Lib/Lib.cs +++ b/src/Lib/Lib.cs @@ -99,7 +99,7 @@ static public void InvokePlayerMenu(CCSPlayerController? invoke, String name, return; } - ChatMenu menu = new ChatMenu(name); + var menu = new ChatMenu(name); foreach(var player in Utilities.GetPlayers()) { @@ -109,7 +109,7 @@ static public void InvokePlayerMenu(CCSPlayerController? invoke, String name, } } - ChatMenus.OpenMenu(invoke, menu); + MenuManager.OpenChatMenu(invoke, menu); } public static void ColourMenu(CCSPlayerController? player,Action callback, String name) @@ -126,7 +126,7 @@ public static void ColourMenu(CCSPlayerController? player,Action