mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +00:00
implemented creature/NPC level
This commit is contained in:
parent
d910baebe6
commit
2527fe92a7
7 changed files with 30 additions and 9 deletions
|
@ -78,6 +78,8 @@ namespace MWClass
|
|||
stats->mDynamic[1].set (ref->base->data.mana);
|
||||
stats->mDynamic[2].set (ref->base->data.fatigue);
|
||||
|
||||
stats->mLevel = ref->base->data.level;
|
||||
|
||||
ptr.getRefData().getCreatureStats() = stats;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,8 @@ namespace MWClass
|
|||
stats->mDynamic[1].set (ref->base->npdt52.mana);
|
||||
stats->mDynamic[2].set (ref->base->npdt52.fatigue);
|
||||
|
||||
stats->mLevel = ref->base->npdt52.level;
|
||||
|
||||
ptr.getRefData().getCreatureStats() = stats;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
/*
|
||||
This file contains classes corresponding to all the window layouts
|
||||
defined in resources/mygui/ *.xml.
|
||||
|
@ -211,11 +213,6 @@ namespace MWGui
|
|||
{
|
||||
setText (names[i][0], store.gameSettings.find (names[i][1])->str);
|
||||
}
|
||||
|
||||
// These are just demo values, you should replace these with
|
||||
// real calls from outside the class later.
|
||||
setText("LevelText", "5");
|
||||
setText("ClassText", "Pilgrim");
|
||||
}
|
||||
|
||||
void setPlayerName(const std::string& playerName)
|
||||
|
@ -274,7 +271,17 @@ namespace MWGui
|
|||
else if (id=="race")
|
||||
setText ("RaceText", value);
|
||||
else if (id=="class")
|
||||
setText ("ClassText", value);
|
||||
setText ("ClassText", value);
|
||||
}
|
||||
|
||||
void setValue (const std::string& id, int value)
|
||||
{
|
||||
if (id=="level")
|
||||
{
|
||||
std::ostringstream text;
|
||||
text << value;
|
||||
setText("LevelText", text.str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -145,6 +145,11 @@ void WindowManager::setValue (const std::string& id, const std::string& value)
|
|||
stats->setValue (id, value);
|
||||
}
|
||||
|
||||
void WindowManager::setValue (const std::string& id, int value)
|
||||
{
|
||||
stats->setValue (id, value);
|
||||
}
|
||||
|
||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||
{
|
||||
std::cout << "message box: " << message << std::endl;
|
||||
|
|
|
@ -167,6 +167,9 @@ namespace MWGui
|
|||
void setValue (const std::string& id, const std::string& value);
|
||||
///< set value for the given ID.
|
||||
|
||||
void setValue (const std::string& id, int value);
|
||||
///< set value for the given ID.
|
||||
|
||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||
|
||||
private:
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace MWMechanics
|
|||
{
|
||||
Stat<int> mAttributes[8];
|
||||
DynamicStat<int> mDynamic[3]; // health, magicka, fatigue
|
||||
int mLevel;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace MWMechanics
|
|||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
// MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
||||
|
||||
// const ESM::NPC *player = ptr.get<ESM::NPC>()->base;
|
||||
const ESM::NPC *player = ptr.get<ESM::NPC>()->base;
|
||||
|
||||
// reset
|
||||
|
||||
creatureStats.mLevel = player->npdt52.level;
|
||||
|
||||
// race
|
||||
const ESM::Race *race =
|
||||
|
@ -153,6 +153,8 @@ namespace MWMechanics
|
|||
mEnvironment.mWindowManager->setValue (dynamicNames[i], stats.mDynamic[i]);
|
||||
}
|
||||
}
|
||||
|
||||
mEnvironment.mWindowManager->setValue ("level", stats.mLevel);
|
||||
}
|
||||
|
||||
if (mUpdatePlayer)
|
||||
|
|
Loading…
Reference in a new issue