send skill updates to GUI sub-system

actorid
Marc Zinnschlag 14 years ago
parent 404aacae1b
commit 283e0df3a0

@ -137,6 +137,9 @@ namespace MWMechanics
MWMechanics::CreatureStats& stats =
MWWorld::Class::get (mWatched).getCreatureStats (mWatched);
MWMechanics::NpcStats& npcStats =
MWWorld::Class::get (mWatched).getNpcStats (mWatched);
static const char *attributeNames[8] =
{
"AttribVal1", "AttribVal2", "AttribVal3", "AttribVal4", "AttribVal5",
@ -148,6 +151,17 @@ namespace MWMechanics
"HBar", "MBar", "FBar"
};
static const char *skillNames[27] =
{
"SkillBlock", "SkillArmorer", "SkillMediumArmor", "SkillHeavyArmor",
"SkillBluntWeapon", "SkillLongBlade", "SkillAxe", "SkillSpear",
"SkillAthletics", "SkillEnchant", "SkillDestruction", "SkillAlteration",
"SkillIllusion", "SkillConjuration", "SkillMysticism", "SkillRestoration",
"SkillAlchemy", "SkillUnarmored", "SkillSecurity", "SkillSneak",
"SkillAcrobatics", "SkillLightArmor", "SkillShortBlade", "SkillMarksman",
"SkillMercantile", "SkillSpeechcraft", "SkillHandToHand",
};
for (int i=0; i<8; ++i)
{
if (stats.mAttributes[i]!=mWatchedCreature.mAttributes[i])
@ -168,6 +182,24 @@ namespace MWMechanics
}
}
bool update = false;
for (int i=0; i<27; ++i)
{
if (npcStats.mSkill[i]!=mWatchedNpc.mSkill[i])
{
update = true;
mWatchedNpc.mSkill[i] = npcStats.mSkill[i];
mEnvironment.mWindowManager->setValue (skillNames[i], npcStats.mSkill[i]);
}
}
if (update)
mEnvironment.mWindowManager->updateSkillArea();
mEnvironment.mWindowManager->setValue ("level", stats.mLevel);
}
@ -181,6 +213,17 @@ namespace MWMechanics
mEnvironment.mWindowManager->setValue ("class",
mEnvironment.mWorld->getPlayerPos().getClass().name);
mUpdatePlayer = false;
MWGui::WindowManager::SkillList majorSkills (5);
MWGui::WindowManager::SkillList minorSkills (5);
for (int i=0; i<5; ++i)
{
minorSkills[i] = mEnvironment.mWorld->getPlayerPos().getClass().data.skills[i][0];
majorSkills[i] = mEnvironment.mWorld->getPlayerPos().getClass().data.skills[i][1];
}
mEnvironment.mWindowManager->configureSkills (majorSkills, minorSkills);
}
}

@ -6,6 +6,7 @@
#include "../mwworld/ptr.hpp"
#include "creaturestats.hpp"
#include "npcstats.hpp"
namespace MWWorld
{
@ -20,6 +21,7 @@ namespace MWMechanics
std::set<MWWorld::Ptr> mActors;
MWWorld::Ptr mWatched;
CreatureStats mWatchedCreature;
NpcStats mWatchedNpc;
bool mUpdatePlayer;
void buildPlayer();

Loading…
Cancel
Save