changed the way NPC faction is checked. Should be the same way for the player.

actorid
gugus 13 years ago
parent be4af711af
commit a268b89239

@ -39,6 +39,9 @@
#include "../mwscript/interpretercontext.hpp" #include "../mwscript/interpretercontext.hpp"
#include <components/compiler/scriptparser.hpp> #include <components/compiler/scriptparser.hpp>
#include "../mwclass/npc.hpp"
#include "../mwmechanics/npcstats.hpp"
namespace namespace
{ {
std::string toLower (const std::string& name) std::string toLower (const std::string& name)
@ -474,22 +477,18 @@ namespace MWDialogue
//NPC faction //NPC faction
if (!info.npcFaction.empty()) if (!info.npcFaction.empty())
{ {
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>(); //MWWorld::Class npcClass = MWWorld::Class::get(actor);
MWMechanics::NpcStats stats = MWWorld::Class::get(actor).getNpcStats(actor);
if (!cellRef) std::map<std::string,int>::iterator it = stats.mFactionRank.find(info.npcFaction);
return false; if(it!=stats.mFactionRank.end())
if (toLower (info.npcFaction)!=toLower (cellRef->base->faction))
return false;
//check NPC rank
if(cellRef->base->npdt52.gold != -10)
{ {
if(cellRef->base->npdt52.rank < info.data.rank) return false; //check rank
if(it->second < info.data.rank) return false;
} }
else else
{ {
if(cellRef->base->npdt12.rank < info.data.rank) return false; //not in the faction
return false;
} }
} }

Loading…
Cancel
Save