Skip to content

Commit

Permalink
added cancel all phrases
Browse files Browse the repository at this point in the history
  • Loading branch information
bierdosenhalter committed Apr 16, 2024
1 parent d8a9f97 commit 830485f
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Client/Commands/CancelAllPhrases.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using API;
using API.Commands;
using Client.Stream;

namespace Client.Commands
{
public class CancelAllPhrases : CommandBase
{
public override string CmdName => "CancelAllPhrases";

public override string CmdUsage => "";

public override string CmdDesc => "Called to cancel a Phrase link.";

public override string Run(IClient handler, string command, Dictionary<string, object> localVars)
{
if (!(handler is RyzomClient ryzomClient))
throw new Exception("Command handler is not a Ryzom client.");

// Check parameters.
if (HasArg(command))
return "Please specify no parameters.";

// Create the message and send.
const string msgName = "PHRASE:CANCEL_ALL";
var out2 = new BitMemoryStream();

if (ryzomClient.GetNetworkManager().GetMessageHeaderManager().PushNameToStream(msgName, out2))
ryzomClient.GetNetworkManager().Push(out2);
else
return $"Unknown message named '{msgName}'.";

return "";
}

public override IEnumerable<string> GetCmdAliases()
{
return new string[] { };
}
}
}

0 comments on commit 830485f

Please sign in to comment.