• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PacketDestination类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ParseMessage

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

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

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


示例17: ParseMessage

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


示例18: ParseMessage

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

            Destination = destination;
            Type = OutgoingPacketType.ChannelList;

            return true;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:10,代码来源:ChannelListPacket.cs


示例19: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.CancelTarget)
                throw new Exception();

            Destination = destination;
            Type = IncomingPacketType.CancelTarget;

            return true;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:10,代码来源:CancelTargetPacket.cs


示例20: ParseMessage

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

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

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PacketDirection类代码示例发布时间:2022-05-24
下一篇:
C# PacketAckPacket类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap