Skip to content
Closed
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
4 changes: 3 additions & 1 deletion VCF.Core/Breadstone/VWorld.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ProjectM;
using ProjectM.Network;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;

Expand All @@ -12,7 +13,8 @@ internal static class VWorld
{
public static void SendSystemMessage(this User user, string message)
{
ServerChatUtils.SendSystemMessageToClient(Server.EntityManager, user, message);
FixedString512Bytes unityMessage = message;
ServerChatUtils.SendSystemMessageToClient(Server.EntityManager, user, ref unityMessage);
}

private static World _serverWorld;
Expand Down
10 changes: 7 additions & 3 deletions VCF.Core/Framework/ChatCommandContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using ProjectM;
using Engine.Console;
using ProjectM;
using ProjectM.Network;
using System;
using Unity.Collections;
using VampireCommandFramework.Breadstone;

namespace VampireCommandFramework;
Expand Down Expand Up @@ -44,9 +46,11 @@ public ChatCommandContext(VChatEvent e)
static int maxMessageLength = 509;
public void Reply(string v)
{
if(v.Length > maxMessageLength)
if (v.Length > maxMessageLength)
v = v[..maxMessageLength];
ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, User, v);

FixedString512Bytes unityMessage = v;
ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, User, ref unityMessage);
}

// todo: expand this, just throw from here as void and build a handler that can message user/log.
Expand Down
6 changes: 4 additions & 2 deletions VCF.Core/Registry/CommandCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ internal void AddCommand(string key, ParameterInfo[] parameters, CommandMetadata

internal CacheResult GetCommand(string rawInput)
{
var lowerRawInput = rawInput.ToLowerInvariant();
// todo: I think allows for overlap between .foo "bar" and .foo bar <no parameters>
List<CommandMetadata> possibleMatches = new();
foreach (var (key, argCounts) in _newCache)
{
if (rawInput.StartsWith(key))
var lowerKey = key.ToLowerInvariant();
if (lowerRawInput.StartsWith(lowerKey))
{
// there's no need to inspect the parameters if the next character isn't a space or the end of the string
// because it means that this was part of a different prefix token
if (rawInput.Length > key.Length && rawInput[key.Length] != ' ')
if (lowerRawInput.Length > lowerKey.Length && lowerRawInput[lowerKey.Length] != ' ')
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion VCF.Core/VCF.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.690" IncludeAssets="compile" />
<PackageReference Include="BepInEx.Core" Version="6.0.0-be.690" IncludeAssets="compile" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="VRising.Unhollowed.Client" Version="1.0.*" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="VRising.Unhollowed.Client" Version="1.1.*" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading