Skill progress bar changed to match MW

celladd
scrawl 10 years ago
parent 5096e5dc0c
commit 55cd9b526c

@ -61,7 +61,7 @@ namespace ESSImport
bool mHasACSC;
ACSC mACSC;
int mSkills[27][2];
int mSkills[27][2]; // skills, base and modified
// creature combat stats, base and modified
// I think these can be ignored in the conversion, because it is not possible

@ -376,9 +376,8 @@ namespace MWGui
for (SkillList::const_iterator it = skills.begin(); it != end; ++it)
{
int skillId = *it;
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
continue;
assert(skillId >= 0 && skillId < ESM::Skill::Length);
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
const MWMechanics::SkillValue &stat = mSkillValues.find(skillId)->second;
int base = stat.getBase();
@ -388,9 +387,14 @@ namespace MWGui
const MWWorld::ESMStore &esmStore =
MWBase::Environment::get().getWorld()->getStore();
int progressRequirement = player.getClass().getNpcStats(player).getSkillProgressRequirement(skillId,
float progressRequirement = player.getClass().getNpcStats(player).getSkillProgressRequirement(skillId,
*esmStore.get<ESM::Class>().find(player.get<ESM::NPC>()->mBase->mClass));
int progressPercent = int(int(stat.getProgress()) / float(progressRequirement) * 100.f);
// This is how vanilla MW displays the progress bar (I think). Note it's slightly inaccurate,
// due to the int casting in the skill levelup logic. Also the progress label could in rare cases
// reach 100% without the skill levelling up.
// Leaving the original display logic for now, for consistency with ess-imported savegames.
int progressPercent = int(float(stat.getProgress()) / float(progressRequirement) * 100.f + 0.5f);
const ESM::Skill* skill = esmStore.get<ESM::Skill>().find(skillId);

Loading…
Cancel
Save