本文整理汇总了C#中Packet.GetEndString方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.GetEndString方法的具体用法?C# Packet.GetEndString怎么用?C# Packet.GetEndString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.GetEndString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleReport
public static void HandleReport(Packet packet, IClient client, bool fromQueue)
{
// TODO: Replace temporary talk code
string message = packet.GetEndString();
if (message[0] == '%')
{
string scriptFilename = message.Substring(1);
try
{
Program.Logger.LogDebug(String.Format("Loading {0}", scriptFilename));
Script script = Script.LoadFromFile(scriptFilename);
Program.Logger.LogDebug("Compiling");
client.Server.ScriptHost.Compile(script);
if (script.Compiled)
{
Program.Logger.LogDebug("Executing");
client.Server.ScriptHost.Execute(script, null, new Object[]{client.Character});
}
else
{
Program.Logger.LogError("Script compilation failed: ");
foreach (var error in script.results.Errors)
{
Console.WriteLine(error);
}
}
}
catch (Exception ex)
{
Program.Logger.LogError("Script execution failed", ex);
}
}
else if (message[0] == '$') // TODO: $ as command macro, = as eval
{
try
{
CommandParser.Parse(message.Substring(1), client.Character);
}
catch (Exception ex)
{
Packet warning = new Packet(PacketFamily.Message, PacketAction.Open);
warning.AddString(String.Format("{0}: {1}", ex.GetType().Name, ex.Message));
client.Send(warning);
}
}
client.Character.SendMsg((IMessageTarget)client.Character.Map, new MessageLocal(client.Character, message));
}
示例2: _handleTalkReply
/// <summary>
/// Handler for the TALK_REPLY packet (sent in response to not-found for PMs sent from this end)
/// </summary>
private void _handleTalkReply(Packet pkt)
{
if (OnPMRecipientNotFound == null) return;
switch (pkt.GetShort())
{
//player is not found so a sys error needs to be displayed
case 1: //TALK_NOTFOUND response (no other members of this enum)
string from = pkt.GetEndString();
from = char.ToUpper(from[0]) + from.Substring(1).ToLower();
OnPMRecipientNotFound(from);
break;
}
}
示例3: HandleMessage
public static void HandleMessage(Packet packet, IClient client, bool fromQueue)
{
String message = packet.GetEndString();
client.Character.SendMsg((IMessageTarget)client.Server.Global, new MessageGlobal(client.Character, message));
}
示例4: _handleTalkSpec
private void _handleTalkSpec(Packet pkt)
{
if (OnMuted != null)
OnMuted(pkt.GetEndString());
}
示例5: _handleTalkPlayer
/// <summary>
/// Handler for the TALK_PLAYER packet (sent for public chat messages)
/// </summary>
private void _handleTalkPlayer(Packet pkt)
{
if (OnPlayerChatByID == null) return;
short fromPlayerID = pkt.GetShort();
string message = pkt.GetEndString();
OnPlayerChatByID(TalkType.Local, fromPlayerID, message);
}
示例6: _handleTalkServer
private void _handleTalkServer(Packet pkt)
{
if (OnPlayerChatByName == null) return;
string msg = pkt.GetEndString();
OnPlayerChatByName(TalkType.Server, null, msg);
}
示例7: _handlePartyRequest
//handles a request to join/invite from another player
private void _handlePartyRequest(Packet pkt)
{
if (OnPartyRequest == null) return;
PartyRequestType type = (PartyRequestType) pkt.GetChar();
short playerID = pkt.GetShort();
string name = pkt.GetEndString();
name = char.ToUpper(name[0]) + name.Substring(1);
OnPartyRequest(type, playerID, name);
}
示例8: _handleMessageOpen
private void _handleMessageOpen(Packet pkt)
{
if (OnStatusMessage != null)
OnStatusMessage(pkt.GetEndString());
}
示例9: _handleTradeRequest
private void _handleTradeRequest(Packet pkt)
{
pkt.Skip(1); //something - will always be 123 from this client
short playerID = pkt.GetShort();
string name = pkt.GetEndString();
if (OnTradeRequested != null)
OnTradeRequested(playerID, name);
}
示例10: _handlePlayersPong
private void _handlePlayersPong(Packet pkt)
{
if (OnPlayerFindCommandReply != null)
OnPlayerFindCommandReply(true, true, pkt.GetEndString());
}