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=false) const
 
void updateStatusBar (ProgressBar *const bar, const bool percent=true) 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="Window", const Modal modal=Modal_false, Window *const parent=0, std::string skin="")
 
virtual ~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=0, int offsetY=0)
 
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=0, const int offsetY=0)
 
virtual void resetToDefaultSize ()
 
void adjustPositionAfterResize (const int oldScreenWidth, const int oldScreenHeight)
 
LayoutgetLayout ()
 
void clearLayout ()
 
void reflowLayout (int w=0, int h=0)
 
LayoutCellplace (const int x, const int y, Widget *const wg, const int w=1, const int h=1)
 
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)
 
virtual ~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)
 
virtual ~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)
 
virtual ~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=255U) 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=false)
 
static void updateJobBar (ProgressBar *const bar, const bool percent=true)
 
static void updateXPBar (ProgressBar *const bar, const bool percent=true)
 
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=true)
 
- 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=0) const
 
bool getOptionBool (const std::string &name, const bool def=false) 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", 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, 480, 500);
101 
102  mTabs->setSelectable(false);
105 
106  if ((localPlayer != nullptr) && !localPlayer->getRaceName().empty())
107  {
108  setCaption(strprintf("%s (%s)", localPlayer->getName().c_str(),
109  localPlayer->getRaceName().c_str()));
110  }
111 
113  if (max == 0)
114  max = 1;
115 
116  mHpBar = new ProgressBar(this,
118  / static_cast<float>(max),
119  80,
120  0,
122  "hpprogressbar.xml", "hpprogressbar_fill.xml");
125  mHpBar->setSelectable(false);
126 
127  const int64_t maxExp = PlayerInfo::getAttribute64(
129  mXpBar = new ProgressBar(this,
130  maxExp != 0 ?
131  static_cast<float>(PlayerInfo::getAttribute64(
133  static_cast<float>(maxExp) : static_cast<float>(0),
134  80,
135  0,
137  "xpprogressbar.xml", "xpprogressbar_fill.xml");
140  mXpBar->setSelectable(false);
141 
142  const bool job = serverConfig.getValueBool("showJob", true);
143 
145  // TRANSLATORS: status window label
146  mMpLabel = new Label(this, _("MP:"));
147  const bool useMagic = playerHandler->canUseMagic();
148  mMpBar = new ProgressBar(this,
149  max != 0 ? static_cast<float>(PlayerInfo::getAttribute(
150  Attributes::PLAYER_MAX_MP)) / static_cast<float>(max)
151  : static_cast<float>(0),
152  80,
153  0,
155  useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml",
156  useMagic ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml");
157  mMpBar->setSelectable(false);
158  if (useMagic)
159  {
162  }
163  else
164  {
167  }
168 
169  place(0, 0, mLvlLabel, 3);
170  place(0, 1, mHpLabel).setPadding(3);
171  place(1, 1, mHpBar, 4);
172  place(5, 1, mXpLabel).setPadding(3);
173  place(6, 1, mXpBar, 5);
174  place(0, 2, mMpLabel).setPadding(3);
175  // 5, 2 and 6, 2 Job Progress Bar
176  if (job)
177  place(1, 2, mMpBar, 4);
178  else
179  place(1, 2, mMpBar, 10);
180 
181  if (job)
182  {
183  // TRANSLATORS: status window label
184  mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0));
185  // TRANSLATORS: status window label
186  mJobLabel = new Label(this, _("Job:"));
187  mJobBar = new ProgressBar(this, 0.0F, 80, 0, ProgressColorId::PROG_JOB,
188  "jobprogressbar.xml", "jobprogressbar_fill.xml");
191  mJobBar->setSelectable(false);
192 
193  place(3, 0, mJobLvlLabel, 3);
194  place(5, 2, mJobLabel).setPadding(3);
195  place(6, 2, mJobBar, 5);
196  place(6, 0, mMoneyLabel, 3);
197  }
198  else
199  {
200  mJobLvlLabel = nullptr;
201  mJobLabel = nullptr;
202  mJobBar = nullptr;
203  place(3, 0, mMoneyLabel, 3);
204  }
205 
206  place(0, 3, mTabs, 11, 3);
207 
209 
210  place(0, 5, mCopyButton);
211 
212  loadWindowState();
213  enableVisibleSound(true);
214 
215  // Update bars
216  updateHPBar(mHpBar, true);
217  updateMPBar(mMpBar, true);
218  updateXPBar(mXpBar, false);
219 
220  // TRANSLATORS: status window label
221  mMoneyLabel->setCaption(strprintf(_("Money: %s"),
223  Attributes::MONEY)).c_str()));
225 
227  addTabs();
228 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:89
Label * mJobLvlLabel
Definition: statuswindow.h:109
Label * mMpLabel
Definition: statuswindow.h:103
void setDefaultSize()
Definition: window.cpp:1186
#define _(s)
Definition: gettext.h:34
Label * mJobLabel
Definition: statuswindow.h:110
Label * mHpLabel
Definition: statuswindow.h:102
int getWidth() const
Definition: widget.h:220
std::string getRaceName() const
Definition: being.h:856
ProgressBar * mMpBar
Definition: statuswindow.h:106
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha=255U) const A_INLINE
Definition: widget2.h:44
void loadWindowState()
Definition: window.cpp:1075
WindowContainer * windowContainer
TabbedArea * mTabs
Definition: statuswindow.h:99
virtual bool canUseMagic() const =0
Definition: button.h:94
std::string formatCurrency(const int value)
Definition: unitsdb.cpp:323
Button * mCopyButton
Definition: statuswindow.h:114
Label * mMoneyLabel
Definition: statuswindow.h:101
Configuration serverConfig
ProgressBar * mXpBar
Definition: statuswindow.h:107
ProgressBar * mJobBar
Definition: statuswindow.h:111
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
Widget * getTabContainer() const
Definition: tabbedarea.h:240
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setCaption(const std::string &caption)
Definition: label.cpp:256
Definition: label.h:87
ProgressBar * mHpBar
Definition: statuswindow.h:105
LayoutCell & place(const int x, const int y, Widget *const wg, const int w=1, const int h=1)
Definition: window.cpp:1372
static void updateHPBar(ProgressBar *const bar, const bool showMax=false)
LocalPlayer * localPlayer
bool getValueBool(const std::string &key, const bool deflt) const
void setCloseButton(const bool flag)
Definition: window.cpp:737
std::vector< StatsPage * > mPages
Definition: statuswindow.h:97
const std::string & getName() const
Definition: being.h:233
void enableVisibleSound(bool b)
Definition: window.h:473
Label * mLvlLabel
Definition: statuswindow.h:100
LayoutCell & setPadding(int p)
Definition: layoutcell.h:59
Layout & getLayout()
Definition: window.cpp:1353
void setSaveVisible(const bool save)
Definition: window.h:298
static void updateXPBar(ProgressBar *const bar, const bool percent=true)
Label * mXpLabel
Definition: statuswindow.h:104
void updateMPBar(ProgressBar *bar, const bool showMax=false) const
void updateLevelLabel()
int getHeight() const
Definition: widget.h:239
void setResizable(const bool resize)
Definition: window.cpp:615
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:760
SetupWindow * setupWindow
Definition: setupwindow.cpp:63
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
Window(const std::string &caption="Window", const Modal modal=Modal_false, Window *const parent=0, std::string skin="")
Definition: window.cpp:108
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:113
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void setCaption(const std::string &caption)
Definition: window.h:523
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:192
void setWindowName(const std::string &name)
Definition: window.h:353

◆ ~StatusWindow()

StatusWindow::~StatusWindow ( )

Definition at line 230 of file statuswindow.cpp.

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

231 {
234 }
#define delete2(var)
Definition: delete2.h:24
void delete_all(Container &c)
Definition: dtor.h:55
std::vector< StatsPage * > mPages
Definition: statuswindow.h:97
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:113

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 643 of file statuswindow.cpp.

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

644 {
645  if (chatWindow == nullptr)
646  return;
647 
648  if (event.getId() == "copy")
649  {
651  }
652 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:88
void addInputText(const std::string &text, const bool space=true)
std::string getStatsStr() const
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:113

◆ addTab()

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

Definition at line 248 of file statuswindow.cpp.

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

Referenced by addTabs().

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

◆ addTabBasic()

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

Definition at line 256 of file statuswindow.cpp.

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

Referenced by addTabs().

257 {
258  mTabs->addTab(name,
260 }
TabbedArea * mTabs
Definition: statuswindow.h:99
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:113
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:229

◆ addTabs()

void StatusWindow::addTabs ( )
private

Definition at line 236 of file statuswindow.cpp.

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

Referenced by StatusWindow().

237 {
238  // TRANSLATORS: status window tab name
239  addTabBasic(_("Basic"));
240  const STD_VECTOR<std::string> &pages = StatDb::getPages();
241  FOR_EACH(STD_VECTOR<std::string>::const_iterator, it, pages)
242  {
243  addTab(*it);
244  }
245  mTabs->adjustSize();
246 }
#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:99
void adjustSize()
Definition: tabbedarea.cpp:559
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 286 of file statuswindow.cpp.

References _, Label::adjustSize(), CAST_S32, ServerCommandType::exp, UnitsDb::formatCurrency64(), PlayerInfo::getAttribute(), mHpBar, mJobBar, mJobLvlLabel, mLvlLabel, mMoneyLabel, mMpBar, Attributes::MONEY, mXpBar, 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().

289 {
290  static bool blocked = false;
291 
292  PRAGMA45(GCC diagnostic push)
293  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
294  switch (id)
295  {
298  updateHPBar(mHpBar, true);
299  break;
300 
303  updateMPBar(mMpBar, true);
304  break;
305 
308  updateXPBar(mXpBar, false);
309  break;
310 
311  case Attributes::MONEY:
312  // TRANSLATORS: status window label
313  mMoneyLabel->setCaption(strprintf(_("Money: %s"),
314  UnitsDb::formatCurrency64(newVal).c_str()));
316  break;
317 
319  // TRANSLATORS: status window label
320  mLvlLabel->setCaption(strprintf(_("Level: %d"),
321  CAST_S32(newVal)));
323  break;
324 
325  // +++ probable need use only some attributes here
329  if (blocked)
330  return;
331  if (mJobLvlLabel != nullptr)
332  {
333  int lvl = PlayerInfo::getAttribute(
335  const int64_t exp = PlayerInfo::getAttribute(
337  const int64_t expNeed = PlayerInfo::getAttribute(
339 
340  if (lvl == 0)
341  {
342  // possible server broken and don't send job level,
343  // then we fixing it.
344  if (expNeed < 20000)
345  {
346  lvl = 0;
347  }
348  else
349  {
350  lvl = CAST_S32((expNeed - 20000) / 150);
351  blocked = true;
353  lvl);
354  blocked = false;
355  }
356  }
357 
358  if (id == Attributes::PLAYER_JOB_EXP &&
359  exp < oldVal &&
360  expNeed >= 20000)
361  { // possible job level up. but server broken and don't send
362  // new job exp limit, we fixing it
363  lvl ++;
364  blocked = true;
366  20000 + lvl * 150);
368  lvl);
369  blocked = false;
370  }
371 
372  // TRANSLATORS: status window label
373  mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl));
375 
376  updateJobBar(mJobBar, false);
377  }
378  break;
379 
380  default:
381  break;
382  }
383  PRAGMA45(GCC diagnostic pop)
384 }
Label * mJobLvlLabel
Definition: statuswindow.h:109
#define _(s)
Definition: gettext.h:34
ProgressBar * mMpBar
Definition: statuswindow.h:106
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
Label * mMoneyLabel
Definition: statuswindow.h:101
ProgressBar * mXpBar
Definition: statuswindow.h:107
ProgressBar * mJobBar
Definition: statuswindow.h:111
std::string formatCurrency64(const int64_t value)
Definition: unitsdb.cpp:328
#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:256
ProgressBar * mHpBar
Definition: statuswindow.h:105
static void updateHPBar(ProgressBar *const bar, const bool showMax=false)
void setAttribute(const AttributesT id, const int64_t value, const Notify notify)
Definition: playerinfo.cpp:108
Label * mLvlLabel
Definition: statuswindow.h:100
static void updateXPBar(ProgressBar *const bar, const bool percent=true)
void updateMPBar(ProgressBar *bar, const bool showMax=false) const
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
void adjustSize()
Definition: label.cpp:192
static void updateJobBar(ProgressBar *const bar, const bool percent=true)

◆ setPointsNeeded()

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

◆ translateLetter()

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

Definition at line 591 of file statuswindow.cpp.

References ServerCommandType::str.

592 {
593  char buf[2];
594  char *const str = gettext(letters);
595  if ((str == nullptr) || strlen(str) != 3)
596  return letters;
597 
598  buf[0] = str[1];
599  buf[1] = 0;
600  return std::string(buf);
601 }

◆ translateLetter2()

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

Definition at line 603 of file statuswindow.cpp.

Referenced by updateStatusBar().

604 {
605  if (letters.size() < 5)
606  return "";
607 
608  return std::string(gettext(letters.substr(1, 1).c_str()));
609 }

◆ updateArrowsBar()

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

Definition at line 556 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().

557 {
558  if ((bar == nullptr) || (equipmentWindow == nullptr))
559  return;
560 
561  const Item *const item = equipmentWindow->getEquipment(
563 
564  if ((item != nullptr) && item->getQuantity() > 0)
565  bar->setText(toString(item->getQuantity()));
566  else
567  bar->setText("0");
568 }
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:82
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 = false 
)
static

Definition at line 392 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().

393 {
394  if (bar == nullptr)
395  return;
396 
399  if (showMax)
400  bar->setText(toString(hp).append("/").append(toString(maxHp)));
401  else
402  bar->setText(toString(hp));
403 
404  float prog = 1.0;
405  if (maxHp > 0)
406  prog = static_cast<float>(hp) / static_cast<float>(maxHp);
407  bar->setProgress(prog);
408 }
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 570 of file statuswindow.cpp.

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

Referenced by MiniStatusWindow::slotsChanged().

571 {
572  if (bar == nullptr)
573  return;
574 
575  const Inventory *const inv = PlayerInfo::getInventory();
576  if (inv == nullptr)
577  return;
578 
579  const int usedSlots = inv->getNumberOfSlotsUsed();
580  const int maxSlots = inv->getSize();
581 
582  if (maxSlots != 0)
583  {
584  bar->setProgress(static_cast<float>(usedSlots)
585  / static_cast<float>(maxSlots));
586  }
587 
588  bar->setText(strprintf("%d", usedSlots));
589 }
int getNumberOfSlotsUsed() const
Definition: inventory.h:163
Inventory * getInventory()
Definition: playerinfo.cpp:207
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 = true 
)
static

Definition at line 489 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().

490 {
491  if (bar == nullptr)
492  return;
493 
494  updateProgressBar(bar,
497  percent);
498 }
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 262 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().

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

◆ updateMoneyBar()

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

Definition at line 537 of file statuswindow.cpp.

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

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

538 {
539  if (bar == nullptr)
540  return;
541 
542  const int money = PlayerInfo::getAttribute(Attributes::MONEY);
543  bar->setText(UnitsDb::formatCurrency(money));
544  if (money > 0)
545  {
546  const float progress = static_cast<float>(money)
547  / static_cast<float>(1000000000);
548  bar->setProgress(progress);
549  }
550  else
551  {
552  bar->setProgress(1.0);
553  }
554 }
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 = false 
) const

Definition at line 410 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().

412 {
413  if (bar == nullptr)
414  return;
415 
418  if (showMax)
419  bar->setText(toString(mp).append("/").append(toString(maxMp)));
420  else
421  bar->setText(toString(mp));
422 
423  float prog = 1.0F;
424  if (maxMp > 0)
425  prog = static_cast<float>(mp) / static_cast<float>(maxMp);
426 
427  if (playerHandler->canUseMagic())
428  {
432  }
433  else
434  {
438  }
439 
440  bar->setProgress(prog);
441 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:89
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha=255U) const A_INLINE
Definition: widget2.h:44
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
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 443 of file statuswindow.cpp.

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

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

