Esempio n. 1
0
        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++;
            }
        }
Esempio n. 2
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ContainerOpen)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ContainerOpen;

            Id = msg.GetByte();
            ItemId = msg.GetUInt16();
            Name = msg.GetString();
            Capacity = msg.GetByte();
            HasParent = msg.GetByte();
            ItemCount = msg.GetByte();

            Items = new List<Tibia.Objects.Item>(ItemCount);

            for (int i = 0; i < ItemCount; i++)
            {
                Objects.Item item = msg.GetItem();
                item.Location = Tibia.Objects.ItemLocation.FromContainer(Id, (byte)i);
                Items.Add(item);
            }

            return true;
        }
Esempio n. 3
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.OutfitWindow)
                return false;

            Destination = destination;
            Type = IncomingPacketType.OutfitWindow;

            Default = msg.GetOutfit();

            byte count = msg.GetByte();
            OutfitList = new List<AvalibleOutfit> { };

            for (int i = 0; i < count; i++)
            {
                AvalibleOutfit outfit = new AvalibleOutfit();

                outfit.Id = msg.GetUInt16();
                outfit.Name = msg.GetString();
                outfit.Addons = msg.GetByte();

                OutfitList.Add(outfit);
            }

            return true;
        }
Esempio n. 4
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.PlayerSkillsUpdate)
                return false;

            Destination = destination;
            Type = IncomingPacketType.PlayerSkillsUpdate;

            Fist = msg.GetByte();
            FistPercent = msg.GetByte();
            Club = msg.GetByte();
            ClubPercent = msg.GetByte();
            Sword = msg.GetByte();
            SwordPercent = msg.GetByte();
            Axe = msg.GetByte();
            AxePercent = msg.GetByte();
            Distance = msg.GetByte();
            DistancePercent = msg.GetByte();
            Shield = msg.GetByte();
            ShieldPercent = msg.GetByte();
            Fish = msg.GetByte();
            FishPercent = msg.GetByte();

            return true;
        }
Esempio n. 5
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ShopWindowOpen)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ShopWindowOpen;

            byte cap = msg.GetByte();
            ShopList = new List<ShopInfo> { };

            for (int i = 0; i < cap; i++)
            {
                ShopInfo item = new ShopInfo();

                item.ItemId = msg.GetUInt16();
                item.SubType = msg.GetByte();
                item.ItemName = msg.GetString();
                item.Weight = msg.GetUInt32();
                item.BuyPrice = msg.GetUInt32();
                item.SellPrice = msg.GetUInt32();
                ShopList.Add(item);
            }

            return true;
        }
Esempio n. 6
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.AutoWalk)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.AutoWalk;

            Directions = new List<Pokemon.Constants.Direction> { };
            byte count = msg.GetByte();

            for (int i = 0; i < count; i++)
            {
                Constants.Direction direction;
                byte dir = msg.GetByte();

                switch (dir)
                {
                    case 1: direction = Pokemon.Constants.Direction.Right; break;
                    case 2: direction = Pokemon.Constants.Direction.UpRight; break;
                    case 3: direction = Pokemon.Constants.Direction.Up; break;
                    case 4: direction = Pokemon.Constants.Direction.UpLeft; break;
                    case 5: direction = Pokemon.Constants.Direction.Left; break;
                    case 6: direction = Pokemon.Constants.Direction.DownLeft; break;
                    case 7: direction = Pokemon.Constants.Direction.Down; break;
                    case 8: direction = Pokemon.Constants.Direction.DownRight; break;
                    default: continue;
                }

                Directions.Add(direction);
            }

            return true;
        }
Esempio n. 7
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ChannelOpen)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ChannelOpen;

            ChannelId = (ChatChannel)msg.GetUInt16();
            ChannelName = msg.GetString();

            if (Client.VersionNumber >= 872)
            {
                NumberOfParticipants = msg.GetUInt16();
                for (ushort p = 0; p < NumberOfParticipants; p++)
                {
                    Participants[p] = msg.GetString();
                }
                NumberOfInvitees = msg.GetUInt16();
                for (ushort i = 0; i < NumberOfInvitees; i++)
                {
                    Invitees[i] = msg.GetString();
                }
            }

            return true;
        }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ShopSaleGoldCount)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ShopSaleGoldCount;

            Cash = msg.GetUInt32();
            byte count = msg.GetByte();

            ItemList = new List<ShopInfo> { };

            for (int i = 0; i < count; i++)
            {
                ShopInfo item = new ShopInfo();

                item.ItemId = msg.GetUInt16();
                item.SubType = msg.GetByte();

                ItemList.Add(item);
            }

            return true;
        }
Esempio n. 10
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.PlayerStatus)
                return false;

            Destination = destination;
            Type = IncomingPacketType.PlayerStatus;

            Health = msg.GetUInt16();
            MaxHealth = msg.GetUInt16();
            PokemonsCount = msg.GetUInt32();

            Experience = msg.GetUInt32();

            Level = msg.GetUInt16();

            LevelPercent = msg.GetByte();

            Pokemons = msg.GetUInt16();
            PokemonsMax = msg.GetUInt16();

            MagicLevel = msg.GetByte();
            MagicLevelPercent = msg.GetByte();
            Soul = msg.GetByte();

            Stamina = msg.GetUInt16();

            return true;
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.TileTransformThing)
                return false;

            Destination = destination;
            Type = IncomingPacketType.TileTransformThing;

            Position = msg.GetLocation();
            StackPosition = msg.GetByte();
            ThingId = msg.GetUInt16();

            if (ThingId == 0x0061 || ThingId == 0x0062 || ThingId == 0x0063)
            {
                CreatureId = msg.GetUInt32();
                CreatureDirection = msg.GetByte();
            }
            else
            {
                Item = new Pokemon.Objects.Item(Client, ThingId, 0);
                Item.Location = Pokemon.Objects.ItemLocation.FromLocation(Position);

                if (Item.HasExtraByte)
                    Item.Count = msg.GetByte();
            }

            return true;
        }
Esempio n. 12
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.TileAddThing)
                return false;

            Destination = destination;
            Type = IncomingPacketType.TileAddThing;

            Location = msg.GetLocation();
            Stack = msg.GetByte();
            ThingId = msg.GetUInt16();

            if (ThingId == 0x0061 || ThingId == 0x0062)
            {
                Creature = new PacketCreature(Client);

                if (ThingId == 0x0062)
                {
                    Creature.Type = PacketCreatureType.Known;
                    Creature.Id = msg.GetUInt32();
                }
                else if (ThingId == 0x0061)
                {
                    Creature.Type = PacketCreatureType.Unknown;
                    Creature.RemoveId = msg.GetUInt32();
                    Creature.Id = msg.GetUInt32();
                    Creature.Name = msg.GetString();
                }

                Creature.Health = msg.GetByte();
                Creature.Direction = msg.GetByte();

                Creature.Outfit = msg.GetOutfit();

                Creature.LightLevel = msg.GetByte();
                Creature.LightColor = msg.GetByte();

                Creature.Speed = msg.GetUInt16();
                Creature.Skull = (Constants.Skull)msg.GetByte();
                Creature.PartyShield = (PartyShield)msg.GetByte();
            }
            else if (ThingId == 0x0063)
            {
                Creature = new PacketCreature(Client);
                Creature.Type = PacketCreatureType.Turn;
                Creature.Id = msg.GetUInt32();
                Creature.Direction = msg.GetByte();
            }
            else
            {
                Item = new Pokemon.Objects.Item(Client, ThingId);
                Item.Location = Pokemon.Objects.ItemLocation.FromLocation(Location);

                if (Item.HasExtraByte)
                    Item.Count = msg.GetByte();
            }

            return true;
        }
Esempio n. 13
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.RemoveAllSkins)
                return false;

            Type = PipePacketType.RemoveAllSkins;

            return true;
        }
Esempio n. 14
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.CancelTarget)
                throw new Exception();

            Destination = destination;
            Type = IncomingPacketType.CancelTarget;

            return true;
        }
Esempio n. 15
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.RemoveText)
                return false;

            Type = PipePacketType.RemoveText;
            TextName = msg.GetString();

            return true;
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.HooksEnableDisable)
                return false;

            Type = PipePacketType.HooksEnableDisable;
            Enable = Convert.ToBoolean(msg.GetByte());

            return true;
        }
Esempio n. 17
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.AutoWalkCancel)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.AutoWalkCancel;

            return true;
        }
Esempio n. 18
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.ChannelList)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.ChannelList;

            return true;
        }
Esempio n. 19
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.RemoveIcon)
                return false;

            Type = PipePacketType.RemoveIcon;
            IconId = msg.GetUInt32();

            return true;
        }
Esempio n. 20
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.OnClickContextMenu)
                return false;

            Type = PipePacketType.OnClickContextMenu;
            EventId = (int)msg.GetUInt32();

            return true;
        }
Esempio n. 21
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.Follow)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.Follow;

            CreatureId = msg.GetUInt32();
            return true;
        }
Esempio n. 22
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.PrivateChannelOpen)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.PrivateChannelOpen;
            Receiver = msg.GetString();

            return true;
        }
