MCPcopy Create free account
hub / github.com/TurningWheel/Barony / getContextMenuOptionsForItem

Function getContextMenuOptionsForItem

src/interface/playerinventory.cpp:11456–11773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11454}
11455
11456std::vector<ItemContextMenuPrompts> getContextMenuOptionsForItem(const int player, Item* item)
11457{
11458 std::vector<ItemContextMenuPrompts> options;
11459 if ( !item )
11460 {
11461 return options;
11462 }
11463
11464 bool playerOwnedItem = false;
11465 if ( item->node )
11466 {
11467 if ( item->node->list == &stats[player]->inventory )
11468 {
11469 playerOwnedItem = true;
11470 }
11471 }
11472
11473 if ( openedChest[player] && itemCategory(item) != SPELL_CAT )
11474 {
11475 if ( playerOwnedItem )
11476 {
11477 options.push_back(PROMPT_STORE_CHEST);
11478 options.push_back(PROMPT_STORE_CHEST_ALL);
11479 options.push_back(PROMPT_DROP);
11480 }
11481 else if ( players[player]->inventoryUI.isItemFromChest(item) )
11482 {
11483 options.push_back(PROMPT_RETRIEVE_CHEST);
11484 options.push_back(PROMPT_RETRIEVE_CHEST_ALL);
11485 }
11486 return options;
11487 }
11488
11489 if ( itemCategory(item) == SPELL_CAT )
11490 {
11491 options.push_back(PROMPT_SPELL_EQUIP);
11492 options.push_back(PROMPT_SPELL_QUICKCAST);
11493 /*if ( spell_t* spell = getSpellFromItem(player, item, true) )
11494 {
11495 if ( spell->ID == SPELL_RESHAPE_WEAPON )
11496 {
11497 options.push_back(PROMPT_SPELL_CHANGE_FOCUS);
11498 }
11499 }*/
11500 if ( !(GenericGUI[player].itemfxGUI.bOpen && GenericGUI[player].itemfxGUI.currentMode == GenericGUIMenu::ItemEffectGUI_t::ITEMFX_MODE_SCEPTER_CHARGE) )
11501 {
11502 return options;
11503 }
11504 }
11505
11506 if ( itemCategory(item) == POTION )
11507 {
11508 bool is_potion_bad = isPotionBad(*item);
11509 if ( is_potion_bad )
11510 {
11511 options.push_back(PROMPT_EQUIP);
11512 if ( !itemIsEquipped(item, player) )
11513 {

Callers 2

drawStatusNewFunction · 0.85

Calls 9

isPotionBadFunction · 0.85
itemIsEquippedFunction · 0.85
playerLearnedSpellbookFunction · 0.85
modeHasTransmuteMenuMethod · 0.80
itemCategoryFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected