void InventoryItem::onArmorDragStop(Event::Mouse* event)
{
    // Check if mouse is over this item
    if (!Rect::inRect(event->position(), position(), size()))
    {
        return;
    }

    if (ItemsList* itemsList = dynamic_cast<ItemsList*>(event->target()))
    {
        InventoryItem* draggedItem = itemsList->draggedItem();
        auto itemObject = draggedItem->item();
        if(itemObject->subtype() != Game::ItemObject::Subtype::ARMOR) return;
        itemsList->removeItem(draggedItem, 1);
        // place current armor back to inventory
        if (_item)
        {
            itemsList->addItem(this, 1);
        }
        this->setItem(itemObject);
        if (auto armor = dynamic_cast<Game::ArmorItemObject*>(itemObject))
        {
            Game::getInstance()->player()->setArmorSlot(armor);
        }
    }
}
void InventoryItem::onHandDragStop(Event::Mouse* event, HAND hand)
{
    // Check if mouse is over this item
    if (!Rect::inRect(event->position(), position(), size()))
    {
        return;
    }

    if (ItemsList* itemsList = dynamic_cast<ItemsList*>(event->target()))
    {
        InventoryItem* itemUi = itemsList->draggedItem();
        auto item = itemUi->item();
        itemsList->removeItem(itemUi, 1);
        // place current weapon back to inventory
        if (_item)
        {
            itemsList->addItem(this, 1);
        }
        this->setItem(item);
        auto player = Game::getInstance()->player();
        if (hand == HAND::LEFT)
        {
            player->setLeftHandSlot(item);
        }
        else
        {
            player->setRightHandSlot(item);
        }
    }
}