Esempio n. 23
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.SetConstant)
                return false;

            Type = PipePacketType.SetConstant;
            ConstantType = (PipeConstantType)msg.GetByte();
            Value = msg.GetUInt32();

            return true;
        }
Esempio n. 24
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.ShopWindowClose)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ShopWindowClose;

            //no data

            return true;
        }
Esempio n. 25
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.ContainerOpenParent)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.ContainerOpenParent;

            Id = msg.GetByte();

            return true;
        }
Esempio n. 26
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.VipAdd)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.VipAdd;

            Name = msg.GetString();

            return true;
        }
Esempio n. 27
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.VipLogout)
                return false;

            Destination = destination;
            Type = IncomingPacketType.VipLogout;

            PlayerId = msg.GetUInt32();

            return true;
        }
Esempio n. 28
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.ChannelClose)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.ChannelClose;

            ChannelId = (ChatChannel)msg.GetUInt16();

            return true;
        }
Esempio n. 29
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.CanReportBugs)
                return false;

            Destination = destination;
            Type = IncomingPacketType.CanReportBugs;

            ReportBugs = msg.GetByte();

            return true;
        }
Esempio n. 30
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.HookSendToServer)
                return false;

            Type = PipePacketType.HookSendToServer;
            ushort InnerLength = msg.GetUInt16();
            msg.Position -= 2;
            PacketToSend = msg.GetBytes(InnerLength+2);

            return true;
        }
Esempio n. 31
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.Death)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.Death;

            //no data


            return(true);
        }
Esempio n. 32
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.HookSendToServer)
            {
                return(false);
            }

            Type = PipePacketType.HookSendToServer;
            ushort InnerLength = msg.GetUInt16();

            msg.Position -= 2;
            PacketToSend  = msg.GetBytes(InnerLength + 2);

            return(true);
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.WaitingList)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.WaitingList;

            Message = msg.GetString();
            Time    = msg.GetByte();

            return(true);
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.PlayerWalkCancel)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.PlayerWalkCancel;

            Direction = msg.GetByte();

            return(true);
        }
Esempio n. 35
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.RuleViolationOpen)
            {
                throw new Exception();
            }

            Destination = destination;
            Type        = IncomingPacketType.RuleViolationOpen;

            ChannelId = msg.GetUInt16();

            return(true);
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.UpdateCreatureText)
            {
                return(false);
            }

            Type = PipePacketType.UpdateCreatureText;

            CreatureId   = msg.GetUInt32();
            CreatureName = msg.GetString();
            Location     = new Location((int)msg.GetUInt32(), (int)msg.GetUInt32(), 0);
            Text         = msg.GetString();

            return(true);
        }
Esempio n. 37
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.LookAt)
            {
                return(false);
            }

            Destination = destination;
            Type        = OutgoingPacketType.LookAt;

            Location      = msg.GetLocation();
            SpriteId      = msg.GetUInt16();
            StackPosition = msg.GetByte();

            return(true);
        }
Esempio n. 38
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.RuleViolationRemove)
            {
                throw new Exception();
            }

            Destination = destination;
            Type        = IncomingPacketType.RuleViolationRemove;

            Name = msg.GetString();

            return(true);
        }
Esempio n. 39
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.FyiMessage)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.FyiMessage;

            Message = msg.GetString();

            return(true);
        }
Esempio n. 40
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.FightModes)
            {
                return(false);
            }

            Destination = destination;
            Type        = OutgoingPacketType.FightModes;

            FightMode = msg.GetByte();
            ChaseMode = msg.GetByte();
            SafeMode  = msg.GetByte();

            return(true);
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.InventoryResetSlot)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.InventoryResetSlot;

            Slot = msg.GetByte();

            return(true);
        }
Esempio n. 42
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.VipState)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.VipState;

            PlayerId    = msg.GetUInt32();
            PlayerName  = msg.GetString();
            PlayerState = msg.GetByte();

            return(true);
        }
Esempio n. 43
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.PlayerFlags)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.PlayerFlags;

            Flag = msg.GetUInt16();

            return(true);
        }
Esempio n. 44
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int postion = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ContainerClose)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.ContainerClose;

            Id = msg.GetByte();

            return(true);
        }
Esempio n. 45
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ChannelClosePrivate)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.ChannelClosePrivate;

            ChannelId = msg.GetUInt16();

            return(true);
        }
Esempio n. 46
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.ShopSell)
            {
                return(false);
            }

            Destination = destination;
            Type        = OutgoingPacketType.ShopSell;

            ItemId = msg.GetUInt16();
            Count  = msg.GetByte();
            Amount = msg.GetByte();

            return(true);
        }
Esempio n. 47
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.ItemUseBattlelist)
            {
                return(false);
            }

            Destination = destination;
            Type        = OutgoingPacketType.ItemUseBattlelist;

            FromLocation      = msg.GetLocation();
            SpriteId          = msg.GetUInt16();
            FromStackPosition = msg.GetByte();
            CreatureId        = msg.GetUInt32();

            return(true);
        }
Esempio n. 48
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.AddSkin)
            {
                return(false);
            }

            Type   = PipePacketType.AddSkin;
            SkinId = msg.GetUInt32();
            PosX   = msg.GetUInt16();
            PosY   = msg.GetUInt16();
            Width  = msg.GetUInt16();
            Height = msg.GetUInt16();
            GUIId  = msg.GetUInt16();

            return(true);
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.TileRemoveThing)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.TileRemoveThing;

            Position      = msg.GetLocation();
            StackPosition = msg.GetByte();

            return(true);
        }
Esempio n. 50
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.MagicEffect)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.MagicEffect;

            Location = msg.GetLocation();
            Effect   = (Effect)msg.GetByte();

            return(true);
        }
Esempio n. 51
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.CreatureSkull)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.CreatureSkull;

            CreatureId    = msg.GetUInt32();
            CreatureSkull = msg.GetByte();

            return(true);
        }
Esempio n. 52
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ChannelOpen)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.ChannelOpen;

            ChannelId   = (ChatChannel)msg.GetUInt16();
            ChannelName = msg.GetString();

            return(true);
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.WorldLight)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.WorldLight;

            LightLevel = msg.GetByte();
            LightColor = msg.GetByte();

            return(true);
        }
Esempio n. 54
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.CancelTarget)
            {
                throw new Exception();
            }

            Destination = destination;
            Type        = IncomingPacketType.CancelTarget;

            if (Client.VersionNumber >= 860)
            {
                Count = msg.GetUInt32();
            }

            return(true);
        }
Esempio n. 55
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg)
        {
            int msgPosition = msg.Position, outMsgPosition = outMsg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.MoveWest)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.MoveWest;
            outMsg.AddByte((byte)Type);

            Client.playerLocation.X--;

            return(ParseMapDescription(msg, Client.playerLocation.X - 8, Client.playerLocation.Y - 6, Client.playerLocation.Z, 1, 14, outMsg));
        }
Esempio n. 56
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)PipePacketType.DisplayText)
            {
                return(false);
            }

            Type = PipePacketType.DisplayText;

            TextId   = msg.GetString();
            Location = new Location((int)msg.GetUInt32(), (int)msg.GetUInt32(), 0);
            Color    = Color.FromArgb((int)msg.GetUInt32(), (int)msg.GetUInt32(), (int)msg.GetUInt32());
            Font     = (ClientFont)msg.GetUInt32();
            Text     = msg.GetString();

            return(true);
        }
Esempio n. 57
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.AutoWalk)
            {
                return(false);
            }

            Destination = destination;
            Type        = OutgoingPacketType.AutoWalk;

            Directions = new List <Tibia.Constants.Direction> {
            };
            byte count = msg.GetByte();

            for (int i = 0; i < count; i++)
            {
                Constants.Direction direction;
                byte dir = msg.GetByte();

                switch (dir)
                {
                case 1: direction = Tibia.Constants.Direction.Right; break;

                case 2: direction = Tibia.Constants.Direction.UpRight; break;

                case 3: direction = Tibia.Constants.Direction.Up; break;

                case 4: direction = Tibia.Constants.Direction.UpLeft; break;

                case 5: direction = Tibia.Constants.Direction.Left; break;

                case 6: direction = Tibia.Constants.Direction.DownLeft; break;

                case 7: direction = Tibia.Constants.Direction.Down; break;

                case 8: direction = Tibia.Constants.Direction.DownRight; break;

                default: continue;
                }

                Directions.Add(direction);
            }

            return(true);
        }
Esempio n. 58
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.AnimatedText)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.AnimatedText;

            Location = msg.GetLocation();
            Color    = (TextColor)msg.GetByte();
            Message  = msg.GetString();

            return(true);
        }
Esempio n. 59
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.Projectile)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.Projectile;

            FromPosition = msg.GetLocation();
            ToPosition   = msg.GetLocation();
            Effect       = (ProjectileType)msg.GetByte();

            return(true);
        }
Esempio n. 60
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.SelfAppear)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.SelfAppear;

            YourId       = msg.GetUInt32();
            Unknown      = msg.GetUInt16(); // Related to client-side drawing speed
            CanReportBug = msg.GetByte();

            return(true);
        }