|
|
|
@ -102,22 +102,7 @@ namespace MWGui
|
|
|
|
|
updateSpells();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SpellWindow::onModelIndexSelected(SpellModel::ModelIndex index)
|
|
|
|
|
{
|
|
|
|
|
const Spell& spell = mSpellView->getModel()->getItem(index);
|
|
|
|
|
if (spell.mType == Spell::Type_EnchantedItem)
|
|
|
|
|
{
|
|
|
|
|
onEnchantedItemSelected(spell.mItem, spell.mActive);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
onSpellSelected(spell.mId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SpellWindow::onSpellSelected(const std::string& spellId)
|
|
|
|
|
{
|
|
|
|
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
|
|
|
|
void SpellWindow::askDeleteSpell(const std::string &spellId)
|
|
|
|
|
{
|
|
|
|
|
// delete spell, if allowed
|
|
|
|
|
const ESM::Spell* spell =
|
|
|
|
@ -141,13 +126,29 @@ namespace MWGui
|
|
|
|
|
dialog->eventCancelClicked.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SpellWindow::onModelIndexSelected(SpellModel::ModelIndex index)
|
|
|
|
|
{
|
|
|
|
|
const Spell& spell = mSpellView->getModel()->getItem(index);
|
|
|
|
|
if (spell.mType == Spell::Type_EnchantedItem)
|
|
|
|
|
{
|
|
|
|
|
onEnchantedItemSelected(spell.mItem, spell.mActive);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
|
|
|
|
askDeleteSpell(spell.mId);
|
|
|
|
|
else
|
|
|
|
|
onSpellSelected(spell.mId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SpellWindow::onSpellSelected(const std::string& spellId)
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
|
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
|
|
|
|
store.setSelectedEnchantItem(store.end());
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateSpells();
|
|
|
|
|
}
|
|
|
|
@ -184,6 +185,10 @@ namespace MWGui
|
|
|
|
|
return;
|
|
|
|
|
selected = (selected + itemcount) % itemcount;
|
|
|
|
|
|
|
|
|
|
onModelIndexSelected(selected);
|
|
|
|
|
const Spell& spell = mSpellView->getModel()->getItem(selected);
|
|
|
|
|
if (spell.mType == Spell::Type_EnchantedItem)
|
|
|
|
|
onEnchantedItemSelected(spell.mItem, spell.mActive);
|
|
|
|
|
else
|
|
|
|
|
onSpellSelected(spell.mId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|