forked from teamnwah/openmw-tes3coop
applying new interface vol.2, inconsistent
This commit is contained in:
parent
bd1bb2e55d
commit
86ad7a96f4
6 changed files with 56 additions and 43 deletions
|
@ -86,7 +86,7 @@ namespace MWMechanics
|
||||||
if (effects.second)
|
if (effects.second)
|
||||||
{
|
{
|
||||||
const ESM::MagicEffect *magicEffect =
|
const ESM::MagicEffect *magicEffect =
|
||||||
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||||
iter->mEffectID);
|
iter->mEffectID);
|
||||||
|
|
||||||
if (iter->mDuration==0)
|
if (iter->mDuration==0)
|
||||||
|
@ -114,18 +114,18 @@ namespace MWMechanics
|
||||||
std::pair<ESM::EffectList, bool> ActiveSpells::getEffectList (const std::string& id) const
|
std::pair<ESM::EffectList, bool> ActiveSpells::getEffectList (const std::string& id) const
|
||||||
{
|
{
|
||||||
if (const ESM::Spell *spell =
|
if (const ESM::Spell *spell =
|
||||||
MWBase::Environment::get().getWorld()->getStore().spells.search (id))
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
|
||||||
return std::make_pair (spell->mEffects, false);
|
return std::make_pair (spell->mEffects, false);
|
||||||
|
|
||||||
if (const ESM::Potion *potion =
|
if (const ESM::Potion *potion =
|
||||||
MWBase::Environment::get().getWorld()->getStore().potions.search (id))
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
|
||||||
return std::make_pair (potion->mEffects, false);
|
return std::make_pair (potion->mEffects, false);
|
||||||
|
|
||||||
if (const ESM::Ingredient *ingredient =
|
if (const ESM::Ingredient *ingredient =
|
||||||
MWBase::Environment::get().getWorld()->getStore().ingreds.search (id))
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
|
||||||
{
|
{
|
||||||
const ESM::MagicEffect *magicEffect =
|
const ESM::MagicEffect *magicEffect =
|
||||||
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||||
ingredient->mData.mEffectID[0]);
|
ingredient->mData.mEffectID[0]);
|
||||||
|
|
||||||
ESM::ENAMstruct effect;
|
ESM::ENAMstruct effect;
|
||||||
|
|
|
@ -103,9 +103,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
float fFatigueReturnBase = store.gameSettings.find("fFatigueReturnBase")->getFloat ();
|
float fFatigueReturnBase = store.get<ESM::GameSetting>().find("fFatigueReturnBase")->getFloat ();
|
||||||
float fFatigueReturnMult = store.gameSettings.find("fFatigueReturnMult")->getFloat ();
|
float fFatigueReturnMult = store.get<ESM::GameSetting>().find("fFatigueReturnMult")->getFloat ();
|
||||||
float fEndFatigueMult = store.gameSettings.find("fEndFatigueMult")->getFloat ();
|
float fEndFatigueMult = store.get<ESM::GameSetting>().find("fEndFatigueMult")->getFloat ();
|
||||||
|
|
||||||
float capacity = MWWorld::Class::get(ptr).getCapacity(ptr);
|
float capacity = MWWorld::Class::get(ptr).getCapacity(ptr);
|
||||||
float encumbrance = MWWorld::Class::get(ptr).getEncumbrance(ptr);
|
float encumbrance = MWWorld::Class::get(ptr).getEncumbrance(ptr);
|
||||||
|
@ -122,7 +122,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
if (!stunted)
|
if (!stunted)
|
||||||
{
|
{
|
||||||
float fRestMagicMult = store.gameSettings.find("fRestMagicMult")->getFloat ();
|
float fRestMagicMult = store.get<ESM::GameSetting>().find("fRestMagicMult")->getFloat ();
|
||||||
|
|
||||||
DynamicStat<float> magicka = stats.getMagicka();
|
DynamicStat<float> magicka = stats.getMagicka();
|
||||||
magicka.setCurrent (magicka.getCurrent()
|
magicka.setCurrent (magicka.getCurrent()
|
||||||
|
|
|
@ -41,10 +41,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max);
|
float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max);
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
return store.gameSettings.find ("fFatigueBase")->getFloat()
|
return gmst.find ("fFatigueBase")->getFloat()
|
||||||
- store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised);
|
- gmst.find ("fFatigueMult")->getFloat() * (1-normalised);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Stat<int> &CreatureStats::getAttribute(int index) const
|
const Stat<int> &CreatureStats::getAttribute(int index) const
|
||||||
|
|
|
@ -42,8 +42,9 @@ namespace MWMechanics
|
||||||
if (mRaceSelected)
|
if (mRaceSelected)
|
||||||
{
|
{
|
||||||
const ESM::Race *race =
|
const ESM::Race *race =
|
||||||
MWBase::Environment::get().getWorld()->getStore().races.find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find (
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().getRace());
|
MWBase::Environment::get().getWorld()->getPlayer().getRace()
|
||||||
|
);
|
||||||
|
|
||||||
bool male = MWBase::Environment::get().getWorld()->getPlayer().isMale();
|
bool male = MWBase::Environment::get().getWorld()->getPlayer().isMale();
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ namespace MWMechanics
|
||||||
if (!MWBase::Environment::get().getWorld()->getPlayer().getBirthsign().empty())
|
if (!MWBase::Environment::get().getWorld()->getPlayer().getBirthsign().empty())
|
||||||
{
|
{
|
||||||
const ESM::BirthSign *sign =
|
const ESM::BirthSign *sign =
|
||||||
MWBase::Environment::get().getWorld()->getStore().birthSigns.find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find (
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
|
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
|
||||||
|
@ -132,14 +133,15 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MWWorld::IndexListT<ESM::Skill>::MapType ContainerType;
|
const MWWorld::Store<ESM::Skill> &skills =
|
||||||
const ContainerType& skills = MWBase::Environment::get().getWorld()->getStore().skills.list;
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>();
|
||||||
|
|
||||||
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
|
MWWorld::Store<ESM::Skill>::iterator iter = skills.begin();
|
||||||
|
for (; iter != skills.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (iter->second.mData.mSpecialization==class_.mData.mSpecialization)
|
if (iter->mData.mSpecialization==class_.mData.mSpecialization)
|
||||||
{
|
{
|
||||||
int index = iter->first;
|
int index = iter->mIndex;
|
||||||
|
|
||||||
if (index>=0 && index<27)
|
if (index>=0 && index<27)
|
||||||
{
|
{
|
||||||
|
@ -261,12 +263,16 @@ namespace MWMechanics
|
||||||
if (mUpdatePlayer)
|
if (mUpdatePlayer)
|
||||||
{
|
{
|
||||||
// basic player profile; should not change anymore after the creation phase is finished.
|
// basic player profile; should not change anymore after the creation phase is finished.
|
||||||
MWBase::Environment::get().getWindowManager()->setValue ("name", MWBase::Environment::get().getWorld()->getPlayer().getName());
|
MWBase::WindowManager *winMgr =
|
||||||
MWBase::Environment::get().getWindowManager()->setValue ("race",
|
MWBase::Environment::get().getWindowManager();
|
||||||
MWBase::Environment::get().getWorld()->getStore().races.find (MWBase::Environment::get().getWorld()->getPlayer().
|
|
||||||
getRace())->mName);
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
MWBase::Environment::get().getWindowManager()->setValue ("class",
|
MWWorld::Player &player = world->getPlayer();
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().getClass().mName);
|
|
||||||
|
winMgr->setValue ("name", player.getName());
|
||||||
|
winMgr->setValue ("race", world->getStore().get<ESM::Race>().find (player.getRace())->mName);
|
||||||
|
winMgr->setValue ("class", player.getClass().mName);
|
||||||
|
|
||||||
mUpdatePlayer = false;
|
mUpdatePlayer = false;
|
||||||
|
|
||||||
MWBase::WindowManager::SkillList majorSkills (5);
|
MWBase::WindowManager::SkillList majorSkills (5);
|
||||||
|
@ -274,11 +280,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
{
|
{
|
||||||
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][0];
|
minorSkills[i] = player.getClass().mData.mSkills[i][0];
|
||||||
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][1];
|
majorSkills[i] = player.getClass().mData.mSkills[i][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->configureSkills (majorSkills, minorSkills);
|
winMgr->configureSkills (majorSkills, minorSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
mActors.update (movement, duration, paused);
|
mActors.update (movement, duration, paused);
|
||||||
|
@ -313,7 +319,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerClass (const std::string& id)
|
void MechanicsManager::setPlayerClass (const std::string& id)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setClass (*MWBase::Environment::get().getWorld()->getStore().classes.find (id));
|
MWBase::Environment::get().getWorld()->getPlayer().setClass (
|
||||||
|
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (id)
|
||||||
|
);
|
||||||
mClassSelected = true;
|
mClassSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
|
|
@ -81,7 +81,8 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
|
||||||
if (level<0)
|
if (level<0)
|
||||||
level = static_cast<int> (getSkill (skillIndex).getBase());
|
level = static_cast<int> (getSkill (skillIndex).getBase());
|
||||||
|
|
||||||
const ESM::Skill *skill = MWBase::Environment::get().getWorld()->getStore().skills.find (skillIndex);
|
const ESM::Skill *skill =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find (skillIndex);
|
||||||
|
|
||||||
float skillFactor = 1;
|
float skillFactor = 1;
|
||||||
|
|
||||||
|
@ -96,14 +97,15 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
|
||||||
throw std::runtime_error ("invalid skill gain factor");
|
throw std::runtime_error ("invalid skill gain factor");
|
||||||
}
|
}
|
||||||
|
|
||||||
float typeFactor =
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->getFloat();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
float typeFactor = gmst.find ("fMiscSkillBonus")->getFloat();
|
||||||
|
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
if (class_.mData.mSkills[i][0]==skillIndex)
|
if (class_.mData.mSkills[i][0]==skillIndex)
|
||||||
{
|
{
|
||||||
typeFactor =
|
typeFactor = gmst.find ("fMinorSkillBonus")->getFloat();
|
||||||
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->getFloat();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -111,8 +113,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
if (class_.mData.mSkills[i][1]==skillIndex)
|
if (class_.mData.mSkills[i][1]==skillIndex)
|
||||||
{
|
{
|
||||||
typeFactor =
|
typeFactor = gmst.find ("fMajorSkillBonus")->getFloat();
|
||||||
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->getFloat();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -124,8 +125,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
|
||||||
|
|
||||||
if (skill->mData.mSpecialization==class_.mData.mSpecialization)
|
if (skill->mData.mSpecialization==class_.mData.mSpecialization)
|
||||||
{
|
{
|
||||||
specialisationFactor =
|
specialisationFactor = gmst.find ("fSpecialSkillBonus")->getFloat();
|
||||||
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->getFloat();
|
|
||||||
|
|
||||||
if (specialisationFactor<=0)
|
if (specialisationFactor<=0)
|
||||||
throw std::runtime_error ("invalid skill specialisation factor");
|
throw std::runtime_error ("invalid skill specialisation factor");
|
||||||
|
@ -178,7 +178,8 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
|
||||||
mLevelProgress += levelProgress;
|
mLevelProgress += levelProgress;
|
||||||
|
|
||||||
// check the attribute this skill belongs to
|
// check the attribute this skill belongs to
|
||||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld ()->getStore ().skills.find(skillIndex);
|
const ESM::Skill* skill =
|
||||||
|
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::Skill>().find(skillIndex);
|
||||||
++mSkillIncreases[skill->mData.mAttribute];
|
++mSkillIncreases[skill->mData.mAttribute];
|
||||||
|
|
||||||
// Play sound & skill progress notification
|
// Play sound & skill progress notification
|
||||||
|
|
|
@ -40,7 +40,8 @@ namespace MWMechanics
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.begin();
|
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.begin();
|
||||||
it != effects.end(); ++it)
|
it != effects.end(); ++it)
|
||||||
{
|
{
|
||||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID);
|
const ESM::MagicEffect* effect =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(it->mEffectID);
|
||||||
int _school = effect->mData.mSchool;
|
int _school = effect->mData.mSchool;
|
||||||
int _skillLevel = stats.getSkill (spellSchoolToSkill(_school)).getModified();
|
int _skillLevel = stats.getSkill (spellSchoolToSkill(_school)).getModified();
|
||||||
|
|
||||||
|
@ -61,7 +62,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
inline int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor)
|
inline int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
const ESM::Spell* spell =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell.().find(spellId);
|
||||||
return getSpellSchool(spell, actor);
|
return getSpellSchool(spell, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +109,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
inline float getSpellSuccessChance (const std::string& spellId, const MWWorld::Ptr& actor)
|
inline float getSpellSuccessChance (const std::string& spellId, const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
const ESM::Spell* spell =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||||
return getSpellSuccessChance(spell, actor);
|
return getSpellSuccessChance(spell, actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue