Exemplo n.º 1
0
void InventoryState::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(false);

    auto game = Game::getInstance();

    setX((game->renderer()->width()  - 499)*0.5);
    setY((game->renderer()->height() - 427)*0.5);

    addUI("background", new Image("art/intrface/invbox.frm"));
    getActiveUI("background")->addEventHandler("mouserightclick", this, (EventRecieverMethod) &InventoryState::backgroundRightClick);

    addUI("button_up",   new ImageButton(ImageButton::TYPE_INVENTORY_UP_ARROW,   128, 40));
    addUI("button_down", new ImageButton(ImageButton::TYPE_INVENTORY_DOWN_ARROW, 128, 65));

    addUI("button_done", new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, 438, 328));
    getActiveUI("button_done")->addEventHandler("mouseleftclick", this, (EventRecieverMethod) &InventoryState::onDoneButtonClick);

    // screen
    auto screenX = 300;
    auto screenY = 47;

    auto player = Game::getInstance()->player();

    addUI("player_name", new TextArea(player->name(), screenX, screenY));

    auto line1 = new Image(142, 1);
    line1->setX(screenX);
    line1->setY(screenY+16);
    line1->texture()->fill(0x3ff800ff); // default green color

    auto msg = ResourceManager::msgFileType("text/english/game/inventry.msg");

    std::string statsLabels;
    for (unsigned int i = 0; i != 7; ++i) statsLabels += msg->message(i)->text() + "\n";
    addUI("label_stats", new TextArea(statsLabels, screenX, screenY + 10*2));

    std::string statsValues;
    for (unsigned int i = 0; i != 7; ++i) statsValues += std::to_string(player->stat(i)) + "\n";
    addUI("label_stats_values", new TextArea(statsValues, screenX + 22, screenY + 20));

    std::stringstream ss;
    for (unsigned int i=7; i<14; i++)
    {
        ss << msg->message(i)->text() << "\n";
    }
    auto textLabel = new TextArea(ss.str(), screenX+40, screenY+20);

    // label: hit points
    ss.str("");
    ss << player->hitPoints();
    ss << "/";
    ss << player->hitPointsMax();
    auto hitPointsLabel = new TextArea(ss.str(), screenX+94, screenY+20);
    hitPointsLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    // label: armor class
    ss.str("");
    ss << player->armorClass();
    auto armorClassLabel = new TextArea(ss.str(), screenX+94, screenY+30);
    armorClassLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // armorSlot, leftHand, rightHand
    GameArmorItemObject* armorSlot = player->armorSlot();
    GameItemObject* leftHand = player->leftHandSlot();
    GameItemObject* rightHand = player->rightHandSlot();


    // label: damage treshold levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageThreshold(GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_LASER) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_FIRE) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_NORMAL) <<"/";
    }
    else
    {
        ss << player->damageThreshold(GameCritterObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_EXPLOSION) <<"/";
    }
    auto damageThresholdLabel = new TextArea(ss.str(), screenX+94, screenY+40);
    damageThresholdLabel->setWidth(26)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // label: damage resistance levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageResist(GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_LASER) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_FIRE) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_NORMAL) <<"%";
    }
    else
    {
        ss << player->damageResist(GameCritterObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_EXPLOSION) <<"%";
    }
    auto damageResistanceLabel = new TextArea(ss.str(), screenX+120, screenY+40);

    auto line2 = new Image(142, 1);
    line2->setX(screenX);
    line2->setY(screenY+94);
    line2->texture()->fill(0x3ff800ff); // default green color

    auto line3 = new Image(142, 1);
    line3->setX(screenX);
    line3->setY(screenY+134);
    line3->texture()->fill(0x3ff800ff); // default green color

    // label: Total Wt: (20)
    auto weight = player->carryWeight();
    auto weightMax = player->carryWeightMax();

    ss.str("");
    ss << weight;
    auto totalWtLabel = new TextArea(msg->message(20), screenX+14, screenY+180);
    auto weightLabel = new TextArea(ss.str(), screenX+70, screenY+180);
    weightLabel->setWidth(24)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    ss.str("");
    ss << "/" << weightMax;
    auto weightMaxLabel = new TextArea(ss.str(), screenX+94, screenY+180);
    if (weight>weightMax)
    {
        weightLabel->setFont(ResourceManager::font("font1.aaf", 0xff0000ff));
    }

    // label: left hand
    ss.str("");
    if (leftHand)
    {
        ss << _handItemSummary(leftHand);
    }
    auto leftHandLabel = new TextArea(ss.str(), screenX, screenY+100);

    // label: right hand
    ss.str("");
    if (rightHand)
    {
        ss << _handItemSummary(rightHand);
    }
    auto rightHandLabel = new TextArea(ss.str(), screenX, screenY+140);

    // screen info
    auto screenLabel = new TextArea("", screenX, screenY+20);
    screenLabel->setWidth(140); //screen size
    screenLabel->setHeight(168);
    screenLabel->setVisible(false);
    screenLabel->setWordWrap(true);


    addUI(line1);
    addUI("textLabel", textLabel);
    addUI("hitPointsLabel", hitPointsLabel);
    addUI("armorClassLabel", armorClassLabel);
    addUI("damageThresholdLabel", damageThresholdLabel);
    addUI("damageResistanceLabel", damageResistanceLabel);
    addUI("line2", line2);
    addUI("line3", line3);
    addUI("totalWtLabel", totalWtLabel);
    addUI("weightLabel", weightLabel);
    addUI("weightMaxLabel", weightMaxLabel);
    addUI("leftHandLabel", leftHandLabel);
    addUI("rightHandLabel", rightHandLabel);
    addUI("screenLabel", screenLabel);


    // BIG ICONS
    // icon: armor
    if (armorSlot)
    {
        auto armorUi = new ImageList();
        armorUi->addImage(new Image(armorSlot->inventorySlotUi()));
        armorUi->addImage(new Image(armorSlot->inventoryDragUi()));
        armorUi->setX(200 - armorUi->width()*0.5);
        armorUi->setY(215 - armorUi->height()*0.5);
        addUI(armorUi);

        armorUi->addEventHandler("mouseleftdown", this, (EventRecieverMethod) &InventoryState::onArmorSlotMouseDown);
        //armorUi->addEventHandler("mouseleftup", this, (EventRecieverMethod) &InventoryState::onArmorSlotMouseUp);
        //armorUi->addEventHandler("mousedrag", armorSlot.get(), (EventRecieverMethod) &InventoryState::onSlotDrag);
        //armorUi->addEventHandler("mouseleftdown", armorSlot.get(), (EventRecieverMethod) &InventoryState::onSlotMouseDown);
        //armorUi->addEventHandler("mouseleftup", armorSlot.get(), (EventRecieverMethod) &InventoryState::onSlotMouseUp);
    }

    // icon: left hand
    if (leftHand)
    {
        auto leftHandUi = new ImageList();
        leftHandUi->addImage(new Image(leftHand->inventorySlotUi()));
        leftHandUi->addImage(new Image(leftHand->inventoryDragUi()));
        leftHandUi->setX(200 - leftHandUi->width()*0.5);
        leftHandUi->setY(317 - leftHandUi->height()*0.5);
        addUI(leftHandUi);

        leftHandUi->addEventHandler("mouseleftdown", this, (EventRecieverMethod) &InventoryState::onLeftHandSlotMouseDown);
        //leftHandUi->addEventHandler("mousedrag", leftHand.get(), (EventRecieverMethod) &InventoryState::onSlotDrag);
        //leftHandUi->addEventHandler("mouseleftdown", leftHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseDown);
        //leftHandUi->addEventHandler("mouseleftup", leftHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseUp);
    }

    // icon: right hand
    if (rightHand)
    {
        auto rightHandUi = new ImageList();
        rightHandUi->addImage(new Image(rightHand->inventorySlotUi()));
        rightHandUi->addImage(new Image(rightHand->inventoryDragUi()));
        rightHandUi->setX(290 - rightHandUi->width()*0.5);
        rightHandUi->setY(317 - rightHandUi->height()*0.5);
        addUI(rightHandUi);

        rightHandUi->addEventHandler("mouseleftdown", this, (EventRecieverMethod) &InventoryState::onRightHandSlotMouseDown);
        //rightHandUi->addEventHandler("mousedrag", rightHand.get(), (EventRecieverMethod) &InventoryState::onSlotDrag);
        //rightHandUi->addEventHandler("mouseleftdown", rightHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseDown);
        //rightHandUi->addEventHandler("mouseleftup", rightHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseUp);
    }

}
Exemplo n.º 2
0
 void Opcode80CA::_run()
 {
     auto& debug = Logger::debug("SCRIPT");
     debug << "[80CA] [+] int value = get_critter_stat(GameCritterObject* who, int number)" << std::endl;
     int number = _script->dataStack()->popInteger();
     debug << "    number = " << number << std::endl;
     auto object = _script->dataStack()->popObject();
     if (!object)
     {
         _error("get_critter_stat(who, stat) - who is NULL");
     }
     auto critter = dynamic_cast<Game::CritterObject*>(object);
     if (!critter)
     {
         _error("get_critter_stat(who, stat) - who is not a critter");
     }
     int result = 0;
     switch (number)
     {
         case 0: // ST
         case 1: // PE
         case 2: // EN
         case 3: // CH
         case 4: // IN
         case 5: // AG
         case 6: // LU
         {
             result = critter->statTotal((STAT)number);
             break;
         }
         case 7: // max hit points
         {
             result = critter->hitPointsMax();
             break;
         }
         case 8: // max action points
         {
             result = critter->actionPointsMax();
             break;
         }
         case 9: // armor class
         {
             result = critter->armorClass();
             break;
         }
         case 11: // melee damage
         {
             result = critter->meleeDamage();
             break;
         }
         case 12: // carry weight max
         {
             result = critter->carryWeightMax();
             break;
         }
         case 13: // sequence
         {
             result = critter->sequence();
             break;
         }
         case 14: // heal rate
         {
             result = critter->healingRate();
             break;
         }
         case 15: // crit chance
         {
             result = critter->criticalChance();
             break;
         }
         case 16: // better criticals
             // @TODO
             break;
         case 17: //
         {
             result = critter->damageThreshold(DAMAGE::NORMAL);
             break;
         }
         case 18: //
         {
             result = critter->damageThreshold(DAMAGE::LASER);
             break;
         }
         case 19: //
         {
             result = critter->damageThreshold(DAMAGE::FIRE);
             break;
         }
         case 20: //
         {
             result = critter->damageThreshold(DAMAGE::PLASMA);
             break;
         }
         case 21: //
         {
             result = critter->damageThreshold(DAMAGE::ELECTRICAL);
             break;
         }
         case 22: //
         {
             result = critter->damageThreshold(DAMAGE::EMP);
             break;
         }
         case 23: //
         {
             result = critter->damageThreshold(DAMAGE::EXPLOSIVE);
             break;
         }
         case 24: //
         {
             result = critter->damageResist(DAMAGE::NORMAL);
             break;
         }
         case 25: //
         {
             result = critter->damageResist(DAMAGE::LASER);
             break;
         }
         case 26: //
         {
             result = critter->damageResist(DAMAGE::FIRE);
             break;
         }
         case 27: //
         {
             result = critter->damageResist(DAMAGE::PLASMA);
             break;
         }
         case 28: //
         {
             result = critter->damageResist(DAMAGE::ELECTRICAL);
             break;
         }
         case 29: //
         {
             result = critter->damageResist(DAMAGE::EMP);
             break;
         }
         case 30: //
         {
             result = critter->damageResist(DAMAGE::EXPLOSIVE);
             break;
         }
         case 31: // rad resist
         {
             result = critter->damageResist(DAMAGE::RADIATION);
             break;
         }
         case 32: // poison resist
         {
             result = critter->damageResist(DAMAGE::POISON);
             break;
         }
         case 33: // age
         {
             result = critter->age();
             break;
         }
         case 34: // gender
         {
             result = (unsigned)critter->gender();
             break;
         }
         case 35: // hit points
         {
             result = critter->hitPoints();
             break;
         }
         case 36: // current poison
         {
             result = critter->poisonLevel();
             break;
         }
         case 37: // current radiation
         {
             result = critter->radiationLevel();
             break;
         }
         default:
         {
             _error("VM::opcode80CA - unimplemented number:" + std::to_string(number));
         }
     }
     _script->dataStack()->push(result);
     debug << "    value  = " << result << std::endl;
 }
Exemplo n.º 3
0
void Inventory::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(false);

    auto game = Game::getInstance();
    auto panelHeight = Game::getInstance()->locationState()->playerPanelState()->height();

    setX((game->renderer()->width()  - 499)/2); // 499x377 = art/intrface/invbox.frm
    setY((game->renderer()->height() - 377 - panelHeight)/2);

    addUI("background", new Image("art/intrface/invbox.frm"));
    getActiveUI("background")->addEventHandler("mouserightclick", [this](Event* event){ this->backgroundRightClick(dynamic_cast<MouseEvent*>(event)); });

    addUI("button_up",   new ImageButton(ImageButton::TYPE_INVENTORY_UP_ARROW,   128, 40));
    addUI("button_down", new ImageButton(ImageButton::TYPE_INVENTORY_DOWN_ARROW, 128, 65));

    addUI("button_done", new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, 438, 328));
    getActiveUI("button_done")->addEventHandler("mouseleftclick", [this](Event* event){ this->onDoneButtonClick(dynamic_cast<MouseEvent*>(event)); });

    // screen
    auto screenX = 300;
    auto screenY = 47;

    auto player = Game::getInstance()->player();

    addUI("player_name", new TextArea(player->name(), screenX, screenY));

    auto line1 = new Image(142, 1);
    line1->setX(screenX);
    line1->setY(screenY+16);
    line1->texture()->fill(0x3ff800ff); // default green color

    std::string statsLabels;
    for (unsigned int i = 0; i != 7; ++i) statsLabels += _t(MSG_INVENTORY, i) + "\n";
    addUI("label_stats", new TextArea(statsLabels, screenX, screenY + 10*2));

    std::string statsValues;
    for (unsigned int i = 0; i != 7; ++i) statsValues += std::to_string(player->stat(i)) + "\n";
    addUI("label_stats_values", new TextArea(statsValues, screenX + 22, screenY + 20));

    std::stringstream ss;
    for (unsigned int i=7; i<14; i++)
    {
        ss << _t(MSG_INVENTORY, i) << "\n";
    }
    auto textLabel = new TextArea(ss.str(), screenX+40, screenY+20);

    // label: hit points
    ss.str("");
    ss << player->hitPoints();
    ss << "/";
    ss << player->hitPointsMax();
    auto hitPointsLabel = new TextArea(ss.str(), screenX+94, screenY+20);
    hitPointsLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    // label: armor class
    ss.str("");
    ss << player->armorClass();
    auto armorClassLabel = new TextArea(ss.str(), screenX+94, screenY+30);
    armorClassLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // armorSlot, leftHand, rightHand
    Game::GameArmorItemObject* armorSlot = player->armorSlot();
    Game::GameItemObject* leftHand = player->leftHandSlot();
    Game::GameItemObject* rightHand = player->rightHandSlot();


    // label: damage treshold levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_LASER) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_FIRE) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"/";
    }
    else
    {
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_EXPLOSION) <<"/";
    }
    auto damageThresholdLabel = new TextArea(ss.str(), screenX+94, screenY+40);
    damageThresholdLabel->setWidth(26)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // label: damage resistance levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_LASER) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_FIRE) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"%";
    }
    else
    {
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_EXPLOSION) <<"%";
    }
    auto damageResistanceLabel = new TextArea(ss.str(), screenX+120, screenY+40);

    auto line2 = new Image(142, 1);
    line2->setX(screenX);
    line2->setY(screenY+94);
    line2->texture()->fill(0x3ff800ff); // default green color

    auto line3 = new Image(142, 1);
    line3->setX(screenX);
    line3->setY(screenY+134);
    line3->texture()->fill(0x3ff800ff); // default green color

    // label: Total Wt: (20)
    auto weight = player->carryWeight();
    auto weightMax = player->carryWeightMax();

    ss.str("");
    ss << weight;
    auto totalWtLabel = new TextArea(_t(MSG_INVENTORY, 20), screenX+14, screenY+180);
    auto weightLabel = new TextArea(ss.str(), screenX+70, screenY+180);
    weightLabel->setWidth(24)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    ss.str("");
    ss << "/" << weightMax;
    auto weightMaxLabel = new TextArea(ss.str(), screenX+94, screenY+180);
    if (weight>weightMax)
    {
        weightLabel->setFont(ResourceManager::font("font1.aaf", 0xff0000ff));
    }

    // label: left hand
    ss.str("");
    if (leftHand)
    {
        ss << _handItemSummary(leftHand);
    }
    auto leftHandLabel = new TextArea(ss.str(), screenX, screenY+100);

    // label: right hand
    ss.str("");
    if (rightHand)
    {
        ss << _handItemSummary(rightHand);
    }
    auto rightHandLabel = new TextArea(ss.str(), screenX, screenY+140);

    // screen info
    auto screenLabel = new TextArea("", screenX, screenY+20);
    screenLabel->setWidth(140); //screen size
    screenLabel->setHeight(168);
    screenLabel->setVisible(false);
    screenLabel->setWordWrap(true);


    addUI(line1);
    addUI("textLabel", textLabel);
    addUI("hitPointsLabel", hitPointsLabel);
    addUI("armorClassLabel", armorClassLabel);
    addUI("damageThresholdLabel", damageThresholdLabel);
    addUI("damageResistanceLabel", damageResistanceLabel);
    addUI("line2", line2);
    addUI("line3", line3);
    addUI("totalWtLabel", totalWtLabel);
    addUI("weightLabel", weightLabel);
    addUI("weightMaxLabel", weightMaxLabel);
    addUI("leftHandLabel", leftHandLabel);
    addUI("rightHandLabel", rightHandLabel);
    addUI("screenLabel", screenLabel);

    auto inventoryList = new ItemsList(40, 40);
    inventoryList->setItems(game->player()->inventory());
    addUI(inventoryList);

    // BIG ICONS
    // icon: armor
    if (armorSlot)
    {
        auto inventoryItem = new InventoryItem(armorSlot, 154, 183);
        inventoryItem->setType(InventoryItem::TYPE_SLOT);
        inventoryItem->addEventHandler("itemdragstop", [inventoryList](Event* event){ inventoryList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); });
        inventoryList->addEventHandler("itemdragstop", [inventoryItem](Event* event){ inventoryItem->onArmorDragStop(dynamic_cast<MouseEvent*>(event)); });
        addUI(inventoryItem);
    }

    // icon: left hand
    if (leftHand)
    {
        auto inventoryItem = new InventoryItem(leftHand, 154, 286);
        inventoryItem->setType(InventoryItem::TYPE_SLOT);
        inventoryItem->addEventHandler("itemdragstop", [inventoryList](Event* event){ inventoryList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); });
        inventoryList->addEventHandler("itemdragstop", [inventoryItem](Event* event){ inventoryItem->onHandDragStop(dynamic_cast<MouseEvent*>(event)); });
        addUI(inventoryItem);
    }

    // icon: right hand
    if (rightHand)
    {
        auto inventoryItem = new InventoryItem(rightHand, 247, 286);
        inventoryItem->setType(InventoryItem::TYPE_SLOT);
        inventoryItem->addEventHandler("itemdragstop", [inventoryList](Event* event){ inventoryList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); });
        inventoryList->addEventHandler("itemdragstop", [inventoryItem](Event* event){ inventoryItem->onHandDragStop(dynamic_cast<MouseEvent*>(event)); });
        addUI(inventoryItem);
    }

}