forked from mirror/openmw-tes3mp
Enchanting, spellmaking dialog: check for flags when listing known effects
This commit is contained in:
parent
df262e53ae
commit
d16e0c063c
4 changed files with 28 additions and 5 deletions
|
@ -24,7 +24,7 @@ namespace MWGui
|
||||||
|
|
||||||
EnchantingDialog::EnchantingDialog()
|
EnchantingDialog::EnchantingDialog()
|
||||||
: WindowBase("openmw_enchanting_dialog.layout")
|
: WindowBase("openmw_enchanting_dialog.layout")
|
||||||
, EffectEditorBase()
|
, EffectEditorBase(EffectEditorBase::Enchanting)
|
||||||
, mItemSelectionDialog(NULL)
|
, mItemSelectionDialog(NULL)
|
||||||
{
|
{
|
||||||
getWidget(mName, "NameEdit");
|
getWidget(mName, "NameEdit");
|
||||||
|
|
|
@ -287,7 +287,7 @@ namespace MWGui
|
||||||
|
|
||||||
SpellCreationDialog::SpellCreationDialog()
|
SpellCreationDialog::SpellCreationDialog()
|
||||||
: WindowBase("openmw_spellcreation_dialog.layout")
|
: WindowBase("openmw_spellcreation_dialog.layout")
|
||||||
, EffectEditorBase()
|
, EffectEditorBase(EffectEditorBase::Spellmaking)
|
||||||
{
|
{
|
||||||
getWidget(mNameEdit, "NameEdit");
|
getWidget(mNameEdit, "NameEdit");
|
||||||
getWidget(mMagickaCost, "MagickaCost");
|
getWidget(mMagickaCost, "MagickaCost");
|
||||||
|
@ -444,10 +444,11 @@ namespace MWGui
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
EffectEditorBase::EffectEditorBase()
|
EffectEditorBase::EffectEditorBase(Type type)
|
||||||
: mAddEffectDialog()
|
: mAddEffectDialog()
|
||||||
, mSelectAttributeDialog(NULL)
|
, mSelectAttributeDialog(NULL)
|
||||||
, mSelectSkillDialog(NULL)
|
, mSelectSkillDialog(NULL)
|
||||||
|
, mType(type)
|
||||||
{
|
{
|
||||||
mAddEffectDialog.eventEffectAdded += MyGUI::newDelegate(this, &EffectEditorBase::onEffectAdded);
|
mAddEffectDialog.eventEffectAdded += MyGUI::newDelegate(this, &EffectEditorBase::onEffectAdded);
|
||||||
mAddEffectDialog.eventEffectModified += MyGUI::newDelegate(this, &EffectEditorBase::onEffectModified);
|
mAddEffectDialog.eventEffectModified += MyGUI::newDelegate(this, &EffectEditorBase::onEffectModified);
|
||||||
|
@ -482,6 +483,13 @@ namespace MWGui
|
||||||
const std::vector<ESM::ENAMstruct>& list = spell->mEffects.mList;
|
const std::vector<ESM::ENAMstruct>& list = spell->mEffects.mList;
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator it2 = list.begin(); it2 != list.end(); ++it2)
|
for (std::vector<ESM::ENAMstruct>::const_iterator it2 = list.begin(); it2 != list.end(); ++it2)
|
||||||
{
|
{
|
||||||
|
const ESM::MagicEffect * effect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(it2->mEffectID);
|
||||||
|
|
||||||
|
// skip effects that do not allow spellmaking/enchanting
|
||||||
|
int requiredFlags = (mType == Spellmaking) ? ESM::MagicEffect::AllowSpellmaking : ESM::MagicEffect::AllowEnchanting;
|
||||||
|
if (!(effect->mData.mFlags & requiredFlags))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (std::find(knownEffects.begin(), knownEffects.end(), it2->mEffectID) == knownEffects.end())
|
if (std::find(knownEffects.begin(), knownEffects.end(), it2->mEffectID) == knownEffects.end())
|
||||||
knownEffects.push_back(it2->mEffectID);
|
knownEffects.push_back(it2->mEffectID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,13 @@ namespace MWGui
|
||||||
class EffectEditorBase
|
class EffectEditorBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EffectEditorBase();
|
enum Type
|
||||||
|
{
|
||||||
|
Spellmaking,
|
||||||
|
Enchanting
|
||||||
|
};
|
||||||
|
|
||||||
|
EffectEditorBase(Type type);
|
||||||
virtual ~EffectEditorBase();
|
virtual ~EffectEditorBase();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -121,6 +127,9 @@ namespace MWGui
|
||||||
void setWidgets (Widgets::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
|
void setWidgets (Widgets::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
|
||||||
|
|
||||||
virtual void notifyEffectsChanged () {}
|
virtual void notifyEffectsChanged () {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Type mType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
||||||
|
|
|
@ -16,6 +16,7 @@ struct MagicEffect
|
||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
{
|
{
|
||||||
|
// Hardcoded flags
|
||||||
TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure.
|
TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure.
|
||||||
TargetAttribute = 0x2, // Affects a specific attribute, which is specified elsewhere in the effect structure.
|
TargetAttribute = 0x2, // Affects a specific attribute, which is specified elsewhere in the effect structure.
|
||||||
NoDuration = 0x4, // Has no duration. Only runs effect once on cast.
|
NoDuration = 0x4, // Has no duration. Only runs effect once on cast.
|
||||||
|
@ -28,7 +29,12 @@ struct MagicEffect
|
||||||
UncappedDamage = 0x1000, // Negates multiple cap behaviours. Allows an effect to reduce an attribute below zero; removes the normal minimum effect duration of 1 second.
|
UncappedDamage = 0x1000, // Negates multiple cap behaviours. Allows an effect to reduce an attribute below zero; removes the normal minimum effect duration of 1 second.
|
||||||
NonRecastable = 0x4000, // Does not land if parent spell is already affecting target. Shows "you cannot re-cast" message for self target.
|
NonRecastable = 0x4000, // Does not land if parent spell is already affecting target. Shows "you cannot re-cast" message for self target.
|
||||||
Unreflectable = 0x10000, // Cannot be reflected, the effect always lands normally.
|
Unreflectable = 0x10000, // Cannot be reflected, the effect always lands normally.
|
||||||
CasterLinked = 0x20000 // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
|
CasterLinked = 0x20000, // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
|
||||||
|
|
||||||
|
// Moddable flags
|
||||||
|
AllowSpellmaking = 0x200,
|
||||||
|
AllowEnchanting = 0x400,
|
||||||
|
Negative = 0x800 // TODO: needs research
|
||||||
};
|
};
|
||||||
enum MagnitudeDisplayType
|
enum MagnitudeDisplayType
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue