mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 16:45:35 +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[1].set (ref->base->data.mana);
|
||||||
stats->mDynamic[2].set (ref->base->data.fatigue);
|
stats->mDynamic[2].set (ref->base->data.fatigue);
|
||||||
|
|
||||||
|
stats->mLevel = ref->base->data.level;
|
||||||
|
|
||||||
ptr.getRefData().getCreatureStats() = stats;
|
ptr.getRefData().getCreatureStats() = stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,8 @@ namespace MWClass
|
||||||
stats->mDynamic[1].set (ref->base->npdt52.mana);
|
stats->mDynamic[1].set (ref->base->npdt52.mana);
|
||||||
stats->mDynamic[2].set (ref->base->npdt52.fatigue);
|
stats->mDynamic[2].set (ref->base->npdt52.fatigue);
|
||||||
|
|
||||||
|
stats->mLevel = ref->base->npdt52.level;
|
||||||
|
|
||||||
ptr.getRefData().getCreatureStats() = stats;
|
ptr.getRefData().getCreatureStats() = stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file contains classes corresponding to all the window layouts
|
This file contains classes corresponding to all the window layouts
|
||||||
defined in resources/mygui/ *.xml.
|
defined in resources/mygui/ *.xml.
|
||||||
|
@ -211,11 +213,6 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
setText (names[i][0], store.gameSettings.find (names[i][1])->str);
|
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)
|
void setPlayerName(const std::string& playerName)
|
||||||
|
@ -274,7 +271,17 @@ namespace MWGui
|
||||||
else if (id=="race")
|
else if (id=="race")
|
||||||
setText ("RaceText", value);
|
setText ("RaceText", value);
|
||||||
else if (id=="class")
|
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);
|
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)
|
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||||
{
|
{
|
||||||
std::cout << "message box: " << message << std::endl;
|
std::cout << "message box: " << message << std::endl;
|
||||||
|
|
|
@ -167,6 +167,9 @@ namespace MWGui
|
||||||
void setValue (const std::string& id, const std::string& value);
|
void setValue (const std::string& id, const std::string& value);
|
||||||
///< set value for the given ID.
|
///< 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);
|
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
Stat<int> mAttributes[8];
|
Stat<int> mAttributes[8];
|
||||||
DynamicStat<int> mDynamic[3]; // health, magicka, fatigue
|
DynamicStat<int> mDynamic[3]; // health, magicka, fatigue
|
||||||
|
int mLevel;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ namespace MWMechanics
|
||||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||||
// MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (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
|
// reset
|
||||||
|
creatureStats.mLevel = player->npdt52.level;
|
||||||
|
|
||||||
// race
|
// race
|
||||||
const ESM::Race *race =
|
const ESM::Race *race =
|
||||||
|
@ -153,6 +153,8 @@ namespace MWMechanics
|
||||||
mEnvironment.mWindowManager->setValue (dynamicNames[i], stats.mDynamic[i]);
|
mEnvironment.mWindowManager->setValue (dynamicNames[i], stats.mDynamic[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mEnvironment.mWindowManager->setValue ("level", stats.mLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUpdatePlayer)
|
if (mUpdatePlayer)
|
||||||
|
|
Loading…
Reference in a new issue