Declare the parameter type enum where both packet structs see it
An enum which is declared inside a packet is generated as a nested type of its struct. The ref struct of the same packet is generated into another file and refers to the enum by its plain name, so it didn't compile. Declare it next to the other shared enums instead, which puts it into the namespace - that's also where CharacterStatus lives, which is used by a structure of another packet in the same way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MSpK6jkyF8ZS5nYXyGwYxA (cherry picked from commit 33703647e97d9fb13680086d0366f8200fe2865a)
This commit is contained in:
@@ -85,16 +85,16 @@ public class ChatCommandListViewPlugIn : IChatCommandListViewPlugIn
|
|||||||
return connection.SendAsync(Write);
|
return connection.SendAsync(Write);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChatCommandInfo.ChatCommandParameterType GetParameterType(string typeName)
|
private static ChatCommandParameterType GetParameterType(string typeName)
|
||||||
{
|
{
|
||||||
return typeName switch
|
return typeName switch
|
||||||
{
|
{
|
||||||
nameof(Boolean) => ChatCommandInfo.ChatCommandParameterType.Boolean,
|
nameof(Boolean) => ChatCommandParameterType.Boolean,
|
||||||
nameof(Byte) or nameof(SByte)
|
nameof(Byte) or nameof(SByte)
|
||||||
or nameof(Int16) or nameof(UInt16)
|
or nameof(Int16) or nameof(UInt16)
|
||||||
or nameof(Int32) or nameof(UInt32)
|
or nameof(Int32) or nameof(UInt32)
|
||||||
or nameof(Int64) or nameof(UInt64) => ChatCommandInfo.ChatCommandParameterType.Number,
|
or nameof(Int64) or nameof(UInt64) => ChatCommandParameterType.Number,
|
||||||
_ => ChatCommandInfo.ChatCommandParameterType.Text,
|
_ => ChatCommandParameterType.Text,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31730,3 +31730,24 @@ public readonly struct ScoreEntry
|
|||||||
White = 7,
|
White = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The kind of value which a chat command parameter expects.
|
||||||
|
/// </summary>
|
||||||
|
public enum ChatCommandParameterType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The parameter expects a text.
|
||||||
|
/// </summary>
|
||||||
|
Text = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parameter expects a number.
|
||||||
|
/// </summary>
|
||||||
|
Number = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parameter expects a 0 or a 1.
|
||||||
|
/// </summary>
|
||||||
|
Boolean = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11345,29 +11345,6 @@
|
|||||||
</Fields>
|
</Fields>
|
||||||
</Structure>
|
</Structure>
|
||||||
</Structures>
|
</Structures>
|
||||||
<Enums>
|
|
||||||
<Enum>
|
|
||||||
<Name>ChatCommandParameterType</Name>
|
|
||||||
<Description>The kind of value which a chat command parameter expects.</Description>
|
|
||||||
<Values>
|
|
||||||
<EnumValue>
|
|
||||||
<Name>Text</Name>
|
|
||||||
<Description>The parameter expects a text.</Description>
|
|
||||||
<Value>0</Value>
|
|
||||||
</EnumValue>
|
|
||||||
<EnumValue>
|
|
||||||
<Name>Number</Name>
|
|
||||||
<Description>The parameter expects a number.</Description>
|
|
||||||
<Value>1</Value>
|
|
||||||
</EnumValue>
|
|
||||||
<EnumValue>
|
|
||||||
<Name>Boolean</Name>
|
|
||||||
<Description>The parameter expects a 0 or a 1.</Description>
|
|
||||||
<Value>2</Value>
|
|
||||||
</EnumValue>
|
|
||||||
</Values>
|
|
||||||
</Enum>
|
|
||||||
</Enums>
|
|
||||||
</Packet>
|
</Packet>
|
||||||
</Packets>
|
</Packets>
|
||||||
<Enums>
|
<Enums>
|
||||||
@@ -11938,5 +11915,26 @@
|
|||||||
</EnumValue>
|
</EnumValue>
|
||||||
</Values>
|
</Values>
|
||||||
</Enum>
|
</Enum>
|
||||||
|
<Enum>
|
||||||
|
<Name>ChatCommandParameterType</Name>
|
||||||
|
<Description>The kind of value which a chat command parameter expects.</Description>
|
||||||
|
<Values>
|
||||||
|
<EnumValue>
|
||||||
|
<Name>Text</Name>
|
||||||
|
<Description>The parameter expects a text.</Description>
|
||||||
|
<Value>0</Value>
|
||||||
|
</EnumValue>
|
||||||
|
<EnumValue>
|
||||||
|
<Name>Number</Name>
|
||||||
|
<Description>The parameter expects a number.</Description>
|
||||||
|
<Value>1</Value>
|
||||||
|
</EnumValue>
|
||||||
|
<EnumValue>
|
||||||
|
<Name>Boolean</Name>
|
||||||
|
<Description>The parameter expects a 0 or a 1.</Description>
|
||||||
|
<Value>2</Value>
|
||||||
|
</EnumValue>
|
||||||
|
</Values>
|
||||||
|
</Enum>
|
||||||
</Enums>
|
</Enums>
|
||||||
</PacketDefinitions>
|
</PacketDefinitions>
|
||||||
|
|||||||
@@ -37,18 +37,18 @@ public class ChatCommandPacketTest
|
|||||||
group.Name = "Group";
|
group.Name = "Group";
|
||||||
group.ShortName = "group";
|
group.ShortName = "group";
|
||||||
group.IsRequired = true;
|
group.IsRequired = true;
|
||||||
group.Type = ChatCommandInfo.ChatCommandParameterType.Number;
|
group.Type = ChatCommandParameterType.Number;
|
||||||
|
|
||||||
var ancient = written[1];
|
var ancient = written[1];
|
||||||
ancient.Name = "Ancient";
|
ancient.Name = "Ancient";
|
||||||
ancient.ShortName = "anc";
|
ancient.ShortName = "anc";
|
||||||
ancient.ValidValues = "0|1|2";
|
ancient.ValidValues = "0|1|2";
|
||||||
ancient.Type = ChatCommandInfo.ChatCommandParameterType.Number;
|
ancient.Type = ChatCommandParameterType.Number;
|
||||||
|
|
||||||
var skill = written[2];
|
var skill = written[2];
|
||||||
skill.Name = "Skill";
|
skill.Name = "Skill";
|
||||||
skill.ShortName = "sk";
|
skill.ShortName = "sk";
|
||||||
skill.Type = ChatCommandInfo.ChatCommandParameterType.Boolean;
|
skill.Type = ChatCommandParameterType.Boolean;
|
||||||
|
|
||||||
var read = new ChatCommandInfoRef(data);
|
var read = new ChatCommandInfoRef(data);
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class ChatCommandPacketTest
|
|||||||
Assert.That(read[1].IsRequired, Is.False);
|
Assert.That(read[1].IsRequired, Is.False);
|
||||||
|
|
||||||
Assert.That(read[2].Name, Is.EqualTo("Skill"));
|
Assert.That(read[2].Name, Is.EqualTo("Skill"));
|
||||||
Assert.That(read[2].Type, Is.EqualTo(ChatCommandInfo.ChatCommandParameterType.Boolean));
|
Assert.That(read[2].Type, Is.EqualTo(ChatCommandParameterType.Boolean));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user