|
|
|
@ -47,37 +47,45 @@ namespace MWWorld
|
|
|
|
|
mPlayer.mData.setPosition(playerPos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::saveSkillsAttributes()
|
|
|
|
|
void Player::saveStats()
|
|
|
|
|
{
|
|
|
|
|
MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer());
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
|
|
|
|
mSaveSkills[i] = stats.getSkill(i);
|
|
|
|
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
|
|
|
|
mSaveAttributes[i] = stats.getAttribute(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::restoreSkillsAttributes()
|
|
|
|
|
void Player::restoreStats()
|
|
|
|
|
{
|
|
|
|
|
MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer());
|
|
|
|
|
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
|
|
|
|
MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer());
|
|
|
|
|
MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer());
|
|
|
|
|
MWMechanics::DynamicStat<float> health = creatureStats.getDynamic(0);
|
|
|
|
|
creatureStats.setHealth(int(health.getBase() / gmst.find("fWereWolfHealth")->getFloat()));
|
|
|
|
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
|
|
|
|
stats.setSkill(i, mSaveSkills[i]);
|
|
|
|
|
npcStats.setSkill(i, mSaveSkills[i]);
|
|
|
|
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
|
|
|
|
stats.setAttribute(i, mSaveAttributes[i]);
|
|
|
|
|
npcStats.setAttribute(i, mSaveAttributes[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::setWerewolfSkillsAttributes()
|
|
|
|
|
void Player::setWerewolfStats()
|
|
|
|
|
{
|
|
|
|
|
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
|
|
|
|
MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer());
|
|
|
|
|
MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer());
|
|
|
|
|
MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer());
|
|
|
|
|
MWMechanics::DynamicStat<float> health = creatureStats.getDynamic(0);
|
|
|
|
|
creatureStats.setHealth(int(health.getBase() * gmst.find("fWereWolfHealth")->getFloat()));
|
|
|
|
|
for(size_t i = 0;i < ESM::Attribute::Length;++i)
|
|
|
|
|
{
|
|
|
|
|
// Oh, Bethesda. It's "Intelligence".
|
|
|
|
|
std::string name = "fWerewolf"+((i==ESM::Attribute::Intelligence) ? std::string("Intellegence") :
|
|
|
|
|
ESM::Attribute::sAttributeNames[i]);
|
|
|
|
|
|
|
|
|
|
MWMechanics::AttributeValue value = stats.getAttribute(i);
|
|
|
|
|
MWMechanics::AttributeValue value = npcStats.getAttribute(i);
|
|
|
|
|
value.setBase(int(gmst.find(name)->getFloat()));
|
|
|
|
|
stats.setAttribute(i, value);
|
|
|
|
|
npcStats.setAttribute(i, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(size_t i = 0;i < ESM::Skill::Length;i++)
|
|
|
|
@ -90,9 +98,9 @@ namespace MWWorld
|
|
|
|
|
std::string name = "fWerewolf"+((i==ESM::Skill::Mercantile) ? std::string("Merchantile") :
|
|
|
|
|
ESM::Skill::sSkillNames[i]);
|
|
|
|
|
|
|
|
|
|
MWMechanics::SkillValue value = stats.getSkill(i);
|
|
|
|
|
MWMechanics::SkillValue value = npcStats.getSkill(i);
|
|
|
|
|
value.setBase(int(gmst.find(name)->getFloat()));
|
|
|
|
|
stats.setSkill(i, value);
|
|
|
|
|
npcStats.setSkill(i, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -366,8 +374,8 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
if (player.mObject.mNpcStats.mWerewolfDeprecatedData && player.mObject.mNpcStats.mIsWerewolf)
|
|
|
|
|
{
|
|
|
|
|
saveSkillsAttributes();
|
|
|
|
|
setWerewolfSkillsAttributes();
|
|
|
|
|
saveStats();
|
|
|
|
|
setWerewolfStats();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPlayer().getClass().getCreatureStats(getPlayer()).getAiSequence().clear();
|
|
|
|
|