Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support next MAUL version #281

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading