本文整理汇总了C#中DOL.GS.PacketHandler.GSTCPPacketOut.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# GSTCPPacketOut.WriteString方法的具体用法?C# GSTCPPacketOut.WriteString怎么用?C# GSTCPPacketOut.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.PacketHandler.GSTCPPacketOut
的用法示例。
在下文中一共展示了GSTCPPacketOut.WriteString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendDelveInfo
/// <summary>
/// New system in v1.110+ for delve info. delve is cached by client in extra file, stored locally.
/// </summary>
/// <param name="info"></param>
public override void SendDelveInfo(string info)
{
var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DelveInfo));
pak.WriteString(info, 2048);
pak.WriteByte(0); // 0-terminated
SendTCP(pak);
}
示例2: SendFindGroupWindowUpdate
public override void SendFindGroupWindowUpdate(GamePlayer[] list)
{
if (m_gameClient.Player==null)
return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.FindGroupUpdate)))
{
if (list!=null)
{
pak.WriteByte((byte)list.Length);
byte nbleader=0;
byte nbsolo=0x1E;
foreach(GamePlayer player in list)
{
if (player.Group!=null)
{
pak.WriteByte(nbleader++);
}
else
{
pak.WriteByte(nbsolo++);
}
pak.WriteByte(player.Level);
pak.WritePascalString(player.Name);
pak.WriteString(player.CharacterClass.Name, 4);
//Dinberg:Instances - We use ZoneSkinID to bluff our way to victory and
//trick the client for positioning objects (as IDs are hard coded).
if(player.CurrentZone != null)
pak.WriteShort(player.CurrentZone.ZoneSkinID);
else
pak.WriteShort(0); // ?
pak.WriteByte(0); // duration
pak.WriteByte(0); // objective
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte((byte) (player.Group!=null ? 1 : 0));
pak.WriteByte(0);
}
}
else
{
pak.WriteByte(0);
}
SendTCP(pak);
}
}
示例3: SendVersionAndCryptKey
/// <summary>
/// Reply on Server Opening to Client Encryption Request
/// Actually forces Encryption Off to work with Portal.
/// </summary>
public override void SendVersionAndCryptKey()
{
//Construct the new packet
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CryptKey)))
{
pak.WriteByte((byte)m_gameClient.ClientType);
//Disable encryption (1110+ always encrypt)
pak.WriteByte(0x00);
// Reply with current version
pak.WriteString((((int)m_gameClient.Version) / 1000) + "." + (((int)m_gameClient.Version) - 1000), 5);
// revision, last seen (c) 0x63
pak.WriteByte(0x00);
// Build number
pak.WriteByte(0x00); // last seen : 0x44 0x05
pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例4: SendFindGroupWindowUpdate
public override void SendFindGroupWindowUpdate(GamePlayer[] list)
{
if (m_gameClient.Player == null) return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.FindGroupUpdate)))
{
if (list != null)
{
pak.WriteByte((byte)list.Length);
byte nbleader = 0;
byte nbsolo = 0x1E;
foreach (GamePlayer player in list)
{
if (player.Group != null)
{
pak.WriteByte(nbleader++);
}
else
{
pak.WriteByte(nbsolo++);
}
pak.WriteByte(player.Level);
pak.WritePascalString(player.Name);
pak.WriteString(player.CharacterClass.Name, 4);
//Dinberg:Instances - you know the score by now ;)
//ZoneSkinID for clientside positioning of objects.
if (player.CurrentZone != null)
pak.WriteByte((byte)player.CurrentZone.ZoneSkinID);
else
pak.WriteByte(255);
pak.WriteByte(0); // duration
pak.WriteByte(0); // objective
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte((byte)(player.Group != null ? 1 : 0));
pak.WriteByte(0);
}
}
else
{
pak.WriteByte(0x00);
}
SendTCP(pak);
}
}
示例5: SendKeepComponentInteract
public override void SendKeepComponentInteract(IGameKeepComponent component)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepComponentInteractResponse)))
{
pak.WriteShort((ushort)component.Keep.KeepID);
pak.WriteByte((byte)component.Keep.Realm);
pak.WriteByte(component.HealthPercent);
pak.WriteByte(component.Keep.EffectiveLevel(component.Keep.Level));
pak.WriteByte(component.Keep.EffectiveLevel((byte)ServerProperties.Properties.MAX_KEEP_LEVEL));
//guild
pak.WriteByte((byte)1); //Keep Type: always melee here, type is no longer used
if (component.Keep.Guild != null)
{
pak.WriteString(component.Keep.Guild.Name);
}
pak.WriteByte(0);
SendTCP(pak);
}
}
示例6: SendMessage
public override void SendMessage(string msg, eChatType type, eChatLoc loc)
{
if (m_gameClient.ClientState == GameClient.eClientState.CharScreen)
return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Message)))
{
pak.WriteShort(0xFFFF);
pak.WriteShort((ushort)m_gameClient.SessionID);
pak.WriteByte((byte)type);
pak.Fill(0x0, 3);
string str;
if (loc == eChatLoc.CL_ChatWindow)
str = "@@";
else if (loc == eChatLoc.CL_PopupWindow)
str = "##";
else
str = "";
pak.WriteString(str+msg);
SendTCP(pak);
}
}
示例7: SendMessage
public virtual void SendMessage(string msg, eChatType type, eChatLoc loc)
{
if (m_gameClient.ClientState == GameClient.eClientState.CharScreen)
return;
// types not supported by 1.68+ clients
switch (type)
{
case eChatType.CT_ScreenCenterSmaller:
case eChatType.CT_ScreenCenter:
return;
}
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Message)))
{
pak.WriteShort((ushort) m_gameClient.SessionID);
pak.WriteShort(0x00);
pak.WriteByte((byte) type);
pak.Fill(0x0, 3);
String str;
if (loc == eChatLoc.CL_ChatWindow)
str = "@@";
else if (loc == eChatLoc.CL_PopupWindow)
str = "##";
else
str = "";
str = String.Concat(str, msg);
pak.WriteString(str);
SendTCP(pak);
}
}
示例8: SendHousePayRentDialog
public virtual void SendHousePayRentDialog(string title)
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog)))
{
pak.WriteByte(0x00);
pak.WriteByte((byte) eDialogCode.HousePayRent);
pak.Fill(0x00, 8); // empty
pak.WriteByte(0x02); // type
pak.WriteByte(0x01); // wrap
if (title.Length > 0)
pak.WriteString(title); // title ??
pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例9: SendTimerWindow
public virtual void SendTimerWindow(string title, int seconds)
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TimerWindow)))
{
pak.WriteShort((ushort) seconds);
pak.WriteByte((byte) title.Length);
pak.WriteByte(1);
pak.WriteString((title.Length > byte.MaxValue ? title.Substring(0, byte.MaxValue) : title));
SendTCP(pak);
}
}
示例10: SendCustomDialog
public virtual void SendCustomDialog(string msg, CustomDialogResponse callback)
{
if (m_gameClient.Player == null)
return;
lock (m_gameClient.Player)
{
if (m_gameClient.Player.CustomDialogCallback != null)
m_gameClient.Player.CustomDialogCallback(m_gameClient.Player, 0x00);
m_gameClient.Player.CustomDialogCallback = callback;
}
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog)))
{
pak.WriteByte(0x00);
pak.WriteByte((byte) eDialogCode.CustomDialog);
pak.WriteShort((ushort) m_gameClient.SessionID); //data1
pak.WriteShort(0x01); //custom dialog! //data2
pak.WriteShort(0x00); //data3
pak.WriteShort(0x00);
pak.WriteByte((byte) (callback == null ? 0x00 : 0x01)); //ok or yes/no response
pak.WriteByte(0x01); // autowrap text
if (msg.Length > 0)
pak.WriteString(msg, msg.Length);
pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例11: SendDialogBox
public virtual void SendDialogBox(eDialogCode code, ushort data1, ushort data2, ushort data3, ushort data4,
eDialogType type, bool autoWrapText, string message)
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog)))
{
pak.WriteByte(0x00);
pak.WriteByte((byte) code);
pak.WriteShort(data1); //data1
pak.WriteShort(data2); //data2
pak.WriteShort(data3); //data3
pak.WriteShort(data4); //data4
pak.WriteByte((byte) type);
pak.WriteByte((byte) (autoWrapText ? 0x01 : 0x00));
if (message.Length > 0)
pak.WriteString(message, message.Length);
pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例12: SendQuestAbortCommand
// i'm reusing the questsubscribe command for quest abort since its 99% the same, only different event dets fired
// data 3 defines wether it's subscribe or abort
public virtual void SendQuestAbortCommand(GameNPC abortingNPC, ushort questid, string abortMessage)
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog)))
{
pak.WriteByte(0x00);
pak.WriteByte(0x64);
pak.WriteShort(questid); //questid, data1
pak.WriteShort((ushort) abortingNPC.ObjectID); //data2
pak.WriteShort(0x01); // 0x01 means abort data3
pak.WriteShort(0x00);
pak.WriteByte(0x01); // yes/no response
pak.WriteByte(0x01); // autowrap message
if (abortMessage.Length > 0)
pak.WriteString(abortMessage, abortMessage.Length);
pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例13: SendGuildLeaveCommand
public virtual void SendGuildLeaveCommand(GamePlayer invitingPlayer, string inviteMessage)
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog)))
{
pak.WriteByte(0x00);
pak.WriteByte(0x08);
pak.WriteShort((ushort) invitingPlayer.ObjectID); //data1
pak.Fill(0x00, 6); //data2&data3
pak.WriteByte(0x01);
pak.WriteByte(0x00);
if (inviteMessage.Length > 0)
pak.WriteString(inviteMessage, inviteMessage.Length);
pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例14: SendFindGroupWindowUpdate
public virtual void SendFindGroupWindowUpdate(GamePlayer[] list)
{
if (m_gameClient.Player == null)
return;
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.FindGroupUpdate)))
{
if (list != null)
{
pak.WriteByte((byte) list.Length);
byte nbleader = 0;
byte nbsolo = 0x1E;
foreach (GamePlayer player in list)
{
if (player.Group != null)
{
pak.WriteByte(nbleader++);
}
else
{
pak.WriteByte(nbsolo++);
}
pak.WriteByte(player.Level);
pak.WritePascalString(player.Name);
pak.WriteString(player.CharacterClass.Name, 4);
//Dinberg:Instances - have to write zoneskinID, it uses this to display the text 'x is in y'.
if (player.CurrentZone != null)
pak.WriteByte((byte) player.CurrentZone.ZoneSkinID);
else
pak.WriteByte(255);
}
}
else
{
pak.WriteShort(0x0000);
}
SendTCP(pak);
}
}