[ChatBoxExtensions] Updated to 2023r172ex1

This commit is contained in:
kafeijao 2023-08-14 19:34:13 +01:00
parent 4c09f9bd57
commit 1d2533ff2b
No known key found for this signature in database
GPG key ID: E99978723E454B4C
13 changed files with 41 additions and 23 deletions

View file

@ -1,5 +1,5 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.Networking;
using ABI_RC.Core.Player;
namespace NAK.ChatBoxExtensions.Integrations;
@ -18,9 +18,9 @@ public class CommandBase
{
string partialName = argument.Replace("*", "").Trim();
if (String.IsNullOrWhiteSpace(partialName)) return false;
return MetaPort.Instance.username.Contains(partialName);
return AuthManager.username.Contains(partialName);
}
return MetaPort.Instance.username == argument;
return AuthManager.username == argument;
}
internal static void LocalCommandIgnoreOthers(string argument, Action<string[]> callback)
@ -53,4 +53,4 @@ public class CommandBase
{
return CVRPlayerManager.Instance.TryGetPlayerName(guid);
}
}
}

View file

@ -19,7 +19,7 @@ internal class ChatBoxCommands : CommandBase
{
RemoteCommandListenForSelf(message, args =>
{
API.SendMessage("/pong " + GetPlayerUsername(sender), false, true);
API.SendMessage("/pong " + GetPlayerUsername(sender), false, true, true);
});
});
@ -33,10 +33,10 @@ internal class ChatBoxCommands : CommandBase
{
awaitingPing = false;
TimeSpan timeSincePing = DateTime.Now - pingTime; // calculate the time difference
API.SendMessage($"Time since ping: {timeSincePing.TotalMilliseconds}ms", false, true);
API.SendMessage($"Time since ping: {timeSincePing.TotalMilliseconds}ms", false, true, true);
return;
}
API.SendMessage($"You have to ping first, {GetPlayerUsername(sender)}!", false, true);
API.SendMessage($"You have to ping first, {GetPlayerUsername(sender)}!", false, true, true);
});
});
}

View file

@ -1,5 +1,5 @@
using ABI_RC.Core;
using ABI_RC.Core.Base;
using ABI_RC.Core.Vivox;
namespace NAK.ChatBoxExtensions.Integrations;
@ -28,14 +28,14 @@ internal class ChilloutVRBaseCommands : CommandBase
{
LocalCommandIgnoreOthers(message, args =>
{
Audio.SetMicrophoneActive(true);
VivoxDeviceHandler.InputMuted = true;
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
Audio.SetMicrophoneActive(true);
VivoxDeviceHandler.InputMuted = false;
});
});
}

View file

@ -8,8 +8,8 @@ public static class Commands
internal static void InitializeCommandHandlers()
{
Kafe.ChatBox.API.OnMessageSent += (source, msg, notification, displayMsg) => HandleSentCommand(msg, notification, displayMsg);
Kafe.ChatBox.API.OnMessageReceived += (source, sender, msg, notification, displayMsg) => HandleReceivedCommand(sender, msg, notification, displayMsg);
Kafe.ChatBox.API.OnMessageSent += msg => HandleSentCommand(msg.Message, msg.TriggerNotification, msg.DisplayOnChatBox);
Kafe.ChatBox.API.OnMessageReceived += msg => HandleReceivedCommand(msg.SenderGuid, msg.Message, msg.TriggerNotification, msg.DisplayOnChatBox);
}
internal static void RegisterCommand(string prefix, Action<string, bool, bool> onCommandSent = null, Action<string, string, bool, bool> onCommandReceived = null)