1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Spell cost is updatedon every change in enchanting and spellmaking.

This commit is contained in:
PLkolek 2013-07-31 13:33:30 +02:00
parent 7fd7621458
commit 8bc8c38f2d
2 changed files with 25 additions and 11 deletions

View file

@ -81,6 +81,15 @@ namespace MWGui
mDeleteButton->setVisible (false); mDeleteButton->setVisible (false);
mEffect.mRange = ESM::RT_Self; mEffect.mRange = ESM::RT_Self;
if (!(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf))
mEffect.mRange = ESM::RT_Touch;
if (!(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch))
mEffect.mRange = ESM::RT_Target;
mEffect.mMagnMin = 1;
mEffect.mMagnMax = 1;
mEffect.mDuration = 1;
mEffect.mArea = 0;
eventEffectAdded(mEffect);
onRangeButtonClicked(mRangeButton); onRangeButtonClicked(mRangeButton);
@ -93,11 +102,6 @@ namespace MWGui
mMagnitudeMinValue->setCaption("1"); mMagnitudeMinValue->setCaption("1");
mMagnitudeMaxValue->setCaption("- 1"); mMagnitudeMaxValue->setCaption("- 1");
mAreaValue->setCaption("0"); mAreaValue->setCaption("0");
mEffect.mMagnMin = 1;
mEffect.mMagnMax = 1;
mEffect.mDuration = 1;
mEffect.mArea = 0;
} }
void EditEffectDialog::editEffect (ESM::ENAMstruct effect) void EditEffectDialog::editEffect (ESM::ENAMstruct effect)
@ -106,7 +110,7 @@ namespace MWGui
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID); MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
setMagicEffect(magicEffect); setMagicEffect(magicEffect);
mOldEffect = effect;
mEffect = effect; mEffect = effect;
mEditing = true; mEditing = true;
@ -121,6 +125,7 @@ namespace MWGui
onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1); onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1);
onAreaChanged (mAreaSlider, effect.mArea); onAreaChanged (mAreaSlider, effect.mArea);
onDurationChanged (mDurationSlider, effect.mDuration-1); onDurationChanged (mDurationSlider, effect.mDuration-1);
eventEffectModified(mEffect);
} }
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
@ -196,6 +201,7 @@ namespace MWGui
onAreaChanged(mAreaSlider,0); onAreaChanged(mAreaSlider,0);
} }
updateBoxes(); updateBoxes();
eventEffectModified(mEffect);
} }
void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender) void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender)
@ -208,26 +214,27 @@ namespace MWGui
void EditEffectDialog::onOkButtonClicked (MyGUI::Widget* sender) void EditEffectDialog::onOkButtonClicked (MyGUI::Widget* sender)
{ {
setVisible(false); setVisible(false);
if (mEditing)
eventEffectModified(mEffect);
else
eventEffectAdded(mEffect);
} }
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender) void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
{ {
setVisible(false); setVisible(false);
if(mEditing)
eventEffectModified(mOldEffect);
else
eventEffectRemoved(mEffect);
} }
void EditEffectDialog::setSkill (int skill) void EditEffectDialog::setSkill (int skill)
{ {
mEffect.mSkill = skill; mEffect.mSkill = skill;
eventEffectModified(mEffect);
} }
void EditEffectDialog::setAttribute (int attribute) void EditEffectDialog::setAttribute (int attribute)
{ {
mEffect.mAttribute = attribute; mEffect.mAttribute = attribute;
eventEffectModified(mEffect);
} }
void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos)
@ -237,6 +244,7 @@ namespace MWGui
// trigger the check again (see below) // trigger the check again (see below)
onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition ()); onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition ());
eventEffectModified(mEffect);
} }
void EditEffectDialog::onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos)
@ -252,18 +260,22 @@ namespace MWGui
mEffect.mMagnMax = pos+1; mEffect.mMagnMax = pos+1;
mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast<std::string>(pos+1)); mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast<std::string>(pos+1));
eventEffectModified(mEffect);
} }
void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos)
{ {
mDurationValue->setCaption(boost::lexical_cast<std::string>(pos+1)); mDurationValue->setCaption(boost::lexical_cast<std::string>(pos+1));
mEffect.mDuration = pos+1; mEffect.mDuration = pos+1;
eventEffectModified(mEffect);
} }
void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos)
{ {
mAreaValue->setCaption(boost::lexical_cast<std::string>(pos)); mAreaValue->setCaption(boost::lexical_cast<std::string>(pos));
mEffect.mArea = pos; mEffect.mArea = pos;
eventEffectModified(mEffect);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -617,6 +629,7 @@ namespace MWGui
void EffectEditorBase::onEffectAdded (ESM::ENAMstruct effect) void EffectEditorBase::onEffectAdded (ESM::ENAMstruct effect)
{ {
mEffects.push_back(effect); mEffects.push_back(effect);
mSelectedEffect=mEffects.size()-1;
updateEffectsView(); updateEffectsView();
} }

View file

@ -75,6 +75,7 @@ namespace MWGui
protected: protected:
ESM::ENAMstruct mEffect; ESM::ENAMstruct mEffect;
ESM::ENAMstruct mOldEffect;
const ESM::MagicEffect* mMagicEffect; const ESM::MagicEffect* mMagicEffect;
}; };