public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(CreatureId); msg.AddByte(LightLevel); msg.AddByte(LightColor); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddOutfit(Default); msg.AddByte((byte)OutfitList.Count); foreach (AvalibleOutfit i in OutfitList) { msg.AddUInt16(i.Id); msg.AddString(i.Name); msg.AddByte(i.Addons); } if (Client.VersionNumber >= 870) { msg.AddByte((byte)MountList.Count); foreach (MountDescription i in MountList) { msg.AddUInt16(i.Id); msg.AddString(i.Name); } } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(FromPosition); msg.AddLocation(ToPosition); msg.AddByte((byte)Effect); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(PlayerId); msg.AddString(PlayerName); msg.AddByte(PlayerState); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(YourId); msg.AddUInt16(0x0032); // Related to client-side drawing speed msg.AddByte(CanReportBug); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddByte(Slot); msg.AddItem(Item); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(Location); msg.AddByte((byte)Color); msg.AddString(Message); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt16(Health); msg.AddUInt16(MaxHealth); msg.AddUInt32(Capacity); if (Client.VersionNumber >= 870) { msg.AddUInt64(Experience); } else { msg.AddUInt32((uint)Experience); } msg.AddUInt16(Level); msg.AddByte(LevelPercent); msg.AddUInt16(Mana); msg.AddUInt16(MaxMana); msg.AddByte(MagicLevel); msg.AddByte(MagicLevelPercent); msg.AddByte(Soul); msg.AddUInt16(Stamina); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(FromLocation); msg.AddByte(FromStackPosition); msg.AddLocation(ToLocation); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt16(ItemId); msg.AddByte(Count); msg.AddByte(Amount); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(FromLocation); msg.AddUInt16(SpriteId); msg.AddByte(FromStackPosition); msg.AddUInt32(CreatureId); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddByte(FightMode); msg.AddByte(ChaseMode); msg.AddByte(SafeMode); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(Location); msg.AddUInt16(ItemId); msg.AddByte(StackPosition); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt16(ItemId); msg.AddByte(Count); msg.AddByte(Amount); msg.AddByte(Unknown); msg.AddByte(Convert.ToByte(WithBackpack)); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddByte((byte)Channels.Count); foreach (Objects.Channel c in Channels) { msg.AddUInt16((ushort)c.Id); msg.AddString(c.Name); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddString(Name); msg.AddByte((byte)Items.Count); foreach (Objects.Item i in Items) { msg.AddItem(i); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(Cash); msg.AddByte((byte)ItemList.Count); foreach (ShopInfo i in ItemList) { msg.AddUInt16(i.ItemId); msg.AddByte(i.SubType); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddOutfit(Default); msg.AddByte((byte)OutfitList.Count); foreach (AvalibleOutfit i in OutfitList) { msg.AddUInt16(i.Id); msg.AddString(i.Name); msg.AddByte(i.Addons); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddByte((byte)ShopList.Count); foreach (ShopInfo i in ShopList) { msg.AddUInt16(i.ItemId); msg.AddByte(i.SubType); msg.AddString(i.ItemName); msg.AddUInt32(i.Weight); msg.AddUInt32(i.BuyPrice); msg.AddUInt32(i.SellPrice); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt16(ChannelId); msg.AddString(Name); }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg) { int msgPosition = msg.Position, outMsgPosition = outMsg.Position; if (msg.GetByte() != (byte)IncomingPacketType.FloorChangeUp) return false; Destination = destination; Type = IncomingPacketType.FloorChangeUp; outMsg.AddByte((byte)Type); Client.playerLocation.Z--; try { //going to surface if (Client.playerLocation.Z == 7) { //floor 7 and 6 already set for (int i = 5; i >= 0; i--) ParseFloorDescription(msg, Client.playerLocation.X - 8, Client.playerLocation.Y - 6, i, 18, 14, 8 - i, outMsg); } //underground, going one floor up (still underground) else if (Client.playerLocation.Z > 7) ParseFloorDescription(msg, Client.playerLocation.X - 8, Client.playerLocation.Y - 6, Client.playerLocation.Z - 2, 18, 14, 3, outMsg); return true; } finally { Client.playerLocation.X++; Client.playerLocation.Y++; } }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg) { if (msg.GetByte() != (byte)IncomingPacketType.TileUpdate) return false; Destination = destination; Type = IncomingPacketType.TileUpdate; outMsg.AddByte((byte)Type); Objects.Location pos = msg.GetLocation(); outMsg.AddLocation(pos); ushort thingId = msg.PeekUInt16(); if (thingId == 0xFF01) { outMsg.AddUInt16(msg.GetUInt16()); } else { ParseTileDescription(msg, pos, outMsg); outMsg.AddUInt16(msg.GetUInt16()); } return true; }
public void SendDisconnectLogin(string reason) { NetworkMessage message = new NetworkMessage(); message.AddByte((byte)ServerPacketType.Disconnect); message.AddString(reason); Send(message); }
/// <summary> /// Adds the spells. /// </summary> /// <param name="message">The message.</param> /// <param name="spells">The spells.</param> private static void AddSpells(NetworkMessage message, ICollection <ISpell> spells) { message.AddUInt16((ushort)spells.Count); foreach (ISpell spell in spells) { message.AddByte(spell.Id); } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="premiumTimeLeft">The premium time left.</param> /// <param name="vocation">The vocation.</param> /// <param name="spells">The spells.</param> public static void Add(NetworkMessage message, TimeSpan premiumTimeLeft, IVocation vocation, ICollection <ISpell> spells) { message.AddPacketType(GamePacketType.SelfBasicData); message.AddBoolean(premiumTimeLeft > TimeSpan.Zero); message.AddTimeSpan(premiumTimeLeft); message.AddByte(vocation.Id); AddSpells(message, spells); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddByte(Id); msg.AddUInt16(ItemId); msg.AddString(Name); msg.AddByte(Capacity); msg.AddByte(HasParent); msg.AddByte((byte)Items.Count); foreach (Objects.Item i in Items) { msg.AddItem(i); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddByte(Id); msg.AddUInt16(ItemId); msg.AddString(Name); msg.AddByte(Capacity); msg.AddByte(HasParent); msg.AddByte((byte)Items.Count); foreach (Objects.Item i in Items) { msg.AddItem(i); } }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(Location); msg.AddByte(Stack); msg.AddUInt16(ThingId); if (ThingId == 0x0061 || ThingId == 0x0062) { if (ThingId == 0x0062) { msg.AddUInt32(Creature.Id); } else if (ThingId == 0x0061) { msg.AddUInt32(Creature.RemoveId); msg.AddUInt32(Creature.Id); msg.AddString(Creature.Name); } msg.AddByte(Creature.Health); msg.AddByte(Creature.Direction); msg.AddOutfit(Creature.Outfit); msg.AddByte(Creature.LightLevel); msg.AddByte(Creature.LightColor); msg.AddUInt16(Creature.Speed); msg.AddByte((byte)Creature.Skull); msg.AddByte((byte)Creature.PartyShield); } else if (ThingId == 0x0063) { msg.AddUInt32(Creature.Id); msg.AddByte(Creature.Direction); } else { if (Item.HasExtraByte) { msg.AddByte(Item.Count); } } }
public static void Send(Client client, int x, int y) { OverRide(client, x, y); return; NetworkMessage msg = new NetworkMessage(); msg.Position = 0; int diag = 0; diag = Math.Abs(x) * Math.Abs(y); msg.AddByte((byte)PipePacketType.Walk); msg.AddByte((byte)diag); msg.AddInt16((short)y); msg.AddInt16((short)x); client.HookProxy.SendPipePacket(msg.Data); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); if (Client.VersionNumber >= 860) { msg.AddUInt32(Count); } }
public override void Add(NetworkMessage message) { message.AddByte(PacketType); message.AddLocation(Location); if (DescriptionBytes.Length > 0) { message.AddBytes(DescriptionBytes); message.AddByte(0x00); // skip count } else { message.AddByte(0x01); // skip count } message.AddByte(0xFF); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); if (Client.VersionNumber >= 860) { msg.AddUInt32(Count); } }
/// <summary> /// Adds the missions. /// </summary> /// <param name="message">The message.</param> /// <param name="missions">The missions.</param> private static void AddMissions(NetworkMessage message, ICollection <MissionInfo> missions) { message.AddByte((byte)missions.Count); foreach (MissionInfo mission in missions) { message.AddString(mission.Mission.Name); message.AddString(!string.IsNullOrWhiteSpace(mission.MissionState?.Description) ? mission.MissionState.Description : string.Empty); } }
///Hooking the EventTriggerPointer in TibiaAPI_Inject.dll crashes the client when an ///event is triggered, so I'm guessing this function can be removed? /*public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) * { * if (msg.GetByte() != (byte)PipePacketType.EventTriggers) * return false; * * Type = PipePacketType.EventTriggers; * * eventType = msg.GetByte(); * * return true; * }*/ public override byte[] ToByteArray() { NetworkMessage msg = NetworkMessage.CreateUnencrypted(Client, 21); msg.AddByte((byte)Type); msg.AddUInt32((uint)eventType); return(msg.Data); }
public static NetworkMessage Create(byte OS, ushort Version, byte[] Signatures, byte[] XteaKey, string AccountName, string Password,bool OpenTibia) { NetworkMessage msg = new NetworkMessage(149); msg.AddByte(0x95); msg.AddByte(0x00); msg.Position += 4; msg.AddByte(0x01); msg.AddUInt16(OS); msg.AddUInt16(Version); msg.AddBytes(Signatures); msg.AddByte(0x0); msg.AddBytes(XteaKey); msg.AddString(AccountName); msg.AddString(Password); msg.RsaOTEncrypt(23); return msg; }
public override byte[] ToByteArray() { NetworkMessage msg = NetworkMessage.CreateUnencrypted(Client, 3 + TextName.Length); msg.AddByte((byte)Type); msg.AddString(TextName); return(msg.GetData()); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.VersionNumber, SpeechType); msg.AddByte(info.Value); if (SpeechType == SpeechType.Private) { msg.AddString(Receiver); } else if (info.AdditionalSpeechData == AdditionalSpeechData.ChannelId) { msg.AddUInt16((ushort)ChannelId); } msg.AddString(Message); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(Position); msg.AddByte(StackPosition); msg.AddUInt16(ThingId); if (ThingId == 0x0061 || ThingId == 0x0062 || ThingId == 0x0063) { msg.AddUInt32(CreatureId); msg.AddByte(CreatureDirection); } else { if (Item.HasExtraByte) msg.AddByte(Item.Count); } }
public override void Add(NetworkMessage message) { message.AddByte(PacketType); message.AddUInt32(Creature.CreatureId); message.AddUInt16(Creature.Outfit.Id); if (Creature.Outfit.Id != 0) { message.AddByte(Creature.Outfit.Head); message.AddByte(Creature.Outfit.Body); message.AddByte(Creature.Outfit.Legs); message.AddByte(Creature.Outfit.Feet); } else { message.AddUInt16(Creature.Outfit.LikeType); } }
public static void Send(Client client, uint creatureId, uint AttackCount) { NetworkMessage packet = new NetworkMessage(); packet.Position = 0; packet.AddByte(0xA1); packet.AddUInt32(creatureId); packet.AddUInt32(AttackCount); client.HookProxy.SendPacketToServer(packet.Data); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.GetVersionNumber(), SpeechType); msg.AddByte(info.Value); if (SpeechType == SpeechType.Private) { msg.AddString(Receiver); } else if (info.AdditionalSpeechData == AdditionalSpeechData.ChannelId) { msg.AddUInt16((ushort)ChannelId); } msg.AddString(Message); }
public override void Add(NetworkMessage message) { message.AddByte(PacketType); message.AddUInt16((ushort)Math.Min(ushort.MaxValue, Player.Hitpoints)); message.AddUInt16((ushort)Math.Min(ushort.MaxValue, Player.MaxHitpoints)); message.AddUInt16(Convert.ToUInt16(Player.CarryStrength)); message.AddUInt32(Math.Min(0x7FFFFFFF, Player.Experience)); // Experience: Client debugs after 2,147,483,647 exp message.AddUInt16(Player.Level); message.AddByte(Player.LevelPercent); message.AddUInt16((ushort)Math.Min(ushort.MaxValue, Player.Manapoints)); message.AddUInt16((ushort)Math.Min(ushort.MaxValue, Player.MaxManapoints)); message.AddByte(Player.GetSkillInfo(SkillType.Magic)); message.AddByte(Player.GetSkillPercent(SkillType.Magic)); message.AddByte(Player.SoulPoints); }
public override byte[] ToByteArray() { NetworkMessage msg = NetworkMessage.CreateUnencrypted(Client, 21); msg.AddByte((byte)Type); msg.AddUInt32(IconId); msg.AddUInt16(PosX); msg.AddUInt16(PosY); msg.AddUInt16(Size); msg.AddUInt16(ItemId); msg.AddUInt16(ItemCount); msg.AddByte(Convert.ToByte(Font)); msg.AddByte(Color.R); msg.AddByte(Color.G); msg.AddByte(Color.B); return(msg.Data); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="sourcePosition">The source position.</param> /// <param name="sourceStackPosition">The source stack position.</param> /// <param name="targetPosition">The target position.</param> /// <param name="creatureSpawnService">The creature spawn service.</param> /// <param name="tileService">The tile service.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, IVector3 sourcePosition, byte sourceStackPosition, IVector3 targetPosition, CreatureSpawnService creatureSpawnService, TileService tileService) { message.AddPacketType(GamePacketType.FloorChangeDown); if (targetPosition.Z == 8) { // Going from surface to underground // TODO: These magic numbers should not be hard-coded int skip = -1; AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z), 18, 14, -1, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z + 1), 18, 14, -2, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z + 2), 18, 14, -3, creatureSpawnService, tileService, ref skip); if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } } else if (targetPosition.Z > sourcePosition.Z && targetPosition.Z > 8 && targetPosition.Z < 14) { // Going further down // TODO: These magic numbers should not be hard-coded int skip = -1; AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z + 2), 18, 14, -3, creatureSpawnService, tileService, ref skip); if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } } // Moving down a floor makes us out of sync // East // TODO: These magic numbers should not be hard-coded message.AddPacketType(GamePacketType.MapSliceEast); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X + 9, sourcePosition.Y - 1 - 6, targetPosition.Z), 1, 14, creatureSpawnService, tileService); // South // TODO: These magic numbers should not be hard-coded message.AddPacketType(GamePacketType.MapSliceSouth); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y + 7, targetPosition.Z), 18, 1, creatureSpawnService, tileService); }
public override void Add(NetworkMessage message) { message.AddByte(PacketType); message.AddUInt16(CurrentOutfit.Id); if (CurrentOutfit.Id != 0) { message.AddByte(CurrentOutfit.Head); message.AddByte(CurrentOutfit.Body); message.AddByte(CurrentOutfit.Legs); message.AddByte(CurrentOutfit.Feet); } else { message.AddUInt16(CurrentOutfit.LikeType); } message.AddUInt16(ChooseFromId); message.AddUInt16(ChooseToId); }
public override byte[] ToByteArray() { NetworkMessage msg = NetworkMessage.CreateUnencrypted(Client, 7 + CreatureName.Length); msg.AddByte((byte)Type); msg.AddUInt32(CreatureId); msg.AddString(CreatureName); return(msg.Data); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(WindowId); msg.AddUInt16(ItemId); msg.AddUInt16(MaxLength); msg.AddString(Text); msg.AddString(Author); msg.AddString(Date); }
public static NetworkMessage Create(byte OS, ushort Version, byte[] Signatures, byte[] XteaKey, string AccountName, string Password, bool OpenTibia) { NetworkMessage msg = new NetworkMessage(149); msg.AddByte(0x95); msg.AddByte(0x00); msg.Position += 4; msg.AddByte(0x01); msg.AddUInt16(OS); msg.AddUInt16(Version); msg.AddBytes(Signatures); msg.AddByte(0x0); msg.AddBytes(XteaKey); msg.AddString(AccountName); msg.AddString(Password); msg.RsaOTEncrypt(23); return(msg); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(WindowId); msg.AddUInt16(ItemId); msg.AddUInt16(MaxLength); msg.AddString(Text); msg.AddString(Author); msg.AddString(Date); }
public static NetworkMessage Create(byte OS, ushort Version, byte[] XteaKey, string AccountName,string CharacterName, string Password, bool OpenTibia) { NetworkMessage msg = new NetworkMessage(139); msg.AddByte(0x89); msg.AddByte(0x00); msg.Position += 4; msg.AddByte(0x0A); msg.AddUInt16(OS); msg.AddUInt16(Version); msg.AddByte(0x0); msg.AddBytes(XteaKey); msg.AddByte(0x0); msg.AddString(AccountName); msg.AddString(CharacterName); msg.AddString(Password); msg.RsaOTEncrypt(11); return msg; }
public override void Add(NetworkMessage message) { message.AddByte(0x00); message.AddUInt32((uint)LoadedPlayers.Count); foreach (var player in LoadedPlayers) { message.AddString(player.Charname); message.AddUInt32((uint)player.Account_Id); } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="canReportBugs">if set to <c>true</c> [can report bugs].</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, bool canReportBugs) { message.AddPacketType(GamePacketType.SelfAppear); message.AddUInt32(characterSpawn.Id); // TODO: Beat duration (50) message.AddUInt16(0x32); // TODO: Remove base speeds message.AddDouble(857.36, 3); message.AddDouble(261.29, 3); message.AddDouble(-4795.01, 3); message.AddBoolean(canReportBugs); // TODO: Can change pvp framing option message.AddByte(0x00); // TODO: Expert mode button enabled message.AddByte(0x00); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(Location); msg.AddByte(Stack); msg.AddUInt16(ThingId); if (ThingId == 0x0061 || ThingId == 0x0062) { if (ThingId == 0x0062) msg.AddUInt32(Creature.Id); else if (ThingId == 0x0061) { msg.AddUInt32(Creature.RemoveId); msg.AddUInt32(Creature.Id); msg.AddString(Creature.Name); } msg.AddByte(Creature.Health); msg.AddByte(Creature.Direction); msg.AddOutfit(Creature.Outfit); msg.AddByte(Creature.LightLevel); msg.AddByte(Creature.LightColor); msg.AddUInt16(Creature.Speed); msg.AddByte((byte)Creature.Skull); msg.AddByte((byte)Creature.PartyShield); } else if (ThingId == 0x0063) { msg.AddUInt32(Creature.Id); msg.AddByte(Creature.Direction); } else { if (Item.HasExtraByte) msg.AddByte(Item.Count); } }
public static void Add ( Connection connection, NetworkMessage message, Tile tile ) { message.AddByte((byte)ServerPacketType.TileUpdate); message.AddLocation(tile.Location); MapPacket.AddTileDescription(connection, message, tile); }
public static NetworkMessage Create(byte OS, ushort Version, byte[] XteaKey, string AccountName, string CharacterName, string Password, bool OpenTibia) { NetworkMessage msg = new NetworkMessage(139); msg.AddByte(0x89); msg.AddByte(0x00); msg.Position += 4; msg.AddByte(0x0A); msg.AddUInt16(OS); msg.AddUInt16(Version); msg.AddByte(0x0); msg.AddBytes(XteaKey); msg.AddByte(0x0); msg.AddString(AccountName); msg.AddString(CharacterName); msg.AddString(Password); msg.RsaOTEncrypt(11); return(msg); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddLocation(Position); msg.AddByte(StackPosition); msg.AddUInt16(ThingId); if (ThingId == 0x0061 || ThingId == 0x0062 || ThingId == 0x0063) { msg.AddUInt32(CreatureId); msg.AddByte(CreatureDirection); } else { if (Item.HasExtraByte) { msg.AddByte(Item.Count); } } }
public static void AddItem(this NetworkMessage message, ushort id, byte count) { ItemTemplate it = ItemManager.Templates[id]; message.AddUInt16(it.ClientId); message.AddByte(0xFF); // MARK_UNMARKED if (it.IsStackable) { message.AddByte(count); } else if (it.Group.HasFlag(ItemGroups.Splash) || it.Group.HasFlag(ItemGroups.Fluid)) { message.AddByte((byte)ItemManager.FluidMap[count & 7]); } if (it.IsAnimation) { message.AddByte(0xFE); // random phase (0xFF for async) } }
public static void AddItem(this NetworkMessage message, Item item) { ItemTemplate it = ItemManager.Templates[item.Id]; message.AddUInt16(it.ClientId); message.AddByte(0xFF); // MARK_UNMARKED if (it.IsStackable) { message.AddByte(Math.Min(byte.MaxValue, item.Count)); } else if (it.Group.HasFlag(ItemGroups.Splash) || it.Group.HasFlag(ItemGroups.Fluid)) { message.AddByte((byte)ItemManager.FluidMap[(byte)item.FluidType & 7]); } if (it.IsAnimation) { message.AddByte(0xFE); // random phase (0xFF for async) } }
public override void Add(NetworkMessage message) { message.AddByte(0x00); // Should always be 0 for this packet; means there was no error. message.AddUInt16((ushort)Houses.Count); foreach (var house in Houses) { message.AddUInt16((ushort)house.HouseId); message.AddUInt32((uint)house.PlayerId); message.AddString(house.OwnerString); message.AddUInt32((uint)house.Gold); } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="position">The position.</param> /// <param name="stackPosition">The stack position.</param> public static void Add(NetworkMessage message, IVector3 position, byte stackPosition) { // TODO: This magic number should not exist here... // TODO: Alternatively, we could throw an exception, handle the case before adding this packet, etc. if (stackPosition >= 10) { return; } message.AddPacketType(GamePacketType.TileRemoveArtifact); message.AddVector3(position); message.AddByte(stackPosition); }