コード例 #1
0
 private void OnCreativeInventoryAction(CreativeInventoryActionPacket p)
 {
     if (CreativeInventoryAction != null) CreativeInventoryAction.Invoke(this, new PacketEventArgs<CreativeInventoryActionPacket>(p));
 }
コード例 #2
0
ファイル: Client.Recv.cs プロジェクト: AVATAR-Phoenix/c-raft
 public static void HandlePacketCreativeInventoryAction(Client client, CreativeInventoryActionPacket packet)
 {
     if (client.Owner.GameMode == 1)
         client.Owner.Inventory[packet.Slot] = new ItemStack(packet.ItemID, (sbyte)packet.Quantity, packet.Damage);
     else
         client.Kick("Invalid action: CreativeInventoryAction");
 }
コード例 #3
0
ファイル: Client.Recv.cs プロジェクト: dekema2/c-raft
        public static void HandlePacketCreativeInventoryAction(Client client, CreativeInventoryActionPacket packet)
        {
            if (client.Owner.GameMode == 1)

                if (packet.Item.Type == -1 && packet.Item.Durability == 0 && packet.Item.Count == 0) // We are adding an item to our mouse cursor from the quick bar
                {
                    //may need to do something here
                    return;
                }
                else
                {
                    if (packet.Slot != -1)// mouse cursor mode
                    {
                        client.Owner.Inventory[packet.Slot] = packet.Item;
                    }

                }
            else
                client.Kick("Invalid action: CreativeInventoryAction");
        }
コード例 #4
0
ファイル: PacketHandlers.cs プロジェクト: IdentErr/c-raft
        public static void ReadCreativeInventoryAction(Client client, PacketReader reader)
        {
            CreativeInventoryActionPacket ci = new CreativeInventoryActionPacket();
            ci.Read(reader);

            if (!reader.Failed)
                Client.HandlePacketCreativeInventoryAction(client, ci);
        }
コード例 #5
0
ファイル: Client.Recv.cs プロジェクト: IdentErr/c-raft
        public static void HandlePacketCreativeInventoryAction(Client client, CreativeInventoryActionPacket packet)
        {
            if (client.Owner.GameMode == 1)

                if (packet.ItemID == -1 && packet.Damage == 0 && packet.Quantity == 0) // We are adding an item to our mouse cursor from the quick bar
                {
                    //may need to do something here
                    return;
                }
                else
                {
                    if (packet.Slot != -1)// mouse cursor mode
                    {
                        client.Owner.Inventory[packet.Slot] = new ItemStack(packet.ItemID, (sbyte)packet.Quantity, packet.Damage);
                    }

                }
            else
                client.Kick("Invalid action: CreativeInventoryAction");
        }