2011-01-02 16:17:33 +00:00
|
|
|
#ifndef MWGUI_STATS_WINDOW_H
|
|
|
|
#define MWGUI_STATS_WINDOW_H
|
|
|
|
|
2012-10-01 15:17:04 +00:00
|
|
|
#include "../mwworld/esmstore.hpp"
|
2011-01-02 16:17:33 +00:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "../mwmechanics/stat.hpp"
|
2012-04-01 17:36:57 +00:00
|
|
|
#include "window_pinnable_base.hpp"
|
2011-02-21 19:36:35 +00:00
|
|
|
|
2011-01-02 16:17:33 +00:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2011-02-21 19:36:35 +00:00
|
|
|
class WindowManager;
|
2011-01-02 16:17:33 +00:00
|
|
|
|
2012-04-01 17:36:57 +00:00
|
|
|
class StatsWindow : public WindowPinnableBase
|
2011-01-02 16:17:33 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-05-19 12:19:21 +00:00
|
|
|
typedef std::map<std::string, int> FactionList;
|
2011-01-02 16:17:33 +00:00
|
|
|
|
|
|
|
typedef std::vector<int> SkillList;
|
|
|
|
|
2012-08-12 16:11:09 +00:00
|
|
|
StatsWindow(MWBase::WindowManager& parWindowManager);
|
2011-01-02 16:17:33 +00:00
|
|
|
|
2012-05-19 12:19:21 +00:00
|
|
|
/// automatically updates all the data in the stats window, but only if it has changed.
|
|
|
|
void onFrame();
|
|
|
|
|
2011-01-02 16:17:33 +00:00
|
|
|
void setBar(const std::string& name, const std::string& tname, int val, int max);
|
|
|
|
void setPlayerName(const std::string& playerName);
|
|
|
|
|
|
|
|
/// Set value for the given ID.
|
|
|
|
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
2012-09-15 15:12:42 +00:00
|
|
|
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
2011-01-02 16:17:33 +00:00
|
|
|
void setValue (const std::string& id, const std::string& value);
|
|
|
|
void setValue (const std::string& id, int value);
|
2011-01-02 16:35:03 +00:00
|
|
|
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
2011-01-02 16:17:33 +00:00
|
|
|
|
|
|
|
void configureSkills (const SkillList& major, const SkillList& minor);
|
2012-11-23 18:56:45 +00:00
|
|
|
void setReputation (int reputation) { if (reputation != mReputation) mChanged = true; this->mReputation = reputation; }
|
|
|
|
void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
|
2011-01-02 16:17:33 +00:00
|
|
|
void updateSkillArea();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
|
|
|
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
|
|
|
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
2012-05-20 23:58:11 +00:00
|
|
|
MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
2012-06-06 18:29:30 +00:00
|
|
|
MyGUI::Widget* addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
2011-01-02 16:17:33 +00:00
|
|
|
|
2012-05-19 12:55:09 +00:00
|
|
|
void setFactions (const FactionList& factions);
|
2012-11-28 01:15:34 +00:00
|
|
|
void setExpelled (const std::set<std::string>& expelled);
|
2012-05-19 12:55:09 +00:00
|
|
|
void setBirthSign (const std::string &signId);
|
|
|
|
|
2011-03-12 12:54:00 +00:00
|
|
|
void onWindowResize(MyGUI::Window* window);
|
2012-05-11 06:45:03 +00:00
|
|
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
2011-01-02 16:17:33 +00:00
|
|
|
|
2012-07-13 10:51:58 +00:00
|
|
|
static const int sLineHeight;
|
2011-01-02 16:17:33 +00:00
|
|
|
|
2012-05-11 06:15:22 +00:00
|
|
|
MyGUI::Widget* mLeftPane;
|
|
|
|
MyGUI::Widget* mRightPane;
|
|
|
|
|
2012-09-09 21:50:57 +00:00
|
|
|
MyGUI::ScrollView* mSkillView;
|
2012-07-13 10:51:58 +00:00
|
|
|
int mLastPos, mClientHeight;
|
2011-01-02 16:17:33 +00:00
|
|
|
|
2012-07-13 10:51:58 +00:00
|
|
|
SkillList mMajorSkills, mMinorSkills, mMiscSkills;
|
|
|
|
std::map<int, MWMechanics::Stat<float> > mSkillValues;
|
|
|
|
std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
|
2013-03-03 12:11:02 +00:00
|
|
|
std::map<std::string, MyGUI::Widget*> mFactionWidgetMap;
|
2012-05-19 12:19:21 +00:00
|
|
|
FactionList mFactions; ///< Stores a list of factions and the current rank
|
2012-07-13 10:51:58 +00:00
|
|
|
std::string mBirthSignId;
|
|
|
|
int mReputation, mBounty;
|
2013-03-03 12:11:02 +00:00
|
|
|
std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
|
2012-11-28 01:15:34 +00:00
|
|
|
std::set<std::string> mExpelled;
|
2012-04-05 22:17:23 +00:00
|
|
|
|
2012-05-19 12:19:21 +00:00
|
|
|
bool mChanged;
|
|
|
|
|
2012-04-05 22:17:23 +00:00
|
|
|
protected:
|
|
|
|
virtual void onPinToggled();
|
2011-01-02 16:17:33 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|