mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 17:45:34 +00:00
check playerfaction during dialogue
This commit is contained in:
parent
a268b89239
commit
2c7c945208
2 changed files with 34 additions and 0 deletions
|
@ -493,6 +493,21 @@ namespace MWDialogue
|
|||
}
|
||||
|
||||
// TODO check player faction
|
||||
if(!info.pcFaction.empty())
|
||||
{
|
||||
MWMechanics::NpcStats stats = MWWorld::Class::get(actor).getNpcStats(mEnvironment.mWorld->getPlayer().getPlayer());
|
||||
std::map<std::string,int>::iterator it = stats.mFactionRank.find(info.npcFaction);
|
||||
if(it!=stats.mFactionRank.end())
|
||||
{
|
||||
//check rank
|
||||
if(it->second < info.data.rank) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//not in the faction
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//check gender
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||
|
@ -655,6 +670,7 @@ namespace MWDialogue
|
|||
|
||||
void DialogueManager::executeScript(std::string script)
|
||||
{
|
||||
std::cout << script;
|
||||
std::vector<Interpreter::Type_Code> code;
|
||||
if(compile(script,code))
|
||||
{
|
||||
|
@ -796,4 +812,19 @@ namespace MWDialogue
|
|||
mChoiceMap[question] = choice;
|
||||
mIsInChoice = true;
|
||||
}
|
||||
|
||||
std::string DialogueManager::getFaction()
|
||||
{
|
||||
std::string factionID("");
|
||||
MWMechanics::NpcStats stats = MWWorld::Class::get(mActor).getNpcStats(mEnvironment.mWorld->getPlayer().getPlayer());
|
||||
if(stats.mFactionRank.empty())
|
||||
{
|
||||
std::cout << "No faction for this actor!";
|
||||
}
|
||||
else
|
||||
{
|
||||
factionID = stats.mFactionRank.begin()->first;
|
||||
}
|
||||
return factionID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,9 @@ namespace MWDialogue
|
|||
|
||||
void askQuestion(std::string question,int choice);
|
||||
|
||||
///get the faction of the actor you are talking with
|
||||
std::string getFaction();
|
||||
|
||||
//calbacks for the GUI
|
||||
void keywordSelected(std::string keyword);
|
||||
void goodbyeSelected();
|
||||
|
|
Loading…
Reference in a new issue