ManaPlus
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

#include <statuswindow.h>

Inheritance diagram for StatusWindow:
Window ActionListener AttributeListener BasicContainer2 MouseListener WidgetListener BasicContainer Widget WidgetDeathListener Widget2

Public Member Functions

 StatusWindow ()
 
 ~StatusWindow ()
 
void setPointsNeeded (const AttributesT id, const int needed)
 
void updateMPBar (ProgressBar *bar, const bool showMax) const
 
void updateStatusBar (ProgressBar *const bar, const bool percent) const
 
void action (const ActionEvent &event)
 
void attributeChanged (const AttributesT id, const int64_t oldVal, const int64_t newVal)
 
void updateLevelLabel ()
 
- Public Member Functions inherited from Window
 Window (const std::string &caption, const Modal modal, Window *const parent, std::string skin)
 
 ~Window ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void setContentSize (int width, int height)
 
void setLocationRelativeTo (const Widget *const widget)
 
void setLocationHorisontallyRelativeTo (const Widget *const widget)
 
void setLocationRelativeTo (const ImagePosition::Type &position, int offsetX, int offsetY)
 
void setResizable (const bool resize)
 
void redraw ()
 
void widgetResized (const Event &event)
 
void widgetMoved (const Event &event)
 
void widgetHidden (const Event &event)
 
void setCloseButton (const bool flag)
 
bool getCloseButton () const
 
void setAllowClose (const bool b)
 
bool getAlowClose () const
 
bool isResizable () const
 
void setMinWidth (const int width)
 
int getMinWidth () const
 
void setMinHeight (const int height)
 
int getMinHeight () const
 
void setMaxWidth (const int width)
 
int getMaxWidth () const
 
void setMaxHeight (const int height)
 
int getMaxHeight () const
 
void setShowTitle (bool flag)
 
void setStickyButton (const bool flag)
 
void setSticky (const bool sticky)
 
bool isSticky () const
 
void setStickyButtonLock (const bool sticky)
 
bool isStickyButtonLock () const
 
virtual void setVisible (Visible visible)
 
void setVisible (const Visible visible, const bool forceSticky)
 
bool isDefaultVisible () const
 
void setDefaultVisible (const bool save)
 
bool willSaveVisible () const
 
void setSaveVisible (const bool save)
 
void postInit ()
 
WindowgetParentWindow () const
 
virtual void scheduleDelete ()
 
void mousePressed (MouseEvent &event)
 
void mouseDragged (MouseEvent &event)
 
void mouseMoved (MouseEvent &event)
 
void mouseReleased (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
void mouseEntered (MouseEvent &event)
 
void updateResizeHandler (MouseEvent &event)
 
void setWindowName (const std::string &name)
 
const std::string & getWindowName () const
 
void loadWindowState ()
 
void saveWindowState ()
 
void setDefaultSize (const int defaultX, const int defaultY, int defaultWidth, int defaultHeight)
 
void setDefaultSize ()
 
void setDefaultSize (const int defaultWidth, const int defaultHeight, const ImagePosition::Type &position, const int offsetx, const int offsetY)
 
virtual void resetToDefaultSize ()
 
void adjustPositionAfterResize (const int oldScreenWidth, const int oldScreenHeight)
 
LayoutgetLayout ()
 
void clearLayout ()
 
void reflowLayout (int w, int h)
 
LayoutCellplace (const int x, const int y, Widget *const wg, const int w, const int h)
 
ContainerPlacer getPlacer (const int x, const int y)
 
void center ()
 
void centerHorisontally ()
 
virtual void close ()
 
void setModal (const Modal modal)
 
Rect getWindowArea () const
 
bool isResizeAllowed (const MouseEvent &event) const
 
void setCaptionFont (Font *font)
 
void enableVisibleSound (bool b)
 
bool isWindowVisible () const
 
void setPadding (int padding)
 
int getPadding () const
 
void setTitleBarHeight (unsigned int height)
 
unsigned int getTitleBarHeight () const
 
void setCaption (const std::string &caption)
 
const std::string & getCaption () const
 
void setAlignment (Graphics::Alignment alignment)
 
Graphics::Alignment getAlignment () const
 
void setMovable (Move movable)
 
bool isMovable () const
 
Rect getChildrenArea ()
 
virtual void resizeToContent ()
 
- Public Member Functions inherited from BasicContainer2
 BasicContainer2 (const Widget2 *const widget)
 
 ~BasicContainer2 ()
 
void setOpaque (Opaque opaque)
 
bool isOpaque () const
 
virtual void add (Widget *const widget)
 
void addXY (Widget *const widget, const int x, const int y)
 
- Public Member Functions inherited from BasicContainer
 BasicContainer (const Widget2 *const widget)
 
 ~BasicContainer ()
 
void showWidgetPart (Widget *const widget, const Rect &area)
 
void moveToTop (Widget *const widget)
 
void moveToBottom (Widget *const widget)
 
void focusNext ()
 
void focusPrevious ()
 
void logic ()
 
void setFocusHandler (FocusHandler *const focusHandler)
 
void setInternalFocusHandler (FocusHandler *const focusHandler)
 
WidgetgetWidgetAt (int x, int y)
 
void death (const Event &event)
 
WidgetfindFirstWidget (const std::set< Widget *> &list)
 
void add (Widget *const widget)
 
virtual void remove (Widget *const widget)
 
virtual void clear ()
 
- Public Member Functions inherited from Widget
 Widget (const Widget2 *const widget)
 
 ~Widget ()
 
virtual void drawFrame (Graphics *graphics)
 
virtual void safeDrawFrame (Graphics *graphics)
 
void setFrameSize (const unsigned int frameSize)
 
unsigned int getFrameSize () const
 
WidgetgetParent () const
 
void setWidth (const int width)
 
int getWidth () const
 
void setHeight (const int height)
 
int getHeight () const
 
void setSize (const int width, const int height)
 
void setX (const int x)
 
int getX () const
 
void setY (const int y)
 
int getY () const
 
void setPosition (const int x, const int y)
 
void setDimension (const Rect &dimension)
 
const RectgetDimension () const
 
void setFocusable (const bool focusable)
 
bool isFocusable () const
 
virtual bool isFocused () const
 
void setEnabled (const bool enabled)
 
bool isEnabled () const
 
void setVisible (Visible visible)
 
bool isVisible () const
 
void setBaseColor (const Color &color)
 
const ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
FocusHandlergetFocusHandler ()
 
void addActionListener (ActionListener *const actionListener)
 
void removeActionListener (ActionListener *const actionListener)
 
void addDeathListener (WidgetDeathListener *const deathListener)
 
void removeDeathListener (WidgetDeathListener *const deathListener)
 
void addMouseListener (MouseListener *const mouseListener)
 
void removeMouseListener (MouseListener *const mouseListener)
 
void addKeyListener (KeyListener *const keyListener)
 
void removeKeyListener (KeyListener *const keyListener)
 
void addFocusListener (FocusListener *const focusListener)
 
void removeFocusListener (FocusListener *const focusListener)
 
void addWidgetListener (WidgetListener *const widgetListener)
 
void removeWidgetListener (WidgetListener *const widgetListener)
 
void setActionEventId (const std::string &actionEventId)
 
const std::string & getActionEventId () const
 
virtual void getAbsolutePosition (int &x, int &y) const
 
virtual void setParent (Widget *parent)
 
FontgetFont () const
 
void setFont (Font *const font)
 
virtual void fontChanged ()
 
bool isTabInEnabled () const
 
void setTabInEnabled (const bool enabled)
 
bool isTabOutEnabled () const
 
void setTabOutEnabled (const bool enabled)
 
void requestModalFocus ()
 
virtual void requestModalMouseInputFocus ()
 
virtual void releaseModalFocus ()
 
virtual void releaseModalMouseInputFocus ()
 
virtual bool isModalFocused () const
 
virtual bool isModalMouseInputFocused () const
 
const std::list< MouseListener * > & getMouseListeners () const A_CONST
 
const std::list< KeyListener * > & getKeyListeners () const A_CONST
 
const std::list< FocusListener * > & getFocusListeners () const A_CONST
 
virtual FocusHandlergetInternalFocusHandler ()
 
void setInternalFocusHandler (FocusHandler *const internalFocusHandler)
 
void setId (const std::string &id)
 
const std::string & getId () const
 
virtual void showPart (const Rect &rectangle)
 
bool isAllowLogic () const
 
void setMouseConsume (const bool b)
 
bool isMouseConsume () const
 
void setRedraw (const bool b)
 
virtual bool isSelectable () const
 
void setSelectable (const bool selectable)
 
void windowResized ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
 
const ColorgetThemeCharColor (const signed char c, bool &valid) const A_INLINE
 
virtual void setWidget2 (const Widget2 *const widget)
 
void setPalette (int palette)
 
void checkPalette ()
 
void setForegroundColor2 (const Color &color)
 
WidgetgetWindow () const
 
virtual void setWindow (Widget *const window)
 
- Public Member Functions inherited from WidgetDeathListener
virtual ~WidgetDeathListener ()
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetShown (const Event &event)
 
- Public Member Functions inherited from ActionListener
virtual ~ActionListener ()
 
- Public Member Functions inherited from AttributeListener
 AttributeListener ()
 
virtual ~ AttributeListener ()
 

Static Public Member Functions

static void updateHPBar (ProgressBar *const bar, const bool showMax)
 
static void updateJobBar (ProgressBar *const bar, const bool percent)
 
static void updateXPBar (ProgressBar *const bar, const bool percent)
 
static void updateWeightBar (ProgressBar *const bar)
 
static void updateInvSlotsBar (ProgressBar *const bar)
 
static void updateMoneyBar (ProgressBar *const bar)
 
static void updateArrowsBar (ProgressBar *const bar)
 
static void updateProgressBar (ProgressBar *const bar, const int64_t value, const int64_t max, const bool percent)
 
static void updateProgressBar (ProgressBar *const bar, const AttributesT id, const bool percent)
 
- Static Public Member Functions inherited from Window
static void setWindowContainer (WindowContainer *const windowContainer)
 
- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Static Public Member Functions inherited from AttributeListener
static void distributeEvent (const AttributesT id, const int64_t oldVal, const int64_t newVal)
 
static void addListener (AttributeListener *const listener)
 
static void removeListener (const AttributeListener *const listener)
 

Private Member Functions

void addTabs ()
 
void addTab (const std::string &name)
 
void addTabBasic (const std::string &name)
 

Static Private Member Functions

static std::string translateLetter (const char *const letters)
 
static std::string translateLetter2 (const std::string &letters)
 

Private Attributes

std::vector< StatsPage * > mPages
 
TabbedAreamTabs
 
LabelmLvlLabel
 
LabelmMoneyLabel
 
LabelmHpLabel
 
LabelmMpLabel
 
LabelmXpLabel
 
ProgressBarmHpBar
 
ProgressBarmMpBar
 
ProgressBarmXpBar
 
LabelmJobLvlLabel
 
LabelmJobLabel
 
ProgressBarmJobBar
 
StatsPageBasicmBasicStatsPage
 
ButtonmCopyButton
 

Additional Inherited Members

- Data Fields inherited from Widget
Visible mVisible
 
- Protected Types inherited from BasicContainer
typedef std::vector< Widget * > WidgetList
 
typedef WidgetList::iterator WidgetListIterator
 
typedef WidgetList::const_iterator WidgetListConstIterator
 
typedef WidgetList::reverse_iterator WidgetListReverseIterator
 
typedef WidgetList::const_reverse_iterator WidgetListCReverseIterator
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 
- Protected Member Functions inherited from Window
bool canMove () const
 
int getOption (const std::string &name, const int def) const
 
bool getOptionBool (const std::string &name, const bool def) const
 
void setTitlePadding (const int p)
 
int getTitlePadding () const
 
- Protected Member Functions inherited from BasicContainer
virtual void drawChildren (Graphics *const graphics)
 
virtual void safeDrawChildren (Graphics *const graphics)
 
virtual void logicChildren ()
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from WidgetDeathListener
 WidgetDeathListener ()
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from WidgetListener
 WidgetListener ()
 
- Protected Member Functions inherited from ActionListener
 ActionListener ()
 
- Protected Attributes inherited from Window
std::string mCaption
 
Graphics::Alignment mAlignment
 
int mPadding
 
unsigned int mTitleBarHeight
 
Move mMovable
 
int mDragOffsetX
 
int mDragOffsetY
 
bool mMoved
 
SkinmSkin
 
int mDefaultX
 
int mDefaultY
 
int mDefaultWidth
 
int mDefaultHeight
 
int mCaptionOffsetX
 
int mCaptionOffsetY
 
bool mShowTitle
 
bool mLastRedraw
 
- Protected Attributes inherited from BasicContainer2
Opaque mOpaque
 
- Protected Attributes inherited from BasicContainer
WidgetList mWidgets
 
WidgetList mLogicWidgets
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Detailed Description

The player status dialog.

Definition at line 43 of file statuswindow.h.

Constructor & Destructor Documentation

◆ StatusWindow()

StatusWindow::StatusWindow ( )

Constructor.

Definition at line 66 of file statuswindow.cpp.

References _, addTabs(), Label::adjustSize(), Net::PlayerHandler::canUseMagic(), Window::enableVisibleSound(), UnitsDb::formatCurrency(), PlayerInfo::getAttribute(), PlayerInfo::getAttribute64(), Widget::getHeight(), Window::getLayout(), Being::getName(), Being::getRaceName(), TabbedArea::getTabContainer(), Widget2::getThemeColor(), ConfigurationObject::getValueBool(), TabbedArea::getWidgetContainer(), Widget::getWidth(), ThemeColorId::HP_BAR, ThemeColorId::HP_BAR_OUTLINE, ThemeColorId::JOB_BAR, ThemeColorId::JOB_BAR_OUTLINE, Window::loadWindowState(), localPlayer, mCopyButton, mHpBar, mHpLabel, mJobBar, mJobLabel, mJobLvlLabel, mLvlLabel, mMoneyLabel, mMpBar, mMpLabel, Attributes::MONEY, ThemeColorId::MP_BAR, ThemeColorId::MP_BAR_OUTLINE, mTabs, mXpBar, mXpLabel, ThemeColorId::NO_MP_BAR, ThemeColorId::NO_MP_BAR_OUTLINE, Window::place(), Attributes::PLAYER_EXP, Attributes::PLAYER_EXP_NEEDED, Attributes::PLAYER_HP, Attributes::PLAYER_MAX_HP, Attributes::PLAYER_MAX_MP, playerHandler, ProgressColorId::PROG_EXP, ProgressColorId::PROG_HP, ProgressColorId::PROG_JOB, ProgressColorId::PROG_MP, ProgressColorId::PROG_NO_MP, SetupWindow::registerWindowForReset(), serverConfig, LayoutType::SET, Label::setCaption(), Window::setCaption(), Window::setCloseButton(), ProgressBar::setColor(), Window::setDefaultSize(), LayoutCell::setPadding(), Window::setResizable(), LayoutCell::setRowHeight(), Window::setSaveVisible(), Widget::setSelectable(), Window::setStickyButtonLock(), setupWindow, Window::setWindowName(), strprintf(), updateHPBar(), updateLevelLabel(), updateMPBar(), updateXPBar(), windowContainer, ThemeColorId::XP_BAR, and ThemeColorId::XP_BAR_OUTLINE.

66  :
67  Window(localPlayer != nullptr ? localPlayer->getName() :
68  "?", Modal_false, nullptr, "status.xml"),
71  mPages(),
73  // TRANSLATORS: status window label
74  mLvlLabel(new Label(this, strprintf(_("Level: %d"), 0))),
75  // TRANSLATORS: status window label
76  mMoneyLabel(new Label(this, strprintf(_("Money: %s"), ""))),
77  // TRANSLATORS: status window label
78  mHpLabel(new Label(this, _("HP:"))),
79  mMpLabel(nullptr),
80  // TRANSLATORS: status window label
81  mXpLabel(new Label(this, _("Exp:"))),
82  mHpBar(nullptr),
83  mMpBar(nullptr),
84  mXpBar(nullptr),
85  mJobLvlLabel(nullptr),
86  mJobLabel(nullptr),
87  mJobBar(nullptr),
89  // TRANSLATORS: status window button
90  mCopyButton(new Button(this, _("Copy to chat"), "copy", BUTTON_SKIN, this))
91 {
92  setWindowName("Status");
93  if (setupWindow != nullptr)
95  setResizable(true);
96  setCloseButton(true);
97  setSaveVisible(true);
98  setStickyButtonLock(true);
100  (windowContainer->getHeight() - 500) / 2,
101  480,
102  500);
103 
104  mTabs->setSelectable(false);
107 
108  if ((localPlayer != nullptr) && !localPlayer->getRaceName().empty())
109  {
110  setCaption(strprintf("%s (%s)", localPlayer->getName().c_str(),
111  localPlayer->getRaceName().c_str()));
112  }
113 
115  if (max == 0)
116  max = 1;
117 
118  mHpBar = new ProgressBar(this,
120  / static_cast<float>(max),
121  80,
122  0,
124  "hpprogressbar.xml", "hpprogressbar_fill.xml");
127  mHpBar->setSelectable(false);
128 
129  const int64_t maxExp = PlayerInfo::getAttribute64(
131  mXpBar = new ProgressBar(this,
132  maxExp != 0 ?
133  static_cast<float>(PlayerInfo::getAttribute64(
135  static_cast<float>(maxExp) : static_cast<float>(0),
136  80,
137  0,
139  "xpprogressbar.xml", "xpprogressbar_fill.xml");
142  mXpBar->setSelectable(false);
143 
144  const bool job = serverConfig.getValueBool("showJob", true);
145 
147  // TRANSLATORS: status window label
148  mMpLabel = new Label(this, _("MP:"));
149  const bool useMagic = playerHandler->canUseMagic();
150  mMpBar = new ProgressBar(this,
151  max != 0 ? static_cast<float>(PlayerInfo::getAttribute(
152  Attributes::PLAYER_MAX_MP)) / static_cast<float>(max)
153  : static_cast<float>(0),
154  80,
155  0,
157  useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml",
158  useMagic ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml");
159  mMpBar->setSelectable(false);
160  if (useMagic)
161  {
164  }
165  else
166  {
169  }
170 
171  place(0, 0, mLvlLabel, 3, 1);
172  place(0, 1, mHpLabel, 1, 1).setPadding(3);
173  place(1, 1, mHpBar, 4, 1);
174  place(5, 1, mXpLabel, 1, 1).setPadding(3);
175  place(6, 1, mXpBar, 5, 1);
176  place(0, 2, mMpLabel, 1, 1).setPadding(3);
177  // 5, 2 and 6, 2 Job Progress Bar
178  if (job)
179  place(1, 2, mMpBar, 4, 1);
180  else
181  place(1, 2, mMpBar, 10, 1);
182 
183  if (job)
184  {
185  // TRANSLATORS: status window label
186  mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0));
187  // TRANSLATORS: status window label
188  mJobLabel = new Label(this, _("Job:"));
189  mJobBar = new ProgressBar(this, 0.0F, 80, 0, ProgressColorId::PROG_JOB,
190  "jobprogressbar.xml", "jobprogressbar_fill.xml");
193  mJobBar->setSelectable(false);
194 
195  place(3, 0, mJobLvlLabel, 3, 1);
196  place(5, 2, mJobLabel, 1, 1).setPadding(3);
197  place(6, 2, mJobBar, 5, 1);
198  place(6, 0, mMoneyLabel, 3, 1);
199  }
200  else
201  {
202  mJobLvlLabel = nullptr;
203  mJobLabel = nullptr;
204  mJobBar = nullptr;
205  place(3, 0, mMoneyLabel, 3, 1);
206  }
207 
208  place(0, 3, mTabs, 11, 3);
209 
211 
212  place(0, 5, mCopyButton, 1, 1);
213 
214  loadWindowState();
215  enableVisibleSound(true);
216 
217  // Update bars
218  updateHPBar(mHpBar, true);
219  updateMPBar(mMpBar, true);
220  updateXPBar(mXpBar, false);
221 
222  // TRANSLATORS: status window label
223  mMoneyLabel->setCaption(strprintf(_("Money: %s"),
225  Attributes::MONEY)).c_str()));
227 
229  addTabs();
230 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:92
Label * mJobLvlLabel
Definition: statuswindow.h:110
Label * mMpLabel
Definition: statuswindow.h:104
void setDefaultSize()
Definition: window.cpp:1193
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
Definition: window.cpp:1379
#define _(s)
Definition: gettext.h:34
Label * mJobLabel
Definition: statuswindow.h:111
Label * mHpLabel
Definition: statuswindow.h:103
int getWidth() const
Definition: widget.h:220
std::string getRaceName() const
Definition: being.h:860
ProgressBar * mMpBar
Definition: statuswindow.h:107
void loadWindowState()
Definition: window.cpp:1082
WindowContainer * windowContainer
TabbedArea * mTabs
Definition: statuswindow.h:100
virtual bool canUseMagic() const =0
Definition: button.h:96
std::string formatCurrency(const int value)
Definition: unitsdb.cpp:323
Button * mCopyButton
Definition: statuswindow.h:115
Label * mMoneyLabel
Definition: statuswindow.h:102
Configuration serverConfig
ProgressBar * mXpBar
Definition: statuswindow.h:108
ProgressBar * mJobBar
Definition: statuswindow.h:112
void registerWindowForReset(Window *const window)
int64_t getAttribute64(const AttributesT id)
Definition: playerinfo.cpp:92
void setSelectable(const bool selectable)
Definition: widget.h:947
Widget * getWidgetContainer() const
Definition: tabbedarea.h:243
void updateMPBar(ProgressBar *bar, const bool showMax) const
Widget * getTabContainer() const
Definition: tabbedarea.h:240
const std::string BUTTON_SKIN
Definition: button.h:88
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setCaption(const std::string &caption)
Definition: label.cpp:261
Definition: label.h:87
ProgressBar * mHpBar
Definition: statuswindow.h:106
static void updateHPBar(ProgressBar *const bar, const bool showMax)
LocalPlayer * localPlayer
bool getValueBool(const std::string &key, const bool deflt) const
void setCloseButton(const bool flag)
Definition: window.cpp:744
std::vector< StatsPage * > mPages
Definition: statuswindow.h:98
const std::string & getName() const
Definition: being.h:231
void enableVisibleSound(bool b)
Definition: window.h:480
Label * mLvlLabel
Definition: statuswindow.h:101
LayoutCell & setPadding(int p)
Definition: layoutcell.h:59
Layout & getLayout()
Definition: window.cpp:1360
void setSaveVisible(const bool save)
Definition: window.h:299
Label * mXpLabel
Definition: statuswindow.h:105
void updateLevelLabel()
int getHeight() const
Definition: widget.h:239
void setResizable(const bool resize)
Definition: window.cpp:622
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:767
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:44
SetupWindow * setupWindow
Definition: setupwindow.cpp:63
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
static void updateXPBar(ProgressBar *const bar, const bool percent)
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:114
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void setCaption(const std::string &caption)
Definition: window.h:530
void setColor(const Color &color1, const Color &color2)
void setRowHeight(const int n, const int h)
Definition: layoutcell.cpp:127
void adjustSize()
Definition: label.cpp:197
Window(const std::string &caption, const Modal modal, Window *const parent, std::string skin)
Definition: window.cpp:108
void setWindowName(const std::string &name)
Definition: window.h:354

◆ ~StatusWindow()

StatusWindow::~StatusWindow ( )

Definition at line 232 of file statuswindow.cpp.

References delete2, delete_all(), mBasicStatsPage, and mPages.

233 {
236 }
#define delete2(var)
Definition: delete2.h:24
void delete_all(Container &c)
Definition: dtor.h:55
std::vector< StatsPage * > mPages
Definition: statuswindow.h:98
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:114

Member Function Documentation

◆ action()

void StatusWindow::action ( const ActionEvent actionEvent)
virtual

Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.

Parameters
actionEventThe event of the action.

Implements ActionListener.

Definition at line 655 of file statuswindow.cpp.

References ChatWindow::addInputText(), chatWindow, ActionEvent::getId(), StatsPageBasic::getStatsStr(), and mBasicStatsPage.

656 {
657  if (chatWindow == nullptr)
658  return;
659 
660  if (event.getId() == "copy")
661  {
663  true);
664  }
665 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:89
std::string getStatsStr() const
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:114
void addInputText(const std::string &text, const bool space)

◆ addTab()

void StatusWindow::addTab ( const std::string &  name)
private

Definition at line 250 of file statuswindow.cpp.

References TabbedArea::addTab(), mPages, and mTabs.

Referenced by addTabs().

251 {
252  StatsPage *const page = new StatsPage(this, name);
253  mTabs->addTab(name,
254  page);
255  mPages.push_back(page);
256 }
TabbedArea * mTabs
Definition: statuswindow.h:100
std::vector< StatsPage * > mPages
Definition: statuswindow.h:98
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237

◆ addTabBasic()

void StatusWindow::addTabBasic ( const std::string &  name)
private

Definition at line 258 of file statuswindow.cpp.

References TabbedArea::addTab(), mBasicStatsPage, and mTabs.

Referenced by addTabs().

259 {
260  mTabs->addTab(name,
262 }
TabbedArea * mTabs
Definition: statuswindow.h:100
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:114
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237

◆ addTabs()

void StatusWindow::addTabs ( )
private

Definition at line 238 of file statuswindow.cpp.

References _, addTab(), addTabBasic(), TabbedArea::adjustSize(), FOR_EACH, StatDb::getPages(), mTabs, and pages.

Referenced by StatusWindow().

239 {
240  // TRANSLATORS: status window tab name
241  addTabBasic(_("Basic"));
242  const STD_VECTOR<std::string> &pages = StatDb::getPages();
243  FOR_EACH(STD_VECTOR<std::string>::const_iterator, it, pages)
244  {
245  addTab(*it);
246  }
247  mTabs->adjustSize();
248 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
#define _(s)
Definition: gettext.h:34
void addTabBasic(const std::string &name)
void addTab(const std::string &name)
TabbedArea * mTabs
Definition: statuswindow.h:100
void adjustSize()
Definition: tabbedarea.cpp:567
const char *const pages[SETUP_PAGES+1]
const std::vector< std::string > & getPages()
Definition: statdb.cpp:81

◆ attributeChanged()

void StatusWindow::attributeChanged ( const AttributesT  id,
const int64_t  oldVal,
const int64_t  newVal 
)
virtual

Implements AttributeListener.

Definition at line 288 of file statuswindow.cpp.

References _, Label::adjustSize(), CAST_S32, ServerCommandType::exp, UnitsDb::formatCurrency64(), PlayerInfo::getAttribute(), mHpBar, mJobBar, mJobLvlLabel, mLvlLabel, mMoneyLabel, mMpBar, Attributes::MONEY, mXpBar, Notify_true, Attributes::PLAYER_BASE_LEVEL, Attributes::PLAYER_EXP, Attributes::PLAYER_EXP_NEEDED, Attributes::PLAYER_HP, Attributes::PLAYER_JOB_EXP, Attributes::PLAYER_JOB_EXP_NEEDED, Attributes::PLAYER_JOB_LEVEL, Attributes::PLAYER_MAX_HP, Attributes::PLAYER_MAX_MP, Attributes::PLAYER_MP, PRAGMA45(), PlayerInfo::setAttribute(), Label::setCaption(), strprintf(), updateHPBar(), updateJobBar(), updateMPBar(), and updateXPBar().

291 {
292  static bool blocked = false;
293 
294  PRAGMA45(GCC diagnostic push)
295  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
296  switch (id)
297  {
300  updateHPBar(mHpBar, true);
301  break;
302 
305  updateMPBar(mMpBar, true);
306  break;
307 
310  updateXPBar(mXpBar, false);
311  break;
312 
313  case Attributes::MONEY:
314  // TRANSLATORS: status window label
315  mMoneyLabel->setCaption(strprintf(_("Money: %s"),
316  UnitsDb::formatCurrency64(newVal).c_str()));
318  break;
319 
321  // TRANSLATORS: status window label
322  mLvlLabel->setCaption(strprintf(_("Level: %d"),
323  CAST_S32(newVal)));
325  break;
326 
327  // +++ probable need use only some attributes here
331  if (blocked)
332  return;
333  if (mJobLvlLabel != nullptr)
334  {
335  int lvl = PlayerInfo::getAttribute(
337  const int64_t exp = PlayerInfo::getAttribute(
339  const int64_t expNeed = PlayerInfo::getAttribute(
341 
342  if (lvl == 0)
343  {
344  // possible server broken and don't send job level,
345  // then we fixing it.
346  if (expNeed < 20000)
347  {
348  lvl = 0;
349  }
350  else
351  {
352  lvl = CAST_S32((expNeed - 20000) / 150);
353  blocked = true;
355  lvl,
356  Notify_true);
357  blocked = false;
358  }
359  }
360 
361  if (id == Attributes::PLAYER_JOB_EXP &&
362  exp < oldVal &&
363  expNeed >= 20000)
364  { // possible job level up. but server broken and don't send
365  // new job exp limit, we fixing it
366  lvl ++;
367  blocked = true;
369  20000 + lvl * 150,
370  Notify_true);
372  lvl,
373  Notify_true);
374  blocked = false;
375  }
376 
377  // TRANSLATORS: status window label
378  mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl));
380 
381  updateJobBar(mJobBar, false);
382  }
383  break;
384 
385  default:
386  break;
387  }
388  PRAGMA45(GCC diagnostic pop)
389 }
Label * mJobLvlLabel
Definition: statuswindow.h:110
#define _(s)
Definition: gettext.h:34
ProgressBar * mMpBar
Definition: statuswindow.h:107
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
Label * mMoneyLabel
Definition: statuswindow.h:102
ProgressBar * mXpBar
Definition: statuswindow.h:108
ProgressBar * mJobBar
Definition: statuswindow.h:112
std::string formatCurrency64(const int64_t value)
Definition: unitsdb.cpp:328
void updateMPBar(ProgressBar *bar, const bool showMax) const
#define CAST_S32
Definition: cast.h:29
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setCaption(const std::string &caption)
Definition: label.cpp:261
ProgressBar * mHpBar
Definition: statuswindow.h:106
static void updateHPBar(ProgressBar *const bar, const bool showMax)
void setAttribute(const AttributesT id, const int64_t value, const Notify notify)
Definition: playerinfo.cpp:108
Label * mLvlLabel
Definition: statuswindow.h:101
static void updateXPBar(ProgressBar *const bar, const bool percent)
static void updateJobBar(ProgressBar *const bar, const bool percent)
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void adjustSize()
Definition: label.cpp:197
const bool Notify_true
Definition: notify.h:29

◆ setPointsNeeded()

void StatusWindow::setPointsNeeded ( const AttributesT  id,
const int  needed 
)

◆ translateLetter()

std::string StatusWindow::translateLetter ( const char *const  letters)
staticprivate

Definition at line 597 of file statuswindow.cpp.

References ServerCommandType::str.

598 {
599  char buf[2];
600  char *const str = gettext(letters);
601  if ((str == nullptr) || strlen(str) != 3)
602  return letters;
603 
604  buf[0] = str[1];
605  buf[1] = 0;
606  return std::string(buf);
607 }

◆ translateLetter2()

std::string StatusWindow::translateLetter2 ( const std::string &  letters)
staticprivate

Definition at line 609 of file statuswindow.cpp.

Referenced by updateStatusBar().

610 {
611  if (letters.size() < 5)
612  return "";
613 
614  return std::string(gettext(letters.substr(1, 1).c_str()));
615 }

◆ updateArrowsBar()

void StatusWindow::updateArrowsBar ( ProgressBar *const  bar)
static

Definition at line 562 of file statuswindow.cpp.

References equipmentWindow, EquipmentWindow::getEquipment(), Net::InventoryHandler::getProjectileSlot(), Item::getQuantity(), inventoryHandler, ServerCommandType::item, ProgressBar::setText(), and Catch::toString().

Referenced by MiniStatusWindow::arrowsChanged(), and MiniStatusWindow::MiniStatusWindow().

563 {
564  if ((bar == nullptr) || (equipmentWindow == nullptr))
565  return;
566 
567  const Item *const item = equipmentWindow->getEquipment(
569 
570  if ((item != nullptr) && item->getQuantity() > 0)
571  bar->setText(toString(item->getQuantity()));
572  else
573  bar->setText("0");
574 }
virtual int getProjectileSlot() const =0
int getQuantity() const
Definition: item.h:104
const Item * getEquipment(const int i) const
Definition: item.h:48
Net::InventoryHandler * inventoryHandler
Definition: net.cpp:85
void setText(const std::string &str)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
EquipmentWindow * equipmentWindow

◆ updateHPBar()

void StatusWindow::updateHPBar ( ProgressBar *const  bar,
const bool  showMax 
)
static

Definition at line 397 of file statuswindow.cpp.

References PlayerInfo::getAttribute(), Attributes::PLAYER_HP, Attributes::PLAYER_MAX_HP, ProgressBar::setProgress(), ProgressBar::setText(), and Catch::toString().

Referenced by attributeChanged(), MiniStatusWindow::attributeChanged(), MiniStatusWindow::MiniStatusWindow(), and StatusWindow().

398 {
399  if (bar == nullptr)
400  return;
401 
404  if (showMax)
405  bar->setText(toString(hp).append("/").append(toString(maxHp)));
406  else
407  bar->setText(toString(hp));
408 
409  float prog = 1.0;
410  if (maxHp > 0)
411  prog = static_cast<float>(hp) / static_cast<float>(maxHp);
412  bar->setProgress(prog);
413 }
void setText(const std::string &str)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void setProgress(const float progress)

◆ updateInvSlotsBar()

void StatusWindow::updateInvSlotsBar ( ProgressBar *const  bar)
static

Definition at line 576 of file statuswindow.cpp.

References PlayerInfo::getInventory(), Inventory::getNumberOfSlotsUsed(), Inventory::getSize(), ProgressBar::setProgress(), ProgressBar::setText(), and strprintf().

Referenced by MiniStatusWindow::slotsChanged().

577 {
578  if (bar == nullptr)
579  return;
580 
581  const Inventory *const inv = PlayerInfo::getInventory();
582  if (inv == nullptr)
583  return;
584 
585  const int usedSlots = inv->getNumberOfSlotsUsed();
586  const int maxSlots = inv->getSize();
587 
588  if (maxSlots != 0)
589  {
590  bar->setProgress(static_cast<float>(usedSlots)
591  / static_cast<float>(maxSlots));
592  }
593 
594  bar->setText(strprintf("%d", usedSlots));
595 }
int getNumberOfSlotsUsed() const
Definition: inventory.h:163
Inventory * getInventory()
Definition: playerinfo.cpp:192
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setText(const std::string &str)
void setProgress(const float progress)
unsigned getSize() const
Definition: inventory.h:75

◆ updateJobBar()

void StatusWindow::updateJobBar ( ProgressBar *const  bar,
const bool  percent 
)
static

Definition at line 494 of file statuswindow.cpp.

References PlayerInfo::getAttribute(), Attributes::PLAYER_JOB_EXP, Attributes::PLAYER_JOB_EXP_NEEDED, and updateProgressBar().

Referenced by attributeChanged(), MiniStatusWindow::MiniStatusWindow(), and MiniStatusWindow::statChanged().

496 {
497  if (bar == nullptr)
498  return;
499 
500  updateProgressBar(bar,
503  percent);
504 }
static void updateProgressBar(ProgressBar *const bar, const int64_t value, const int64_t max, const bool percent)
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100

◆ updateLevelLabel()

void StatusWindow::updateLevelLabel ( )

Definition at line 264 of file statuswindow.cpp.

References _, Label::adjustSize(), PlayerInfo::getAttribute(), Being::getGroupId(), GroupDb::getName(), localPlayer, mLvlLabel, Attributes::PLAYER_BASE_LEVEL, Label::setCaption(), and strprintf().

Referenced by LocalPlayer::setGroupId(), and StatusWindow().

265 {
266  if (localPlayer == nullptr)
267  return;
268 
269  const int groupId = localPlayer->getGroupId();
270  const std::string &name = GroupDb::getName(groupId);
271  if (!name.empty())
272  {
273  // TRANSLATORS: status window label
274  mLvlLabel->setCaption(strprintf(_("Level: %d (%s %d)"),
276  name.c_str(),
277  groupId));
278  }
279  else
280  {
281  // TRANSLATORS: status window label
282  mLvlLabel->setCaption(strprintf(_("Level: %d"),
284  }
286 }
#define _(s)
Definition: gettext.h:34
const std::string & getName(const int id)
Definition: groupdb.cpp:337
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setCaption(const std::string &caption)
Definition: label.cpp:261
LocalPlayer * localPlayer
int getGroupId() const
Definition: being.h:1090
Label * mLvlLabel
Definition: statuswindow.h:101
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void adjustSize()
Definition: label.cpp:197

◆ updateMoneyBar()

void StatusWindow::updateMoneyBar ( ProgressBar *const  bar)
static

Definition at line 543 of file statuswindow.cpp.

References UnitsDb::formatCurrency(), PlayerInfo::getAttribute(), Attributes::MONEY, ProgressBar::setProgress(), and ProgressBar::setText().

Referenced by MiniStatusWindow::attributeChanged(), and MiniStatusWindow::MiniStatusWindow().

544 {
545  if (bar == nullptr)
546  return;
547 
548  const int money = PlayerInfo::getAttribute(Attributes::MONEY);
549  bar->setText(UnitsDb::formatCurrency(money));
550  if (money > 0)
551  {
552  const float progress = static_cast<float>(money)
553  / static_cast<float>(1000000000);
554  bar->setProgress(progress);
555  }
556  else
557  {
558  bar->setProgress(1.0);
559  }
560 }
std::string formatCurrency(const int value)
Definition: unitsdb.cpp:323
void setText(const std::string &str)
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void setProgress(const float progress)

◆ updateMPBar()

void StatusWindow::updateMPBar ( ProgressBar bar,
const bool  showMax 
) const

Definition at line 415 of file statuswindow.cpp.

References Net::PlayerHandler::canUseMagic(), PlayerInfo::getAttribute(), Widget2::getThemeColor(), ThemeColorId::MP_BAR, ThemeColorId::MP_BAR_OUTLINE, ThemeColorId::NO_MP_BAR, ThemeColorId::NO_MP_BAR_OUTLINE, Attributes::PLAYER_MAX_MP, Attributes::PLAYER_MP, playerHandler, ProgressColorId::PROG_MP, ProgressColorId::PROG_NO_MP, ProgressBar::setColor(), ProgressBar::setProgress(), ProgressBar::setProgressPalette(), ProgressBar::setText(), and Catch::toString().

Referenced by attributeChanged(), MiniStatusWindow::attributeChanged(), MiniStatusWindow::MiniStatusWindow(), MiniStatusWindow::statChanged(), and StatusWindow().

417 {
418  if (bar == nullptr)
419  return;
420 
423  if (showMax)
424  bar->setText(toString(mp).append("/").append(toString(maxMp)));
425  else
426  bar->setText(toString(mp));
427 
428  float prog = 1.0F;
429  if (maxMp > 0)
430  prog = static_cast<float>(mp) / static_cast<float>(maxMp);
431 
432  if (playerHandler->canUseMagic())
433  {
437  }
438  else
439  {
443  }
444 
445  bar->setProgress(prog);
446 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:92
virtual bool canUseMagic() const =0
void setText(const std::string &str)
void setProgressPalette(const ProgressColorIdT progressPalette)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:44
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void setColor(const Color &color1, const Color &color2)
void setProgress(const float progress)

◆ updateProgressBar() [1/2]

void StatusWindow::updateProgressBar ( ProgressBar *const  bar,
const int64_t  value,
const int64_t  max,
const bool  percent 
)
static

Definition at line 448 of file statuswindow.cpp.

References _, CAST_U64, ProgressBar::setProgress(), ProgressBar::setText(), strprintf(), and Catch::toString().

Referenced by updateJobBar(), updateProgressBar(), and updateXPBar().

452 {
453  if (bar == nullptr)
454  return;
455 
456  if (max == 0)
457  {
458  // TRANSLATORS: status bar label
459  bar->setText(_("Max"));
460  bar->setProgress(1);
461  bar->setText(toString(CAST_U64(value)));
462  }
463  else
464  {
465  const float progress = static_cast<float>(value)
466  / static_cast<float>(max);
467  if (percent)
468  {
469  bar->setText(strprintf("%2.5f%%",
470  static_cast<double>(100 * progress)));
471  }
472  else
473  {
474  bar->setText(toString(
475  CAST_U64(value)).append(
476  "/").append(toString(
477  CAST_U64(max))));
478  }
479  bar->setProgress(progress);
480  }
481 }
#define _(s)
Definition: gettext.h:34
#define CAST_U64
Definition: cast.h:32
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setText(const std::string &str)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
void setProgress(const float progress)

◆ updateProgressBar() [2/2]

void StatusWindow::updateProgressBar ( ProgressBar *const  bar,
const AttributesT  id,
const bool  percent 
)
static

Definition at line 506 of file statuswindow.cpp.

References ServerCommandType::exp, PlayerInfo::getStatExperience(), and updateProgressBar().

509 {
510  const std::pair<int, int> exp = PlayerInfo::getStatExperience(id);
511  updateProgressBar(bar, exp.first, exp.second, percent);
512 }
const std::pair< int, int > getStatExperience(const AttributesT id)
Definition: playerinfo.cpp:173
static void updateProgressBar(ProgressBar *const bar, const int64_t value, const int64_t max, const bool percent)

◆ updateStatusBar()

void StatusWindow::updateStatusBar ( ProgressBar *const  bar,
const bool  percent 
) const

Definition at line 617 of file statuswindow.cpp.

References Settings::disableGameModifiers, GameModifiers::getAttackTypeString(), GameModifiers::getAttackWeaponTypeString(), GameModifiers::getAwayModeString(), GameModifiers::getCameraModeString(), GameModifiers::getCrazyMoveTypeString(), GameModifiers::getFollowModeString(), GameModifiers::getImitationModeString(), GameModifiers::getMagicAttackTypeString(), GameModifiers::getMapDrawTypeString(), GameModifiers::getMoveToTargetTypeString(), GameModifiers::getMoveTypeString(), GameModifiers::getPickUpTypeString(), GameModifiers::getPvpAttackTypeString(), GameModifiers::getQuickDropCounterString(), GameModifiers::getTargetingTypeString(), Widget2::getThemeColor(), ProgressBar::setBackgroundColor(), ProgressBar::setProgress(), ProgressBar::setText(), settings, ThemeColorId::STATUSBAR_OFF, ThemeColorId::STATUSBAR_ON, and translateLetter2().

Referenced by MiniStatusWindow::updateStatus().

619 {
620  if (bar == nullptr)
621  return;
626  .append(" ").append(translateLetter2(
631  .append(" ").append(translateLetter2(
634  .append(" ").append(translateLetter2(
636  .append(" ").append(translateLetter2(
641 
642  bar->setProgress(50);
644  {
646  255U));
647  }
648  else
649  {
651  255U));
652  }
653 }
static std::string getMapDrawTypeString()
bool disableGameModifiers
Definition: settings.h:153
static std::string getMoveTypeString()
Settings settings
Definition: settings.cpp:31
void setBackgroundColor(const Color &color)
static std::string getQuickDropCounterString()
static std::string getMoveToTargetTypeString()
static std::string getPickUpTypeString()
static std::string getAwayModeString()
static std::string getFollowModeString()
void setText(const std::string &str)
static std::string getTargetingTypeString()
static std::string getImitationModeString()
static std::string getCrazyMoveTypeString()
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:44
static std::string translateLetter2(const std::string &letters)
static std::string getMagicAttackTypeString()
static std::string getAttackWeaponTypeString()
static std::string getAttackTypeString()
static std::string getPvpAttackTypeString()
void setProgress(const float progress)
static std::string getCameraModeString()

◆ updateWeightBar()

void StatusWindow::updateWeightBar ( ProgressBar *const  bar)
static

Definition at line 514 of file statuswindow.cpp.

References _, UnitsDb::formatWeight(), PlayerInfo::getAttribute(), Attributes::MAX_WEIGHT, ProgressBar::setProgress(), ProgressBar::setText(), strprintf(), and Attributes::TOTAL_WEIGHT.

Referenced by MiniStatusWindow::attributeChanged().

515 {
516  if (bar == nullptr)
517  return;
518 
520  {
521  // TRANSLATORS: status bar label
522  bar->setText(_("Max"));
523  bar->setProgress(1.0);
524  }
525  else
526  {
527  const int totalWeight = PlayerInfo::getAttribute(
529  const int maxWeight = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT);
530  float progress = 1.0F;
531  if (maxWeight != 0)
532  {
533  progress = static_cast<float>(totalWeight)
534  / static_cast<float>(maxWeight);
535  }
536  bar->setText(strprintf("%s/%s",
537  UnitsDb::formatWeight(totalWeight).c_str(),
538  UnitsDb::formatWeight(maxWeight).c_str()));
539  bar->setProgress(progress);
540  }
541 }
#define _(s)
Definition: gettext.h:34
std::string formatWeight(const int value)
Definition: unitsdb.cpp:351
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setText(const std::string &str)
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void setProgress(const float progress)

◆ updateXPBar()

void StatusWindow::updateXPBar ( ProgressBar *const  bar,
const bool  percent 
)
static

Definition at line 483 of file statuswindow.cpp.

References PlayerInfo::getAttribute(), Attributes::PLAYER_EXP, Attributes::PLAYER_EXP_NEEDED, and updateProgressBar().

Referenced by attributeChanged(), MiniStatusWindow::attributeChanged(), MiniStatusWindow::MiniStatusWindow(), and StatusWindow().

484 {
485  if (bar == nullptr)
486  return;
487 
488  updateProgressBar(bar,
491  percent);
492 }
static void updateProgressBar(ProgressBar *const bar, const int64_t value, const int64_t max, const bool percent)
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100

Field Documentation

◆ mBasicStatsPage

StatsPageBasic* StatusWindow::mBasicStatsPage
private

Definition at line 114 of file statuswindow.h.

Referenced by action(), addTabBasic(), setPointsNeeded(), and ~StatusWindow().

◆ mCopyButton

Button* StatusWindow::mCopyButton
private

Definition at line 115 of file statuswindow.h.

Referenced by StatusWindow().

◆ mHpBar

ProgressBar* StatusWindow::mHpBar
private

Definition at line 106 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mHpLabel

Label* StatusWindow::mHpLabel
private

Definition at line 103 of file statuswindow.h.

Referenced by StatusWindow().

◆ mJobBar

ProgressBar* StatusWindow::mJobBar
private

Definition at line 112 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mJobLabel

Label* StatusWindow::mJobLabel
private

Definition at line 111 of file statuswindow.h.

Referenced by StatusWindow().

◆ mJobLvlLabel

Label* StatusWindow::mJobLvlLabel
private

Definition at line 110 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mLvlLabel

Label* StatusWindow::mLvlLabel
private

Definition at line 101 of file statuswindow.h.

Referenced by attributeChanged(), StatusWindow(), and updateLevelLabel().

◆ mMoneyLabel

Label* StatusWindow::mMoneyLabel
private

Definition at line 102 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mMpBar

ProgressBar* StatusWindow::mMpBar
private

Definition at line 107 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mMpLabel

Label* StatusWindow::mMpLabel
private

Definition at line 104 of file statuswindow.h.

Referenced by StatusWindow().

◆ mPages

std::vector<StatsPage*> StatusWindow::mPages
private

Definition at line 98 of file statuswindow.h.

Referenced by addTab(), and ~StatusWindow().

◆ mTabs

TabbedArea* StatusWindow::mTabs
private

Definition at line 100 of file statuswindow.h.

Referenced by addTab(), addTabBasic(), addTabs(), and StatusWindow().

◆ mXpBar

ProgressBar* StatusWindow::mXpBar
private

Definition at line 108 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mXpLabel

Label* StatusWindow::mXpLabel
private

Definition at line 105 of file statuswindow.h.

Referenced by StatusWindow().


The documentation for this class was generated from the following files: