mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-13 15:44:35 +01:00
Optimized help command
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Common.Resources.Proto;
|
using Common.Resources.Proto;
|
||||||
using Common;
|
using Common;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace PemukulPaku.GameServer.Commands
|
namespace PemukulPaku.GameServer.Commands
|
||||||
{
|
{
|
||||||
@@ -9,26 +10,26 @@ namespace PemukulPaku.GameServer.Commands
|
|||||||
{
|
{
|
||||||
public override void Run(Session session, string[] args)
|
public override void Run(Session session, string[] args)
|
||||||
{
|
{
|
||||||
RecvChatMsgNotify notify = new() { };
|
RecvChatMsgNotify notify = new();
|
||||||
//hardcoding values is fun AND easy!
|
//hardcoding values is fun AND easy!
|
||||||
string msg = "<color=#B00B><size=26>Commands</size></color><size=16><color=#555>\n";
|
StringBuilder msg = new("<color=#B00B><size=26>Commands</size></color><size=16><color=#555>\n");
|
||||||
msg += "command <required> [optional]\n";
|
msg.Append("command <required> [optional]\n");
|
||||||
//msg += "┌\n";
|
//msg.Append("┌\n");
|
||||||
foreach (Command Cmd in CommandFactory.Commands)
|
foreach (Command Cmd in CommandFactory.Commands)
|
||||||
{
|
{
|
||||||
if(Cmd.CmdType == CommandType.All || Cmd.CmdType == CommandType.Player)
|
if (Cmd.CmdType == CommandType.All || Cmd.CmdType == CommandType.Player)
|
||||||
{
|
{
|
||||||
msg += "┝<size=22>" + Cmd.Name + " " + Cmd.Description + "</size>\n";
|
msg.Append("┝<size=22>" + Cmd.Name + " " + Cmd.Description + "</size>\n");
|
||||||
if (Cmd.Examples is not null)
|
if (Cmd.Examples is not null)
|
||||||
{
|
{
|
||||||
foreach (string Example in Cmd.Examples)
|
foreach (string Example in Cmd.Examples)
|
||||||
{
|
{
|
||||||
msg += "│┕" + Example + "\n";
|
msg.Append("│┕" + Example + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg += "</color></size>";
|
msg.Append("</color></size>");
|
||||||
|
|
||||||
//I really want to figure out how to grab from Chatroom.cs instead, but oh well.
|
//I really want to figure out how to grab from Chatroom.cs instead, but oh well.
|
||||||
ChatMsg AiMsg = new()
|
ChatMsg AiMsg = new()
|
||||||
@@ -36,16 +37,16 @@ namespace PemukulPaku.GameServer.Commands
|
|||||||
Uid = 0,
|
Uid = 0,
|
||||||
Nickname = "Ai-chan",
|
Nickname = "Ai-chan",
|
||||||
Time = (uint)Global.GetUnixInSeconds(),
|
Time = (uint)Global.GetUnixInSeconds(),
|
||||||
Msg = msg,
|
Msg = msg.ToString(),
|
||||||
Content = new() { },
|
Content = new(),
|
||||||
Channel = ChatMsg.MsgChannel.World,
|
Channel = ChatMsg.MsgChannel.World,
|
||||||
AvatarId = 3201,
|
AvatarId = 3201,
|
||||||
DressId = 593201,
|
DressId = 593201,
|
||||||
FrameId = 200001,
|
FrameId = 200001,
|
||||||
CustomHeadId = 161080,
|
CustomHeadId = 161080,
|
||||||
CheckResult = new() { NumberCheck = 0, ShieldType = 0, RewriteText = msg }
|
CheckResult = new() { NumberCheck = 0, ShieldType = 0, RewriteText = msg.ToString() }
|
||||||
};
|
};
|
||||||
AiMsg.Content.Items.Add(new() { MsgStr = msg });
|
AiMsg.Content.Items.Add(new() { MsgStr = msg.ToString() });
|
||||||
notify.ChatMsgLists.Add(AiMsg);
|
notify.ChatMsgLists.Add(AiMsg);
|
||||||
session.Send(Packet.FromProto(notify, CmdId.RecvChatMsgNotify));
|
session.Send(Packet.FromProto(notify, CmdId.RecvChatMsgNotify));
|
||||||
}
|
}
|
||||||
@@ -54,7 +55,7 @@ namespace PemukulPaku.GameServer.Commands
|
|||||||
{
|
{
|
||||||
foreach (Command Cmd in CommandFactory.Commands)
|
foreach (Command Cmd in CommandFactory.Commands)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor= ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
Console.WriteLine(" " + Cmd.Name);
|
Console.WriteLine(" " + Cmd.Name);
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
c.Trail(Cmd.Description);
|
c.Trail(Cmd.Description);
|
||||||
|
|||||||
Reference in New Issue
Block a user