本文整理汇总了C#中ServerEngine.PacketEngine.Packet.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteString方法的具体用法?C# Packet.WriteString怎么用?C# Packet.WriteString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServerEngine.PacketEngine.Packet
的用法示例。
在下文中一共展示了Packet.WriteString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendGuild
public static byte[] SendGuild(Guild g)
{
Packet p = new Packet(200);
p.WriteInt(g.ID);
p.WriteString(g.Name);
p.WriteInt(g.Members.Count);
foreach (GuildMember c in g.Members)
{
p.WriteInt((int)c.Rank);
p.WriteInt(c.Character.CharacterId);
p.WriteString(c.Character.Name);
p.WriteString(c.Title);
p.WriteByte(Convert.ToByte(c.Online));
p.WriteHexString("01");
}
return p.GetWrittenBuffer(PacketIds.SendGuild);
}
示例2: SendWorldList
/// <summary>
/// Send list of worlds to client
/// </summary>
/// <returns></returns>
public static byte[] SendWorldList(WorldInfo[] worldInfos)
{
Packet p = new Packet(100);
p.WriteByte(worldInfos.Length);
for (int i = 0; i < worldInfos.Length; i++)
{
p.WriteByte(worldInfos[i].WorldId);
p.WriteString(worldInfos[i].WorldName);
p.WriteString(worldInfos[i].WorldDesc);
}
return p.GetWrittenBuffer(PacketIds.SendWorldList);
}
示例3: SendCharacterList
/// <summary>
/// Send character list to client
/// </summary>
/// <returns></returns>
public static byte[] SendCharacterList(Character[] characters)
{
Packet p = new Packet(200);
p.WriteByte(characters.Length);
foreach (Character c in characters)
{
p.WriteInt(c.MapId);
p.WriteInt(c.CharacterId);
p.WriteString(c.Name);
p.WriteByte(c.Class);
p.WriteShort(c.Level);
p.WriteInt(c.CurrentHp);
p.WriteInt(c.MaxHp);
p.WriteInt(c.MaxMana);
p.WriteShort(c.Strength);
p.WriteShort(c.Stamina);
p.WriteShort(c.Dexterity);
p.WriteShort(c.Energy);
p.WriteHexString("00 00 00 00 02 00 00 00 00 00 00 00"); // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
foreach (Equipment e in c.GetVisuals())
{
p.WriteShort(e.VisualID);
p.WriteByte(e.Plus);
p.WriteByte(e.Slvl);
}
p.WriteHexString("01 00"); // ending bytes
}
return p.GetWrittenBuffer(PacketIds.SendCharacterList);
}
示例4: SendTradePetOffer
public static byte[] SendTradePetOffer(Pet pet, int MoneyWanted, int targetid)
{
Packet p = new Packet(200);
p.WriteHexString("00");
p.WriteInt(pet.OwnerID);
p.WriteInt(targetid);
p.WriteInt(pet.PetID);
p.WriteInt(MoneyWanted);
p.WriteString("Pet"); // type of the pet, could be like beast, undead etc
p.WriteString(pet.Name);
p.WriteShort(pet.Level);
p.WriteInt(pet.MaxHealth);
p.WriteShort(pet.Damage);
p.WriteShort(pet.Defense);
p.WriteShort(pet.AttackRating);
p.WriteHexString("01 00 00 00");
return p.GetWrittenBuffer(PacketIds.SendTradePetOffer);
}
示例5: SendSpawnPlayers
public static byte[] SendSpawnPlayers(Character ch)
{
Packet p = new Packet(200);
p.WriteHexString("00");
p.WriteInt(ch.MapId);
p.WriteHexString("01 00");
p.WriteInt(ch.CharacterId);
p.WriteShort(ch.X);
p.WriteShort(ch.Y);
p.WriteHexString("76");
p.WriteShort(ch.X);
p.WriteShort(ch.Y);
p.WriteHexString("76");
p.WriteHexString("16 B2 00 00");
p.WriteByte(ch.Class);
p.WriteString(ch.Name);
p.WriteInt(ch.Fame);
p.WriteHexString("00"); // bool selling
p.WriteString(""); // shopname
p.WriteString(""); // shopdesc
p.WriteHexString("00"); // purple name
p.WriteHexString("00"); // fe
p.WriteHexString("00"); // fe ring
p.WriteHexString("00"); // maybe has guild thingy
//if Character has guild
//p.WriteHexString("00 00 00 00"); // guild id
//p.WriteString(""); // guild name
//p.WriteHexString("00 00 00 00"); // maybe guild position
//p.WriteHexString("00 00 00 00"); // maybe guild position
//p.WriteHexString("00 00 00 00 00 00 00 00");
//p.WriteHexString("00"); // something
p.WriteHexString("00 00 00 00 00 00 00 00 00"); // else write this
foreach (Equipment e in ch.GetVisuals())
{
p.WriteShort(e.VisualID);
p.WriteByte(e.Plus);
p.WriteByte(e.Slvl);
p.WriteByte(e.RequiredClass);
}
p.WriteByte(ch.Rebirth); // rebirth
p.WriteHexString("00 00 00 00 00");
return p.GetWrittenBuffer(PacketIds.SendSpawnPlayers);
}
示例6: SendPlayerPet
public static byte[] SendPlayerPet(Character ch)
{
Packet p = new Packet(200);
Pet pet = ch.Pet;
p.WriteInt(ch.CharacterId);
if (pet != null)
{
p.WriteHexString("01");
p.WriteInt(pet.PetID);
p.WriteInt(pet.OwnerID);
p.WriteInt(pet.MapID);
p.WriteByte(pet.PetType);
p.WriteString(pet.Name);
p.WriteShort(pet.Level);
p.WriteShort(pet.Position.X);
p.WriteShort(pet.Position.Y);
p.WriteHexString("38 D7 03 96 04 38 CE 00");
p.WriteInt(pet.TotalHealth);
p.WriteInt(pet.CurHealth);
p.WriteShort(pet.TotalDamage);
p.WriteShort(pet.TotalDefense);
p.WriteShort(pet.TotalAttackRating);
p.WriteHexString("01 00 09 00 00 00 00 00 56 2A 00 00 01 ");
p.WriteLong(pet.CurrentExperience);
p.WriteLong(pet.NegativeExperience);
p.WriteLong(pet.ExperienceToLevel + pet.NegativeExperience);
p.WriteByte(pet.Evolution);
p.WriteByte(pet.Wildness);
p.WriteByte(Convert.ToByte(pet.IsLegendary));
p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00");
p.WriteHexString("00 00 00 00 00 00 00 00 00 00");
}
else
p.WriteHexString("00"); // no pet
return p.GetWrittenBuffer(PacketIds.SendPetOnLogin);
}
示例7: SendSpawnPlayer
public static byte[] SendSpawnPlayer(Character ch)
{
Packet p = new Packet(200);
p.WriteHexString("00");
p.WriteInt(ch.CharacterId);
p.WriteInt(ch.MapId);
p.WriteShort(ch.Position.X);
p.WriteShort(ch.Position.Y);
p.WriteHexString("76");
p.WriteShort(ch.Position.X);
p.WriteShort(ch.Position.Y);
p.WriteHexString("76");
p.WriteHexString("0B C5 00 00");
p.WriteByte(ch.Class);
p.WriteString(ch.Name);
p.WriteInt(ch.Fame);
p.WriteByte(Convert.ToByte(ch.Shop.Active));
p.WriteString(ch.Shop.ShopName);
p.WriteString(ch.Shop.ShopDesc);
p.WriteHexString("00 00 00 00 00 00 00 00 00");
p.WriteInt(ch.Party.PartyID);
p.WriteInt(ch.Party.Leader.CharacterId);
p.WriteHexString("00 00 00 00");
foreach (Equipment e in ch.GetVisuals())
{
p.WriteShort(e.VisualID);
p.WriteByte(e.Plus);
p.WriteByte(e.Slvl);
p.WriteByte(e.RequiredClass);
}
p.WriteHexString("00 00 00 00 00 00");
return p.GetWrittenBuffer(PacketIds.SendSpawnPlayer);
}
示例8: SendGuildMemberInfo
public static byte[] SendGuildMemberInfo(GuildMember g)
{
Packet p = new Packet(200);
p.WriteInt(g.Character.CharacterId);
p.WriteString(g.Character.Name);
p.WriteInt((int)g.Rank);
p.WriteString(g.Title);
p.WriteByte(Convert.ToByte(g.Online));
p.WriteByte(g.Character.Level);
p.WriteHexString("00"); // some stats
p.WriteByte(g.Character.Class);
return p.GetWrittenBuffer(PacketIds.SendGuildMemberInfo);
}
示例9: SendGuildNotice
public static byte[] SendGuildNotice(Guild g)
{
Packet p = new Packet(20);
p.WriteInt(g.Leader.Character.CharacterId);
p.WriteHexString("09");
p.WriteString(g.Notice);
return p.GetWrittenBuffer(PacketIds.SendGuildNotice);
}
示例10: SendGuildJoin
public static byte[] SendGuildJoin(Character c)
{
Packet p = new Packet(20);
p.WriteHexString("00");
p.WriteHexString("45 1A 00 00"); // guild id
p.WriteHexString("01 00 00 00");
p.WriteInt(c.CharacterId);
p.WriteString(c.Name);
return p.GetWrittenBuffer(PacketIds.SendGuildJoin);
}
示例11: SendGuildMember
public static byte[] SendGuildMember(Guild g, GuildMember m)
{
Packet p = new Packet(20);
p.WriteInt(m.Character.CharacterId);
p.WriteInt(g.ID);
p.WriteString(g.Name);
p.WriteInt((int)m.Rank);
p.WriteString(m.Title);
p.WriteString(m.Character.Name); // owner name
p.WriteHexString("00 00 00 00 00");
p.WriteHexString("02 00 00 00");
p.WriteHexString("00 00 00 00"); // more stats?
p.WriteHexString("00 00 00 00"); // guild mark
return p.GetWrittenBuffer(PacketIds.SendGuildOwner);
}
示例12: SendGuildCreate
public static byte[] SendGuildCreate(Guild g)
{
Packet p = new Packet(20);
p.WriteHexString("00");
p.WriteInt(g.ID);
p.WriteString(g.Name);
return p.GetWrittenBuffer(PacketIds.SendGuildCreate);
}
示例13: SendGuildChat
public static byte[] SendGuildChat(Character ch, string message)
{
Packet p = new Packet(20);
p.WriteInt(ch.CharacterId);
p.WriteHexString("06");
p.WriteString(message);
return p.GetWrittenBuffer(PacketIds.SendGuildNotice);
}
示例14: SendGuildChangeMemberTitle
public static byte[] SendGuildChangeMemberTitle(Guild g, GuildMember m, GuildMemberError e)
{
Packet p = new Packet(20);
p.WriteByte((byte)e); // error proly
if (e == GuildMemberError.Success)
{
p.WriteInt(g.ID);
p.WriteInt(m.Character.CharacterId);
p.WriteString(m.Title);
}
else
{
p.WriteInt(0);
p.WriteInt(0);
p.WriteString("");
}
return p.GetWrittenBuffer(PacketIds.SendGuildChangeMemberTitle);
}
示例15: SendPetRenamed
public static byte[] SendPetRenamed(Pet pet)
{
Packet p = new Packet(200);
p.WriteHexString("00");
p.WriteInt(pet.PetID);
p.WriteString(pet.Name);
return p.GetWrittenBuffer(PacketIds.SendPetRenamed);
}