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

Method openGUI

src/interface/interface.cpp:7540–7725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7538//}
7539
7540void GenericGUIMenu::openGUI(int type, Item* effectItem, int effectBeatitude, int effectItemType, int usingSpellID)
7541{
7542 this->closeGUI();
7543
7544 if ( !effectItem && usingSpellID != SPELL_NONE && effectItemType == SPELL_ITEM )
7545 {
7546 for ( node_t* node = stats[gui_player]->inventory.first; node; node = node->next )
7547 {
7548 Item* item = static_cast<Item*>(node->element);
7549 if ( !item )
7550 {
7551 continue;
7552 }
7553 //Search player's inventory for the special spell item.
7554 if ( itemCategory(item) != SPELL_CAT )
7555 {
7556 continue;
7557 }
7558 spell_t* spell = getSpellFromItem(gui_player, item, false);
7559 if ( spell && spell->ID == usingSpellID )
7560 {
7561 effectItem = item;
7562 break;
7563 }
7564 }
7565 if ( !effectItem )
7566 {
7567 return;
7568 }
7569 }
7570
7571 if ( players[gui_player] && players[gui_player]->entity )
7572 {
7573 if ( players[gui_player]->entity->isBlind() )
7574 {
7575 messagePlayer(gui_player, MESSAGE_MISC, Language::get(892));
7576 return; // I can't see!
7577 }
7578 }
7579
7580 if ( players[gui_player]->inventoryUI.bCompactView )
7581 {
7582 // if compact view, then we don't want the inventory slot being selected
7583 if ( players[gui_player]->inventoryUI.getSelectedSlotY() < 0 )
7584 {
7585 players[gui_player]->inventoryUI.selectSlot(0, 0);
7586 }
7587 }
7588 players[gui_player]->openStatusScreen(GUI_MODE_INVENTORY, INVENTORY_MODE_ITEM); // Reset the GUI to the inventory.
7589
7590 guiActive = true;
7591 itemEffectItemBeatitude = effectBeatitude;
7592 itemEffectItemType = effectItemType;
7593 guiType = static_cast<GUICurrentType>(type);
7594 if ( type == GUICurrentType::GUI_TYPE_ITEMFX )
7595 {
7596 if ( items[effectItemType].category == SPELLBOOK )
7597 {

Callers 14

actPlayerFunction · 0.80
actAssistShrineMethod · 0.80
actHudWeaponFunction · 0.80
item_ScrollIdentifyFunction · 0.80
item_ScrollEnchantWeaponFunction · 0.80
item_ScrollEnchantArmorFunction · 0.80
item_ScrollRemoveCurseFunction · 0.80
item_ScrollRepairFunction · 0.80
actCauldronFunction · 0.80
actWorkbenchFunction · 0.80
actMailboxFunction · 0.80
net.cppFile · 0.80

Calls 15

closeGUIMethod · 0.95
getSpellFromItemFunction · 0.85
stationOpenSoundFunction · 0.85
isBlindMethod · 0.80
getSelectedSlotYMethod · 0.80
selectSlotMethod · 0.80
openStatusScreenMethod · 0.80
openItemEffectMenuMethod · 0.80
closeFollowerMenuGUIMethod · 0.80
closeCalloutMenuGUIMethod · 0.80
closeChestMethod · 0.80
openAlchemyMenuMethod · 0.80

Tested by

no test coverage detected