mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-23 03:47:34 -04:00
check playerfaction during dialogue
This commit is contained in:
parent
a268b89239
commit
2c7c945208
@ -493,6 +493,21 @@ namespace MWDialogue
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO check player faction
|
// 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
|
//check gender
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
@ -655,6 +670,7 @@ namespace MWDialogue
|
|||||||
|
|
||||||
void DialogueManager::executeScript(std::string script)
|
void DialogueManager::executeScript(std::string script)
|
||||||
{
|
{
|
||||||
|
std::cout << script;
|
||||||
std::vector<Interpreter::Type_Code> code;
|
std::vector<Interpreter::Type_Code> code;
|
||||||
if(compile(script,code))
|
if(compile(script,code))
|
||||||
{
|
{
|
||||||
@ -796,4 +812,19 @@ namespace MWDialogue
|
|||||||
mChoiceMap[question] = choice;
|
mChoiceMap[question] = choice;
|
||||||
mIsInChoice = true;
|
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);
|
void askQuestion(std::string question,int choice);
|
||||||
|
|
||||||
|
///get the faction of the actor you are talking with
|
||||||
|
std::string getFaction();
|
||||||
|
|
||||||
//calbacks for the GUI
|
//calbacks for the GUI
|
||||||
void keywordSelected(std::string keyword);
|
void keywordSelected(std::string keyword);
|
||||||
void goodbyeSelected();
|
void goodbyeSelected();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user