forked from teamnwah/openmw-tes3coop
finished?
This commit is contained in:
parent
95f3a20e2c
commit
76b494100e
23 changed files with 381 additions and 67 deletions
|
@ -118,7 +118,7 @@ namespace MWBase
|
||||||
/// Set value for the given ID.
|
/// Set value for the given ID.
|
||||||
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value) = 0;
|
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value) = 0;
|
||||||
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value) = 0;
|
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value) = 0;
|
||||||
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value) = 0;
|
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value) = 0;
|
||||||
virtual void setValue (const std::string& id, const std::string& value) = 0;
|
virtual void setValue (const std::string& id, const std::string& value) = 0;
|
||||||
virtual void setValue (const std::string& id, int value) = 0;
|
virtual void setValue (const std::string& id, int value) = 0;
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ void CharacterCreation::setValue (const std::string& id, const MWMechanics::Stat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value)
|
void CharacterCreation::setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
if (mReviewDialog)
|
if (mReviewDialog)
|
||||||
{
|
{
|
||||||
|
@ -294,17 +294,17 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::setPlayerHealth (const MWMechanics::DynamicStat<int>& value)
|
void CharacterCreation::setPlayerHealth (const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mPlayerHealth = value;
|
mPlayerHealth = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::setPlayerMagicka (const MWMechanics::DynamicStat<int>& value)
|
void CharacterCreation::setPlayerMagicka (const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mPlayerMagicka = value;
|
mPlayerMagicka = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<int>& value)
|
void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mPlayerFatigue = value;
|
mPlayerFatigue = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,14 +35,14 @@ namespace MWGui
|
||||||
//Show a dialog
|
//Show a dialog
|
||||||
void spawnDialog(const char id);
|
void spawnDialog(const char id);
|
||||||
|
|
||||||
void setPlayerHealth (const MWMechanics::DynamicStat<int>& value);
|
void setPlayerHealth (const MWMechanics::DynamicStat<float>& value);
|
||||||
|
|
||||||
void setPlayerMagicka (const MWMechanics::DynamicStat<int>& value);
|
void setPlayerMagicka (const MWMechanics::DynamicStat<float>& value);
|
||||||
|
|
||||||
void setPlayerFatigue (const MWMechanics::DynamicStat<int>& value);
|
void setPlayerFatigue (const MWMechanics::DynamicStat<float>& value);
|
||||||
|
|
||||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
||||||
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
||||||
void configureSkills (const SkillList& major, const SkillList& minor);
|
void configureSkills (const SkillList& major, const SkillList& minor);
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ namespace MWGui
|
||||||
std::string mPlayerRaceId;
|
std::string mPlayerRaceId;
|
||||||
std::string mPlayerBirthSignId;
|
std::string mPlayerBirthSignId;
|
||||||
ESM::Class mPlayerClass;
|
ESM::Class mPlayerClass;
|
||||||
MWMechanics::DynamicStat<int> mPlayerHealth;
|
MWMechanics::DynamicStat<float> mPlayerHealth;
|
||||||
MWMechanics::DynamicStat<int> mPlayerMagicka;
|
MWMechanics::DynamicStat<float> mPlayerMagicka;
|
||||||
MWMechanics::DynamicStat<int> mPlayerFatigue;
|
MWMechanics::DynamicStat<float> mPlayerFatigue;
|
||||||
|
|
||||||
//Class generation vars
|
//Class generation vars
|
||||||
unsigned mGenerateClassStep; // Keeps track of current step in Generate Class dialog
|
unsigned mGenerateClassStep; // Keeps track of current step in Generate Class dialog
|
||||||
|
|
|
@ -161,7 +161,7 @@ void HUD::setEffect(const char *img)
|
||||||
mEffect1->setImageTexture(img);
|
mEffect1->setImageTexture(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<int>& value)
|
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
static const char *ids[] =
|
static const char *ids[] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop);
|
HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop);
|
||||||
void setEffect(const char *img);
|
void setEffect(const char *img);
|
||||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
||||||
void setFPS(float fps);
|
void setFPS(float fps);
|
||||||
void setTriangleCount(unsigned int count);
|
void setTriangleCount(unsigned int count);
|
||||||
void setBatchCount(unsigned int count);
|
void setBatchCount(unsigned int count);
|
||||||
|
|
|
@ -4,6 +4,17 @@
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/stat.hpp"
|
||||||
|
|
||||||
|
#include <components/esm_store/reclists.hpp>
|
||||||
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -26,6 +37,7 @@ namespace MWGui
|
||||||
getWidget(b, "Attrib" + boost::lexical_cast<std::string>(i));
|
getWidget(b, "Attrib" + boost::lexical_cast<std::string>(i));
|
||||||
b->setUserData (i-1);
|
b->setUserData (i-1);
|
||||||
b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked);
|
b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked);
|
||||||
|
mAttributes.push_back(b);
|
||||||
|
|
||||||
mAttributeValues.push_back(t);
|
mAttributeValues.push_back(t);
|
||||||
|
|
||||||
|
@ -35,29 +47,152 @@ namespace MWGui
|
||||||
mAttributeMultipliers.push_back(t);
|
mAttributeMultipliers.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
center();
|
int curX = mMainWidget->getWidth()/2 - (16 + 2) * 1.5;
|
||||||
|
for (int i=0; i<3; ++i)
|
||||||
|
{
|
||||||
|
MyGUI::ImageBox* image = mMainWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(curX,250,16,16), MyGUI::Align::Default);
|
||||||
|
image->setImageTexture ("icons\\tx_goldicon.dds");
|
||||||
|
curX += 24+2;
|
||||||
|
mCoins.push_back(image);
|
||||||
|
}
|
||||||
|
|
||||||
open();
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LevelupDialog::setAttributeValues()
|
||||||
|
{
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||||
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||||
|
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||||
|
|
||||||
|
for (int i=0; i<8; ++i)
|
||||||
|
{
|
||||||
|
int val = creatureStats.getAttribute (i).getBase ();
|
||||||
|
if (std::find(mSpentAttributes.begin(), mSpentAttributes.end(), i) != mSpentAttributes.end())
|
||||||
|
{
|
||||||
|
val += pcStats.getLevelupAttributeMultiplier (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val >= 100)
|
||||||
|
val = 100;
|
||||||
|
|
||||||
|
mAttributeValues[i]->setCaption(boost::lexical_cast<std::string>(val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LevelupDialog::resetCoins ()
|
||||||
|
{
|
||||||
|
int curX = mMainWidget->getWidth()/2 - (16 + 2) * 1.5;
|
||||||
|
for (int i=0; i<3; ++i)
|
||||||
|
{
|
||||||
|
MyGUI::ImageBox* image = mCoins[i];
|
||||||
|
image->setCoord(MyGUI::IntCoord(curX,250,16,16));
|
||||||
|
curX += 24+2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LevelupDialog::assignCoins ()
|
||||||
|
{
|
||||||
|
resetCoins();
|
||||||
|
for (unsigned int i=0; i<mSpentAttributes.size(); ++i)
|
||||||
|
{
|
||||||
|
MyGUI::ImageBox* image = mCoins[i];
|
||||||
|
int attribute = mSpentAttributes[i];
|
||||||
|
|
||||||
|
int xdiff = mAttributeMultipliers[attribute]->getCaption() == "" ? 0 : 30;
|
||||||
|
|
||||||
|
MyGUI::IntPoint pos = mAttributes[attribute]->getAbsolutePosition() - mMainWidget->getAbsolutePosition() - MyGUI::IntPoint(24+xdiff,-4);
|
||||||
|
image->setPosition(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
setAttributeValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelupDialog::open()
|
void LevelupDialog::open()
|
||||||
{
|
{
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||||
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||||
|
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
|
|
||||||
mClassImage->setImageTexture ("textures\\levelup\\acrobat.dds");
|
mSpentAttributes.clear();
|
||||||
|
resetCoins();
|
||||||
|
|
||||||
|
setAttributeValues();
|
||||||
|
|
||||||
|
// set class image
|
||||||
|
const ESM::Class& playerClass = MWBase::Environment::get().getWorld ()->getPlayer ().getClass ();
|
||||||
|
// retrieve the ID to this class
|
||||||
|
std::string classId;
|
||||||
|
std::map<std::string, ESM::Class> list = MWBase::Environment::get().getWorld()->getStore ().classes.list;
|
||||||
|
for (std::map<std::string, ESM::Class>::iterator it = list.begin(); it != list.end(); ++it)
|
||||||
|
{
|
||||||
|
if (playerClass.name == it->second.name)
|
||||||
|
classId = it->first;
|
||||||
|
}
|
||||||
|
mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds");
|
||||||
|
|
||||||
/// \todo replace this with INI-imported texts
|
/// \todo replace this with INI-imported texts
|
||||||
int level = 2;
|
int level = creatureStats.getLevel ()+1;
|
||||||
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast<std::string>(level));
|
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast<std::string>(level));
|
||||||
|
|
||||||
|
for (int i=0; i<8; ++i)
|
||||||
|
{
|
||||||
|
MyGUI::TextBox* text = mAttributeMultipliers[i];
|
||||||
|
int mult = pcStats.getLevelupAttributeMultiplier (i);
|
||||||
|
text->setCaption(mult <= 1 ? "" : "x" + boost::lexical_cast<std::string>(mult));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}", std::vector<std::string>());
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||||
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||||
|
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||||
|
|
||||||
|
if (mSpentAttributes.size() < 3)
|
||||||
|
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}", std::vector<std::string>());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// increase attributes
|
||||||
|
for (int i=0; i<3; ++i)
|
||||||
|
{
|
||||||
|
MWMechanics::Stat<int>& attribute = creatureStats.getAttribute(mSpentAttributes[i]);
|
||||||
|
attribute.setBase (attribute.getBase () + pcStats.getLevelupAttributeMultiplier (mSpentAttributes[i]));
|
||||||
|
|
||||||
|
if (attribute.getBase() >= 100)
|
||||||
|
attribute.setBase(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "When you gain a level, in addition to increasing three primary attributes, your Health
|
||||||
|
// will automatically increase by 10% of your Endurance attribute. If you increased Endurance this level,
|
||||||
|
// the Health increase is calculated from the increased Endurance"
|
||||||
|
creatureStats.increaseLevelHealthBonus (creatureStats.getAttribute(ESM::Attribute::Endurance).getBase() * 0.1f);
|
||||||
|
|
||||||
|
creatureStats.setLevel (creatureStats.getLevel()+1);
|
||||||
|
pcStats.levelUp ();
|
||||||
|
|
||||||
|
mWindowManager.removeGuiMode (GM_Rest);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelupDialog::onAttributeClicked (MyGUI::Widget *sender)
|
void LevelupDialog::onAttributeClicked (MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
int index = *sender->getUserData<int>();
|
int attribute = *sender->getUserData<int>();
|
||||||
|
|
||||||
|
std::vector<int>::iterator found = std::find(mSpentAttributes.begin(), mSpentAttributes.end(), attribute);
|
||||||
|
if (found != mSpentAttributes.end())
|
||||||
|
mSpentAttributes.erase (found);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mSpentAttributes.size() == 3)
|
||||||
|
mSpentAttributes[2] = attribute;
|
||||||
|
else
|
||||||
|
mSpentAttributes.push_back(attribute);
|
||||||
|
}
|
||||||
|
assignCoins();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,20 @@ namespace MWGui
|
||||||
MyGUI::ImageBox* mClassImage;
|
MyGUI::ImageBox* mClassImage;
|
||||||
MyGUI::TextBox* mLevelText;
|
MyGUI::TextBox* mLevelText;
|
||||||
|
|
||||||
|
std::vector<MyGUI::Button*> mAttributes;
|
||||||
std::vector<MyGUI::TextBox*> mAttributeValues;
|
std::vector<MyGUI::TextBox*> mAttributeValues;
|
||||||
std::vector<MyGUI::TextBox*> mAttributeMultipliers;
|
std::vector<MyGUI::TextBox*> mAttributeMultipliers;
|
||||||
|
std::vector<MyGUI::ImageBox*> mCoins;
|
||||||
|
|
||||||
|
std::vector<int> mSpentAttributes;
|
||||||
|
|
||||||
void onOkButtonClicked (MyGUI::Widget* sender);
|
void onOkButtonClicked (MyGUI::Widget* sender);
|
||||||
void onAttributeClicked (MyGUI::Widget* sender);
|
void onAttributeClicked (MyGUI::Widget* sender);
|
||||||
|
|
||||||
|
void assignCoins();
|
||||||
|
void resetCoins();
|
||||||
|
|
||||||
|
void setAttributeValues();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,21 +134,21 @@ void ReviewDialog::setBirthSign(const std::string& signId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<int>& value)
|
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mHealth->setValue(value.getCurrent(), value.getModified());
|
mHealth->setValue(value.getCurrent(), value.getModified());
|
||||||
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
||||||
mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<int>& value)
|
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mMagicka->setValue(value.getCurrent(), value.getModified());
|
mMagicka->setValue(value.getCurrent(), value.getModified());
|
||||||
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
||||||
mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<int>& value)
|
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mFatigue->setValue(value.getCurrent(), value.getModified());
|
mFatigue->setValue(value.getCurrent(), value.getModified());
|
||||||
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
||||||
|
|
|
@ -35,9 +35,9 @@ namespace MWGui
|
||||||
void setClass(const ESM::Class& class_);
|
void setClass(const ESM::Class& class_);
|
||||||
void setBirthSign (const std::string &signId);
|
void setBirthSign (const std::string &signId);
|
||||||
|
|
||||||
void setHealth(const MWMechanics::DynamicStat<int>& value);
|
void setHealth(const MWMechanics::DynamicStat<float>& value);
|
||||||
void setMagicka(const MWMechanics::DynamicStat<int>& value);
|
void setMagicka(const MWMechanics::DynamicStat<float>& value);
|
||||||
void setFatigue(const MWMechanics::DynamicStat<int>& value);
|
void setFatigue(const MWMechanics::DynamicStat<float>& value);
|
||||||
|
|
||||||
void setAttribute(ESM::Attribute::AttributeID attributeId, const MWMechanics::Stat<int>& value);
|
void setAttribute(ESM::Attribute::AttributeID attributeId, const MWMechanics::Stat<int>& value);
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ void StatsWindow::setBar(const std::string& name, const std::string& tname, int
|
||||||
getWidget(pt, name);
|
getWidget(pt, name);
|
||||||
pt->setProgressRange(max);
|
pt->setProgressRange(max);
|
||||||
pt->setProgressPosition(val);
|
pt->setProgressPosition(val);
|
||||||
|
std::cout << "set bar " << name << val << " " << max << std::endl;
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << val << "/" << max;
|
out << val << "/" << max;
|
||||||
|
@ -137,7 +138,7 @@ void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<int>&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value)
|
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
static const char *ids[] =
|
static const char *ids[] =
|
||||||
{
|
{
|
||||||
|
@ -150,7 +151,7 @@ void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicSta
|
||||||
if (ids[i]==id)
|
if (ids[i]==id)
|
||||||
{
|
{
|
||||||
std::string id (ids[i]);
|
std::string id (ids[i]);
|
||||||
setBar (id, id + "T", value.getCurrent(), value.getModified());
|
setBar (id, id + "T", static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||||
|
|
||||||
// health, magicka, fatigue tooltip
|
// health, magicka, fatigue tooltip
|
||||||
MyGUI::Widget* w;
|
MyGUI::Widget* w;
|
||||||
|
@ -236,12 +237,21 @@ void StatsWindow::configureSkills (const std::vector<int>& major, const std::vec
|
||||||
|
|
||||||
void StatsWindow::onFrame ()
|
void StatsWindow::onFrame ()
|
||||||
{
|
{
|
||||||
if (mMainWidget->getVisible())
|
if (!mMainWidget->getVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
MWMechanics::NpcStats PCstats = MWWorld::Class::get(player).getNpcStats(player);
|
MWMechanics::NpcStats PCstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||||
|
|
||||||
|
// level progress
|
||||||
|
MyGUI::Widget* levelWidget;
|
||||||
|
for (int i=0; i<2; ++i)
|
||||||
|
{
|
||||||
|
getWidget(levelWidget, i==0 ? "Level_str" : "LevelText");
|
||||||
|
levelWidget->setUserString("RangePosition_LevelProgress", boost::lexical_cast<std::string>(PCstats.getLevelProgress()));
|
||||||
|
levelWidget->setUserString("Caption_LevelProgressText", boost::lexical_cast<std::string>(PCstats.getLevelProgress()) + "/10");
|
||||||
|
}
|
||||||
|
|
||||||
setFactions(PCstats.getFactionRanks());
|
setFactions(PCstats.getFactionRanks());
|
||||||
|
|
||||||
setBirthSign(MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
setBirthSign(MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace MWGui
|
||||||
|
|
||||||
/// Set value for the given ID.
|
/// Set value for the given ID.
|
||||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
||||||
void setValue (const std::string& id, const std::string& value);
|
void setValue (const std::string& id, const std::string& value);
|
||||||
void setValue (const std::string& id, int value);
|
void setValue (const std::string& id, int value);
|
||||||
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
||||||
|
|
|
@ -250,6 +250,7 @@ void WindowManager::updateVisible()
|
||||||
mAlchemyWindow->setVisible(false);
|
mAlchemyWindow->setVisible(false);
|
||||||
mSpellWindow->setVisible(false);
|
mSpellWindow->setVisible(false);
|
||||||
mQuickKeysMenu->setVisible(false);
|
mQuickKeysMenu->setVisible(false);
|
||||||
|
mLevelupDialog->setVisible(false);
|
||||||
|
|
||||||
mHud->setVisible(true);
|
mHud->setVisible(true);
|
||||||
|
|
||||||
|
@ -301,6 +302,9 @@ void WindowManager::updateVisible()
|
||||||
case GM_Alchemy:
|
case GM_Alchemy:
|
||||||
mAlchemyWindow->setVisible(true);
|
mAlchemyWindow->setVisible(true);
|
||||||
break;
|
break;
|
||||||
|
case GM_Rest:
|
||||||
|
mLevelupDialog->setVisible(true);
|
||||||
|
break;
|
||||||
case GM_Name:
|
case GM_Name:
|
||||||
case GM_Race:
|
case GM_Race:
|
||||||
case GM_Class:
|
case GM_Class:
|
||||||
|
@ -398,8 +402,9 @@ void WindowManager::setValue (int parSkill, const MWMechanics::Stat<float>& valu
|
||||||
mPlayerSkillValues[parSkill] = value;
|
mPlayerSkillValues[parSkill] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value)
|
void WindowManager::setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
|
std::cout << " set value " << id << value.getModified () << std::endl;
|
||||||
mStatsWindow->setValue (id, value);
|
mStatsWindow->setValue (id, value);
|
||||||
mHud->setValue (id, value);
|
mHud->setValue (id, value);
|
||||||
mCharGen->setValue(id, value);
|
mCharGen->setValue(id, value);
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace MWGui
|
||||||
///< Set value for the given ID.
|
///< Set value for the given ID.
|
||||||
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||||
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value);
|
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value);
|
||||||
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
||||||
virtual void setValue (const std::string& id, const std::string& value);
|
virtual void setValue (const std::string& id, const std::string& value);
|
||||||
virtual void setValue (const std::string& id, int value);
|
virtual void setValue (const std::string& id, int value);
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ namespace MWGui
|
||||||
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||||
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
||||||
std::map<int, MWMechanics::Stat<float> > mPlayerSkillValues;
|
std::map<int, MWMechanics::Stat<float> > mPlayerSkillValues;
|
||||||
MWMechanics::DynamicStat<int> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
MWMechanics::DynamicStat<float> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
||||||
|
|
||||||
|
|
||||||
MyGUI::Gui *mGui; // Gui
|
MyGUI::Gui *mGui; // Gui
|
||||||
|
|
|
@ -190,6 +190,9 @@ namespace MWInput
|
||||||
case A_ToggleWeapon:
|
case A_ToggleWeapon:
|
||||||
toggleWeapon ();
|
toggleWeapon ();
|
||||||
break;
|
break;
|
||||||
|
case A_Rest:
|
||||||
|
rest();
|
||||||
|
break;
|
||||||
case A_ToggleSpell:
|
case A_ToggleSpell:
|
||||||
toggleSpell ();
|
toggleSpell ();
|
||||||
break;
|
break;
|
||||||
|
@ -543,6 +546,12 @@ namespace MWInput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputManager::rest()
|
||||||
|
{
|
||||||
|
if (!mWindows.isGuiMode ())
|
||||||
|
mWindows.pushGuiMode (MWGui::GM_Rest);
|
||||||
|
}
|
||||||
|
|
||||||
void InputManager::screenshot()
|
void InputManager::screenshot()
|
||||||
{
|
{
|
||||||
mEngine.screenshot();
|
mEngine.screenshot();
|
||||||
|
|
|
@ -168,6 +168,7 @@ namespace MWInput
|
||||||
void toggleWalking();
|
void toggleWalking();
|
||||||
void toggleAutoMove();
|
void toggleAutoMove();
|
||||||
void exitNow();
|
void exitNow();
|
||||||
|
void rest();
|
||||||
|
|
||||||
void quickKey (int index);
|
void quickKey (int index);
|
||||||
void showQuickKeysMenu();
|
void showQuickKeysMenu();
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace MWMechanics
|
||||||
creatureStats.getMagicEffects().get (EffectKey (84)).mMagnitude * 0.1 + 0.5;
|
creatureStats.getMagicEffects().get (EffectKey (84)).mMagnitude * 0.1 + 0.5;
|
||||||
|
|
||||||
creatureStats.getHealth().setBase(
|
creatureStats.getHealth().setBase(
|
||||||
static_cast<int> (0.5 * (strength + endurance)));
|
static_cast<int> (0.5 * (strength + endurance)) + creatureStats.getLevelHealthBonus ());
|
||||||
|
|
||||||
creatureStats.getMagicka().setBase(
|
creatureStats.getMagicka().setBase(
|
||||||
static_cast<int> (intelligence + magickaFactor * intelligence));
|
static_cast<int> (intelligence + magickaFactor * intelligence));
|
||||||
|
|
|
@ -9,6 +9,21 @@
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
|
CreatureStats::CreatureStats()
|
||||||
|
: mLevelHealthBonus(0.f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatureStats::increaseLevelHealthBonus (float value)
|
||||||
|
{
|
||||||
|
mLevelHealthBonus += value;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CreatureStats::getLevelHealthBonus () const
|
||||||
|
{
|
||||||
|
return mLevelHealthBonus;
|
||||||
|
}
|
||||||
|
|
||||||
const AiSequence& CreatureStats::getAiSequence() const
|
const AiSequence& CreatureStats::getAiSequence() const
|
||||||
{
|
{
|
||||||
return mAiSequence;
|
return mAiSequence;
|
||||||
|
@ -40,17 +55,17 @@ namespace MWMechanics
|
||||||
return mAttributes[index];
|
return mAttributes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicStat<int> &CreatureStats::getHealth() const
|
const DynamicStat<float> &CreatureStats::getHealth() const
|
||||||
{
|
{
|
||||||
return mDynamic[0];
|
return mDynamic[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicStat<int> &CreatureStats::getMagicka() const
|
const DynamicStat<float> &CreatureStats::getMagicka() const
|
||||||
{
|
{
|
||||||
return mDynamic[1];
|
return mDynamic[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicStat<int> &CreatureStats::getFatigue() const
|
const DynamicStat<float> &CreatureStats::getFatigue() const
|
||||||
{
|
{
|
||||||
return mDynamic[2];
|
return mDynamic[2];
|
||||||
}
|
}
|
||||||
|
@ -103,22 +118,22 @@ namespace MWMechanics
|
||||||
return mAttributes[index];
|
return mAttributes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicStat<int> &CreatureStats::getHealth()
|
DynamicStat<float> &CreatureStats::getHealth()
|
||||||
{
|
{
|
||||||
return mDynamic[0];
|
return mDynamic[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicStat<int> &CreatureStats::getMagicka()
|
DynamicStat<float> &CreatureStats::getMagicka()
|
||||||
{
|
{
|
||||||
return mDynamic[1];
|
return mDynamic[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicStat<int> &CreatureStats::getFatigue()
|
DynamicStat<float> &CreatureStats::getFatigue()
|
||||||
{
|
{
|
||||||
return mDynamic[2];
|
return mDynamic[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicStat<int> &CreatureStats::getDynamic(int index)
|
DynamicStat<float> &CreatureStats::getDynamic(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index > 2) {
|
if (index < 0 || index > 2) {
|
||||||
throw std::runtime_error("dynamic stat index is out of range");
|
throw std::runtime_error("dynamic stat index is out of range");
|
||||||
|
@ -154,17 +169,17 @@ namespace MWMechanics
|
||||||
mAttributes[index] = value;
|
mAttributes[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::setHealth(const DynamicStat<int> &value)
|
void CreatureStats::setHealth(const DynamicStat<float> &value)
|
||||||
{
|
{
|
||||||
mDynamic[0] = value;
|
mDynamic[0] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::setMagicka(const DynamicStat<int> &value)
|
void CreatureStats::setMagicka(const DynamicStat<float> &value)
|
||||||
{
|
{
|
||||||
mDynamic[1] = value;
|
mDynamic[1] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::setFatigue(const DynamicStat<int> &value)
|
void CreatureStats::setFatigue(const DynamicStat<float> &value)
|
||||||
{
|
{
|
||||||
mDynamic[2] = value;
|
mDynamic[2] = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MWMechanics
|
||||||
class CreatureStats
|
class CreatureStats
|
||||||
{
|
{
|
||||||
Stat<int> mAttributes[8];
|
Stat<int> mAttributes[8];
|
||||||
DynamicStat<int> mDynamic[3]; // health, magicka, fatigue
|
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
|
||||||
int mLevel;
|
int mLevel;
|
||||||
Spells mSpells;
|
Spells mSpells;
|
||||||
ActiveSpells mActiveSpells;
|
ActiveSpells mActiveSpells;
|
||||||
|
@ -30,15 +30,18 @@ namespace MWMechanics
|
||||||
int mAlarm;
|
int mAlarm;
|
||||||
AiSequence mAiSequence;
|
AiSequence mAiSequence;
|
||||||
|
|
||||||
|
float mLevelHealthBonus;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CreatureStats();
|
||||||
|
|
||||||
const Stat<int> & getAttribute(int index) const;
|
const Stat<int> & getAttribute(int index) const;
|
||||||
|
|
||||||
const DynamicStat<int> & getHealth() const;
|
const DynamicStat<float> & getHealth() const;
|
||||||
|
|
||||||
const DynamicStat<int> & getMagicka() const;
|
const DynamicStat<float> & getMagicka() const;
|
||||||
|
|
||||||
const DynamicStat<int> & getFatigue() const;
|
const DynamicStat<float> & getFatigue() const;
|
||||||
|
|
||||||
const Spells & getSpells() const;
|
const Spells & getSpells() const;
|
||||||
|
|
||||||
|
@ -59,13 +62,13 @@ namespace MWMechanics
|
||||||
|
|
||||||
Stat<int> & getAttribute(int index);
|
Stat<int> & getAttribute(int index);
|
||||||
|
|
||||||
DynamicStat<int> & getHealth();
|
DynamicStat<float> & getHealth();
|
||||||
|
|
||||||
DynamicStat<int> & getMagicka();
|
DynamicStat<float> & getMagicka();
|
||||||
|
|
||||||
DynamicStat<int> & getFatigue();
|
DynamicStat<float> & getFatigue();
|
||||||
|
|
||||||
DynamicStat<int> & getDynamic(int index);
|
DynamicStat<float> & getDynamic(int index);
|
||||||
|
|
||||||
Spells & getSpells();
|
Spells & getSpells();
|
||||||
|
|
||||||
|
@ -76,11 +79,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
void setAttribute(int index, const Stat<int> &value);
|
void setAttribute(int index, const Stat<int> &value);
|
||||||
|
|
||||||
void setHealth(const DynamicStat<int> &value);
|
void setHealth(const DynamicStat<float> &value);
|
||||||
|
|
||||||
void setMagicka(const DynamicStat<int> &value);
|
void setMagicka(const DynamicStat<float> &value);
|
||||||
|
|
||||||
void setFatigue(const DynamicStat<int> &value);
|
void setFatigue(const DynamicStat<float> &value);
|
||||||
|
|
||||||
void setSpells(const Spells &spells);
|
void setSpells(const Spells &spells);
|
||||||
|
|
||||||
|
@ -104,6 +107,10 @@ namespace MWMechanics
|
||||||
|
|
||||||
float getFatigueTerm() const;
|
float getFatigueTerm() const;
|
||||||
///< Return effective fatigue
|
///< Return effective fatigue
|
||||||
|
|
||||||
|
// small hack to allow the fact that Health permanently increases by 10% of endurance on each level up
|
||||||
|
void increaseLevelHealthBonus(float value);
|
||||||
|
float getLevelHealthBonus() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,16 @@
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
MWMechanics::NpcStats::NpcStats()
|
MWMechanics::NpcStats::NpcStats()
|
||||||
: mMovementFlags (0), mDrawState (DrawState_Nothing)
|
: mMovementFlags (0), mDrawState (DrawState_Nothing)
|
||||||
{}
|
, mLevelProgress(0)
|
||||||
|
{
|
||||||
|
mSkillIncreases.resize (ESM::Attribute::Length);
|
||||||
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
|
mSkillIncreases[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
MWMechanics::DrawState_ MWMechanics::NpcStats::getDrawState() const
|
MWMechanics::DrawState_ MWMechanics::NpcStats::getDrawState() const
|
||||||
{
|
{
|
||||||
|
@ -122,7 +128,10 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
|
||||||
throw std::runtime_error ("invalid skill specialisation factor");
|
throw std::runtime_error ("invalid skill specialisation factor");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1.0 / (level +1) * (1.0 / skillFactor) * typeFactor * specialisationFactor;
|
//return 1.0 / (level +1) * (1.0 / (skillFactor)) * typeFactor * specialisationFactor;
|
||||||
|
|
||||||
|
///FIXME: TEST FOR FASTER LEVELLING
|
||||||
|
return 1.0 / (level +1) * (1.0 / (skillFactor/100)) * typeFactor * specialisationFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWMechanics::NpcStats::useSkill (int skillIndex, const ESM::Class& class_, int usageType)
|
void MWMechanics::NpcStats::useSkill (int skillIndex, const ESM::Class& class_, int usageType)
|
||||||
|
@ -134,7 +143,64 @@ void MWMechanics::NpcStats::useSkill (int skillIndex, const ESM::Class& class_,
|
||||||
base += getSkillGain (skillIndex, class_, usageType);
|
base += getSkillGain (skillIndex, class_, usageType);
|
||||||
|
|
||||||
if (static_cast<int> (base)!=level)
|
if (static_cast<int> (base)!=level)
|
||||||
|
{
|
||||||
|
// skill leveled up
|
||||||
base = level+1;
|
base = level+1;
|
||||||
|
|
||||||
|
// if this is a major or minor skill of the class, increase level progress
|
||||||
|
//bool levelProgress = false;
|
||||||
|
bool levelProgress = true;
|
||||||
|
for (int i=0; i<2; ++i)
|
||||||
|
for (int j=0; j<5; ++j)
|
||||||
|
{
|
||||||
|
int skill = class_.data.skills[j][i];
|
||||||
|
if (skill == skillIndex)
|
||||||
|
levelProgress = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!levelProgress)
|
||||||
|
std::cout <<"This is not a level skilL" << std::endl;
|
||||||
|
|
||||||
|
mLevelProgress += levelProgress;
|
||||||
|
|
||||||
|
// check the attribute this skill belongs to
|
||||||
|
const ESM::Skill* skill = MWBase::Environment::get().getWorld ()->getStore ().skills.find(skillIndex);
|
||||||
|
++mSkillIncreases[skill->data.attribute];
|
||||||
|
|
||||||
|
if (mLevelProgress >= 10)
|
||||||
|
{
|
||||||
|
// levelup is possible now
|
||||||
|
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}", std::vector<std::string>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getSkill (skillIndex).setBase (base);
|
getSkill (skillIndex).setBase (base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MWMechanics::NpcStats::getLevelProgress () const
|
||||||
|
{
|
||||||
|
return mLevelProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWMechanics::NpcStats::levelUp()
|
||||||
|
{
|
||||||
|
mLevelProgress -= 10;
|
||||||
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
|
mSkillIncreases[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MWMechanics::NpcStats::getLevelupAttributeMultiplier(int attribute) const
|
||||||
|
{
|
||||||
|
// Source: http://www.uesp.net/wiki/Morrowind:Level#How_to_Level_Up
|
||||||
|
int num = mSkillIncreases[attribute];
|
||||||
|
if (num <= 1)
|
||||||
|
return 1;
|
||||||
|
else if (num <= 4)
|
||||||
|
return 2;
|
||||||
|
else if (num <= 7)
|
||||||
|
return 3;
|
||||||
|
else if (num <= 9)
|
||||||
|
return 4;
|
||||||
|
else
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "stat.hpp"
|
#include "stat.hpp"
|
||||||
#include "drawstate.hpp"
|
#include "drawstate.hpp"
|
||||||
|
@ -45,6 +46,10 @@ namespace MWMechanics
|
||||||
unsigned int mMovementFlags;
|
unsigned int mMovementFlags;
|
||||||
Stat<float> mSkill[27];
|
Stat<float> mSkill[27];
|
||||||
|
|
||||||
|
int mLevelProgress; // 0-10
|
||||||
|
|
||||||
|
std::vector<int> mSkillIncreases; // number of skill increases for each attribute
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NpcStats();
|
NpcStats();
|
||||||
|
@ -73,6 +78,12 @@ namespace MWMechanics
|
||||||
|
|
||||||
void useSkill (int skillIndex, const ESM::Class& class_, int usageType = -1);
|
void useSkill (int skillIndex, const ESM::Class& class_, int usageType = -1);
|
||||||
///< Increase skill by usage.
|
///< Increase skill by usage.
|
||||||
|
|
||||||
|
int getLevelProgress() const;
|
||||||
|
|
||||||
|
int getLevelupAttributeMultiplier(int attribute) const;
|
||||||
|
|
||||||
|
void levelUp();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,4 +183,8 @@ op 0x2000172: GetStartingAngle
|
||||||
op 0x2000173: GetStartingAngle, explicit reference
|
op 0x2000173: GetStartingAngle, explicit reference
|
||||||
op 0x2000174: ToggleVanityMode
|
op 0x2000174: ToggleVanityMode
|
||||||
op 0x2000175-0x200018B: Get controls disabled
|
op 0x2000175-0x200018B: Get controls disabled
|
||||||
opcodes 0x200018C-0x3ffffff unused
|
op 0x200018C: GetLevel
|
||||||
|
op 0x200018D: GetLevel, explicit reference
|
||||||
|
op 0x200018E: SetLevel
|
||||||
|
op 0x200018F: SetLevel, explicit reference
|
||||||
|
opcodes 0x200018F-0x3ffffff unused
|
||||||
|
|
|
@ -32,6 +32,42 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
namespace Stats
|
namespace Stats
|
||||||
{
|
{
|
||||||
|
template<class R>
|
||||||
|
class OpGetLevel : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
|
Interpreter::Type_Integer value =
|
||||||
|
MWWorld::Class::get (ptr)
|
||||||
|
.getCreatureStats (ptr)
|
||||||
|
.getLevel();
|
||||||
|
|
||||||
|
runtime.push (value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class R>
|
||||||
|
class OpSetLevel : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
MWWorld::Class::get (ptr)
|
||||||
|
.getCreatureStats (ptr)
|
||||||
|
.setLevel(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<class R>
|
template<class R>
|
||||||
class OpGetAttribute : public Interpreter::Opcode0
|
class OpGetAttribute : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
|
@ -592,6 +628,11 @@ namespace MWScript
|
||||||
const int opcodeModDisposition = 0x200014d;
|
const int opcodeModDisposition = 0x200014d;
|
||||||
const int opcodeModDispositionExplicit = 0x200014e;
|
const int opcodeModDispositionExplicit = 0x200014e;
|
||||||
|
|
||||||
|
const int opcodeGetLevel = 0x200018c;
|
||||||
|
const int opcodeGetLevelExplicit = 0x200018d;
|
||||||
|
const int opcodeSetLevel = 0x200018e;
|
||||||
|
const int opcodeSetLevelExplicit = 0x200018f;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
static const char *attributes[numberOfAttributes] =
|
static const char *attributes[numberOfAttributes] =
|
||||||
|
@ -674,6 +715,9 @@ namespace MWScript
|
||||||
extensions.registerInstruction("moddisposition","l",opcodeModDisposition,
|
extensions.registerInstruction("moddisposition","l",opcodeModDisposition,
|
||||||
opcodeModDispositionExplicit);
|
opcodeModDispositionExplicit);
|
||||||
extensions.registerFunction("getpcrank",'l',"/S",opcodeGetPCRank,opcodeGetPCRankExplicit);
|
extensions.registerFunction("getpcrank",'l',"/S",opcodeGetPCRank,opcodeGetPCRankExplicit);
|
||||||
|
|
||||||
|
extensions.registerInstruction("setlevel", "l", opcodeSetLevel, opcodeSetLevelExplicit);
|
||||||
|
extensions.registerFunction("getlevel", 'l', "", opcodeGetLevel, opcodeGetLevelExplicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -745,6 +789,12 @@ namespace MWScript
|
||||||
interpreter.installSegment5(opcodeModDispositionExplicit,new OpModDisposition<ExplicitRef>);
|
interpreter.installSegment5(opcodeModDispositionExplicit,new OpModDisposition<ExplicitRef>);
|
||||||
interpreter.installSegment3(opcodeGetPCRank,new OpGetPCRank<ImplicitRef>);
|
interpreter.installSegment3(opcodeGetPCRank,new OpGetPCRank<ImplicitRef>);
|
||||||
interpreter.installSegment3(opcodeGetPCRankExplicit,new OpGetPCRank<ExplicitRef>);
|
interpreter.installSegment3(opcodeGetPCRankExplicit,new OpGetPCRank<ExplicitRef>);
|
||||||
|
|
||||||
|
interpreter.installSegment5 (opcodeGetLevel, new OpGetLevel<ImplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeGetLevelExplicit, new OpGetLevel<ExplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeSetLevel, new OpSetLevel<ImplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeSetLevelExplicit, new OpSetLevel<ExplicitRef>);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 440 438" name="_Main">
|
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 440 438" name="_Main">
|
||||||
|
|
||||||
<Widget type="Widget" skin="MW_Box" position="28 14 391 198">
|
<Widget type="Widget" skin="MW_Box" position="28 14 391 198">
|
||||||
<Widget type="ImageBox" skin="ImageBox" name="ClassImage" position="0 0 391 198">
|
<Widget type="ImageBox" skin="ImageBox" name="ClassImage" position="4 4 383 190">
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeStrength}"/>
|
<Property key="Caption" value="#{sAttributeStrength}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal1">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal1">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -45,7 +44,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeIntelligence}"/>
|
<Property key="Caption" value="#{sAttributeIntelligence}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal2">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal2">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -59,7 +57,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeWillpower}"/>
|
<Property key="Caption" value="#{sAttributeWillpower}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal3">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal3">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -73,7 +70,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeAgility}"/>
|
<Property key="Caption" value="#{sAttributeAgility}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal4">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal4">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -88,7 +84,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeSpeed}"/>
|
<Property key="Caption" value="#{sAttributeSpeed}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal5">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal5">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -102,7 +97,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeEndurance}"/>
|
<Property key="Caption" value="#{sAttributeEndurance}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal6">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal6">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -116,7 +110,6 @@
|
||||||
<Property key="Caption" value="#{sAttributePersonality}"/>
|
<Property key="Caption" value="#{sAttributePersonality}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal7">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal7">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
@ -130,7 +123,6 @@
|
||||||
<Property key="Caption" value="#{sAttributeLuck}"/>
|
<Property key="Caption" value="#{sAttributeLuck}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal8">
|
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal8">
|
||||||
<Property key="Caption" value="54"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
Loading…
Reference in a new issue