Beispiel #1
0
        void UnEquipItem_Handler(Task t)
        {
            byte equipSlot = 0xFF;

            EquipItemRequest eir      = (EquipItemRequest)t.Args;
            Item             equipped = t.Client.Character.EquippedItem(eir.ItemID);

            if (equipped != null)
            {
                equipSlot = equipped.Slot;
                t.Client.Character.UnEquipItem(equipped.Slot, eir.Slot);
                AddDBQuery(equipped.UpdateDBString(), null, false);
            }

            // Send response to the client
            t.Client.SendPacket(new UnEquipItemResponse(t.Client.Character, eir.ItemID, eir.Slot, equipSlot != 0xFF));

            if (equipSlot != 0xFF)
            {
                // Tell other players about it
                SeeUnequipPacket pkt     = new SeeUnequipPacket(t.Client.Character.ID, equipSlot);
                PlayMap          map     = _server.GetPlayMap(t.Client.Character.MapID);
                Connection[]     players = map.Players;
                foreach (Connection c in players)
                {
                    if (c != t.Client)
                    {
                        c.SendPacket(pkt);
                    }
                }
            }
        }
Beispiel #2
0
        void UnEquipItem_Handler(Task t)
        {
            byte equipSlot = 0xFF;

            EquipItemRequest eir = (EquipItemRequest)t.Args;
            Item equipped = t.Client.Character.EquippedItem(eir.ItemID);
            if (equipped != null)
            {
                equipSlot = equipped.Slot;
                t.Client.Character.UnEquipItem(equipped.Slot, eir.Slot);
                AddDBQuery(equipped.UpdateDBString(), null, false);
            }

            // Send response to the client
            t.Client.SendPacket(new UnEquipItemResponse(t.Client.Character, eir.ItemID, eir.Slot, equipSlot != 0xFF));

            if (equipSlot != 0xFF)
            {
                // Tell other players about it
                SeeUnequipPacket pkt = new SeeUnequipPacket(t.Client.Character.ID, equipSlot);
                PlayMap map = _server.GetPlayMap(t.Client.Character.MapID);
                Connection[] players = map.Players;
                foreach (Connection c in players)
                {
                    if (c != t.Client)
                    {
                        c.SendPacket(pkt);
                    }
                }
            }
        }