forked from mirror/openmw-tes3mp
ESSImport: convert faction reactions and known dialogue topics
This commit is contained in:
parent
6d5bb57e00
commit
06736e9e03
5 changed files with 38 additions and 1 deletions
|
@ -9,6 +9,8 @@
|
|||
#include <components/esm/loadclas.hpp>
|
||||
#include <components/esm/loadglob.hpp>
|
||||
#include <components/esm/cellstate.hpp>
|
||||
#include <components/esm/loadfact.hpp>
|
||||
#include <components/esm/dialoguestate.hpp>
|
||||
#include <components/esm/custommarkerstate.hpp>
|
||||
|
||||
#include "importcrec.hpp"
|
||||
|
@ -214,6 +216,12 @@ public:
|
|||
mContext->mPlayer.mObject.mNpcStats.mFactions[it->mFactionName.toString()] = faction;
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = pcdt.mKnownDialogueTopics.begin();
|
||||
it != pcdt.mKnownDialogueTopics.end(); ++it)
|
||||
{
|
||||
mContext->mDialogueState.mKnownTopics.push_back(Misc::StringUtils::lowerCase(*it));
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -295,6 +303,24 @@ private:
|
|||
std::map<std::string, int> mKillCounter;
|
||||
};
|
||||
|
||||
class ConvertFACT : public Converter
|
||||
{
|
||||
public:
|
||||
virtual void read(ESM::ESMReader& esm)
|
||||
{
|
||||
std::string id = esm.getHNString("NAME");
|
||||
ESM::Faction faction;
|
||||
faction.load(esm);
|
||||
|
||||
Misc::StringUtils::toLower(id);
|
||||
for (std::map<std::string, int>::const_iterator it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it)
|
||||
{
|
||||
std::string faction2 = Misc::StringUtils::lowerCase(it->first);
|
||||
mContext->mDialogueState.mChangedFactionReaction[id].insert(std::make_pair(faction2, it->second));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -181,6 +181,8 @@ namespace ESSImport
|
|||
Ogre::LogManager logman;
|
||||
Ogre::Root root;
|
||||
|
||||
// TODO: set up encoding on ESMReader based on openmw.cfg / --encoding switch
|
||||
|
||||
ESM::ESMReader esm;
|
||||
esm.open(mEssFile);
|
||||
|
||||
|
@ -216,6 +218,7 @@ namespace ESSImport
|
|||
converters[ESM::REC_LEVC] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::CreatureLevList>());
|
||||
converters[ESM::REC_LEVI] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::ItemLevList>());
|
||||
converters[ESM::REC_CNTC] = boost::shared_ptr<Converter>(new ConvertCNTC());
|
||||
converters[ESM::REC_FACT] = boost::shared_ptr<Converter>(new ConvertFACT());
|
||||
|
||||
std::set<unsigned int> unknownRecords;
|
||||
|
||||
|
@ -322,6 +325,10 @@ namespace ESSImport
|
|||
}
|
||||
context.mPlayer.save(writer);
|
||||
writer.endRecord(ESM::REC_PLAY);
|
||||
|
||||
writer.startRecord (ESM::REC_DIAS);
|
||||
context.mDialogueState.save(writer);
|
||||
writer.endRecord(ESM::REC_DIAS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <components/esm/loadnpc.hpp>
|
||||
#include <components/esm/player.hpp>
|
||||
#include <components/esm/dialoguestate.hpp>
|
||||
|
||||
#include "importnpcc.hpp"
|
||||
#include "importcrec.hpp"
|
||||
|
@ -25,6 +26,8 @@ namespace ESSImport
|
|||
ESM::NPC mPlayerBase;
|
||||
std::string mCustomPlayerClassName;
|
||||
|
||||
ESM::DialogueState mDialogueState;
|
||||
|
||||
int mDay, mMonth, mYear;
|
||||
float mHour;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace ESSImport
|
|||
{
|
||||
while (esm.isNextSub("DNAM"))
|
||||
{
|
||||
// TODO: deal with encoding?
|
||||
mKnownDialogueTopics.push_back(esm.getHString());
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,10 @@ namespace ESM
|
|||
|
||||
struct DialogueState
|
||||
{
|
||||
// must be lower case topic IDs
|
||||
std::vector<std::string> mKnownTopics;
|
||||
|
||||
// must be lower case faction IDs
|
||||
std::map<std::string, std::map<std::string, int> > mChangedFactionReaction;
|
||||
|
||||
void load (ESMReader &esm);
|
||||
|
|
Loading…
Reference in a new issue