447 {
448  if (bar == nullptr)
449  return;
450 
451  if (max == 0)
452  {
453  // TRANSLATORS: status bar label
454  bar->setText(_("Max"));
455  bar->setProgress(1);
456  bar->setText(toString(CAST_U64(value)));
457  }
458  else
459  {
460  const float progress = static_cast<float>(value)
461  / static_cast<float>(max);
462  if (percent)
463  {
464  bar->setText(strprintf("%2.5f%%",
465  static_cast<double>(100 * progress)));
466  }
467  else
468  {
469  bar->setText(toString(
470  CAST_U64(value)).append(
471  "/").append(toString(
472  CAST_U64(max))));
473  }
474  bar->setProgress(progress);
475  }
476 }
#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 = true 
)
static

Definition at line 500 of file statuswindow.cpp.

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

503 {
504  const std::pair<int, int> exp = PlayerInfo::getStatExperience(id);
505  updateProgressBar(bar, exp.first, exp.second, percent);
506 }
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 = true 
) const

Definition at line 611 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().

613 {
614  if (bar == nullptr)
615  return;
620  .append(" ").append(translateLetter2(
625  .append(" ").append(translateLetter2(
628  .append(" ").append(translateLetter2(
630  .append(" ").append(translateLetter2(
635 
636  bar->setProgress(50);
639  else
641 }
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha=255U) const A_INLINE
Definition: widget2.h:44
static std::string getMapDrawTypeString()
bool disableGameModifiers
Definition: settings.h:154
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()
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 508 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().

509 {
510  if (bar == nullptr)
511  return;
512 
514  {
515  // TRANSLATORS: status bar label
516  bar->setText(_("Max"));
517  bar->setProgress(1.0);
518  }
519  else
520  {
521  const int totalWeight = PlayerInfo::getAttribute(
523  const int maxWeight = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT);
524  float progress = 1.0F;
525  if (maxWeight != 0)
526  {
527  progress = static_cast<float>(totalWeight)
528  / static_cast<float>(maxWeight);
529  }
530  bar->setText(strprintf("%s/%s",
531  UnitsDb::formatWeight(totalWeight).c_str(),
532  UnitsDb::formatWeight(maxWeight).c_str()));
533  bar->setProgress(progress);
534  }
535 }
#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 = true 
)
static

Definition at line 478 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().

479 {
480  if (bar == nullptr)
481  return;
482 
483  updateProgressBar(bar,
486  percent);
487 }
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 113 of file statuswindow.h.

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

◆ mCopyButton

Button* StatusWindow::mCopyButton
private

Definition at line 114 of file statuswindow.h.

Referenced by StatusWindow().

◆ mHpBar

ProgressBar* StatusWindow::mHpBar
private

Definition at line 105 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mHpLabel

Label* StatusWindow::mHpLabel
private

Definition at line 102 of file statuswindow.h.

Referenced by StatusWindow().

◆ mJobBar

ProgressBar* StatusWindow::mJobBar
private

Definition at line 111 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mJobLabel

Label* StatusWindow::mJobLabel
private

Definition at line 110 of file statuswindow.h.

Referenced by StatusWindow().

◆ mJobLvlLabel

Label* StatusWindow::mJobLvlLabel
private

Definition at line 109 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mLvlLabel

Label* StatusWindow::mLvlLabel
private

Definition at line 100 of file statuswindow.h.

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

◆ mMoneyLabel

Label* StatusWindow::mMoneyLabel
private

Definition at line 101 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mMpBar

ProgressBar* StatusWindow::mMpBar
private

Definition at line 106 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mMpLabel

Label* StatusWindow::mMpLabel
private

Definition at line 103 of file statuswindow.h.

Referenced by StatusWindow().

◆ mPages

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

Definition at line 97 of file statuswindow.h.

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

◆ mTabs

TabbedArea* StatusWindow::mTabs
private

Definition at line 99 of file statuswindow.h.

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

◆ mXpBar

ProgressBar* StatusWindow::mXpBar
private

Definition at line 107 of file statuswindow.h.

Referenced by attributeChanged(), and StatusWindow().

◆ mXpLabel

Label* StatusWindow::mXpLabel
private

Definition at line 104 of file statuswindow.h.

Referenced by StatusWindow().


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