本文整理汇总了C#中Zepheus.FiestaLib.Networking.Packet.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteString方法的具体用法?C# Packet.WriteString怎么用?C# Packet.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zepheus.FiestaLib.Networking.Packet
的用法示例。
在下文中一共展示了Packet.WriteString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sendPartyMessage
public static void sendPartyMessage(WorldClient client, Packet packet)
{
string mess;
byte len;
if (!packet.TryReadByte(out len) || !packet.TryReadString(out mess, len))
{
Log.WriteLine(LogLevel.Error, "PartyChat :: Can not parse party chat from {0}", client.Character.Character.Name);
return;
}
if(Program.Entity.Parties.Where(c => c.CharNo == client.Character.Character.ID).Count() == 1)
{
Party getPartyInfo = Program.Entity.Parties.First(c => c.CharNo == client.Character.Character.ID);
foreach (Party party in Program.Entity.Parties.Where(c => c.PartyNo == getPartyInfo.PartyNo))
{
Character character = Program.Entity.Characters.First(c => c.ID == party.CharNo);
WorldClient wclient = ClientManager.Instance.GetClientByCharname(character.Name);
using (var ppacket = new Packet(SH8Type.PartyChat))
{
ppacket.WriteString(client.Character.Character.Name, 16);
ppacket.WriteByte(len);
ppacket.WriteString(mess, len);
wclient.SendPacket(ppacket);
}
}
}
else
{
using (var ppacket = new Packet(SH8Type.PartyChatErr))
{
ppacket.WriteUShort(1985);
client.SendPacket(ppacket);
}
}
}
示例2: WriteBasicCharInfo
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
{
packet.WriteInt(wchar.Character.ID);
packet.WriteString(wchar.Character.Name, 16);
packet.WriteUShort(wchar.Character.CharLevel);
packet.WriteByte(wchar.Character.Slot);
MapInfo mapinfo;
if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.Map, out mapinfo))
{
Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.Map);
wchar.Character.Map = 0;//we reset
packet.WriteString("Rou", 12);
}
else
{
packet.WriteString(mapinfo.ShortName, 12);
}
packet.WriteByte(0); // UNK
packet.WriteInt(0x00000000); // Random seed
WriteLook(wchar, packet);
WriteEquipment(wchar, packet);
WriteRefinement(wchar, packet);
packet.Fill(4, 0xff); // UNK
packet.WriteString("Rou", 12); //TODO: load from mapinfo.shn
packet.WriteInt(0); // X, doesn't matter
packet.WriteInt(0); // Y, neither
packet.WriteInt(0x63dd45ca);
packet.WriteByte(0);
packet.WriteInt(100); // Test later!
packet.WriteByte(0);
wchar.Detach();
}
示例3: SendMasterRequest
public void SendMasterRequest()
{
using (var packet = new Packet(SH37Type.SendMasterRequest))
{
packet.WriteString(pRequest.InviterClient.Character.Character.Name, 16);
packet.WriteString(pRequest.InvitedClient.Character.Character.Name, 16);
this.pRequest.InvitedClient.SendPacket(packet);
}
}
示例4: ChangeFromGuildAcademyToResponse
public static void ChangeFromGuildAcademyToResponse(WorldClient client, Packet packet)
{
string GuildName;
string RequestName;
bool answer;
if (!packet.TryReadString(out GuildName, 16) || !packet.TryReadString(out RequestName, 16)|| (!packet.TryReadBool(out answer) || !client.Character.IsInGuildAcademy))
return;
if (answer)
{
GuildAcademyMember pMember = client.Character.GuildAcademy.Members.Find(m => m.Character.Character.Name == RequestName);
if (pMember == null)
return;
pMember.Character.IsInGuildAcademy = false;
pMember.Academy.RemoveMember(pMember);
pMember.Character.GuildAcademy.Guild.AddMember(pMember.Character, GuildRank.Member, Program.DatabaseManager.GetClient().GetConnection(), true, true);
pMember.Character.Guild = pMember.Character.GuildAcademy.Guild;
pMember.Character.IsInGuild = true;
using (var pack = new Packet(SH38Type.SendJoinGuildFromAcademy))
{
//this packet remove character from academy List and added to GuildList
pack.WriteString(RequestName, 16);
pack.WriteString(client.Character.Character.Name, 16);
pack.WriteByte(6);//rank
pack.WriteInt(0);//unk
pack.WriteUShort(0);//korp
pack.Fill(64, 0x00);//unk
pack.WriteByte(true ? (byte)0x95 : (byte)0x00);// (this.isOnline ? (byte)0x95 : (byte)0x00);
pack.Fill(3, 0x00);//unk
pack.WriteByte(pMember.Character.Character.Job);
pack.WriteByte(pMember.Character.Character.CharLevel);
pack.Fill(13, 0x00);//unk
client.Character.GuildAcademy.Guild.Broadcast(pack);
client.Character.GuildAcademy.Broadcast(pack);
}
}
using (var p2 = new Packet(SH4Type.CharacterGuildinfo))
{
client.Character.Guild.WriteGuildInfo(packet);
client.SendPacket(p2);
}
using (var pack = new Packet(SH29Type.GuildMemberJoined))
{
pack.WriteString(client.Character.Character.Name, 16);
client.Character.GuildAcademy.Guild.Broadcast(pack);
client.Character.GuildAcademy.Broadcast(pack);
}
using (var pack = new Packet(SH29Type.ChangeResponse))
{
pack.WriteUShort(3137);//unk
pack.WriteByte(3);
pack.Fill(2, 0x00);//unk
client.SendPacket(pack);
}
}
示例5: FriendInvite
public static void FriendInvite(WorldClient pClient, Packet pPacket)
{
string sender, receiver;
if (!pPacket.TryReadString(out sender, 16) ||
!pPacket.TryReadString(out receiver, 16))
{
Log.WriteLine(LogLevel.Warn, "Error reading friend invite.");
return;
}
WorldCharacter inviter = pClient.Character;
WorldClient invitee = ClientManager.Instance.GetClientByCharname(receiver);
if (invitee == null)
{
//character not found
using (var pack = new Packet(SH21Type.FriendInviteResponse))
{
pack.WriteString(sender, 16);
pack.WriteString(receiver, 16);
pack.WriteUShort(0x0946); // Cannot find ${Target}
pClient.SendPacket(pack);
}
}
else if (receiver == sender)
{
using (var pack = new Packet(SH21Type.FriendInviteResponse))
{
pack.WriteString(sender, 16);
pack.WriteString(receiver, 16);
pack.WriteUShort(0x0942); // You cannot add yourself to your Buddy List.
pClient.SendPacket(pack);
}
}
else if (inviter.Friends.Find(f => f.Name == receiver) != null)
{
using (var pack = new Packet(SH21Type.FriendInviteResponse))
{
pack.WriteString(sender, 16);
pack.WriteString(receiver, 16);
pack.WriteUShort(0x0945); // {Target} is already registered in the friends list.
pClient.SendPacket(pack);
}
}
else
{
using (var pack = new Packet(SH21Type.FriendInviteRequest))
{
pack.WriteString(receiver, 16);
pack.WriteString(sender, 16);
invitee.SendPacket(pack);
}
}
}
示例6: SendGameMessage
public static void SendGameMessage(ZoneCharacter character, string Message, string script)
{
using (var packet = new Packet(SH27Type.GameMessage))
{
packet.WriteString(script, 31);
packet.WriteByte(24);
packet.WriteInt(Message.Length);
packet.WriteByte(0);
packet.WriteString(Message, Message.Length);
character.Client.SendPacket(packet);
}
}
示例7: Wisper
public static void Wisper(WorldClient client, Packet packet)
{
string toname;
byte messagelenght;
if (packet.TryReadString(out toname, 16) && packet.TryReadByte(out messagelenght))
{
string message;
if (!packet.TryReadString(out message, messagelenght))
{
return;
}
WorldClient toChar = ClientManager.Instance.GetClientByCharname(toname);
if (toChar != null)
{
using (var frompacket = new Packet(SH8Type.WisperFrom))
{
frompacket.WriteString(client.Character.Character.Name, 16);
if (!toChar.Character.BlocketUser.Contains(client.Character.Character.Name))
{
frompacket.WriteByte(0);
}
else
{
frompacket.WriteByte(12);//blocket notdisplay message
}
frompacket.WriteByte(messagelenght);
frompacket.WriteString(message, messagelenght);
toChar.SendPacket(frompacket);
}
using (var pack = new Packet(SH8Type.WisperTo))
{
pack.WriteString(toname, 16);
pack.WriteByte(messagelenght);
pack.WriteString(message, messagelenght);
client.SendPacket(pack);
}
}
else
{
//target not found
using (var pp = new Packet(SH8Type.WisperTargetNotfound))
{
pp.WriteUShort(3945);//unk
pp.WriteString(toname, 16);
client.SendPacket(pp);
}
}
}
}
示例8: LeaveParty
public static void LeaveParty(WorldClient client, Packet packet)
{
Party party;
party = Program.Entity.Parties.First(c => c.CharNo == client.Character.Character.ID);
foreach (Party PartyListFromDB in Program.Entity.Parties.Where(c => c.PartyNo == party.PartyNo).OrderBy(c => c.MasterNo))
{
Character character;
character = Program.Entity.Characters.First(c => c.ID == PartyListFromDB.CharNo);
WorldClient Partyclient = ClientManager.Instance.GetClientByCharname(character.Name);
using (var ppacket = new Packet(SH14Type.LeaveParty))
{
ppacket.WriteString(client.Character.Character.Name, 16);
ppacket.WriteUShort(1281);
Partyclient.SendPacket(ppacket);
}
}
if(Program.Entity.Parties.Where(c => c.PartyNo == party.PartyNo).Count() == 2){
Party OtherClientParty;
OtherClientParty = Program.Entity.Parties.First(c => c.CharNo != client.Character.Character.ID);
Program.Entity.DeleteObject(OtherClientParty);
}
Program.Entity.DeleteObject(party);
Program.Entity.SaveChanges();
}
示例9: BroadcastGuildName
public void BroadcastGuildName()
{
var packet = new Packet(SH29Type.GuildNameResult);
packet.WriteInt(Guild.ID);
packet.WriteString(Guild.Name, 16);
BroadcastManager.Instance.BroadcastInRange(Character, packet, false);
}
示例10: BroadcastGuildName
public void BroadcastGuildName()
{
var packet = new Packet(SH29Type.GuildNameResult);
packet.WriteInt(Academy.Guild.ID);
packet.WriteString(Academy.Guild.Name, 16);
Character.BroucastPacket(packet);
}
示例11: SendGuildNameResult
public static void SendGuildNameResult(WorldClient client, int pID, string pName)
{
using (var packet = new Packet(SH29Type.GuildNameResult))
{
packet.WriteInt(pID);
packet.WriteString(pName, 16);
client.SendPacket(packet);
}
}
示例12: SendQuestion
public static void SendQuestion(ZoneCharacter character, Question question, ushort range)
{
using (var packet = new Packet(SH15Type.Question))
{
packet.WriteString(question.Text, 129);
packet.WriteUShort(character.MapObjectID); // Obj id
packet.WriteInt(character.Position.X);
packet.WriteInt(character.Position.Y);
packet.WriteUShort(range); // Distance how far your allowed to run when the question window is closed by Client
packet.WriteByte((byte)question.Answers.Count);
for (byte i = 0; i < question.Answers.Count; ++i)
{
packet.WriteByte(i);
packet.WriteString(question.Answers[i], 32);
}
character.Client.SendPacket(packet);
}
}
示例13: SendAcademyResponse
public static void SendAcademyResponse(WorldClient pClient,string GuildName, GuildAcademyResponse Response)
{
using (var packet = new Packet(SH38Type.AcademyResponse))
{
packet.WriteString(GuildName, 16);
packet.WriteUShort((ushort)Response);
pClient.SendPacket(packet);
}
}
示例14: SendBackToWorldSelect
public static void SendBackToWorldSelect(WorldClient client)
{
using(Packet packet = new Packet(SH3Type.BackToWorldSelect))
{
packet.WriteUShort(7768);
packet.WriteString(client.AccountKey);
client.SendPacket(packet);
}
}
示例15: SendZoneServerIP
public static void SendZoneServerIP(WorldClient client, ZoneConnection info)
{
using (var packet = new Packet(SH4Type.ServerIP))
{
packet.WriteString(info.IP, 16);
packet.WriteUShort(info.Port);
client.SendPacket(packet);
}
}