本文整理汇总了C#中ServerEngine.PacketEngine.Packet.WriteInt方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteInt方法的具体用法?C# Packet.WriteInt怎么用?C# Packet.WriteInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServerEngine.PacketEngine.Packet
的用法示例。
在下文中一共展示了Packet.WriteInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendUnSealPet
public static byte[] SendUnSealPet(Pet pet)
{
Packet p = new Packet(200);
p.WriteHexString("00");
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((short)pet.Position.X);
p.WriteShort((short)pet.Position.Y);
p.WriteHexString("4E 4E");
p.WriteHexString("01 78 02 4E C6 00");
p.WriteInt(pet.MaxHealth);
p.WriteInt(pet.CurHealth);
p.WriteShort(pet.Damage);
p.WriteShort(pet.Defense);
p.WriteShort(pet.AttackRating);
p.WriteHexString("01 00 09 00 00 00 00 00 25 32 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");
p.WriteHexString("00 00 00 00 00 00 00 00");
return p.GetWrittenBuffer(PacketIds.SendUnSealPet);
}
示例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: SendUnitLoginState
/// <summary>
/// Send Unit Server login state to client
/// </summary>
/// <param name="uls"></param>
/// <param name="PlayerID"></param>
/// <returns></returns>
public static byte[] SendUnitLoginState(LoginState uls, int PlayerID)
{
Packet p = new Packet(100);
if (uls == LoginState.Success)
{
p.WriteShort((short)uls);
p.WriteInt(PlayerID); // if client were ingame before, else its just 00 00 00 00
}
else
{
p.WriteShort((short)uls);
p.WriteHexString("00 00 00 00"); // if its error just logintype and rest zeroes
}
return p.GetWrittenBuffer(PacketIds.SendUnitLoginState);
}
示例5: SendBagItems
public static byte[] SendBagItems(List<BaseItem> items, int bag)
{
Packet p = new Packet(200);
// p.WriteHexString("18 31 A4 00 00 02 00 73 83 D0 00 2A 4E 01 02 B0 04 00 00 00 00 00 00 02 00 00 04 00 05 00 06 00 07 00 08 00 C0 C8 00 C8 00 05 00 06 00 07 00 08 00 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 08 00 00 00 04 00 05 00 07 00 0A 00 0B 00 0C 00 0D 00 00 00 00 01 01 01 02 02 74 83 D0 00 35 4E 02 01 34 08 00 00 00 00 00 00 02 01 00 01 00 00 00 00 00 01 00 00 00 C8 64 00 64 00 00 00 03 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");
p.WriteByte(bag);
p.WriteByte(items.Count);
foreach (BaseItem i in items)
{
p.WriteByte(i.Slot);
p.WriteInt(i.ItemID);
p.WriteShort(i.ReferenceID);
p.WriteByte(i.bType);
p.WriteByte(i.bKind);
p.WriteShort(i.VisualID);
p.WriteInt(i.Price);
p.WriteHexString("00 00");
if (i is Equipment)
{
Equipment e = i as Equipment;
p.WriteByte(e.RequiredClass);
p.WriteShort(e.Amount);
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.WriteShort(e.Durability);
p.WriteShort(e.MaxDurability);
p.WriteShort(e.Damage);
p.WriteShort(e.Defence);
p.WriteShort(e.AttackRating);
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.WriteByte(e.Plus);
p.WriteByte(e.Slvl);
p.WriteHexString("00"); // unknown
p.WriteByte(e.ImbueTries);
p.WriteHexString("00"); // unknown
p.WriteShort(e.DragonSuccessImbueTries);
p.WriteByte(e.DiscountRepairFee);
p.WriteShort(e.TotalDragonImbueTries);
p.WriteShort(e.DragonDamage);
p.WriteShort(e.DragonDefence);
p.WriteShort(e.DragonAttackRating);
p.WriteShort(e.DragonLife);
p.WriteByte(e.MappedData);
if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
p.WriteByte(e.ForceSlot);
p.WriteHexString("00 00"); // unknown
if (e is Cape)
{
Cape c = e as Cape;
p.WriteHexString("00 00"); // required guild position
p.WriteHexString("00 00 00 00 00 00 00");
p.WriteHexString("01 00"); // decrease times of durability
p.WriteByte(c.PolishImbueTries); // polish imbue tries
p.WriteShort(c.MaxPolishImbueTries); // polish max tries
p.WriteShort(c.VigiStat1); // stat1
p.WriteShort(c.VigiStat2); // stat2
p.WriteShort(c.VigiStat3); // stat3
p.WriteShort(c.VigiStat4); // stat4
p.WriteHexString("00 00"); // stat5
p.WriteShort(c.VigiStatAdd1); // stat1 increase
p.WriteShort(c.VigiStatAdd2); // stat2 increase
p.WriteShort(c.VigiStatAdd3); // stat3 increase
p.WriteShort(c.VigiStatAdd4); // stat4 increase
p.WriteHexString("00 00"); // stat5 increase
p.WriteHexString("00 00"); // unknown
}
if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
{
p.WriteByte(e.RebirthHole);
p.WriteByte(e.RebirthHoleItem);
p.WriteShort(e.RebirthHoleStat);
}
}
if (i is ImbueItem)
{
ImbueItem im = i as ImbueItem;
p.WriteByte(im.RequiredClass);
p.WriteShort(i.Amount);
p.WriteHexString("00"); // imbuestat, eg dec level, increase value etc
p.WriteShort(im.ImbueChance);
p.WriteShort(im.IncreaseValue);
p.WriteHexString("00 00"); // could be lowest lvl who knows
p.WriteHexString("00 00"); // maxlevel of usage, for dragon stones
p.WriteHexString("00 00"); // unknown
}
if (i is PotionItem)
{
PotionItem pot = i as PotionItem;
p.WriteByte(pot.RequiredClass);
p.WriteShort(pot.Amount);
p.WriteHexString("00 00 00 00");
//.........这里部分代码省略.........
示例6: SendSpawnStats
// something about repulation, current hp/mana, stats
public static byte[] SendSpawnStats(Character ch)
{
Packet p = new Packet(200);
p.WriteShort(ch.Level);
p.WriteShort(ch.Strength);
p.WriteShort(ch.Stamina);
p.WriteShort(ch.Dexterity);
p.WriteShort(ch.Energy);
p.WriteHexString("01 01 01 01"); // unknown :(, maybe base stats?: D
p.WriteShort(ch.MaxMana);
p.WriteShort(ch.CurrentMana);
p.WriteInt(ch.MaxHp);
p.WriteInt(ch.CurrentHp);
p.WriteLong(ch.CurrentExp); // cur exp
p.WriteHexString("00 00 00 00 00 00 00 00"); // curxp to next training
p.WriteLong(1200000); // exp to level
p.WriteHexString("00 00 00 00 00 00 00 00"); // xp to next training
p.WriteHexString("00 00");
p.WriteHexString("04 00 00 00");
p.WriteHexString("00 00");
p.WriteHexString("08 00 00 00");
p.WriteShort(ch.StatPoint); // stat points
p.WriteHexString("6B 00 00 00"); // total trainings?
p.WriteShort(ch.TrainingPoint); // current trainings
p.WriteHexString("7C 00"); // damage from stats
p.WriteHexString("C5 00 00 00"); // total damage (from items, skills etc)
p.WriteHexString("11 00"); // defence from stats
p.WriteHexString("12 00 00 00"); // total defence (from items, skills etc)
p.WriteHexString("13 00"); // attack rating from stats
p.WriteHexString("14 00 00 00"); // total attack rating (from items, skills etc)
p.WriteHexString("07 00"); // attack range or speed
p.WriteHexString("0B 0B"); // animation speed (the speed hax thingy in xiah 2827)
p.WriteHexString("0B"); // movement speed, from shoes ^_ ^
p.WriteHexString("00 00 00 00 00");
p.WriteInt(ch.Money);
p.WriteHexString("02 00"); // Critical
p.WriteHexString("1A 00");
p.WriteInt(ch.Fame);
p.WriteShort(ch.FiveElementPoint); // five element points (unused)
p.WriteInt(ch.CurrentFEExp); // current fe experience
p.WriteHexString("02 00 00 00"); // fe experience to point, 40000 each level
p.WriteHexString("00 00 00 00"); // that other five element skill experience :S
p.WriteHexString("00 00"); // fire fe level
p.WriteHexString("00 00"); // water fe level
p.WriteHexString("00 00"); // wood fe level
p.WriteHexString("00 00"); // steel fe level
p.WriteHexString("00 00"); // soil fe level
p.WriteByte(ch.Rebirth); // rebirths
p.WriteInt(ch.RepulationPoint); // Repulation points, the points near stat ones :U
return p.GetWrittenBuffer(PacketIds.SendSpawnStats);
}
示例7: 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);
}
示例8: SendMapID
public static byte[] SendMapID(int mapId)
{
Packet p = new Packet(200);
p.WriteHexString("00");
p.WriteInt(mapId);
return p.GetWrittenBuffer(PacketIds.SendMapId);
}
示例9: SendMoneyLeft
public static byte[] SendMoneyLeft(int money)
{
Packet p = new Packet(20);
p.WriteInt(money);
p.WriteHexString("00"); // something
return p.GetWrittenBuffer(PacketIds.SendMoneyLeft);
}
示例10: SendItemOnGround
public static byte[] SendItemOnGround(MapItem e)
{
Packet p = new Packet(200);
p.WriteHexString("00 01 00");
p.WriteInt(e.MapID);
p.WriteShort(e.MapX);
p.WriteShort(e.MapY);
p.WriteByte(e.MapZ);
p.WriteInt(e.MapItemID); // DROP ITEM NEED NEW CLASS DROP ITEM PROBABLY
p.WriteByte(e.bType);
p.WriteShort(e.VisualID);
p.WriteShort(e.ReferenceID);
p.WriteInt(e.ItemID);
p.WriteShort(e.Amount);
p.WriteHexString("00 00 00 00 00 00 01 00 00");
return p.GetWrittenBuffer(PacketIds.SendItemOnGround);
}
示例11: 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);
}
示例12: SendImbueMessage
public static byte[] SendImbueMessage(ImbueError error, ImbueStat stat, int value, Equipment item)
{
Packet p = new Packet(5);
p.WriteByte((byte)error); // Error message
p.WriteByte((byte)stat); // Stat
p.WriteInt(value);
p.WriteHexString("00");
p.WriteShort(item.ReferenceID);
p.WriteByte(item.Plus);
p.WriteByte(item.Slvl);
return p.GetWrittenBuffer(PacketIds.SendImbueMessage);
}
示例13: SendWarehouseRemoveItem
public static byte[] SendWarehouseRemoveItem(byte slot, int itemid)
{
Packet p = new Packet(20);
p.WriteByte(slot);
p.WriteInt(itemid);
p.WriteHexString("01 00 00 00"); // maybe amount who knows
return p.GetWrittenBuffer(PacketIds.SendRemoveWarehouseItem);
}
示例14: SendWarehouseItems
public static byte[] SendWarehouseItems(List<BaseItem> items, int bag)
{
Packet p = new Packet(500);
// p.WriteHexString("9E 38 58 00 01 00 00 00 01 01 00 00 00 00 40 72 F0 00 B8 4E 01 02 B9 04 DD E3 00 00 01 00 02 01 00 28 00 7C 00 08 00 00 00 00 00 C8 F0 0A F0 0A BE 00 00 00 00 00 04 00 03 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
p.WriteHexString("01 00 00 00");
p.WriteHexString("01");
p.WriteByte(items.Count);
p.WriteHexString("00 00 00");
foreach (BaseItem i in items)
{
p.WriteByte(i.Slot);
p.WriteInt(i.ItemID);
p.WriteShort(i.ReferenceID);
p.WriteByte(i.bType);
p.WriteByte(i.bKind);
p.WriteShort(i.VisualID);
p.WriteInt(i.Price);
p.WriteHexString("00 00");
if (i is Equipment)
{
Equipment e = i as Equipment;
p.WriteByte(e.RequiredClass);
p.WriteShort(e.Amount);
p.WriteShort(e.RequiredLevel);
p.WriteShort(e.RequiredDexterity);
p.WriteShort(e.RequiredStrength);
p.WriteShort(e.RequiredStamina);
p.WriteShort(e.RequiredEnergy);
p.WriteShort(e.MaxImbueTries);
p.WriteShort(e.Durability);
p.WriteShort(e.MaxDurability);
p.WriteShort(e.Damage);
p.WriteShort(e.Defence);
p.WriteShort(e.AttackRating);
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.WriteByte(e.Plus);
p.WriteByte(e.Slvl);
p.WriteHexString("00"); // unknown
p.WriteShort(e.ImbueTries);
p.WriteHexString("00"); // unknown
p.WriteShort(e.DragonSuccessImbueTries);
p.WriteByte(e.DiscountRepairFee);
p.WriteShort(e.TotalDragonImbueTries);
p.WriteShort(e.DragonDamage);
p.WriteShort(e.DragonDefence);
p.WriteShort(e.DragonAttackRating);
p.WriteShort(e.DragonLife);
if (e is Mirror)
{
Mirror m = e as Mirror;
p.WriteInt(m.PetID);
p.WriteShort(m.LifeAbsorb);
p.WriteShort(m.DamageAbsorb);
p.WriteShort(m.DefenseAbsorb);
p.WriteShort(m.AttackRatingAbsorb);
p.WriteHexString("00 00 00 00 00 00 00 00 00 00"); // pet skill stuff yo
}
else
{
p.WriteByte(e.MappedData);
if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
{
p.WriteByte(e.ForceSlot);
p.WriteHexString("00 00"); // other slots
}
if (e is Cape)
{
Cape c = e as Cape;
p.WriteHexString("00 00"); // required guild position
p.WriteHexString("00 00 00 00 00 00 00");
p.WriteHexString("01 00"); // decrease times of durability
p.WriteByte(c.PolishImbueTries); // polish imbue tries
p.WriteShort(c.MaxPolishImbueTries); // polish max tries
p.WriteShort(c.VigiStat1); // stat1
p.WriteShort(c.VigiStat2); // stat2
p.WriteShort(c.VigiStat3); // stat3
p.WriteShort(c.VigiStat4); // stat4
p.WriteHexString("00 00"); // stat5
p.WriteShort(c.VigiStatAdd1); // stat1 increase
p.WriteShort(c.VigiStatAdd2); // stat2 increase
p.WriteShort(c.VigiStatAdd3); // stat3 increase
p.WriteShort(c.VigiStatAdd4); // stat4 increase
p.WriteHexString("00 00"); // stat5 increase
p.WriteHexString("00 00"); // unknown
}
if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
{
p.WriteShort(e.RebirthHole);
//p.WriteShort(e.RebirthHoleStat);
}
}
}
if (i is ImbueItem)
{
//.........这里部分代码省略.........
示例15: SendSpawnNpc
public static byte[] SendSpawnNpc(List<Npc> npcs, int mapid)
{
Packet p = new Packet(200);
p.WriteHexString("00"); // unknown
p.WriteInt(mapid);
p.WriteShort(npcs.Count);
foreach (Npc n in npcs)
{
p.WriteInt(n.NpcID);
p.WriteByte(n.NpcType);
p.WriteByte(n.NpcType);
p.WriteHexString("01"); // unknown
p.WriteShort(n.X);
p.WriteShort(n.Y);
p.WriteHexString("00"); // unknown
p.WriteShort(n.Direction);
p.WriteHexString("00 00 00 00 00 00 00 00 00"); // unknown
}
return p.GetWrittenBuffer(PacketIds.SendNpcSpawn);
}