Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:edgegamers/Jailbreak into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Aug 16, 2024
2 parents 08741c5 + ca91940 commit 5931549
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
42 changes: 31 additions & 11 deletions mod/Jailbreak.Warden/Global/WardenBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,19 @@ public bool TrySetWarden(CCSPlayerController controller) {
API.Stats?.PushStat(new ServerStat("JB_WARDEN_ASSIGNED",
Warden.SteamID.ToString()));

oldTag = API.Actain?.getTagService().GetTag(Warden);
oldTagColor = API.Actain?.getTagService().GetTagColor(Warden);
API.Actain?.getTagService().SetTag(Warden, "[WARDEN]");
API.Actain?.getTagService().SetTagColor(Warden, ChatColors.DarkBlue);
if (API.Actain != null) {
var steam = Warden.SteamID;
Server.NextFrameAsync(async () => {
oldTag = await API.Actain.getTagService().GetTag(steam);
oldTagColor = await API.Actain.getTagService().GetTagColor(steam);
Server.NextFrame(() => {
if (!Warden.IsValid) return;
API.Actain.getTagService().SetTag(Warden, "[WARDEN]", false);
API.Actain.getTagService()
.SetTagColor(Warden, ChatColors.DarkBlue, false);
});
});
}

foreach (var player in Utilities.GetPlayers())
player.ExecuteClientCommand($"play sounds/{config.WardenNewSoundName}");
Expand Down Expand Up @@ -181,9 +190,11 @@ public bool TryRemoveWarden(bool isPass = false) {
var ev = new EventNextlevelChanged(true);
ev.FireEvent(false);

API.Actain?.getTagService().SetTag(Warden, oldTag!);
if (oldTag != null)
API.Actain?.getTagService().SetTag(Warden, oldTag, false);
if (oldTagColor != null)
API.Actain?.getTagService().SetTagColor(Warden, oldTagColor.Value);
API.Actain?.getTagService()
.SetTagColor(Warden, oldTagColor.Value, false);

logs.Append(logs.Player(Warden), "is no longer the warden.");
}
Expand Down Expand Up @@ -230,11 +241,20 @@ public HookResult OnDeath(EventPlayerDeath ev, GameEventInfo info) {
[GameEventHandler]
public HookResult OnChangeTeam(EventPlayerTeam @event, GameEventInfo info) {
var player = @event.Userid;
if (player == null) return HookResult.Continue;

if ("[WARDEN]" == API.Actain?.getTagService().GetTag(player)) {
API.Actain.getTagService().SetTag(player, "");
API.Actain.getTagService().SetTagColor(player, ChatColors.Default);
if (player == null || !player.IsValid) return HookResult.Continue;

if (API.Actain != null) {
var steam = player.SteamID;
Server.NextFrameAsync(async () => {
if ("[WARDEN]" != await API.Actain.getTagService().GetTag(steam))
return;
Server.NextFrame(() => {
if (!player.IsValid) return;
API.Actain.getTagService().SetTag(player, "", false);
API.Actain.getTagService()
.SetTagColor(player, ChatColors.Default, false);
});
});
}

if (!((IWardenService)this).IsWarden(player)) return HookResult.Continue;
Expand Down
4 changes: 2 additions & 2 deletions public/Jailbreak.Public/API.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using api.plugin;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Core.Capabilities;
using MAULActainShared.plugin;
using MStatsShared;

namespace Jailbreak.Public;
Expand Down
Binary file modified public/Jailbreak.Public/Mixin/MAULActainShared.dll
Binary file not shown.

0 comments on commit 5931549

Please sign in to comment.