本文整理汇总了C#中ServerEngine.PacketEngine.Packet.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteByte方法的具体用法?C# Packet.WriteByte怎么用?C# Packet.WriteByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServerEngine.PacketEngine.Packet
的用法示例。
在下文中一共展示了Packet.WriteByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendKey
/// <summary>
/// Send public cryption key, first packet on each server when client connects
/// </summary>
/// <param name="key">Cryption key</param>
/// <returns></returns>
public static byte[] SendKey(int key)
{
Packet p = new Packet(5);
p.WriteByte(key);
return p.GetWrittenBuffer(PacketIds.SendKey);
}
示例2: SendChatMessage
public static byte[] SendChatMessage(Character ch, ChatMessageInfo cmi)
{
Packet p = new Packet(200);
p.WriteInt(ch.CharacterId);
p.WriteByte((byte)cmi.Type); // chat type probably
p.WriteString(cmi.Message);
p.WriteString(ch.Name);
if (cmi.Type == ChatType.Whisper)
{
p.WriteInt(cmi.TargetID);
p.WriteString(cmi.TargetName);
}
return p.GetWrittenBuffer(PacketIds.SendChatMessage);
}
示例3: SendCreateCharacter
/// <summary>
/// Create character
/// </summary>
/// <param name="ms">State of character making</param>
/// <param name="playerid">ID of character that was made</param>
/// <returns></returns>
public static byte[] SendCreateCharacter(CharCreationState ms, int playerid)
{
Packet p = new Packet(500);
p.WriteByte((byte)ms);
if (ms == CharCreationState.Success)
p.WriteInt(playerid);
else
p.WriteHexString("00 00 00 00");
return p.GetWrittenBuffer(PacketIds.SendCreateCharacter);
}
示例4: SendBuyItemState
public static byte[] SendBuyItemState(BuyItemState b)
{
Packet p = new Packet(20);
p.WriteByte((byte)b);
return p.GetWrittenBuffer(PacketIds.SendBuyItemState);
}
示例5: SendChannelChange
public static byte[] SendChannelChange(int something, int something2)
{
Packet p = new Packet(200);
p.WriteByte(0);
p.WriteByte(something);
p.WriteByte(something2);
return p.GetWrittenBuffer(PacketIds.SendChannelChange);
}
示例6: 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);
}
示例7: SendAddStat
public static byte[] SendAddStat(int error, AddStatInfo asi, int pointsleft, int statamount)
{
Packet p = new Packet(200);
p.WriteHexString("1E 35 07 00");
p.WriteByte(error);
p.WriteByte(asi.Stat);
p.WriteByte(asi.Amount);
p.WriteShort(pointsleft);
p.WriteShort(statamount);
return p.GetWrittenBuffer();
}
示例8: SendNpcItemList
public static byte[] SendNpcItemList(Npc n, byte bag)
{
Packet p = new Packet(200);
p.WriteHexString("00"); // unknown
p.WriteInt(n.NpcID);
p.WriteByte(bag); // bag
p.WriteShort(n.Bags[bag].ItemCount);
foreach (BaseItem i in n.Bags[bag].Items)
{
p.WriteShort(i.ReferenceID);
p.WriteByte(i.bType);
p.WriteByte(i.bKind);
p.WriteShort(i.VisualID);
p.WriteInt(i.Price);
p.WriteHexString("00 00"); // some quest item, only guild master thingy
p.WriteByte(i.RequiredClass);
p.WriteShort(i.Amount);
p.WriteByte(i.Slot);
p.WriteHexString("00");
if (i is Equipment)
{
Equipment e = i as Equipment;
p.WriteShort(e.RequiredLevel);
p.WriteShort(e.RequiredDexterity);
p.WriteShort(e.RequiredStrength);
p.WriteShort(e.RequiredStamina);
p.WriteShort(e.RequiredEnergy);
p.WriteByte(e.MaxImbueTries);
p.WriteHexString("00"); // something
p.WriteShort(e.Durability);
p.WriteShort(e.Durability);
p.WriteShort(e.Damage);
p.WriteShort(e.Defence);
p.WriteShort(e.AttackRating);
if (e is Cape)
{
Cape c = e as Cape;
p.WriteHexString("00 00"); // faster run
p.WriteHexString("01 00"); // decrease times of durability
p.WriteByte(c.PolishImbueTries); // polish imbue tries
p.WriteHexString("00"); // something
p.WriteShort(c.MaxPolishImbueTries); // polish max tries
p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00"); // something
}
else
{
p.WriteShort(e.AttackSpeed);
p.WriteShort(e.AttackRange);
p.WriteShort(e.IncMaxLife);
p.WriteShort(e.IncMaxMana);
p.WriteShort(e.IncLifeRegen);
p.WriteShort(e.IncManaRegen);
p.WriteShort(e.Critical);
p.WriteHexString("00 00 00 00 00 00 00 00");
}
}
if (i is PotionItem)
{
PotionItem pot = i as PotionItem;
p.WriteShort(pot.HealHp);
p.WriteShort(pot.HealMana);
}
}
return p.GetWrittenBuffer(PacketIds.SendNpcItemList);
}
示例9: SendPlayerID
public static byte[] SendPlayerID(int id)
{
Packet p = new Packet(200);
p.WriteHexString("20 3A 05 00");
p.WriteInt(id);
p.WriteByte(0);
return p.GetWrittenBuffer();
}
示例10: SendMonsterMove
public static byte[] SendMonsterMove(MovementInfo mi)
{
Packet p = new Packet(200);
p.WriteHexString("0A 40 16 00 00 39 05 00 00 03");
p.WriteShort(mi.FromX);
p.WriteShort(mi.FromY);
p.WriteByte(mi.FromZ);
p.WriteShort(mi.ToX);
p.WriteShort(mi.ToY);
p.WriteByte(mi.ToZ);
p.WriteShort(mi.Rotation);
p.WriteHexString("15 03 00 00");
return p.GetWrittenBuffer();
}
示例11: SendMoveItem
public static byte[] SendMoveItem(MoveItemInfo m, byte error)
{
Packet p = new Packet(200);
p.WriteByte(error);
p.WriteByte(m.FromBag);
p.WriteByte(m.FromSlot);
p.WriteByte(m.ToBag);
p.WriteByte(m.ToSlot);
return p.GetWrittenBuffer(PacketIds.SendMoveItem);
}
示例12: SendMapTime
public static byte[] SendMapTime(int year, int month, int day, int hour)
{
Packet p = new Packet(200);
p.WriteShort(year);
p.WriteByte(month);
p.WriteByte(day);
p.WriteByte(hour);
return p.GetWrittenBuffer(PacketIds.SendMapTime);
}
示例13: SendMap
public static byte[] SendMap(Map mh)
{
Packet p = new Packet(200);
p.WriteByte(0);
p.WriteInt(mh.MapID);
p.WriteByte(0);
p.WriteShort(mh.MultiplyValue);
p.WriteByte(mh.MultiplyValue);
p.WriteByte(1);
p.WriteByte(mh.Portals.Count);
foreach (Portal portal in mh.Portals)
{
p.WriteInt(portal.ToMapID);
p.WriteShort(portal.FromX);
p.WriteShort(portal.FromY);
p.WriteShort(portal.Width);
p.WriteShort(portal.Height);
p.WriteByte(1); // type
}
// p.WriteHexString("01 02 01 00 00 00 21 03 2A 03 40 00 40 00 01 0B 00 00 00 91 00 75 00 20 00 20 00 01");
return p.GetWrittenBuffer(PacketIds.SendMap);
}
示例14: SendLoginState
/// <summary>
/// Send LoginState to client
/// </summary>
/// <param name="ls">State of login</param>
/// <returns></returns>
public static byte[] SendLoginState(LoginState ls, int ID)
{
Packet p = new Packet(100);
if (ls == LoginState.Success)
{
p.WriteByte((short)ls);
p.WriteShort(ID); // the total connection amounts from db or somewhere, used in gameserver
p.WriteHexString("01 00 14");
}
else
{
p.WriteByte((short)ls);
p.WriteHexString("00 00 00 00 00"); // if its error just logintype and rest zeroes
}
return p.GetWrittenBuffer(PacketIds.SendLoginState);
}
示例15: SendStats
public static byte[] SendStats(Character ch)
{
Packet p = new Packet(200);
// p.WriteHexString("02 3A 52 00 01 00 02 00 03 00 04 00 05 00 06 00 00 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 00 0B 05 00 00 00 06 00 00 00 07 00 08 00 09 00 01 00 02 00 02 00 0C 07 00 02 03 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
p.WriteShort(ch.Level);
p.WriteShort(ch.Strength);
p.WriteShort(ch.Stamina);
p.WriteShort(ch.Dexterity);
p.WriteShort(ch.Energy);
p.WriteShort(ch.StatPoint); // stat points
//PLOX FUNCTION OF STATS HERE
ch.CalculateTotalStats();
p.WriteHexString("00 00 00 00"); // unknown
p.WriteInt(ch.TotalDamage); // total damage
p.WriteInt(ch.TotalDefence); // total defence
p.WriteInt(ch.TotalAttackRating); // total attack rating
p.WriteHexString("00 0B"); // unknown
p.WriteInt(ch.CurrentHp);
p.WriteInt(ch.MaxHp);
p.WriteShort(ch.CurrentMana);
p.WriteShort(ch.MaxMana);
p.WriteShort(ch.Critical); // critical hit
p.WriteShort(ch.StatDamage); // damage from stats
p.WriteShort(ch.StatDefence); // defence from stats
p.WriteShort(ch.StatAttackRating); // attack rating from stats
p.WriteHexString("0C 07 01"); // unknown
p.WriteByte(ch.MovingSpeed); // movement speed
p.WriteShort(ch.TrainingPoint); // trainings
p.WriteHexString("00 00 00 00"); // unknown
p.WriteInt(ch.Fame);
p.WriteHexString("00"); // gives you green name, luls
p.WriteByte(ch.Rebirth); // rebirths
p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00"); // unknown
p.WriteInt(ch.RepulationPoint); // repulation points
return p.GetWrittenBuffer(PacketIds.SendStats);
}