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

Issue #219: added some more stats filters; fixed two filters

This commit is contained in:
Marc Zinnschlag 2012-11-12 13:56:51 +01:00
parent 77ba8c5117
commit 586ac3f5c6
3 changed files with 43 additions and 18 deletions

View file

@ -208,6 +208,14 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
return select.selectCompare (value); return select.selectCompare (value);
} }
case SelectWrapper::Function_HealthPercent:
{
float ratio = MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getCurrent() /
MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getModified();
return select.selectCompare (ratio);
}
default: default:
@ -250,7 +258,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_AiSetting: case SelectWrapper::Function_AiSetting:
return MWWorld::Class::get (player).getCreatureStats (player).getAiSetting (select.getArgument()); return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAiSetting (select.getArgument());
case SelectWrapper::Function_PcAttribute: case SelectWrapper::Function_PcAttribute:
@ -274,11 +282,8 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
return MWWorld::Class::get (player).getCreatureStats (player).getLevel(); return MWWorld::Class::get (player).getCreatureStats (player).getLevel();
case SelectWrapper::Function_PcGender: case SelectWrapper::Function_PcGender:
{
MWWorld::LiveCellRef<ESM::NPC> *cellRef = player.get<ESM::NPC>(); return player.get<ESM::NPC>()->mBase->mFlags & ESM::NPC::Female ? 0 : 1;
return cellRef->mBase->Female ? 0 : 1;
}
case SelectWrapper::Function_PcClothingModifier: case SelectWrapper::Function_PcClothingModifier:
{ {
@ -324,7 +329,11 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
return result; return result;
} }
case SelectWrapper::Function_Level:
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getLevel();
default: default:
throw std::runtime_error ("unknown integer select function"); throw std::runtime_error ("unknown integer select function");
@ -361,6 +370,16 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
return toLower (mActor.getCell()->mCell->mName)==select.getName(); return toLower (mActor.getCell()->mCell->mName)==select.getName();
case SelectWrapper::Function_SameGender:
return (player.get<ESM::NPC>()->mBase->mFlags & ESM::NPC::Female)==
(mActor.get<ESM::NPC>()->mBase->mFlags & ESM::NPC::Female);
case SelectWrapper::Function_SameRace:
return toLower (mActor.get<ESM::NPC>()->mBase->mRace)!=
toLower (player.get<ESM::NPC>()->mBase->mRace);
case SelectWrapper::Function_SameFaction: case SelectWrapper::Function_SameFaction:
return MWWorld::Class::get (mActor).getNpcStats (mActor).isSameFaction ( return MWWorld::Class::get (mActor).getNpcStats (mActor).isSameFaction (

View file

@ -63,7 +63,9 @@ MWDialogue::SelectWrapper::Function MWDialogue::SelectWrapper::decodeFunction()
{ {
// 0, 1 // 0, 1
case 2: return Function_RankRequirement; case 2: return Function_RankRequirement;
// 3-5 // 3
case 4: return Function_HealthPercent;
// 5
case 6: return Function_PcLevel; case 6: return Function_PcLevel;
case 7: return Function_PcHealthPercent; case 7: return Function_PcHealthPercent;
case 8: case 9: return Function_PcDynamicStat; case 8: case 9: return Function_PcDynamicStat;
@ -75,10 +77,10 @@ MWDialogue::SelectWrapper::Function MWDialogue::SelectWrapper::decodeFunction()
case 39: return Function_PcExpelled; case 39: return Function_PcExpelled;
case 40: return Function_PcCommonDisease; case 40: return Function_PcCommonDisease;
case 41: return Function_PcBlightDisease; case 41: return Function_PcBlightDisease;
// 42
case 42: return Function_PcClothingModifier; case 42: return Function_PcClothingModifier;
case 43: return Function_PcCrimeLevel; case 43: return Function_PcCrimeLevel;
// 44-45 case 44: return Function_SameGender;
case 45: return Function_SameRace;
case 46: return Function_SameFaction; case 46: return Function_SameFaction;
// 47-49 // 47-49
case 50: return Function_Choice; case 50: return Function_Choice;
@ -86,13 +88,14 @@ MWDialogue::SelectWrapper::Function MWDialogue::SelectWrapper::decodeFunction()
case 58: return Function_PcCorprus; case 58: return Function_PcCorprus;
// 59 // 59
case 60: return Function_PcVampire; case 60: return Function_PcVampire;
// 61, 62 case 61: return Function_Level;
// 62
case 63: return Function_TalkedToPc; case 63: return Function_TalkedToPc;
case 64: return Function_PcDynamicStat; case 64: return Function_PcDynamicStat;
// 65 // 65
case 66: return Function_FriendlyHit; case 66: return Function_FriendlyHit;
case 67: case 68: case 69: case 70: return Function_AiSetting; case 67: case 68: case 69: case 70: return Function_AiSetting;
// 71-77 // 71
} }
return Function_False; return Function_False;
@ -199,7 +202,8 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
Function_FriendlyHit, Function_FriendlyHit,
Function_PcLevel, Function_PcGender, Function_PcClothingModifier, Function_PcLevel, Function_PcGender, Function_PcClothingModifier,
Function_PcCrimeLevel, Function_PcCrimeLevel,
Function_RankRequirement, Function_RankRequirement,
Function_Level,
Function_None // end marker Function_None // end marker
}; };
@ -207,6 +211,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
{ {
Function_Global, Function_Local, Function_Global, Function_Local,
Function_PcDynamicStat, Function_PcHealthPercent, Function_PcDynamicStat, Function_PcHealthPercent,
Function_HealthPercent,
Function_None // end marker Function_None // end marker
}; };
@ -214,7 +219,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
{ {
Function_False, Function_False,
Function_Id, Function_Faction, Function_Class, Function_Race, Function_Cell, Function_Id, Function_Faction, Function_Class, Function_Race, Function_Cell,
Function_SameFaction, Function_SameGender, Function_SameRace, Function_SameFaction,
Function_PcCommonDisease, Function_PcBlightDisease, Function_PcCorprus, Function_PcCommonDisease, Function_PcBlightDisease, Function_PcCorprus,
Function_PcExpelled, Function_PcExpelled,
Function_PcVampire, Function_TalkedToPc, Function_PcVampire, Function_TalkedToPc,
@ -250,7 +255,7 @@ bool MWDialogue::SelectWrapper::isNpcOnly() const
static const Function functions[] = static const Function functions[] =
{ {
Function_Faction, SelectWrapper::Function_Class, SelectWrapper::Function_Race, Function_Faction, SelectWrapper::Function_Class, SelectWrapper::Function_Race,
Function_SameFaction, Function_SameGender, Function_SameRace, Function_SameFaction,
Function_PcSkill, Function_PcSkill,
Function_PcExpelled, Function_PcExpelled,
Function_PcVampire, Function_PcVampire,

View file

@ -24,7 +24,7 @@ namespace MWDialogue
Function_Cell, Function_Cell,
Function_Local, Function_Local,
Function_Global, Function_Global,
Function_SameFaction, Function_SameGender, Function_SameRace, Function_SameFaction,
Function_Choice, Function_Choice,
Function_PcCommonDisease, Function_PcBlightDisease, Function_PcCorprus, Function_PcCommonDisease, Function_PcBlightDisease, Function_PcCorprus,
Function_AiSetting, Function_AiSetting,
@ -35,9 +35,10 @@ namespace MWDialogue
Function_TalkedToPc, Function_TalkedToPc,
Function_PcLevel, Function_PcHealthPercent, Function_PcDynamicStat, Function_PcLevel, Function_PcHealthPercent, Function_PcDynamicStat,
Function_PcGender, Function_PcClothingModifier, Function_PcCrimeLevel, Function_PcGender, Function_PcClothingModifier, Function_PcCrimeLevel,
Function_RankRequirement Function_RankRequirement,
Function_HealthPercent, Function_Level
}; };
enum Type enum Type
{ {
Type_None, Type_None,