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


C# PacketIn.ReadUInt32方法代码示例

本文整理汇总了C#中PacketIn.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.ReadUInt32方法的具体用法?C# PacketIn.ReadUInt32怎么用?C# PacketIn.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PacketIn的用法示例。


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

示例1: DropItem

        public static void DropItem(Client client, PacketIn packet)
        {
            int IID = (int)packet.ReadUInt32();
            PlayerItem pItem = PlayerItem.GetItem(IID);

            int quantity = (int)packet.ReadUInt32();

            //check if the item exists
            if (pItem == null)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            //check if player owns the item
            if (pItem.PID != client.Character.Player.PID)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            CodeHandler handler = CodeManager.GetHandler(pItem.Item.Code);

            handler.Drop(pItem, quantity, client.Character, client);
        }
开发者ID:BeshoyFD,项目名称:kalsharp,代码行数:25,代码来源:PT_Item.cs

示例2: DropItem

        public static void DropItem(Client client, PacketIn packet)
        {
            int itemId      = (int)packet.ReadUInt32();
            PlayerItem item = PlayerItem.Get(itemId);
            int quantity    = (int)packet.ReadUInt32();

            if(item == null) {
                ServerConsole.WriteLine(
                    "Player #{0} attempted to drop non-existant item #{1} !",
                    client.Character.Player.PlayerId,
                    itemId
                );
                return;
            }

            if(item.PlayerId != client.Character.Player.PlayerId) {
                ServerConsole.WriteLine(
                    "Player #{0} attempted to drop item that belongs to #{1}!",
                    client.Character.Player.PlayerId,
                    item.PlayerId
                );
                return;
            }

            uint worldId = World.NewId();
            Server.WorldDrops[worldId] = new Drop(item,client.Character,quantity,worldId);

            client.Send(new Packets.SpawnDrop(Server.WorldDrops[worldId]),"Spawn Drop");
            client.Send(new Packets.RemoveFromInventory(item.ItemId,quantity),"Update Inventory");
            client.Character.Player.Inventory.Items.Remove(item);
        }
开发者ID:KalOnline,项目名称:KaLua,代码行数:31,代码来源:PT_Item.cs

示例3: EquipItem

 public static void EquipItem(Client client, PacketIn packet)
 {
     int itemId = (int)packet.ReadUInt32();
     PlayerItem item = PlayerItem.Get(itemId);
     if(item == null) {
         ServerConsole.WriteLine(
             System.Drawing.Color.Red,
             "Player #{0} attempted to equip non-existant item!",
             client.Character.Player.PlayerId
         );
         return;
     }
     if(item.PlayerId != client.Character.Player.PlayerId) {
         ServerConsole.WriteLine(System.Drawing.Color.Red,
             "Player #{0} attempted to equip item that belongs to #{1}!",
             client.Character.Player.PlayerId,
             item.PlayerId
         );
         return;
     }
     if(!item.Wearable) {
         ServerConsole.WriteLine(
             System.Drawing.Color.Red,
             "Player #{0} attempted to equip non-equipable item #{1}!",
             item.PlayerId,item.ItemId
         );
         return;
     }
     PlayerItem.Equip(item);
     client.Send(new Packets.EquipItem(item),"Equip Item");
 }
开发者ID:KalOnline,项目名称:KaLua,代码行数:31,代码来源:PT_Item.cs

示例4: BuyNpcItem

        public static void BuyNpcItem(Client client, PacketIn packet)
        {
            int npcWorldId = (int)packet.ReadUInt32();
            byte v1     = packet.ReadByte();
            byte amount = packet.ReadByte();

            int totalPrice = 0;

            ushort[] items   = new ushort[amount];
            ushort[] amounts = new ushort[amount];
            for(int i=0;i<amount;i++)
            {
                items[i]   = packet.ReadUShort();
                amounts[i] = packet.ReadUShort();

                // TODO, calculate correct price
                totalPrice += 100 * amounts[i];
            }

            // TODO, add geon amount check
            for(int i=0;i<amount;i++)
            {
                // should be items, not player items
                PlayerItem item = PlayerItem.Get((int)items[i]);
                client.Character.Player.Inventory.Items.Add(item);
                // update AddToInventory with generic item-object
                client.Send(new Packets.AddToInventory((int)items[i],(int)amounts[i]),"Buy Item");
                // update amout of geons !
            }
        }
开发者ID:KalOnline,项目名称:KaLua,代码行数:30,代码来源:PT_Npc.cs

示例5: SkillRequest

        public static void SkillRequest(Client client,PacketIn packet)
        {
            byte skillId  = packet.ReadByte();
            uint playerId = packet.ReadUInt32();

            client.SkillHandler.Request(skillId,playerId);

            client.Send(new Packets.SkillExecute(client.Character,skillId,1));
        }
开发者ID:KalOnline,项目名称:KaLua,代码行数:9,代码来源:PT_Skill.cs

示例6: NpcTalk

 public static void NpcTalk(Client client, PacketIn packet)
 {
     Npc npc = Server.WorldNPCs[packet.ReadUInt32()];
     if(npc != null)
     {
         if(npc.Talk != 0) {
             //ServerConsole.WriteLine("Talking with npc #{0} returning Talk #{1}",npc.NpcId,npc.Talk);
             client.Send(new Packets.OpenDialog(npc.Talk));
         }
     }
 }
开发者ID:KalOnline,项目名称:KaLua,代码行数:11,代码来源:PT_Npc.cs

示例7: PickupDrop

        public static void PickupDrop(Client client, PacketIn packet)
        {
            UInt32 worldId = packet.ReadUInt32();
            Drop drop;

            //check if the drop exists
            if (ServerWorld.Entities.ContainsKey(worldId))
            {
                drop = ServerWorld.Entities[worldId] as Drop;
            }
            else
            {
                return;
            }

            CodeHandler handler = CodeManager.GetHandler(drop.PlayerItem.Item.Code);

            handler.Pickup(drop, client.Character, client);
        }
开发者ID:BeshoyFD,项目名称:kalsharp,代码行数:19,代码来源:PT_Item.cs

示例8: PickupDrop

        public static void PickupDrop(Client client, PacketIn packet)
        {
            Drop drop;
            try {
                drop = Server.WorldDrops[packet.ReadUInt32()];
            } catch(Exception) {
                return;
            }

            PlayerItem item = PlayerItem.Get(drop.PlayerItem.ItemId);
            client.Character.Player.Inventory.Items.Add(item);

            client.Send(new Packets.PickupDrop(item),"Pickup Drop");
            client.Send(new Packets.AddToInventory(drop.ItemId,drop.Quantity),"Update Inventory");
            client.Send(new Packets.UnspawnDrop(drop),"Unspawn Drop");

            Server.WorldDrops.Remove((uint)drop.WorldId);
            World.FreeId((uint)drop.WorldId);
        }
开发者ID:KalOnline,项目名称:KaLua,代码行数:19,代码来源:PT_Item.cs

示例9: RestorePlayer

 public static void RestorePlayer(Client client, PacketIn packet)
 {
     int pid = (int)packet.ReadUInt32();
     client.RestorePlayer(pid);
     client.Send(new Packets.DisconnectMessage(Packets.DISCONNECT_MESSAGE.RESTORING_CHARACTER_COMPLETED));
 }
开发者ID:BeshoyFD,项目名称:kalsharp,代码行数:6,代码来源:PT_Character.cs

示例10: PlayerSelect

 public static void PlayerSelect(Client client, PacketIn packet)
 {
     client.PlayerSelect((int)packet.ReadUInt32());
 }
开发者ID:BeshoyFD,项目名称:kalsharp,代码行数:4,代码来源:PT_Character.cs

示例11: DeletePlayer

 public static void DeletePlayer(Client client, PacketIn packet)
 {
     int pid = (int)packet.ReadUInt32();
     client.DeletePlayer(pid);
     client.SendPlayerList();
 }
开发者ID:BeshoyFD,项目名称:kalsharp,代码行数:6,代码来源:PT_Character.cs


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