当前位置: 首页>>代码示例>>C#>>正文


C# PacketDestination类代码示例

本文整理汇总了C#中PacketDestination的典型用法代码示例。如果您正苦于以下问题:C# PacketDestination类的具体用法?C# PacketDestination怎么用?C# PacketDestination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PacketDestination类属于命名空间,在下文中一共展示了PacketDestination类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseMessage

        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;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:30,代码来源:TileTransformThingPacket.cs

示例2: ParseMessage

        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++;
            }
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:34,代码来源:FloorChangeUpPacket.cs

示例3: ParseMessage

        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;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:31,代码来源:PlayerStatusPacket.cs

示例4: ParseMessage

        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;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:28,代码来源:ContainerOpenPacket.cs

示例5: ParseMessage

        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;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:34,代码来源:AutoWalkPacket.cs

示例6: ParseMessage

        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;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:28,代码来源:OutfitWindowPacket.cs

示例7: ParseMessage

        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;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:29,代码来源:ChannelOpenPacket.cs

示例8: ParseMessage

        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;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:28,代码来源:ShopWindowOpenPacket.cs

示例9: ParseMessage

        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;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:26,代码来源:TileUpdatePacket.cs

示例10: ParseMessage

        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;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:27,代码来源:ShopSaleGoldCountPacket.cs

示例11: ParseMessage

        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;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:27,代码来源:PlayerSkillsPacket.cs

示例12: ParseMessage

        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;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:59,代码来源:TileAddThingPacket.cs

示例13: ParseMessage

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

            Type = PipePacketType.RemoveAllSkins;

            return true;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:9,代码来源:RemoveAllSkinsPacket.cs

示例14: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.AutoWalkCancel)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.AutoWalkCancel;

            return true;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:10,代码来源:AutoWalkCancelPacket.cs

示例15: ParseMessage

        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;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:10,代码来源:OnClickContextMenuPacket.cs


注:本文中的PacketDestination类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。