ManaPlus
Public Member Functions | Private Member Functions | Private Attributes
PopupMenu Class Reference

#include <popupmenu.h>

Inheritance diagram for PopupMenu:
Popup LinkHandler Container MouseListener WidgetListener BasicContainer2 BasicContainer Widget WidgetDeathListener Widget2

Public Member Functions

 PopupMenu ()
 
void postInit ()
 
void showPopup (const int x, const int y, const Being *const being)
 
void showPopup (const int x, const int y, const std::vector< ActorSprite *> &beings)
 
void showPlayerPopup (const std::string &nick)
 
void showPopup (const int x, const int y, const FloorItem *const floorItem)
 
void showPopup (Window *const parent, const int x, const int y, const Item *const item, const InventoryTypeT type)
 
void showPopup (const int x, const int y, Button *const button)
 
void showPopup (const int x, const int y, const ProgressBar *const bar)
 
void showPopup (const int x, const int y, MapItem *const mapItem)
 
void showItemPopup (const int x, const int y, const Item *const item)
 
void showItemPopup (const int x, const int y, const int itemId, const ItemColor color)
 
void showDropPopup (const int x, const int y, const Item *const item)
 
void showOutfitsWindowPopup (const int x, const int y)
 
void showSpellPopup (const int x, const int y, TextCommand *const cmd)
 
void showAttackMonsterPopup (const int x, const int y, const std::string &name, const int type)
 
void showPickupItemPopup (const int x, const int y, const std::string &name)
 
void showUndressPopup (const int x, const int y, const Being *const being, const Item *const item)
 
void showMapPopup (const int x, const int y, const int x2, const int y2, const bool isMinimap)
 
void showChatPopup (const int x, const int y, ChatTab *const tab)
 
void showChangePos (const int x, const int y)
 
void showPopup (const int x, const int y, ListModel *const model)
 
void showTextFieldPopup (TextField *const input)
 
void showLinkPopup (const std::string &link)
 
void showWindowsPopup ()
 
void showNpcDialogPopup (const BeingId npcId, const int x, const int y)
 
void showWindowPopup (Window *const window)
 
void showSkillPopup (const SkillInfo *const info)
 
void showSkillLevelPopup (const SkillInfo *const info)
 
void showSkillTypePopup (const SkillInfo *const info)
 
void showSkillOffsetPopup (const SkillInfo *const info, const bool isOffsetX)
 
void showCraftPopup ()
 
void showEmoteType ()
 
void showPartyPopup ()
 
void showGuildPopup ()
 
void showAttackPopup ()
 
void showNavigationPopup ()
 
void showPickupPopup ()
 
void showPlayersPopup ()
 
void showFriendsPopup ()
 
void handleLink (const std::string &link, MouseEvent *event)
 
void clear ()
 
void moveUp ()
 
void moveDown ()
 
void select ()
 
- Public Member Functions inherited from Popup
 Popup (const std::string &name, std::string skin)
 
 ~Popup ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void setContentSize (int width, int height)
 
void setLocationRelativeTo (const Widget *const widget)
 
void mouseMoved (MouseEvent &event)
 
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
 
int getPadding () const
 
void setPadding (int padding)
 
void setPopupName (const std::string &name)
 
const std::string & getPopupName () const
 
void scheduleDelete ()
 
Rect getChildrenArea ()
 
void position (const int x, const int y)
 
void hide ()
 
void widgetResized (const Event &event)
 
void widgetMoved (const Event &event)
 
bool isPopupVisible () const
 
void postInit ()
 
- Public Member Functions inherited from Container
 Container (const Widget2 *const widget)
 
 ~Container ()
 
bool safeRemove (Widget *const widget)
 
void removeControls ()
 
- 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)
 
- 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 mouseEntered (MouseEvent &event)
 
virtual void mouseExited (MouseEvent &event)
 
virtual void mousePressed (MouseEvent &event)
 
virtual void mouseReleased (MouseEvent &event)
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
virtual void mouseDragged (MouseEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetHidden (const Event &event)
 
virtual void widgetShown (const Event &event)
 
- Public Member Functions inherited from LinkHandler
 LinkHandler ()
 
virtual ~LinkHandler ()
 

Private Member Functions

void initPopup ()
 
bool isAllowCommand (const ServerCommandTypeT command)
 
bool isAllowOtherCommand (const ServerCommandTypeT command)
 
void setMousePos ()
 
void setMousePos2 ()
 
void addPlayerRelation (const std::string &name)
 
void addFollow ()
 
void addBuySell (const Being *const being)
 
void addParty (const std::string &nick)
 
void addPartyName (const std::string &partyName)
 
void addBuySellDefault ()
 
void addPlayerMisc ()
 
void addPickupFilter (const std::string &name)
 
void addProtection ()
 
void addUse (const Item *const item)
 
void addItemMenu (const Item *const item, const InventoryTypeT type)
 
void addDrop (const Item *const item, const bool isProtected)
 
void addGmCommands ()
 
void showMuteCommands ()
 
void showPlayerMenu ()
 
void showFloorItemGMCommands ()
 
void showItemGMCommands ()
 
void addNormalRelations ()
 
void addWindowMenu (const Window *const window)
 
void showHomunGMCommands ()
 
void showPetGMCommands ()
 
void showMercenaryGMCommands ()
 
void addChat (const Being *const being)
 
void addMailCommands ()
 
void addCatchPetCommands ()
 
void showGMPopup (const std::string &name)
 
void showPlayerGMCommands (const std::string &name)
 
void showNpcGMCommands ()
 
void showMonsterGMCommands ()
 
void showAdoptCommands ()
 
void addSocialMenu ()
 
bool addBeingMenu ()
 
void showPopup (int x, int y)
 

Private Attributes

StaticBrowserBoxmBrowserBox
 
ScrollAreamScrollArea
 
BeingId mBeingId
 
BeingId mFloorItemId
 
int mItemId
 
int mItemIndex
 
int mItemCards [4]
 
ItemColor mItemColor
 
MapItemmMapItem
 
ChatTabmTab
 
TextCommandmSpell
 
WindowmCallerWindow
 
RenameListener mRenameListener
 
PlayerListener mPlayerListener
 
TextDialogmDialog
 
ButtonmButton
 
const GroupInfomGroup
 
std::string mName
 
std::string mExtName
 
TextFieldmTextField
 
ActorTypeT mType
 
BeingTypeId mSubType
 
int mX
 
int mY
 
bool mAllowCleanMenu
 

Additional Inherited Members

- Static Public Member Functions inherited from Popup
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)
 
- 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 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 Attributes inherited from Popup
int mPadding
 
SkinmSkin
 
- 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

Window showing popup menu.

Definition at line 68 of file popupmenu.h.

Constructor & Destructor Documentation

◆ PopupMenu()

PopupMenu::PopupMenu ( )

Constructor.

Definition at line 104 of file popupmenu.cpp.

References Widget::addMouseListener(), mBrowserBox, mPlayerListener, mRenameListener, mScrollArea, Opaque_false, RenameListener::setDialog(), PlayerListener::setDialog(), StaticBrowserBox::setLinkHandler(), RenameListener::setMapItem(), PlayerListener::setNick(), StaticBrowserBox::setOpaque(), PlayerListener::setType(), ScrollArea::setVerticalScrollPolicy(), ScrollArea::SHOW_AUTO, and ActorType::Unknown.

104  :
105  Popup("PopupMenu", "popupmenu.xml"),
107  "popupbrowserbox.xml")),
108  mScrollArea(nullptr),
111  mItemId(0),
112  mItemIndex(-1),
114  mMapItem(nullptr),
115  mTab(nullptr),
116  mSpell(nullptr),
117  mCallerWindow(nullptr),
118  mRenameListener(),
119  mPlayerListener(),
120  mDialog(nullptr),
121  mButton(nullptr),
122  mGroup(nullptr),
123  mName(),
124  mExtName(),
125  mTextField(nullptr),
128  mX(0),
129  mY(0),
130  mAllowCleanMenu(true)
131 {
134  mRenameListener.setMapItem(nullptr);
135  mRenameListener.setDialog(nullptr);
137  mPlayerListener.setDialog(nullptr);
139  mScrollArea = new ScrollArea(this,
140  mBrowserBox, Opaque_false, std::string());
142  addMouseListener(this);
143 }
MapItem * mMapItem
Definition: popupmenu.h:294
ItemColor mItemColor
Definition: popupmenu.h:293
Popup(const std::string &name, std::string skin)
Definition: popup.cpp:39
int mItemIndex
Definition: popupmenu.h:291
PlayerListener mPlayerListener
Definition: popupmenu.h:299
std::string mExtName
Definition: popupmenu.h:304
void setNick(const std::string &name)
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
const ItemColor ItemColor_one
Definition: itemcolor.h:29
BeingId mFloorItemId
Definition: popupmenu.h:289
void setVerticalScrollPolicy(const ScrollPolicy vPolicy)
ChatTab * mTab
Definition: popupmenu.h:295
void setDialog(TextDialog *dialog)
RenameListener mRenameListener
Definition: popupmenu.h:298
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
TextField * mTextField
Definition: popupmenu.h:305
void setLinkHandler(LinkHandler *linkHandler)
Window * mCallerWindow
Definition: popupmenu.h:297
ScrollArea * mScrollArea
Definition: popupmenu.h:286
int mItemId
Definition: popupmenu.h:290
std::string mName
Definition: popupmenu.h:303
BeingId mBeingId
Definition: popupmenu.h:288
void addMouseListener(MouseListener *const mouseListener)
Definition: widget.cpp:291
const bool Opaque_false
Definition: opaque.h:29
void setMapItem(const MapItem *const mapItem)
void setOpaque(Opaque opaque)
void setType(const ActorTypeT type)
void setDialog(TextDialog *const dialog)
const bool Opaque_true
Definition: opaque.h:29
const BeingId BeingId_zero
Definition: beingid.h:29
TextCommand * mSpell
Definition: popupmenu.h:296
Button * mButton
Definition: popupmenu.h:301
TextDialog * mDialog
Definition: popupmenu.h:300
ActorTypeT mType
Definition: popupmenu.h:306
const GroupInfo * mGroup
Definition: popupmenu.h:302
bool mAllowCleanMenu
Definition: popupmenu.h:310
BeingTypeId mSubType
Definition: popupmenu.h:307

Member Function Documentation

◆ addBeingMenu()

bool PopupMenu::addBeingMenu ( )
private

Definition at line 519 of file popupmenu.cpp.

References actorManager, StaticBrowserBox::addRow(), BeingMenuItem::command, ActorManager::findBeing(), FOR_EACH, fromInt, NPCDB::get(), BeingInfo::getMenu(), Being::getSubType(), Actions::info(), ServerCommandType::item, mBeingId, mBrowserBox, EAthena::menu, and BeingMenuItem::name.

Referenced by showPopup().

520 {
522  if (being == nullptr)
523  return false;
524 
525  BeingInfo *const info = NPCDB::get(fromInt(
526  being->getSubType(), BeingTypeId));
527  if (info == nullptr)
528  return false;
529 
530  const STD_VECTOR<BeingMenuItem> &menu = info->getMenu();
531  FOR_EACH (STD_VECTOR<BeingMenuItem>::const_iterator, it, menu)
532  {
533  const BeingMenuItem &item = *it;
534  mBrowserBox->addRow("/" + item.command, item.name.c_str());
535  }
536  return true;
537 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
BeingInfo * get(const BeingTypeId id)
Definition: npcdb.cpp:187
#define fromInt(val, name)
Definition: intdefines.h:45
std::string command
Definition: beingmenuitem.h:40
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
bool info(InputEvent &event)
Definition: commands.cpp:56
const std::vector< BeingMenuItem > & getMenu() const A_CONST
Definition: beinginfo.cpp:258
Being * findBeing(const BeingId id) const
MenuTypeT menu
Definition: menu.cpp:27
BeingId mBeingId
Definition: popupmenu.h:288
std::string name
Definition: beingmenuitem.h:39
int BeingTypeId
Definition: beingtypeid.h:29
Definition: being.h:93
BeingTypeId getSubType() const
Definition: being.h:399
ActorManager * actorManager
void addRow(const std::string &row, const bool atTop)

◆ addBuySell()

void PopupMenu::addBuySell ( const Being *const  being)
private

Definition at line 2593 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), PlayerRelationsManager::getDefault(), Net::getNetworkType(), Being::isBuyShopEnabled(), Being::isSellShopEnabled(), mBrowserBox, playerRelations, ServerType::TMWATHENA, and PlayerRelation::TRADE.

Referenced by showChatPopup(), and showPopup().

2594 {
2596  {
2597  mBrowserBox->addSeparator("##3---");
2598  const bool haveVending =
2600  if (being->isSellShopEnabled())
2601  {
2602  // TRANSLATORS: popup menu item
2603  // TRANSLATORS: buy item
2604  mBrowserBox->addRow("/buy 'NAME'", _("Buy"));
2605  }
2606  else if (!haveVending)
2607  {
2608  // TRANSLATORS: popup menu item
2609  // TRANSLATORS: buy item
2610  mBrowserBox->addRow("/buy 'NAME'", _("Buy (?)"));
2611  }
2612  if (being->isBuyShopEnabled())
2613  {
2614  // TRANSLATORS: popup menu item
2615  // TRANSLATORS: sell item
2616  mBrowserBox->addRow("/sell 'NAME'", _("Sell"));
2617  }
2618  else if (!haveVending)
2619  {
2620  // TRANSLATORS: popup menu item
2621  // TRANSLATORS: sell item
2622  mBrowserBox->addRow("/sell 'NAME'", _("Sell (?)"));
2623  }
2624  }
2625 }
#define _(s)
Definition: gettext.h:34
bool isBuyShopEnabled() const
Definition: being.cpp:5351
bool isSellShopEnabled() const
Definition: being.cpp:5357
static const unsigned int TRADE
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
ServerTypeT getNetworkType()
Definition: net.cpp:184
unsigned int getDefault() const
PlayerRelationsManager playerRelations
void addRow(const std::string &row, const bool atTop)

◆ addBuySellDefault()

void PopupMenu::addBuySellDefault ( )
private

Definition at line 2627 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), PlayerRelationsManager::getDefault(), mBrowserBox, playerRelations, and PlayerRelation::TRADE.

Referenced by showChatPopup(), and showPlayerPopup().

2628 {
2630  {
2631  mBrowserBox->addSeparator("##3---");
2632  // TRANSLATORS: popup menu item
2633  // TRANSLATORS: buy item
2634  mBrowserBox->addRow("/buy 'NAME'", _("Buy (?)"));
2635  // TRANSLATORS: popup menu item
2636  // TRANSLATORS: sell item
2637  mBrowserBox->addRow("/sell 'NAME'", _("Sell (?)"));
2638  }
2639 }
#define _(s)
Definition: gettext.h:34
static const unsigned int TRADE
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
unsigned int getDefault() const
PlayerRelationsManager playerRelations
void addRow(const std::string &row, const bool atTop)

◆ addCatchPetCommands()

void PopupMenu::addCatchPetCommands ( )
private

Definition at line 3490 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Net::getNetworkType(), mBrowserBox, and ServerType::TMWATHENA.

Referenced by showPopup().

3491 {
3493  return;
3494  // TRANSLATORS: popup menu item
3495  // TRANSLATORS: catch pet command
3496  mBrowserBox->addRow("/catchpet :'BEINGID'", _("Taming pet"));
3497 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
ServerTypeT getNetworkType()
Definition: net.cpp:184
void addRow(const std::string &row, const bool atTop)

◆ addChat()

void PopupMenu::addChat ( const Being *const  being)
private

Definition at line 2690 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), Being::getChat(), mBrowserBox, strprintf(), and ChatObject::title.

Referenced by showPopup().

2691 {
2692  if (being == nullptr)
2693  return;
2694  const ChatObject *const chat = being->getChat();
2695  if (chat != nullptr)
2696  {
2697  mBrowserBox->addRow("join chat",
2698  // TRANSLATORS: popup menu item
2699  // TRANSLATORS: invite player to party
2700  strprintf(_("Join chat %s"), chat->title.c_str()).c_str());
2701  mBrowserBox->addSeparator("##3---");
2702  }
2703 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
std::string title
Definition: chatobject.h:50
ChatObject * getChat() const
Definition: being.h:1002
void addRow(const std::string &row, const bool atTop)

◆ addDrop()

void PopupMenu::addDrop ( const Item *const  item,
const bool  isProtected 
)
private

Definition at line 2864 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), Item::getQuantity(), and mBrowserBox.

Referenced by showDropPopup(), showItemPopup(), and showPopup().

2866 {
2867  if (!isProtected)
2868  {
2869  mBrowserBox->addSeparator("##3---");
2870  if (item->getQuantity() > 1)
2871  {
2872  // TRANSLATORS: popup menu item
2873  // TRANSLATORS: drop item
2874  mBrowserBox->addRow("/dropinv 'INVINDEX'", _("Drop..."));
2875  // TRANSLATORS: popup menu item
2876  // TRANSLATORS: drop all item amount
2877  mBrowserBox->addRow("/dropinvall 'INVINDEX'", _("Drop all"));
2878  }
2879  else
2880  {
2881  // TRANSLATORS: popup menu item
2882  // TRANSLATORS: drop item
2883  mBrowserBox->addRow("/dropinv 'INVINDEX'", _("Drop"));
2884  }
2885  }
2886 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
int getQuantity() const
Definition: item.h:104
void addRow(const std::string &row, const bool atTop)

◆ addFollow()

void PopupMenu::addFollow ( )
private

Definition at line 2581 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), features, Configuration::getBoolValue(), and mBrowserBox.

Referenced by showChatPopup(), showPlayerPopup(), and showPopup().

2582 {
2583  if (features.getBoolValue("allowFollow"))
2584  {
2585  // TRANSLATORS: popup menu item
2586  mBrowserBox->addRow("/follow 'NAME'", _("Follow"));
2587  }
2588  // TRANSLATORS: popup menu item
2589  // TRANSLATORS: imitate player
2590  mBrowserBox->addRow("/imitation 'NAME'", _("Imitate"));
2591 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
bool getBoolValue(const std::string &key) const
Configuration features
void addRow(const std::string &row, const bool atTop)

◆ addGmCommands()

void PopupMenu::addGmCommands ( )
private

Definition at line 2888 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Being::isGM(), localPlayer, and mBrowserBox.

Referenced by showChatPopup(), showDropPopup(), showItemPopup(), showPlayerPopup(), showPopup(), and showUndressPopup().

2889 {
2890  if (localPlayer->isGM())
2891  {
2892  // TRANSLATORS: popup menu item
2893  // TRANSLATORS: gm commands
2894  mBrowserBox->addRow("gm", _("GM..."));
2895  }
2896 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
LocalPlayer * localPlayer
bool isGM() const
Definition: being.h:658
void addRow(const std::string &row, const bool atTop)

◆ addItemMenu()

void PopupMenu::addItemMenu ( const Item *const  item,
const InventoryTypeT  type 
)
private

Definition at line 2817 of file popupmenu.cpp.

References StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), InventoryType::Cart, ItemMenuItem::command1, ItemMenuItem::command2, InventoryType::Craft, Equipm_true, Equipped_true, FOR_EACHP, ItemInfo::getCartMenuConst(), Item::getInfo(), ItemInfo::getInventoryMenuConst(), Item::getQuantity(), ItemInfo::getStorageMenuConst(), Actions::info(), InventoryType::Inventory, Item::isEquipment(), Item::isEquipped(), InventoryType::MailEdit, InventoryType::MailView, mBrowserBox, EAthena::menu, ItemMenuItem::name1, ItemMenuItem::name2, InventoryType::Npc, InventoryType::Storage, InventoryType::Trade, InventoryType::TypeEnd, and InventoryType::Vending.

Referenced by showPopup().

2819 {
2820  const ItemInfo &info = item->getInfo();
2821  const STD_VECTOR<ItemMenuItem> *menu = nullptr;
2822  switch (type)
2823  {
2825  menu = &info.getInventoryMenuConst();
2826  break;
2828  menu = &info.getStorageMenuConst();
2829  break;
2830  case InventoryType::Cart:
2831  menu = &info.getCartMenuConst();
2832  break;
2833  case InventoryType::Trade:
2834  case InventoryType::Npc:
2838  case InventoryType::Craft:
2840  default:
2841  return;
2842  }
2843 
2844  const bool firstMode = (item->isEquipment() == Equipm_true ?
2845  (item->isEquipped() != Equipped_true) : (item->getQuantity() == 1));
2846 
2847  FOR_EACHP (STD_VECTOR<ItemMenuItem>::const_iterator, it, menu)
2848  {
2849  const ItemMenuItem &menuItem = *it;
2850  const std::string &name = firstMode ?
2851  menuItem.name1 : menuItem.name2;
2852  const std::string &command = firstMode ?
2853  menuItem.command1 : menuItem.command2;
2854  if (command.empty() ||
2855  name.empty())
2856  {
2857  continue;
2858  }
2859  mBrowserBox->addRow("/" + command, name.c_str());
2860  }
2861  mBrowserBox->addSeparator("##3---");
2862 }
#define FOR_EACHP(type, iter, array)
Definition: foreach.h:30
std::string command2
Definition: itemmenuitem.h:46
std::string name2
Definition: itemmenuitem.h:44
Equipped isEquipped() const
Definition: item.h:128
std::string name1
Definition: itemmenuitem.h:43
const bool Equipped_true
Definition: equipped.h:29
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
const bool Equipm_true
Definition: equipm.h:29
int getQuantity() const
Definition: item.h:104
bool info(InputEvent &event)
Definition: commands.cpp:56
MenuTypeT menu
Definition: menu.cpp:27
const ItemInfo & getInfo() const
Definition: item.h:170
std::string command1
Definition: itemmenuitem.h:45
const std::vector< ItemMenuItem > & getInventoryMenuConst() const A_CONST
Definition: iteminfo.h:325
const std::vector< ItemMenuItem > & getStorageMenuConst() const A_CONST
Definition: iteminfo.h:327
Equipm isEquipment() const
Definition: item.h:116
const std::vector< ItemMenuItem > & getCartMenuConst() const A_CONST
Definition: iteminfo.h:329
void addRow(const std::string &row, const bool atTop)

◆ addMailCommands()

void PopupMenu::addMailCommands ( )
private

Definition at line 3480 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Net::getNetworkType(), mBrowserBox, and ServerType::TMWATHENA.

Referenced by showChatPopup(), showPlayerPopup(), and showPopup().

3481 {
3483  return;
3484 
3485  // TRANSLATORS: popup menu item
3486  // TRANSLATORS: open mail dialog
3487  mBrowserBox->addRow("/mailto 'NAME'", _("Mail to..."));
3488 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
ServerTypeT getNetworkType()
Definition: net.cpp:184
void addRow(const std::string &row, const bool atTop)

◆ addNormalRelations()

void PopupMenu::addNormalRelations ( )
private

Definition at line 2473 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), and mBrowserBox.

Referenced by addPlayerRelation().

2474 {
2475  // TRANSLATORS: popup menu item
2476  // TRANSLATORS: add player to disregarded list
2477  mBrowserBox->addRow("/disregard 'NAME'", _("Disregard"));
2478  // TRANSLATORS: popup menu item
2479  // TRANSLATORS: add player to ignore list
2480  mBrowserBox->addRow("/ignore 'NAME'", _("Ignore"));
2481  // TRANSLATORS: popup menu item
2482  // TRANSLATORS: add player to black list
2483  mBrowserBox->addRow("/blacklist 'NAME'", _("Black list"));
2484  // TRANSLATORS: popup menu item
2485  // TRANSLATORS: add player to enemy list
2486  mBrowserBox->addRow("/enemy 'NAME'", _("Set as enemy"));
2487  // TRANSLATORS: popup menu item
2488  // TRANSLATORS: add player to erased list
2489  mBrowserBox->addRow("/erase 'NAME'", _("Erase"));
2490 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addRow(const std::string &row, const bool atTop)

◆ addParty()

void PopupMenu::addParty ( const std::string &  nick)
private

Definition at line 2665 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), Being::getParty(), Being::isInParty(), Party::isMember(), localPlayer, mBrowserBox, party, and showAdoptCommands().

Referenced by showChatPopup().

2666 {
2667  if (localPlayer->isInParty())
2668  {
2669  const Party *const party = localPlayer->getParty();
2670  if (party != nullptr)
2671  {
2672  if (!party->isMember(nick))
2673  {
2674  // TRANSLATORS: popup menu item
2675  // TRANSLATORS: invite player to party
2676  mBrowserBox->addRow("/party 'NAME'", _("Invite to party"));
2677  }
2678  else
2679  {
2680  // TRANSLATORS: popup menu item
2681  // TRANSLATORS: kick player from party
2682  mBrowserBox->addRow("/kickparty 'NAME'", _("Kick from party"));
2684  }
2685  mBrowserBox->addSeparator("##3---");
2686  }
2687  }
2688 }
#define _(s)
Definition: gettext.h:34
Definition: party.h:61
void showAdoptCommands()
Definition: popupmenu.cpp:3499
Party * getParty() const
Definition: being.h:329
uint32_t party
bool isMember(const PartyMember *const member) const
Definition: party.cpp:229
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
LocalPlayer * localPlayer
bool isInParty() const
Definition: being.h:320
void addRow(const std::string &row, const bool atTop)

◆ addPartyName()

void PopupMenu::addPartyName ( const std::string &  partyName)
private

Definition at line 2641 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), Party::getName(), Being::getParty(), Being::isInParty(), localPlayer, mBrowserBox, and showAdoptCommands().

Referenced by showPopup().

2642 {
2643  if (localPlayer->isInParty())
2644  {
2645  if (localPlayer->getParty() != nullptr)
2646  {
2647  if (localPlayer->getParty()->getName() != partyName)
2648  {
2649  // TRANSLATORS: popup menu item
2650  // TRANSLATORS: invite player to party
2651  mBrowserBox->addRow("/party 'NAME'", _("Invite to party"));
2652  }
2653  else
2654  {
2655  // TRANSLATORS: popup menu item
2656  // TRANSLATORS: kick player from party
2657  mBrowserBox->addRow("/kickparty 'NAME'", _("Kick from party"));
2659  }
2660  mBrowserBox->addSeparator("##3---");
2661  }
2662  }
2663 }
#define _(s)
Definition: gettext.h:34
void showAdoptCommands()
Definition: popupmenu.cpp:3499
Party * getParty() const
Definition: being.h:329
const std::string & getName() const
Definition: party.h:96
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
LocalPlayer * localPlayer
bool isInParty() const
Definition: being.h:320
void addRow(const std::string &row, const bool atTop)

◆ addPickupFilter()

void PopupMenu::addPickupFilter ( const std::string &  name)
private

Definition at line 2717 of file popupmenu.cpp.

References _, actorManager, StaticBrowserBox::addRow(), ActorManager::isInIgnorePickupList(), ActorManager::isInPickupList(), and mBrowserBox.

Referenced by showDropPopup(), showItemPopup(), and showPopup().

2718 {
2719  if (actorManager->isInPickupList(name)
2721  {
2722  mBrowserBox->addRow("/removepickup 'NAME'",
2723  // TRANSLATORS: popup menu item
2724  // TRANSLATORS: remove item from pickup list
2725  _("Remove from pickup list"));
2726  }
2727  else
2728  {
2729  mBrowserBox->addRow("/addpickup 'NAME'",
2730  // TRANSLATORS: popup menu item
2731  // TRANSLATORS: popup menu item
2732  _("Add to pickup list"));
2733  mBrowserBox->addRow("/ignorepickup 'NAME'",
2734  // TRANSLATORS: popup menu item
2735  // TRANSLATORS: add item to pickup list
2736  _("Add to ignore list"));
2737  }
2738 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
bool isInIgnorePickupList(const std::string &name) const
Definition: actormanager.h:344
bool isInPickupList(const std::string &name) const
Definition: actormanager.h:343
ActorManager * actorManager
void addRow(const std::string &row, const bool atTop)

◆ addPlayerMisc()

void PopupMenu::addPlayerMisc ( )
private

Definition at line 2705 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), and mBrowserBox.

Referenced by showChatPopup(), and showPopup().

2706 {
2707  // TRANSLATORS: popup menu item
2708  mBrowserBox->addRow("/showitems :'BEINGID'", _("Show Items"));
2709  // TRANSLATORS: popup menu item
2710  // TRANSLATORS: undress player
2711  mBrowserBox->addRow("/undress :'BEINGID'", _("Undress"));
2712  // TRANSLATORS: popup menu item
2713  // TRANSLATORS: add comment to player
2714  mBrowserBox->addRow("addcomment", _("Add comment"));
2715 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addRow(const std::string &row, const bool atTop)

◆ addPlayerRelation()

void PopupMenu::addPlayerRelation ( const std::string &  name)
private

Definition at line 2492 of file popupmenu.cpp.

References _, addNormalRelations(), StaticBrowserBox::addRow(), Relation::BLACKLISTED, Relation::DISREGARDED, Relation::ENEMY2, Relation::ERASED, Relation::FRIEND, PlayerRelationsManager::getRelation(), Relation::IGNORED, mBrowserBox, Relation::NEUTRAL, and playerRelations.

Referenced by showChatPopup(), showPlayerPopup(), and showPopup().

2493 {
2494  switch (playerRelations.getRelation(name))
2495  {
2496  case Relation::NEUTRAL:
2497  // TRANSLATORS: popup menu item
2498  // TRANSLATORS: add player to friends list
2499  mBrowserBox->addRow("/friend 'NAME'", _("Be friend"));
2501  break;
2502 
2503  case Relation::FRIEND:
2505  break;
2506 
2507  case Relation::BLACKLISTED:
2508  // TRANSLATORS: popup menu item
2509  // TRANSLATORS: remove player from ignore list
2510  mBrowserBox->addRow("/unignore 'NAME'", _("Unignore"));
2511  // TRANSLATORS: popup menu item
2512  // TRANSLATORS: add player to disregarded list
2513  mBrowserBox->addRow("/disregard 'NAME'", _("Disregard"));
2514  // TRANSLATORS: popup menu item
2515  // TRANSLATORS: add player to ignore list
2516  mBrowserBox->addRow("/ignore 'NAME'", _("Ignore"));
2517  // TRANSLATORS: popup menu item
2518  // TRANSLATORS: add player to enemy list
2519  mBrowserBox->addRow("/enemy 'NAME'", _("Set as enemy"));
2520  // TRANSLATORS: popup menu item
2521  // TRANSLATORS: add player to erased list
2522  mBrowserBox->addRow("/erase 'NAME'", _("Erase"));
2523  break;
2524 
2525  case Relation::DISREGARDED:
2526  // TRANSLATORS: popup menu item
2527  // TRANSLATORS: remove player from ignore list
2528  mBrowserBox->addRow("/unignore 'NAME'", _("Unignore"));
2529  // TRANSLATORS: popup menu item
2530  // TRANSLATORS: add player to completle ignore list
2531  mBrowserBox->addRow("/ignore 'NAME'", _("Completely ignore"));
2532  // TRANSLATORS: popup menu item
2533  // TRANSLATORS: add player to erased list
2534  mBrowserBox->addRow("/erase 'NAME'", _("Erase"));
2535  break;
2536 
2537  case Relation::IGNORED:
2538  // TRANSLATORS: popup menu item
2539  // TRANSLATORS: remove player from ignore list
2540  mBrowserBox->addRow("/unignore 'NAME'", _("Unignore"));
2541  // TRANSLATORS: popup menu item
2542  // TRANSLATORS: add player to erased list
2543  mBrowserBox->addRow("/erase 'NAME'", _("Erase"));
2544  break;
2545 
2546  case Relation::ENEMY2:
2547  // TRANSLATORS: popup menu item
2548  // TRANSLATORS: remove player from ignore list
2549  mBrowserBox->addRow("/unignore 'NAME'", _("Unignore"));
2550  // TRANSLATORS: popup menu item
2551  // TRANSLATORS: add player to disregarded list
2552  mBrowserBox->addRow("/disregard 'NAME'", _("Disregard"));
2553  // TRANSLATORS: popup menu item
2554  // TRANSLATORS: add player to ignore list
2555  mBrowserBox->addRow("/ignore 'NAME'", _("Ignore"));
2556  // TRANSLATORS: popup menu item
2557  // TRANSLATORS: add player to black list
2558  mBrowserBox->addRow("/blacklist 'NAME'", _("Black list"));
2559  // TRANSLATORS: popup menu item
2560  // TRANSLATORS: add player to erased list
2561  mBrowserBox->addRow("/erase 'NAME'", _("Erase"));
2562  break;
2563 
2564  case Relation::ERASED:
2565  // TRANSLATORS: popup menu item
2566  // TRANSLATORS: remove player from ignore list
2567  mBrowserBox->addRow("/unignore 'NAME'", _("Unignore"));
2568  // TRANSLATORS: popup menu item
2569  // TRANSLATORS: add player to disregarded list
2570  mBrowserBox->addRow("/disregard 'NAME'", _("Disregard"));
2571  // TRANSLATORS: popup menu item
2572  // TRANSLATORS: add player to ignore list
2573  mBrowserBox->addRow("/ignore 'NAME'", _("Completely ignore"));
2574  break;
2575 
2576  default:
2577  break;
2578  }
2579 }
#define _(s)
Definition: gettext.h:34
RelationT getRelation(const std::string &name) const
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
PlayerRelationsManager playerRelations
void addNormalRelations()
Definition: popupmenu.cpp:2473
void addRow(const std::string &row, const bool atTop)

◆ addProtection()

void PopupMenu::addProtection ( )
private

Definition at line 2777 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), PlayerInfo::isItemProtected(), mBrowserBox, mItemId, and SPELL_MIN_ID.

Referenced by showDropPopup(), showItemPopup(), and showPopup().

2778 {
2780  {
2781  mBrowserBox->addSeparator("##3---");
2782  // TRANSLATORS: popup menu item
2783  // TRANSLATORS: remove protection from item
2784  mBrowserBox->addRow("/unprotectitem 'ITEMID'", _("Unprotect item"));
2785  }
2786  else
2787  {
2788  if (mItemId < SPELL_MIN_ID)
2789  {
2790  mBrowserBox->addSeparator("##3---");
2791  // TRANSLATORS: popup menu item
2792  // TRANSLATORS: add protection to item
2793  mBrowserBox->addRow("/protectitem 'ITEMID'", _("Protect item"));
2794  }
2795  }
2796 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
const int SPELL_MIN_ID
Definition: spells.h:27
int mItemId
Definition: popupmenu.h:290
bool isItemProtected(const int id)
Definition: playerinfo.cpp:512
void addRow(const std::string &row, const bool atTop)

◆ addSocialMenu()

void PopupMenu::addSocialMenu ( )
private

Definition at line 3508 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), StaticBrowserBox::clearRows(), Being::getGuild(), Net::getNetworkType(), Being::getParty(), guild, initPopup(), localPlayer, mBrowserBox, party, setMousePos(), and ServerType::TMWATHENA.

Referenced by showAttackPopup(), showFriendsPopup(), showGuildPopup(), showNavigationPopup(), showPartyPopup(), showPickupPopup(), and showPlayersPopup().

3509 {
3510  initPopup();
3512  setMousePos();
3513  const Party *const party = localPlayer->getParty();
3514  if (party != nullptr)
3515  {
3516  // TRANSLATORS: popup menu item
3517  // TRANSLATORS: leave party
3518  mBrowserBox->addRow("/leaveparty", _("Leave party"));
3519  }
3520  else
3521  {
3522  // TRANSLATORS: popup menu item
3523  // TRANSLATORS: create party
3524  mBrowserBox->addRow("/createparty", _("Create party"));
3525  }
3526 
3528  {
3529  const Guild *const guild = localPlayer->getGuild();
3530  if (guild != nullptr)
3531  {
3532  // TRANSLATORS: popup menu item
3533  // TRANSLATORS: leave guild
3534  mBrowserBox->addRow("/leaveguild", _("Leave guild"));
3535  }
3536  else
3537  {
3538  // TRANSLATORS: popup menu item
3539  // TRANSLATORS: create guild
3540  mBrowserBox->addRow("/createguild", _("Create guild"));
3541  }
3542  }
3543  mBrowserBox->addSeparator("##3---");
3544 }
#define _(s)
Definition: gettext.h:34
Definition: party.h:61
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
void setMousePos()
Definition: popupmenu.cpp:539
Party * getParty() const
Definition: being.h:329
uint32_t party
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
LocalPlayer * localPlayer
void initPopup()
Definition: popupmenu.cpp:151
ServerTypeT getNetworkType()
Definition: net.cpp:184
uint32_t guild
Definition: guild.h:68
void addRow(const std::string &row, const bool atTop)

◆ addUse()

void PopupMenu::addUse ( const Item *const  item)
private

Definition at line 2798 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Equipm_true, Equipped_true, Item::getInfo(), ItemInfo::getUseButton(), ItemInfo::getUseButton2(), Actions::info(), Item::isEquipment(), Item::isEquipped(), mBrowserBox, and ServerCommandType::str.

Referenced by showDropPopup(), and showItemPopup().

2799 {
2800  const ItemInfo &info = item->getInfo();
2801  const std::string &str = (item->isEquipment() == Equipm_true
2802  && item->isEquipped() == Equipped_true)
2803  ? info.getUseButton2() : info.getUseButton();
2804 
2805  if (str.empty())
2806  {
2807  // TRANSLATORS: popup menu item
2808  mBrowserBox->addRow("/useinv 'INVINDEX'", _("Use"));
2809  }
2810  else
2811  {
2812  // TRANSLATORS: popup menu item
2813  mBrowserBox->addRow("/useinv 'INVINDEX'", str.c_str());
2814  }
2815 }
#define _(s)
Definition: gettext.h:34
Equipped isEquipped() const
Definition: item.h:128
const bool Equipped_true
Definition: equipped.h:29
const std::string & getUseButton() const
Definition: iteminfo.h:117
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
const std::string & getUseButton2() const
Definition: iteminfo.h:123
const bool Equipm_true
Definition: equipm.h:29
bool info(InputEvent &event)
Definition: commands.cpp:56
const ItemInfo & getInfo() const
Definition: item.h:170
Equipm isEquipment() const
Definition: item.h:116
void addRow(const std::string &row, const bool atTop)

◆ addWindowMenu()

void PopupMenu::addWindowMenu ( const Window *const  window)
private

Definition at line 1184 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Window::getAlowClose(), initPopup(), Window::isSticky(), Window::isStickyButtonLock(), and mBrowserBox.

Referenced by showChatPopup(), showOutfitsWindowPopup(), and showWindowPopup().

1185 {
1186  if (window == nullptr)
1187  return;
1188 
1189  initPopup();
1190  if (window->getAlowClose())
1191  {
1192  // TRANSLATORS: popup menu item
1193  // TRANSLATORS: close window
1194  mBrowserBox->addRow("window close", _("Close"));
1195  }
1196 
1197  if (window->isStickyButtonLock())
1198  {
1199  if (window->isSticky())
1200  {
1201  // TRANSLATORS: popup menu item
1202  // TRANSLATORS: unlock window
1203  mBrowserBox->addRow("window unlock", _("Unlock"));
1204  }
1205  else
1206  {
1207  // TRANSLATORS: popup menu item
1208  // TRANSLATORS: lock window
1209  mBrowserBox->addRow("window lock", _("Lock"));
1210  }
1211  }
1212 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void initPopup()
Definition: popupmenu.cpp:151
bool isStickyButtonLock() const
Definition: window.h:263
bool getAlowClose() const
Definition: window.h:191
bool isSticky() const
Definition: window.h:252
void addRow(const std::string &row, const bool atTop)

◆ clear()

void PopupMenu::clear ( )
virtual

Clears the basic container from all widgets.

See also
remove, clear

Reimplemented from BasicContainer.

Definition at line 2758 of file popupmenu.cpp.

References TextDialog::close(), maxCards, mButton, mCallerWindow, mDialog, mItemCards, mItemId, mItemIndex, mMapItem, mSpell, mTab, and mTextField.

Referenced by PopupManager::clearPopup().

2759 {
2760  if (mDialog != nullptr)
2761  {
2762  mDialog->close();
2763  mDialog = nullptr;
2764  }
2765  mItemIndex = -1;
2766  mItemId = 0;
2767  for (int f = 0; f < maxCards; f ++)
2768  mItemCards[f] = 0;
2769  mMapItem = nullptr;
2770  mTab = nullptr;
2771  mSpell = nullptr;
2772  mCallerWindow = nullptr;
2773  mButton = nullptr;
2774  mTextField = nullptr;
2775 }
MapItem * mMapItem
Definition: popupmenu.h:294
int mItemIndex
Definition: popupmenu.h:291
ChatTab * mTab
Definition: popupmenu.h:295
TextField * mTextField
Definition: popupmenu.h:305
Window * mCallerWindow
Definition: popupmenu.h:297
int mItemId
Definition: popupmenu.h:290
int mItemCards[4]
Definition: popupmenu.h:292
TextCommand * mSpell
Definition: popupmenu.h:296
Button * mButton
Definition: popupmenu.h:301
TextDialog * mDialog
Definition: popupmenu.h:300
#define maxCards
Definition: cards.h:24
void close()
Definition: textdialog.cpp:140

◆ handleLink()

void PopupMenu::handleLink ( const std::string &  link,
MouseEvent event 
)
virtual

Handles link action.

Implements LinkHandler.

Definition at line 1250 of file popupmenu.cpp.

References _, actorManager, Widget::addActionListener(), adminHandler, BeingId_zero, BeingTypeId_zero, CAST_S32, Net::GuildHandler::changeMemberPostion(), chatHandler, Window::close(), CREATEWIDGET, CREATEWIDGETR, CREATEWIDGETV, MapItemType::EMPTY, escapeString(), InputManager::executeAction(), InputManager::executeChatCommand(), ActorManager::findBeing(), ActorManager::findBeingByName(), ActorManager::findItem(), fromInt, FloorItem::getCard(), Being::getChat(), MapItem::getComment(), Being::getComment(), Being::getGuild(), ActorSprite::getId(), FloorItem::getItemId(), Viewport::getMap(), Being::getName(), Being::getPartyName(), Map::getSpecialLayer(), Being::getTileX(), Being::getTileY(), MapItem::getType(), MapItem::getX(), Widget::getX(), MapItem::getY(), Widget::getY(), guild, guildHandler, TextField::handleCopy(), TextField::handlePaste(), MapItemType::HOME, inputManager, ServerCommandType::item, ItemColor_one, Net::ChatHandler::joinChat(), Being::loadComment(), localPlayer, mAllowCleanMenu, maxCards, mBeingId, mButton, mCallerWindow, mDialog, mExtName, mFloorItemId, miniStatusWindow, mItemCards, mItemColor, mItemId, mItemIndex, mMapItem, mName, mPlayerListener, mRenameListener, mSpell, mSubType, mTab, mTextField, mType, Net::AdminHandler::mute(), mX, mY, ActorType::Player, LocalPlayer::removeHome(), SocialWindow::removePortal(), replaceAll(), reportAlways, LocalPlayer::saveHomes(), Widget::setActionEventId(), RenameListener::setDialog(), PlayerListener::setDialog(), RenameListener::setMapItem(), PlayerListener::setNick(), Window::setSticky(), TextDialog::setText(), SpecialLayer::setTile(), PlayerListener::setType(), Widget::setVisible(), MiniStatusWindow::showBar(), WindowMenu::showButton(), showChangePos(), showCraftPopup(), showGMPopup(), showMuteCommands(), showPlayerMenu(), showPopup(), socialWindow, ServerCommandType::time, toInt, Catch::toString(), Catch::trim(), ActorType::Unknown, SpecialLayer::updateCache(), Being::updateComment(), viewport, Visible_false, Visible_true, Widget::widgetExists(), windowMenu, x, and y.

Referenced by PopupManager::closePopupMenu().

1252 {
1253  Being *being = nullptr;
1254  if (actorManager != nullptr)
1255  being = actorManager->findBeing(mBeingId);
1256 
1257  mAllowCleanMenu = true;
1258 
1259  if (link == "remove map" && (mMapItem != nullptr))
1260  {
1261  if (viewport != nullptr)
1262  {
1263  const Map *const map = viewport->getMap();
1264  if (map != nullptr)
1265  {
1266  SpecialLayer *const specialLayer = map->getSpecialLayer();
1267  if (specialLayer != nullptr)
1268  {
1269  const bool isHome = (mMapItem->getType()
1271  const int x = static_cast<int>(mMapItem->getX());
1272  const int y = static_cast<int>(mMapItem->getY());
1273  specialLayer->setTile(x, y,
1275  specialLayer->updateCache();
1276  if (socialWindow != nullptr)
1277  socialWindow->removePortal(x, y);
1278  if (isHome && (localPlayer != nullptr))
1279  {
1282  }
1283  }
1284  }
1285  }
1286  }
1287  else if (link == "rename map" && (mMapItem != nullptr))
1288  {
1291  // TRANSLATORS: dialog caption
1292  // TRANSLATORS: number of chars in string should be near original
1293  _("Rename map sign "),
1294  // TRANSLATORS: label
1295  // TRANSLATORS: number of chars in string should be near original
1296  _("Name: "),
1297  nullptr,
1298  false);
1301  mDialog->setActionEventId("ok");
1303  }
1304  else if (link == "edit spell" && (mSpell != nullptr))
1305  {
1307  }
1308  else if (link == "addcomment" && !mName.empty())
1309  {
1310  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1311  // TRANSLATORS: dialog caption
1312  // TRANSLATORS: number of chars in string should be near original
1313  _("Player comment "),
1314  // TRANSLATORS: label
1315  // TRANSLATORS: number of chars in string should be near original
1316  _("Comment: "),
1317  nullptr,
1318  false);
1319  mPlayerListener.setDialog(dialog);
1322 
1323  if (being != nullptr)
1324  {
1325  being->updateComment();
1326  dialog->setText(being->getComment());
1327  }
1328  else
1329  {
1331  static_cast<ActorTypeT>(mType)));
1332  }
1333  dialog->setActionEventId("ok");
1335  }
1336  else if (link == "guild-pos" && !mName.empty())
1337  {
1338  showChangePos(getX(), getY());
1339  return;
1340  }
1341  else if (link == "clipboard copy")
1342  {
1343  if (mTextField != nullptr)
1345  }
1346  else if (link == "clipboard paste")
1347  {
1348  if (mTextField != nullptr)
1350  }
1351  else if (link == "gm" && !mName.empty())
1352  {
1353  showGMPopup(mName);
1354  return;
1355  }
1356  else if (link == "mute" && !mName.empty())
1357  {
1358  showMuteCommands();
1359  return;
1360  }
1361  else if (link == "show" && !mName.empty())
1362  {
1363  showPlayerMenu();
1364  return;
1365  }
1366  else if (link == "window close" && (mCallerWindow != nullptr))
1367  {
1369  mCallerWindow->close();
1370  }
1371  else if (link == "window unlock" && (mCallerWindow != nullptr))
1372  {
1374  mCallerWindow->setSticky(false);
1375  }
1376  else if (link == "window lock" && (mCallerWindow != nullptr))
1377  {
1379  mCallerWindow->setSticky(true);
1380  }
1381  else if (link == "join chat" && (being != nullptr))
1382  {
1383  const ChatObject *const chat = being->getChat();
1384  if (chat != nullptr)
1385  chatHandler->joinChat(chat, "");
1386  }
1387  else if (link == "craftmenu")
1388  {
1389  showCraftPopup();
1390  return;
1391  }
1392  else if (link.compare(0, 10, "guild-pos-") == 0)
1393  {
1394  if (localPlayer != nullptr)
1395  {
1396  const int num = atoi(link.substr(10).c_str());
1397  const Guild *const guild = localPlayer->getGuild();
1398  if (guild != nullptr)
1399  {
1401  guild->getMember(mName), num);
1402  }
1403  }
1404  }
1405  else if (link.compare(0, 7, "player_") == 0)
1406  {
1407  if (actorManager != nullptr)
1408  {
1409  mBeingId = fromInt(atoi(link.substr(7).c_str()), BeingId);
1410  being = actorManager->findBeing(mBeingId);
1411  if (being != nullptr)
1412  {
1413  showPopup(getX(), getY(), being);
1414  return;
1415  }
1416  }
1417  }
1418  else if (link.compare(0, 10, "flooritem_") == 0)
1419  {
1420  if (actorManager != nullptr)
1421  {
1422  const BeingId id = fromInt(atoi(
1423  link.substr(10).c_str()), BeingId);
1424  if (id != BeingId_zero)
1425  {
1426  const FloorItem *const item = actorManager->findItem(id);
1427  if (item != nullptr)
1428  {
1429  mFloorItemId = item->getId();
1430  mItemId = item->getItemId();
1431  for (int f = 0; f < maxCards; f ++)
1432  mItemCards[f] = item->getCard(f);
1433  showPopup(getX(), getY(), item);
1434  return;
1435  }
1436  }
1437  }
1438  }
1439  else if (link.compare(0, 12, "hide button_") == 0)
1440  {
1441  if (windowMenu != nullptr)
1442  windowMenu->showButton(link.substr(12), Visible_false);
1443  }
1444  else if (link.compare(0, 12, "show button_") == 0)
1445  {
1446  if (windowMenu != nullptr)
1447  windowMenu->showButton(link.substr(12), Visible_true);
1448  }
1449  else if (link.compare(0, 9, "hide bar_") == 0)
1450  {
1451  if (miniStatusWindow != nullptr)
1452  miniStatusWindow->showBar(link.substr(9), Visible_false);
1453  }
1454  else if (link.compare(0, 9, "show bar_") == 0)
1455  {
1456  if (miniStatusWindow != nullptr)
1457  miniStatusWindow->showBar(link.substr(9), Visible_true);
1458  }
1459  else if (link.compare(0, 12, "show window_") == 0)
1460  {
1461  const int id = atoi(link.substr(12).c_str());
1462  if (id >= 0)
1463  inputManager.executeAction(static_cast<InputActionT>(id));
1464  }
1465  else if (link.compare(0, 6, "mute_+") == 0)
1466  {
1467  if (being != nullptr)
1468  {
1469  const int time = atoi(link.substr(6).c_str());
1470  adminHandler->mute(being, 1, time);
1471  }
1472  }
1473  else if (link.compare(0, 6, "mute_-") == 0)
1474  {
1475  if (being != nullptr)
1476  {
1477  const int time = atoi(link.substr(6).c_str());
1478  adminHandler->mute(being, 0, time);
1479  }
1480  }
1481  else if (!link.empty() && link[0] == '/')
1482  {
1483  std::string cmd = link.substr(1);
1484  replaceAll(cmd, "'NAME'", mName);
1485  replaceAll(cmd, "'ENAME'", escapeString(mName));
1486  replaceAll(cmd, "'EXTNAME'", mExtName);
1487  replaceAll(cmd, "'EEXTNAME'", escapeString(mExtName));
1488  replaceAll(cmd, "'X'", toString(mX));
1489  replaceAll(cmd, "'Y'", toString(mY));
1490  replaceAll(cmd, "'BEINGID'", toString(toInt(mBeingId, int)));
1491  replaceAll(cmd, "'FLOORID'", toString(toInt(mFloorItemId, int)));
1492  replaceAll(cmd, "'ITEMID'", toString(mItemId));
1493  replaceAll(cmd, "'ITEMCOLOR'", toString(toInt(mItemColor, int)));
1494  replaceAll(cmd, "'BEINGTYPEID'", toString(CAST_S32(mType)));
1495  replaceAll(cmd, "'BEINGSUBTYPEID'", toString(CAST_S32(mSubType)));
1496  replaceAll(cmd, "'PLAYER'", localPlayer->getName());
1497  replaceAll(cmd, "'EPLAYER'", escapeString(localPlayer->getName()));
1498  replaceAll(cmd, "'PLAYERX'", toString(localPlayer->getTileX()));
1499  replaceAll(cmd, "'PLAYERY'", toString(localPlayer->getTileY()));
1500  if (mItemIndex >= 0)
1501  replaceAll(cmd, "'INVINDEX'", toString(mItemIndex));
1502  else
1503  replaceAll(cmd, "'INVINDEX'", "0");
1504  if (mMapItem != nullptr)
1505  {
1506  replaceAll(cmd, "'MAPX'", toString(mMapItem->getX()));
1507  replaceAll(cmd, "'MAPY'", toString(mMapItem->getY()));
1508  }
1509  else
1510  {
1511  replaceAll(cmd, "'MAPX'", toString(mX));
1512  replaceAll(cmd, "'MAPY'", toString(mY));
1513  }
1514 
1515  std::string cards;
1516  for (int f = 0; f < maxCards; f ++)
1517  {
1518  const int id = mItemCards[f];
1519  if (id != 0)
1520  {
1521  cards.append(",");
1522  cards.append(toString(id));
1523  }
1524  }
1525  replaceAll(cmd, "'CARDS'", cards);
1526  replaceAll(cmd, "'ECARDS'", escapeString(cards));
1527  if (actorManager != nullptr)
1528  {
1529  if (being == nullptr)
1530  {
1533  }
1534  }
1535  if (being != nullptr)
1536  replaceAll(cmd, "'PARTY'", being->getPartyName());
1537  else
1538  replaceAll(cmd, "'PARTY'", "");
1539 
1540  const size_t pos = cmd.find(' ');
1541  const std::string type(cmd, 0, pos);
1542  std::string args(cmd, pos == std::string::npos ? cmd.size() : pos + 1);
1543  args = trim(args);
1544  inputManager.executeChatCommand(type, args, mTab);
1545  }
1546  // Unknown actions
1547  else if (link != "cancel")
1548  {
1549  reportAlways("PopupMenu: Warning, unknown action '%s'", link.c_str());
1550  }
1551 
1552  if (!mAllowCleanMenu)
1553  return;
1554 
1556 
1559  mItemId = 0;
1560  mItemIndex = -1;
1561  for (int f = 0; f < maxCards; f ++)
1562  mItemCards[f] = 0;
1564  mMapItem = nullptr;
1565  mTab = nullptr;
1566  mSpell = nullptr;
1567  mCallerWindow = nullptr;
1568  mDialog = nullptr;
1569  mButton = nullptr;
1570  mName.clear();
1571  mExtName.clear();
1572  mTextField = nullptr;
1575  mX = 0;
1576  mY = 0;
1577 }
MapItem * mMapItem
Definition: popupmenu.h:294
ItemColor mItemColor
Definition: popupmenu.h:293
#define _(s)
Definition: gettext.h:34
const std::string & getPartyName() const
Definition: being.h:254
virtual void changeMemberPostion(const GuildMember *const member, const int level) const =0
int getTileY() const
Definition: being.h:173
FloorItem * findItem(const BeingId id) const
int mItemIndex
Definition: popupmenu.h:291
PlayerListener mPlayerListener
Definition: popupmenu.h:299
void handlePaste()
Definition: textfield.cpp:628
const bool Visible_true
Definition: visible.h:29
int getY() const
Definition: mapitem.h:64
void showButton(const std::string &name, const Visible visible)
Definition: windowmenu.cpp:446
#define fromInt(val, name)
Definition: intdefines.h:45
int getY() const
Definition: widget.h:287
std::string mExtName
Definition: popupmenu.h:304
const std::string & getComment() const
Definition: mapitem.h:67
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
void setVisible(Visible visible)
Definition: widget.cpp:224
BeingId getId() const
Definition: actorsprite.h:63
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
void showMuteCommands()
Definition: popupmenu.cpp:3170
void saveHomes()
void showCraftPopup()
Definition: popupmenu.cpp:3460
void setNick(const std::string &name)
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
int BeingId
Definition: beingid.h:29
virtual void joinChat(const ChatObject *const chat, const std::string &password) const =0
std::string & replaceAll(std::string &context, const std::string &from, const std::string &to)
const ItemColor ItemColor_one
Definition: itemcolor.h:29
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
BeingId mFloorItemId
Definition: popupmenu.h:289
#define CREATEWIDGETV(var, type,...)
Definition: createwidget.h:24
Net::GuildHandler * guildHandler
Definition: net.cpp:89
void setTile(const int x, const int y, MapItem *const item)
WindowMenu * windowMenu
Definition: windowmenu.cpp:50
ChatTab * mTab
Definition: popupmenu.h:295
void setDialog(TextDialog *dialog)
const std::string getComment() const
Definition: being.h:811
void removeHome()
RenameListener mRenameListener
Definition: popupmenu.h:298
void handleCopy() const
Definition: textfield.cpp:700
virtual void close()
Definition: window.cpp:901
#define toInt(val, name)
Definition: intdefines.h:46
TextField * mTextField
Definition: popupmenu.h:305
MiniStatusWindow * miniStatusWindow
Window * mCallerWindow
Definition: popupmenu.h:297
int mItemId
Definition: popupmenu.h:290
void updateCache()
#define CAST_S32
Definition: cast.h:29
int getType() const
Definition: mapitem.h:54
void setSticky(const bool sticky)
Definition: window.cpp:765
int getX() const
Definition: mapitem.h:61
const bool Visible_false
Definition: visible.h:29
std::string mName
Definition: popupmenu.h:303
int mItemCards[4]
Definition: popupmenu.h:292
LocalPlayer * localPlayer
SpecialLayer * getSpecialLayer() const
Definition: map.h:240
std::string trim(std::string const &str)
Being * findBeing(const BeingId id) const
BeingId mBeingId
Definition: popupmenu.h:288
void setText(const std::string &text)
Definition: textdialog.cpp:132
void showPlayerMenu()
Definition: popupmenu.cpp:2898
void showBar(const std::string &name, const Visible visible)
SocialWindow * socialWindow
void setMapItem(const MapItem *const mapItem)
const std::string & getName() const
Definition: being.h:231
Definition: map.h:71
Net::AdminHandler * adminHandler
Definition: net.cpp:81
void setType(const ActorTypeT type)
virtual void mute(const Being *const being, const int type, const int limit) const =0
void setDialog(TextDialog *const dialog)
int getX() const
Definition: widget.h:268
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
#define CREATEWIDGET(type,...)
Definition: createwidget.h:28
Net::ChatHandler * chatHandler
Definition: net.cpp:83
static bool widgetExists(const Widget *const widget)
Definition: widget.cpp:360
void showChangePos(const int x, const int y)
Definition: popupmenu.cpp:1116
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
int getTileX() const
Definition: being.h:167
std::string escapeString(std::string str)
InputManager inputManager
const BeingId BeingId_zero
Definition: beingid.h:29
TextCommand * mSpell
Definition: popupmenu.h:296
static std::string loadComment(const std::string &name, const ActorTypeT &type)
Definition: being.cpp:4734
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
Map * getMap() const
Definition: viewport.h:134
bool executeChatCommand(const std::string &cmd, const std::string &args, ChatTab *const tab)
Button * mButton
Definition: popupmenu.h:301
void showGMPopup(const std::string &name)
Definition: popupmenu.cpp:3396
uint32_t guild
TextDialog * mDialog
Definition: popupmenu.h:300
Definition: being.h:93
Definition: guild.h:68
#define reportAlways(...)
Definition: checkutils.h:252
void updateComment()
Definition: being.cpp:4725
void executeAction(const InputActionT keyNum)
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
ActorTypeT mType
Definition: popupmenu.h:306
ChatObject * getChat() const
Definition: being.h:1002
#define maxCards
Definition: cards.h:24
ActorManager * actorManager
void removePortal(const int x, const int y)
Viewport * viewport
Definition: viewport.cpp:35
bool mAllowCleanMenu
Definition: popupmenu.h:310
int getCard(const int index) const
Definition: flooritem.cpp:221
BeingTypeId mSubType
Definition: popupmenu.h:307
int getItemId() const
Definition: flooritem.h:81

◆ initPopup()

void PopupMenu::initPopup ( )
private

◆ isAllowCommand()

bool PopupMenu::isAllowCommand ( const ServerCommandTypeT  command)
private

Definition at line 159 of file popupmenu.cpp.

References ServerPermissionType::all_commands, CAST_SIZE, Enable_true, Net::getNetworkType(), Being::isGM(), localPlayer, GroupInfo::mCommands, mGroup, GroupInfo::mPermissions, ServerCommandEnable::Self, and ServerType::TMWATHENA.

Referenced by showFloorItemGMCommands(), showItemGMCommands(), showMapPopup(), showMonsterGMCommands(), showMuteCommands(), showNpcGMCommands(), showPlayerGMCommands(), showPlayerMenu(), and showPopup().

160 {
161  if (mGroup == nullptr)
162  return false;
163 #ifdef TMWA_SUPPORT
164  // allow any commands for legacy if group > 0
166  localPlayer != nullptr &&
167  localPlayer->isGM())
168  {
169  return true;
170  }
171 #endif
173  Enable_true)
174  {
175  return true;
176  }
177  const ServerCommandEnable::Type enabled =
178  mGroup->mCommands[CAST_SIZE(command)];
179  return (enabled & ServerCommandEnable::Self) != 0;
180 }
const bool Enable_true
Definition: enable.h:29
Enable mPermissions[static_cast< size_t >(ServerPermissionType::Max)]
Definition: groupinfo.h:43
LocalPlayer * localPlayer
ServerCommandEnable::Type mCommands[static_cast< size_t >(ServerCommandType::Max)]
Definition: groupinfo.h:42
ServerTypeT getNetworkType()
Definition: net.cpp:184
#define CAST_SIZE
Definition: cast.h:33
const GroupInfo * mGroup
Definition: popupmenu.h:302
bool isGM() const
Definition: being.h:658

◆ isAllowOtherCommand()

bool PopupMenu::isAllowOtherCommand ( const ServerCommandTypeT  command)
private

Definition at line 182 of file popupmenu.cpp.

References CAST_SIZE, Being::getName(), Net::getNetworkType(), Being::isGM(), localPlayer, GroupInfo::mCommands, mGroup, mName, ServerCommandEnable::Other, ServerCommandEnable::Self, and ServerType::TMWATHENA.

Referenced by showPlayerGMCommands(), and showPlayerMenu().

183 {
184  if (mGroup == nullptr ||
185  localPlayer == nullptr)
186  return false;
187 #ifdef TMWA_SUPPORT
188  // allow any commands for legacy if group > 0
190  localPlayer->isGM())
191  {
192  return true;
193  }
194 #endif
195  const ServerCommandEnable::Type enabled =
196  mGroup->mCommands[CAST_SIZE(command)];
197  if (mName == localPlayer->getName())
198  return (enabled & ServerCommandEnable::Self) != 0;
199  return (enabled & ServerCommandEnable::Other) != 0;
200 }
std::string mName
Definition: popupmenu.h:303
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:231
ServerCommandEnable::Type mCommands[static_cast< size_t >(ServerCommandType::Max)]
Definition: groupinfo.h:42
ServerTypeT getNetworkType()
Definition: net.cpp:184
#define CAST_SIZE
Definition: cast.h:33
const GroupInfo * mGroup
Definition: popupmenu.h:302
bool isGM() const
Definition: being.h:658

◆ moveDown()

void PopupMenu::moveDown ( )

Definition at line 3625 of file popupmenu.cpp.

References mBrowserBox, and StaticBrowserBox::moveSelectionDown().

Referenced by Actions::closeMoveNpcDialog().

3626 {
3628 }
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285

◆ moveUp()

void PopupMenu::moveUp ( )

Definition at line 3620 of file popupmenu.cpp.

References mBrowserBox, and StaticBrowserBox::moveSelectionUp().

Referenced by Actions::closeMoveNpcDialog().

3621 {
3623 }
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285

◆ postInit()

void PopupMenu::postInit ( )
virtual

Reimplemented from Widget.

Definition at line 145 of file popupmenu.cpp.

References BasicContainer2::add(), mScrollArea, and Popup::postInit().

146 {
147  Popup::postInit();
148  add(mScrollArea);
149 }
void postInit()
Definition: popup.h:176
ScrollArea * mScrollArea
Definition: popupmenu.h:286
virtual void add(Widget *const widget)

◆ select()

void PopupMenu::select ( )

Definition at line 3630 of file popupmenu.cpp.

References mBrowserBox, and StaticBrowserBox::selectSelection().

Referenced by Actions::getAmountFromEvent().

3631 {
3633 }
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285

◆ setMousePos()

void PopupMenu::setMousePos ( )
private

Definition at line 539 of file popupmenu.cpp.

References Gui::getMouseState(), Viewport::mMouseX, Viewport::mMouseY, mX, mY, and viewport.

Referenced by addSocialMenu(), showEmoteType(), showLinkPopup(), showPlayerPopup(), showSkillPopup(), showTextFieldPopup(), showWindowPopup(), and showWindowsPopup().

540 {
541  if (viewport != nullptr)
542  {
543  mX = viewport->mMouseX;
544  mY = viewport->mMouseY;
545  }
546  else
547  {
549  }
550 }
int mMouseX
Definition: viewport.h:153
static uint8_t getMouseState(int &x, int &y)
Definition: gui.cpp:1170
int mMouseY
Definition: viewport.h:154
Viewport * viewport
Definition: viewport.cpp:35

◆ setMousePos2()

void PopupMenu::setMousePos2 ( )
private

Definition at line 552 of file popupmenu.cpp.

References Gui::getMouseState(), Viewport::mMouseX, Viewport::mMouseY, mX, mY, and viewport.

Referenced by showSkillLevelPopup(), showSkillOffsetPopup(), and showSkillTypePopup().

553 {
554  if (mX == 0 && mY == 0)
555  {
556  if (viewport != nullptr)
557  {
558  mX = viewport->mMouseX;
559  mY = viewport->mMouseY;
560  }
561  else
562  {
564  }
565  }
566 }
int mMouseX
Definition: viewport.h:153
static uint8_t getMouseState(int &x, int &y)
Definition: gui.cpp:1170
int mMouseY
Definition: viewport.h:154
Viewport * viewport
Definition: viewport.cpp:35

◆ showAdoptCommands()

void PopupMenu::showAdoptCommands ( )
private

Definition at line 3499 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Net::getNetworkType(), mBrowserBox, and ServerType::TMWATHENA.

Referenced by addParty(), addPartyName(), and showPlayerPopup().

3500 {
3502  return;
3503  // TRANSLATORS: popup menu item
3504  // TRANSLATORS: adopt child command
3505  mBrowserBox->addRow("/adoptchild 'NAME'", _("Adopt child"));
3506 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
ServerTypeT getNetworkType()
Definition: net.cpp:184
void addRow(const std::string &row, const bool atTop)

◆ showAttackMonsterPopup()

void PopupMenu::showAttackMonsterPopup ( const int  x,
const int  y,
const std::string &  name,
const int  type 
)

Definition at line 2017 of file popupmenu.cpp.

References _, actorManager, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), MapItemType::ATTACK, BeingTypeId_zero, StaticBrowserBox::clearRows(), ActorManager::getAttackMobIndex(), ActorManager::getAttackMobsSize(), ActorManager::getPriorityAttackMobsSize(), MapItemType::IGNORE_, initPopup(), localPlayer, mBrowserBox, mExtName, mName, ActorType::Monster, mSubType, mType, mX, mY, MapItemType::PRIORITY, showPopup(), ServerCommandType::size, x, and y.

Referenced by AvatarListBox::mousePressed().

2020 {
2021  if ((localPlayer == nullptr) || (actorManager == nullptr))
2022  return;
2023 
2024  initPopup();
2025  mName = name;
2026  mExtName = name;
2029  mX = x;
2030  mY = y;
2031 
2033 
2034  if (name.empty())
2035  {
2036  // TRANSLATORS: popup menu header
2037  mBrowserBox->addRow(_("(default)"), false);
2038  }
2039  else
2040  {
2041  mBrowserBox->addRow(name, false);
2042  }
2043  switch (type)
2044  {
2045  case MapItemType::ATTACK:
2046  {
2047  const int idx = actorManager->getAttackMobIndex(name);
2048  const int size = actorManager->getAttackMobsSize();
2049  if (idx > 0)
2050  {
2051  // TRANSLATORS: popup menu item
2052  // TRANSLATORS: move attack target up
2053  mBrowserBox->addRow("/moveattackup 'NAME'", _("Move up"));
2054  }
2055  if (idx + 1 < size)
2056  {
2057  // TRANSLATORS: popup menu item
2058  // TRANSLATORS: move attack target down
2059  mBrowserBox->addRow("/moveattackdown 'NAME'", _("Move down"));
2060  }
2061  break;
2062  }
2063  case MapItemType::PRIORITY:
2064  {
2065  const int idx = actorManager->
2066  getPriorityAttackMobIndex(name);
2067  const int size = actorManager->getPriorityAttackMobsSize();
2068  if (idx > 0)
2069  {
2070  mBrowserBox->addRow("/movepriorityattackup 'NAME'",
2071  // TRANSLATORS: popup menu item
2072  // TRANSLATORS: move attack target up
2073  _("Move up"));
2074  }
2075  if (idx + 1 < size)
2076  {
2077  mBrowserBox->addRow("/movepriorityattackdown 'NAME'",
2078  // TRANSLATORS: popup menu item
2079  // TRANSLATORS: move attack target down
2080  _("Move down"));
2081  }
2082  break;
2083  }
2084  case MapItemType::IGNORE_:
2085  break;
2086  default:
2087  break;
2088  }
2089 
2090  // TRANSLATORS: popup menu item
2091  // TRANSLATORS: remove attack target
2092  mBrowserBox->addRow("/removeattack 'NAME'", _("Remove"));
2093  mBrowserBox->addSeparator("##3---");
2094  // TRANSLATORS: popup menu item
2095  // TRANSLATORS: close menu
2096  mBrowserBox->addRow("cancel", _("Cancel"));
2097 
2098  showPopup(x, y);
2099 }
#define _(s)
Definition: gettext.h:34
int getPriorityAttackMobsSize() const
Definition: actormanager.h:321
std::string mExtName
Definition: popupmenu.h:304
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
int getAttackMobsSize() const
Definition: actormanager.h:324
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
std::string mName
Definition: popupmenu.h:303
LocalPlayer * localPlayer
void initPopup()
Definition: popupmenu.cpp:151
int getAttackMobIndex(const std::string &name) const
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
ActorTypeT mType
Definition: popupmenu.h:306
ActorManager * actorManager
void addRow(const std::string &row, const bool atTop)
BeingTypeId mSubType
Definition: popupmenu.h:307

◆ showAttackPopup()

void PopupMenu::showAttackPopup ( )

Definition at line 3570 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), addSocialMenu(), mBrowserBox, mX, mY, and showPopup().

Referenced by SocialWindow::action().

3571 {
3572  addSocialMenu();
3573 
3574  // TRANSLATORS: popup menu item
3575  // TRANSLATORS: close menu
3576  mBrowserBox->addRow("cancel", _("Cancel"));
3577  showPopup(mX, mY);
3578 }
#define _(s)
Definition: gettext.h:34
void addSocialMenu()
Definition: popupmenu.cpp:3508
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showChangePos()

void PopupMenu::showChangePos ( const int  x,
const int  y 
)

Definition at line 1116 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), BeingId_zero, BeingTypeId_zero, StaticBrowserBox::clearRows(), FOR_EACH, Being::getGuild(), Guild::getPositions(), guild, initPopup(), localPlayer, maxCards, mBeingId, mBrowserBox, mExtName, mFloorItemId, mItemCards, mItemId, mItemIndex, mMapItem, mName, mSubType, mType, mX, mY, Widget::setVisible(), showPopup(), strprintf(), ActorType::Unknown, Visible_false, x, and y.

Referenced by handleLink().

1117 {
1118  initPopup();
1120  // TRANSLATORS: popup menu header
1121  mBrowserBox->addRow(_("Change guild position"), false);
1122 
1123  if (localPlayer == nullptr)
1124  return;
1125 
1126  mX = x;
1127  mY = y;
1128  const Guild *const guild = localPlayer->getGuild();
1129  if (guild != nullptr)
1130  {
1131  const PositionsMap &map = guild->getPositions();
1132  FOR_EACH (PositionsMap::const_iterator, itr, map)
1133  {
1134  mBrowserBox->addRow(strprintf("@@guild-pos-%u|%[email protected]@",
1135  itr->first, itr->second.c_str()),
1136  false);
1137  }
1138  // TRANSLATORS: popup menu item
1139  // TRANSLATORS: close menu
1140  mBrowserBox->addRow("cancel", _("Cancel"));
1141 
1142  showPopup(x, y);
1143  }
1144  else
1145  {
1148  mItemIndex = -1;
1149  mItemId = 0;
1150  for (int f = 0; f < maxCards; f ++)
1151  mItemCards[f] = 0;
1152  mMapItem = nullptr;
1153  mName.clear();
1154  mExtName.clear();
1157  mX = 0;
1158  mY = 0;
1160  }
1161 }
MapItem * mMapItem
Definition: popupmenu.h:294
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
#define _(s)
Definition: gettext.h:34
int mItemIndex
Definition: popupmenu.h:291
std::string mExtName
Definition: popupmenu.h:304
void setVisible(Visible visible)
Definition: widget.cpp:224
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
BeingId mFloorItemId
Definition: popupmenu.h:289
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
int mItemId
Definition: popupmenu.h:290
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const bool Visible_false
Definition: visible.h:29
const PositionsMap & getPositions() const
Definition: guild.h:191
std::string mName
Definition: popupmenu.h:303
int mItemCards[4]
Definition: popupmenu.h:292
LocalPlayer * localPlayer
BeingId mBeingId
Definition: popupmenu.h:288
void initPopup()
Definition: popupmenu.cpp:151
const BeingId BeingId_zero
Definition: beingid.h:29
std::map< unsigned, std::string > PositionsMap
Definition: guild.h:34
uint32_t guild
Definition: guild.h:68
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
ActorTypeT mType
Definition: popupmenu.h:306
#define maxCards
Definition: cards.h:24
void addRow(const std::string &row, const bool atTop)
BeingTypeId mSubType
Definition: popupmenu.h:307

◆ showChatPopup()

void PopupMenu::showChatPopup ( const int  x,
const int  y,
ChatTab *const  tab 
)

Shows the related popup menu when right click on the chat at the specified mouse coordinates.

Definition at line 912 of file popupmenu.cpp.

References _, actorManager, addBuySell(), addBuySellDefault(), addFollow(), addGmCommands(), addMailCommands(), addParty(), addPlayerMisc(), addPlayerRelation(), StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), addWindowMenu(), BeingId_zero, BeingTypeId_zero, ChatTabType::CHANNEL, chatWindow, StaticBrowserBox::clearRows(), ActorManager::findBeingByName(), ChatTab::getAllowHighlight(), Being::getExtName(), Being::getGuild(), ActorSprite::getId(), Guild::getId(), Party::getMember(), Being::getName(), Net::getNetworkType(), WhisperTab::getNick(), ChatTab::getNoAway(), Being::getParty(), ChatTab::getRemoveNames(), Guild::getServerGuild(), Being::getSubType(), Being::getType(), ChatTab::getType(), guildManager, GuildManager::havePower(), initPopup(), Being::isInParty(), localPlayer, mBeingId, mBrowserBox, mCallerWindow, mExtName, mName, mSubType, mTab, mType, mX, mY, ChatTabType::PARTY, party, ActorType::Player, showPopup(), strprintf(), ServerType::TMWATHENA, ChatTabType::WHISPER, x, and y.

Referenced by ChatWindow::mousePressed().

913 {
914  if (tab == nullptr ||
915  actorManager == nullptr ||
916  localPlayer == nullptr)
917  {
918  return;
919  }
920 
921  initPopup();
922  mTab = tab;
923  mX = x;
924  mY = y;
926 
928 
929  const ChatTabTypeT &type = tab->getType();
930  if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL)
931  {
932  // TRANSLATORS: popup menu item
933  // TRANSLATORS: close chat tab
934  mBrowserBox->addRow("/close", _("Close"));
935  }
936 
937  // TRANSLATORS: popup menu item
938  // TRANSLATORS: remove all text from chat tab
939  mBrowserBox->addRow("/chatclear", _("Clear"));
940  mBrowserBox->addSeparator("##3---");
941 
942  if (tab->getAllowHighlight())
943  {
944  // TRANSLATORS: popup menu item
945  // TRANSLATORS: disable chat tab highlight
946  mBrowserBox->addRow("/disablehighlight", _("Disable highlight"));
947  }
948  else
949  {
950  // TRANSLATORS: popup menu item
951  // TRANSLATORS: enable chat tab highlight
952  mBrowserBox->addRow("/enablehighlight", _("Enable highlight"));
953  }
954  if (tab->getRemoveNames())
955  {
956  // TRANSLATORS: popup menu item
957  // TRANSLATORS: do not remove player names from chat tab
958  mBrowserBox->addRow("/dontremovename", _("Don't remove name"));
959  }
960  else
961  {
962  // TRANSLATORS: popup menu item
963  // TRANSLATORS: remove player names from chat tab
964  mBrowserBox->addRow("/removename", _("Remove name"));
965  }
966  if (tab->getNoAway())
967  {
968  // TRANSLATORS: popup menu item
969  // TRANSLATORS: enable away messages in chat tab
970  mBrowserBox->addRow("/enableaway", _("Enable away"));
971  }
972  else
973  {
974  // TRANSLATORS: popup menu item
975  // TRANSLATORS: disable away messages in chat tab
976  mBrowserBox->addRow("/disableaway", _("Disable away"));
977  }
978  mBrowserBox->addSeparator("##3---");
979  if (type == ChatTabType::PARTY)
980  {
981  // TRANSLATORS: popup menu item
982  // TRANSLATORS: enable away messages in chat tab
983  mBrowserBox->addRow("/leaveparty", _("Leave"));
984  mBrowserBox->addSeparator("##3---");
985  }
986  // TRANSLATORS: popup menu item
987  // TRANSLATORS: copy selected text to clipboard
988  mBrowserBox->addRow("/chatclipboard 'X' 'Y'", _("Copy to clipboard"));
989  mBrowserBox->addSeparator("##3---");
990 
991  if (type == ChatTabType::WHISPER)
992  {
993  const WhisperTab *const wTab = static_cast<WhisperTab*>(tab);
994  const std::string &name = wTab->getNick();
995 
996  const Being* const being = actorManager->findBeingByName(
997  name, ActorType::Player);
998 
999  addGmCommands();
1000  if (being != nullptr)
1001  {
1002  mBeingId = being->getId();
1003  mName = being->getName();
1004  mExtName = being->getExtName();
1005  mType = being->getType();
1006  mSubType = being->getSubType();
1007 
1008  // TRANSLATORS: popup menu item
1009  // TRANSLATORS: trade with player
1010  mBrowserBox->addRow("/trade 'NAME'", _("Trade"));
1011  // TRANSLATORS: popup menu item
1012  // TRANSLATORS: attack player
1013  mBrowserBox->addRow("/attack 'NAME'", _("Attack"));
1014  addMailCommands();
1015  mBrowserBox->addSeparator("##3---");
1016  // TRANSLATORS: popup menu item
1017  // TRANSLATORS: heal player
1018  mBrowserBox->addRow("/heal :'BEINGID'", _("Heal"));
1019  mBrowserBox->addSeparator("##3---");
1020  addPlayerRelation(name);
1021  mBrowserBox->addSeparator("##3---");
1022  addFollow();
1023  // TRANSLATORS: popup menu item
1024  // TRANSLATORS: move to player position
1025  mBrowserBox->addRow("/navigateto 'NAME'", _("Move"));
1026  addPlayerMisc();
1027  addBuySell(being);
1028  mBrowserBox->addSeparator("##3---");
1029  addParty(wTab->getNick());
1030  const Guild *const guild1 = being->getGuild();
1031  const Guild *const guild2 = localPlayer->getGuild();
1032  if (guild2 != nullptr)
1033  {
1034  if (guild1 != nullptr)
1035  {
1036  if (guild1->getId() == guild2->getId())
1037  {
1038 #ifdef TMWA_SUPPORT
1039  if (guild2->getServerGuild() ||
1040  (guildManager != nullptr &&
1041  guildManager->havePower()))
1042 #endif // TMWA_SUPPORT
1043  {
1044  mBrowserBox->addRow("/kickguild 'NAME'",
1045  // TRANSLATORS: popup menu item
1046  // TRANSLATORS: kick player from guild
1047  _("Kick from guild"));
1048  }
1049  if (guild2->getServerGuild())
1050  {
1051  mBrowserBox->addRow(strprintf("@@guild-pos|%s >@@",
1052  // TRANSLATORS: popup menu item
1053  // TRANSLATORS: change player position in guild
1054  _("Change pos in guild")),
1055  false);
1056  }
1057  }
1058  }
1059  else
1060  {
1061 #ifdef TMWA_SUPPORT
1062  if (guild2->getServerGuild() || (guildManager != nullptr
1063  && guildManager->havePower()))
1064 #endif // TMWA_SUPPORT
1065  {
1066  mBrowserBox->addRow("/guild 'NAME'",
1067  // TRANSLATORS: popup menu item
1068  // TRANSLATORS: invite player to guild
1069  _("Invite to guild"));
1070  }
1071  }
1072  }
1073  }
1074  else
1075  {
1077  mName = name;
1078  mExtName = name;
1081  addPlayerRelation(name);
1082  mBrowserBox->addSeparator("##3---");
1083  addMailCommands();
1084  addFollow();
1085 
1086  if (localPlayer->isInParty())
1087  {
1088  const Party *const party = localPlayer->getParty();
1089  if (party != nullptr)
1090  {
1091  const PartyMember *const m = party->getMember(mName);
1092  if (m != nullptr)
1093  {
1094  // TRANSLATORS: popup menu item
1095  // TRANSLATORS: move to player location
1096  mBrowserBox->addRow("/navigateto 'NAME'", _("Move"));
1097  }
1098  }
1099  }
1100  addPlayerMisc();
1103  addParty(wTab->getNick());
1104  mBrowserBox->addSeparator("##3---");
1105  }
1106  }
1107 
1109  // TRANSLATORS: popup menu item
1110  // TRANSLATORS: close menu
1111  mBrowserBox->addRow("cancel", _("Cancel"));
1112 
1113  showPopup(x, y);
1114 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:89
#define _(s)
Definition: gettext.h:34
const std::string & getExtName() const
Definition: being.h:234
int16_t getId() const
Definition: guild.h:134
Definition: party.h:61
void addPlayerRelation(const std::string &name)
Definition: popupmenu.cpp:2492
void addFollow()
Definition: popupmenu.cpp:2581
std::string mExtName
Definition: popupmenu.h:304
BeingId getId() const
Definition: actorsprite.h:63
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
void addGmCommands()
Definition: popupmenu.cpp:2888
bool havePower() const
Definition: guildmanager.h:80
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
bool getServerGuild() const
Definition: guild.h:205
Party * getParty() const
Definition: being.h:329
uint32_t party
ChatTab * mTab
Definition: popupmenu.h:295
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
Window * mCallerWindow
Definition: popupmenu.h:297
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const std::string & getNick() const
Definition: whispertab.h:36
std::string mName
Definition: popupmenu.h:303
void addBuySellDefault()
Definition: popupmenu.cpp:2627
LocalPlayer * localPlayer
GuildManager * guildManager
void addBuySell(const Being *const being)
Definition: popupmenu.cpp:2593
PartyMember * getMember(const BeingId id) const
Definition: party.cpp:98
BeingId mBeingId
Definition: popupmenu.h:288
ChatTabTypeT getType() const
Definition: chattab.h:144
ActorTypeT getType() const
Definition: being.h:115
bool getRemoveNames() const
Definition: chattab.h:163
bool isInParty() const
Definition: being.h:320
void initPopup()
Definition: popupmenu.cpp:151
void addMailCommands()
Definition: popupmenu.cpp:3480
const std::string & getName() const
Definition: being.h:231
ChatTabType ::T ChatTabTypeT
Definition: chattabtype.h:48
ServerTypeT getNetworkType()
Definition: net.cpp:184
bool getNoAway() const
Definition: chattab.h:169
bool getAllowHighlight() const
Definition: chattab.h:157
void addPlayerMisc()
Definition: popupmenu.cpp:2705
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
const BeingId BeingId_zero
Definition: beingid.h:29
void addParty(const std::string &nick)
Definition: popupmenu.cpp:2665
Definition: being.h:93
Definition: guild.h:68
BeingTypeId getSubType() const
Definition: being.h:399
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
ActorTypeT mType
Definition: popupmenu.h:306
void addWindowMenu(const Window *const window)
Definition: popupmenu.cpp:1184
ActorManager * actorManager
void addRow(const std::string &row, const bool atTop)
BeingTypeId mSubType
Definition: popupmenu.h:307

◆ showCraftPopup()

void PopupMenu::showCraftPopup ( )

Definition at line 3460 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::clearRows(), mBrowserBox, mX, mY, showPopup(), and strprintf().

Referenced by handleLink().

3461 {
3463 
3464  for (int f = 0; f < 9; f ++)
3465  {
3466  const std::string cmd = strprintf("/craft %d", f);
3467  mBrowserBox->addRow(cmd,
3468  // TRANSLATORS: popup menu item
3469  // TRANSLATORS: move current item to craft slot
3470  strprintf(_("Move to craft %d"), f + 1).c_str());
3471  }
3472 
3473  // TRANSLATORS: popup menu item
3474  // TRANSLATORS: close menu
3475  mBrowserBox->addRow("cancel", _("Cancel"));
3476 
3477  showPopup(mX, mY);
3478 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showDropPopup()

void PopupMenu::showDropPopup ( const int  x,
const int  y,
const Item *const  item 
)

Definition at line 1848 of file popupmenu.cpp.

References _, addDrop(), addGmCommands(), addPickupFilter(), addProtection(), StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), addUse(), StaticBrowserBox::clearRows(), config, Configuration::getBoolValue(), Item::getCard(), Item::getColor(), Item::getId(), Item::getInvIndex(), Item::getName(), initPopup(), PlayerInfo::isItemProtected(), InventoryWindow::isStorageActive(), maxCards, mBrowserBox, mExtName, mItemCards, mItemColor, mItemId, mItemIndex, mName, mX, mY, showPopup(), x, and y.

Referenced by VirtShortcutContainer::mousePressed().

1851 {
1852  initPopup();
1853  mX = x;
1854  mY = y;
1855  mName.clear();
1856  mExtName.clear();
1858 
1859  if (item != nullptr)
1860  {
1861  mItemId = item->getId();
1862  mItemColor = item->getColor();
1863  mItemIndex = item->getInvIndex();
1864  for (int f = 0; f < maxCards; f ++)
1865  mItemCards[f] = item->getCard(f);
1866  const bool isProtected = PlayerInfo::isItemProtected(mItemId);
1867  addUse(item);
1868  addDrop(item, isProtected);
1870  {
1871  // TRANSLATORS: popup menu item
1872  // TRANSLATORS: add item to storage
1873  mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store"));
1874  }
1875  addProtection();
1876  // TRANSLATORS: popup menu item
1877  // TRANSLATORS: add item name to chat
1878  mBrowserBox->addRow("/addchat 'ITEMID''CARDS'", _("Add to chat"));
1879  if (config.getBoolValue("enablePickupFilter"))
1880  {
1881  mName = item->getName();
1882  mExtName = mName;
1883  mBrowserBox->addSeparator("##3---");
1885  }
1886  }
1887  addGmCommands();
1888  mBrowserBox->addSeparator("##3---");
1889  // TRANSLATORS: popup menu item
1890  mBrowserBox->addRow("/cleardrops", _("Clear drop window"));
1891  mBrowserBox->addSeparator("##3---");
1892  // TRANSLATORS: popup menu item
1893  // TRANSLATORS: close menu
1894  mBrowserBox->addRow("cancel", _("Cancel"));
1895 
1896  showPopup(x, y);
1897 }
int getInvIndex() const
Definition: item.h:164
static bool isStorageActive()
ItemColor mItemColor
Definition: popupmenu.h:293
#define _(s)
Definition: gettext.h:34
int mItemIndex
Definition: popupmenu.h:291
void addPickupFilter(const std::string &name)
Definition: popupmenu.cpp:2717
std::string mExtName
Definition: popupmenu.h:304
void addGmCommands()
Definition: popupmenu.cpp:2888
int getCard(const int index) const
Definition: item.cpp:158
Configuration config
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
void addProtection()
Definition: popupmenu.cpp:2777
bool getBoolValue(const std::string &key) const
int mItemId
Definition: popupmenu.h:290
std::string mName
Definition: popupmenu.h:303
int mItemCards[4]
Definition: popupmenu.h:292
ItemColor getColor() const
Definition: item.h:180
void initPopup()
Definition: popupmenu.cpp:151
void addUse(const Item *const item)
Definition: popupmenu.cpp:2798
std::string getName() const
Definition: item.cpp:139
bool isItemProtected(const int id)
Definition: playerinfo.cpp:512
int getId() const
Definition: item.h:80
void addDrop(const Item *const item, const bool isProtected)
Definition: popupmenu.cpp:2864
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
#define maxCards
Definition: cards.h:24
void addRow(const std::string &row, const bool atTop)

◆ showEmoteType()

void PopupMenu::showEmoteType ( )

Definition at line 1214 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), StaticBrowserBox::clearRows(), ServerType::EVOL2, Net::getNetworkType(), initPopup(), mBrowserBox, mX, mY, setMousePos(), and showPopup().

Referenced by EmoteShortcutContainer::mousePressed().

1215 {
1216  initPopup();
1217  setMousePos();
1218 
1220  // TRANSLATORS: popup menu header
1221  mBrowserBox->addRow(_("Show emotes for:"), false);
1222 
1223  // TRANSLATORS: popup menu item
1224  // TRANSLATORS: show emotes for player
1225  mBrowserBox->addRow("/setemotetype player", _("Player"));
1226 
1227  // TRANSLATORS: popup menu item
1228  // TRANSLATORS: show emotes for pet
1229  mBrowserBox->addRow("/setemotetype pet", _("Pet"));
1230 
1232  {
1233  // TRANSLATORS: popup menu item
1234  // TRANSLATORS: show emotes for homuncules
1235  mBrowserBox->addRow("/setemotetype homun", _("Homunculus"));
1236 
1237  // TRANSLATORS: popup menu item
1238  // TRANSLATORS: show emotes for mercenary
1239  mBrowserBox->addRow("/setemotetype merc", _("Mercenary"));
1240  }
1241  mBrowserBox->addSeparator("##3---");
1242 
1243  // TRANSLATORS: popup menu item
1244  // TRANSLATORS: close menu
1245  mBrowserBox->addRow("cancel", _("Cancel"));
1246 
1247  showPopup(mX, mY);
1248 }
#define _(s)
Definition: gettext.h:34
void setMousePos()
Definition: popupmenu.cpp:539
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
void initPopup()
Definition: popupmenu.cpp:151
ServerTypeT getNetworkType()
Definition: net.cpp:184
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showFloorItemGMCommands()

void PopupMenu::showFloorItemGMCommands ( )
private

Definition at line 3336 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), Net::getNetworkType(), isAllowCommand(), ServerCommandType::iteminfo, mBrowserBox, ServerType::TMWATHENA, and ServerCommandType::whodrops.

Referenced by showGMPopup().

3337 {
3338  const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA;
3339  if (legacy)
3340  return;
3342  {
3343  // TRANSLATORS: popup menu item
3344  // TRANSLATORS: show item information
3345  mBrowserBox->addRow("/iteminfo 'ITEMID'", _("Info"));
3346  }
3348  {
3349  // TRANSLATORS: popup menu item
3350  // TRANSLATORS: show who drops item
3351  mBrowserBox->addRow("/whodrops 'ITEMID'", _("Who drops"));
3352  }
3353 }
#define _(s)
Definition: gettext.h:34
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:159
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
ServerTypeT getNetworkType()
Definition: net.cpp:184
void addRow(const std::string &row, const bool atTop)

◆ showFriendsPopup()

void PopupMenu::showFriendsPopup ( )

Definition at line 3610 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), addSocialMenu(), mBrowserBox, mX, mY, and showPopup().

Referenced by SocialWindow::action().

3611 {
3612  addSocialMenu();
3613 
3614  // TRANSLATORS: popup menu item
3615  // TRANSLATORS: close menu
3616  mBrowserBox->addRow("cancel", _("Cancel"));
3617  showPopup(mX, mY);
3618 }
#define _(s)
Definition: gettext.h:34
void addSocialMenu()
Definition: popupmenu.cpp:3508
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showGMPopup()

void PopupMenu::showGMPopup ( const std::string &  name)
private

Definition at line 3396 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), ActorType::Avatar, StaticBrowserBox::clearRows(), ActorType::Elemental, ActorType::FloorItem, Widget::getX(), Widget::getY(), ActorType::Homunculus, Being::isGM(), localPlayer, mBrowserBox, ActorType::Mercenary, mItemId, ActorType::Monster, mType, ActorType::Npc, ActorType::Pet, ActorType::Player, ActorType::Portal, showFloorItemGMCommands(), showHomunGMCommands(), showItemGMCommands(), showMercenaryGMCommands(), showMonsterGMCommands(), showNpcGMCommands(), showPetGMCommands(), showPlayerGMCommands(), showPopup(), ActorType::SkillUnit, and ActorType::Unknown.

Referenced by handleLink().

3397 {
3399  // TRANSLATORS: popup menu header
3400  mBrowserBox->addRow(_("GM commands"), false);
3401  if (localPlayer->isGM())
3402  {
3403  switch (mType)
3404  {
3405  case ActorType::Player:
3406  showPlayerGMCommands(name);
3407  break;
3408  case ActorType::Npc:
3410  break;
3411  case ActorType::Monster:
3413  break;
3414  case ActorType::FloorItem:
3416  break;
3417  case ActorType::Homunculus:
3419  break;
3420  case ActorType::Pet:
3422  break;
3423  case ActorType::Mercenary:
3425  break;
3426  case ActorType::SkillUnit:
3427  break;
3428  default:
3429  case ActorType::Unknown:
3430  if (mItemId != 0)
3432  break;
3433  case ActorType::Portal:
3434  case ActorType::Avatar:
3435  case ActorType::Elemental:
3436  break;
3437  }
3438  }
3439 
3440  mBrowserBox->addSeparator("##3---");
3441  // TRANSLATORS: popup menu item
3442  // TRANSLATORS: close menu
3443  mBrowserBox->addRow("cancel", _("Cancel"));
3444 
3445  showPopup(getX(), getY());
3446 }
#define _(s)
Definition: gettext.h:34
void showMonsterGMCommands()
Definition: popupmenu.cpp:3277
void showMercenaryGMCommands()
Definition: popupmenu.cpp:3456
int getY() const
Definition: widget.h:287
void showFloorItemGMCommands()
Definition: popupmenu.cpp:3336
void showHomunGMCommands()
Definition: popupmenu.cpp:3448
void showItemGMCommands()
Definition: popupmenu.cpp:3355
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
int mItemId
Definition: popupmenu.h:290
LocalPlayer * localPlayer
void showPetGMCommands()
Definition: popupmenu.cpp:3452
int getX() const
Definition: widget.h:268
void showPlayerGMCommands(const std::string &name)
Definition: popupmenu.cpp:2962
void showNpcGMCommands()
Definition: popupmenu.cpp:3233
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
ActorTypeT mType
Definition: popupmenu.h:306
bool isGM() const
Definition: being.h:658
void addRow(const std::string &row, const bool atTop)

◆ showGuildPopup()

void PopupMenu::showGuildPopup ( )

Definition at line 3556 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), addSocialMenu(), mBrowserBox, mX, mY, and showPopup().

Referenced by SocialWindow::action().

3557 {
3558  addSocialMenu();
3559 
3560  // TRANSLATORS: popup menu item
3561  // TRANSLATORS: change guild notice message
3562  mBrowserBox->addRow("/guildnotice", _("Change notice"));
3563 
3564  // TRANSLATORS: popup menu item
3565  // TRANSLATORS: close menu
3566  mBrowserBox->addRow("cancel", _("Cancel"));
3567  showPopup(mX, mY);
3568 }
#define _(s)
Definition: gettext.h:34
void addSocialMenu()
Definition: popupmenu.cpp:3508
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showHomunGMCommands()

void PopupMenu::showHomunGMCommands ( )
private

Definition at line 3448 of file popupmenu.cpp.

Referenced by showGMPopup().

3449 {
3450 }

◆ showItemGMCommands()

void PopupMenu::showItemGMCommands ( )
private

Definition at line 3355 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), Net::getNetworkType(), isAllowCommand(), ServerCommandType::item, ServerCommandType::iteminfo, mBrowserBox, ServerType::TMWATHENA, and ServerCommandType::whodrops.

Referenced by showGMPopup().

3356 {
3357  const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA;
3358  if (legacy)
3359  return;
3361  {
3362  // TRANSLATORS: popup menu item
3363  // TRANSLATORS: show item information
3364  mBrowserBox->addRow("/iteminfo 'ITEMID'", _("Info"));
3365  }
3367  {
3368  // TRANSLATORS: popup menu item
3369  // TRANSLATORS: show who drops item
3370  mBrowserBox->addRow("/whodrops 'ITEMID'", _("Who drops"));
3371  }
3372  mBrowserBox->addSeparator("##3---");
3374  {
3375  // TRANSLATORS: popup menu item
3376  // TRANSLATORS: gm create item
3377  mBrowserBox->addRow("/createitem 'ITEMID' 1", _("Add 1"));
3378  // TRANSLATORS: popup menu item
3379  // TRANSLATORS: gm create item
3380  mBrowserBox->addRow("/createitem 'ITEMID' 5", _("Add 5"));
3381  // TRANSLATORS: popup menu item
3382  // TRANSLATORS: gm create item
3383  mBrowserBox->addRow("/createitem 'ITEMID' 10", _("Add 10"));
3384  // TRANSLATORS: popup menu item
3385  // TRANSLATORS: gm create item
3386  mBrowserBox->addRow("/createitem 'ITEMID' 100", _("Add 100"));
3387  // TRANSLATORS: popup menu item
3388  // TRANSLATORS: gm create item
3389  mBrowserBox->addRow("/createitem 'ITEMID' 1000", _("Add 1000"));
3390  // TRANSLATORS: popup menu item
3391  // TRANSLATORS: gm create item
3392  mBrowserBox->addRow("/createitem 'ITEMID' 10000", _("Add 10000"));
3393  }
3394 }
#define _(s)
Definition: gettext.h:34
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:159
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
ServerTypeT getNetworkType()
Definition: net.cpp:184
void addRow(const std::string &row, const bool atTop)

◆ showItemPopup() [1/2]

void PopupMenu::showItemPopup ( const int  x,
const int  y,
const Item *const  item 
)

Definition at line 1789 of file popupmenu.cpp.

References _, addDrop(), addGmCommands(), addPickupFilter(), addProtection(), StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), addUse(), StaticBrowserBox::clearRows(), config, Configuration::getBoolValue(), Item::getCard(), Item::getColor(), Item::getId(), Item::getInvIndex(), Item::getName(), initPopup(), PlayerInfo::isItemProtected(), InventoryWindow::isStorageActive(), ItemColor_one, maxCards, mBrowserBox, mExtName, mItemCards, mItemColor, mItemId, mItemIndex, mName, mX, mY, showPopup(), x, and y.

Referenced by ItemShortcutContainer::mousePressed(), ShopListBox::mouseReleased(), and showItemPopup().

1791 {
1792  initPopup();
1793  mX = x;
1794  mY = y;
1795  if (item != nullptr)
1796  {
1797  mItemId = item->getId();
1798  mItemColor = item->getColor();
1799  mItemIndex = item->getInvIndex();
1800  for (int f = 0; f < maxCards; f ++)
1801  mItemCards[f] = item->getCard(f);
1802  }
1803  else
1804  {
1805  mItemId = 0;
1807  mItemIndex = -1;
1808  for (int f = 0; f < maxCards; f ++)
1809  mItemCards[f] = 0;
1810  }
1811  mName.clear();
1812  mExtName.clear();
1814 
1815  if (item != nullptr)
1816  {
1817  const bool isProtected = PlayerInfo::isItemProtected(mItemId);
1818  addUse(item);
1819  addDrop(item, isProtected);
1821  {
1822  // TRANSLATORS: popup menu item
1823  // TRANSLATORS: add item to storage
1824  mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store"));
1825  }
1826  // TRANSLATORS: popup menu item
1827  // TRANSLATORS: add item name to chat
1828  mBrowserBox->addRow("/addchat 'ITEMID''CARDS'", _("Add to chat"));
1829 
1830  if (config.getBoolValue("enablePickupFilter"))
1831  {
1832  mName = item->getName();
1833  mExtName = mName;
1834  mBrowserBox->addSeparator("##3---");
1836  }
1837  }
1838  addProtection();
1839  addGmCommands();
1840  mBrowserBox->addSeparator("##3---");
1841  // TRANSLATORS: popup menu item
1842  // TRANSLATORS: close menu
1843  mBrowserBox->addRow("cancel", _("Cancel"));
1844 
1845  showPopup(x, y);
1846 }
int getInvIndex() const
Definition: item.h:164
static bool isStorageActive()
ItemColor mItemColor
Definition: popupmenu.h:293
#define _(s)
Definition: gettext.h:34
int mItemIndex
Definition: popupmenu.h:291
void addPickupFilter(const std::string &name)
Definition: popupmenu.cpp:2717
std::string mExtName
Definition: popupmenu.h:304
void addGmCommands()
Definition: popupmenu.cpp:2888
int getCard(const int index) const
Definition: item.cpp:158
Configuration config
const ItemColor ItemColor_one
Definition: itemcolor.h:29
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
void addProtection()
Definition: popupmenu.cpp:2777
bool getBoolValue(const std::string &key) const
int mItemId
Definition: popupmenu.h:290
std::string mName
Definition: popupmenu.h:303
int mItemCards[4]
Definition: popupmenu.h:292
ItemColor getColor() const
Definition: item.h:180
void initPopup()
Definition: popupmenu.cpp:151
void addUse(const Item *const item)
Definition: popupmenu.cpp:2798
std::string getName() const
Definition: item.cpp:139
bool isItemProtected(const int id)
Definition: playerinfo.cpp:512
int getId() const
Definition: item.h:80
void addDrop(const Item *const item, const bool isProtected)
Definition: popupmenu.cpp:2864
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
#define maxCards
Definition: cards.h:24
void addRow(const std::string &row, const bool atTop)

◆ showItemPopup() [2/2]

void PopupMenu::showItemPopup ( const int  x,
const int  y,
const int  itemId,
const ItemColor  color 
)

Definition at line 1747 of file popupmenu.cpp.

References _, addGmCommands(), addProtection(), StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), StaticBrowserBox::clearRows(), Inventory::findItem(), PlayerInfo::getInventory(), initPopup(), PlayerInfo::isItemProtected(), ServerCommandType::item, maxCards, mBrowserBox, mItemCards, mItemColor, mItemId, mItemIndex, mX, mY, showItemPopup(), showPopup(), x, and y.

1750 {
1751  const Inventory *const inv = PlayerInfo::getInventory();
1752  if (inv == nullptr)
1753  return;
1754 
1755  Item *const item = inv->findItem(itemId, color);
1756  if (item != nullptr)
1757  {
1758  showItemPopup(x, y, item);
1759  }
1760  else
1761  {
1762  initPopup();
1763  mItemId = itemId;
1764  mItemIndex = -1;
1765  mItemColor = color;
1766  for (int f = 0; f < maxCards; f ++)
1767  mItemCards[f] = 0;
1768  mX = x;
1769  mY = y;
1771 
1773  {
1774  // TRANSLATORS: popup menu item
1775  // TRANSLATORS: use item
1776  mBrowserBox->addRow("/use 'ITEMID'", _("Use"));
1777  }
1778  addProtection();
1779  addGmCommands();
1780  mBrowserBox->addSeparator("##3---");
1781  // TRANSLATORS: popup menu item
1782  // TRANSLATORS: close menu
1783  mBrowserBox->addRow("cancel", _("Cancel"));
1784 
1785  showPopup(x, y);
1786  }
1787 }
ItemColor mItemColor
Definition: popupmenu.h:293
#define _(s)
Definition: gettext.h:34
int mItemIndex
Definition: popupmenu.h:291
Item * findItem(const int itemId, const ItemColor color) const
Definition: inventory.cpp:93
void addGmCommands()
Definition: popupmenu.cpp:2888
Inventory * getInventory()
Definition: playerinfo.cpp:193
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
void addProtection()
Definition: popupmenu.cpp:2777
int mItemId
Definition: popupmenu.h:290
int mItemCards[4]
Definition: popupmenu.h:292
Definition: item.h:48
void initPopup()
Definition: popupmenu.cpp:151
bool isItemProtected(const int id)
Definition: playerinfo.cpp:512
void showItemPopup(const int x, const int y, const Item *const item)
Definition: popupmenu.cpp:1789
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
#define maxCards
Definition: cards.h:24
void addRow(const std::string &row, const bool atTop)

◆ showLinkPopup()

void PopupMenu::showLinkPopup ( const std::string &  link)

Definition at line 2194 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), StaticBrowserBox::clearRows(), initPopup(), mBrowserBox, mExtName, mName, mX, mY, setMousePos(), and showPopup().

Referenced by ItemLinkHandler::handleHttpLink().

2195 {
2196  initPopup();
2197  setMousePos();
2198  mName = link;
2199  mExtName = link;
2200 
2202 
2203  // TRANSLATORS: popup menu item
2204  // TRANSLATORS: open link in browser
2205  mBrowserBox->addRow("/open 'NAME'", _("Open link"));
2206  // TRANSLATORS: popup menu item
2207  // TRANSLATORS: copy link to clipboard
2208  mBrowserBox->addRow("/clipboardcopy 'NAME'", _("Copy to clipboard"));
2209  mBrowserBox->addSeparator("##3---");
2210  // TRANSLATORS: popup menu item
2211  // TRANSLATORS: close menu
2212  mBrowserBox->addRow("cancel", _("Cancel"));
2213 
2214  showPopup(mX, mY);
2215 }
#define _(s)
Definition: gettext.h:34
std::string mExtName
Definition: popupmenu.h:304
void setMousePos()
Definition: popupmenu.cpp:539
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
std::string mName
Definition: popupmenu.h:303
void initPopup()
Definition: popupmenu.cpp:151
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showMapPopup()

void PopupMenu::showMapPopup ( const int  x,
const int  y,
const int  x2,
const int  y2,
const bool  isMinimap 
)

Definition at line 804 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), Settings::cameraMode, StaticBrowserBox::clearRows(), initPopup(), isAllowCommand(), mBrowserBox, mCallerWindow, minimap, mX, mY, settings, showPopup(), and ServerCommandType::slide.

Referenced by Viewport::drawPath(), and Minimap::mouseReleased().

807 {
808  initPopup();
809  mX = x2;
810  mY = y2;
811 
812  if (isMinimap)
814 
816 
817  // TRANSLATORS: popup menu header
818  mBrowserBox->addRow(_("Map Item"), false);
819 
821  {
822  // TRANSLATORS: popup menu item
823  // TRANSLATORS: warp to map item
824  mBrowserBox->addRow("/slide 'MAPX' 'MAPY'", _("Warp"));
825  }
826  // TRANSLATORS: popup menu item
827  // TRANSLATORS: move to map item
828  mBrowserBox->addRow("/navigate 'X' 'Y'", _("Move"));
829  // TRANSLATORS: popup menu item
830  // TRANSLATORS: move camera to map item
831  mBrowserBox->addRow("/movecamera 'X' 'Y'", _("Move camera"));
832  if (settings.cameraMode != 0)
833  {
834  // TRANSLATORS: popup menu item
835  // TRANSLATORS: restore camera to default view
836  mBrowserBox->addRow("/restorecamera", _("Restore camera"));
837  }
838  mBrowserBox->addSeparator("##3---");
839  if (isMinimap)
840  {
841  // TRANSLATORS: popup menu item
842  mBrowserBox->addRow("window close", _("Close"));
843  }
844  mBrowserBox->addSeparator("##3---");
845  // TRANSLATORS: popup menu item
846  // TRANSLATORS: close menu
847  mBrowserBox->addRow("cancel", _("Cancel"));
848 
849  showPopup(x, y);
850 }
#define _(s)
Definition: gettext.h:34
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:159
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
Settings settings
Definition: settings.cpp:31
Window * mCallerWindow
Definition: popupmenu.h:297
void initPopup()
Definition: popupmenu.cpp:151
unsigned int cameraMode
Definition: settings.h:142
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)
Minimap * minimap
Definition: minimap.cpp:61

◆ showMercenaryGMCommands()

void PopupMenu::showMercenaryGMCommands ( )
private

Definition at line 3456 of file popupmenu.cpp.

Referenced by showGMPopup().

3457 {
3458 }

◆ showMonsterGMCommands()

void PopupMenu::showMonsterGMCommands ( )
private

Definition at line 3277 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), BeingId_zero, ServerCommandType::disguise, Net::getNetworkType(), isAllowCommand(), ServerCommandType::kick, mBeingId, mBrowserBox, ServerCommandType::mobinfo, ServerCommandType::mobsearch, ServerCommandType::monster, ServerCommandType::summon, ServerType::TMWATHENA, and ServerCommandType::whereis.

Referenced by showGMPopup().

3278 {
3279  if (mBeingId != BeingId_zero)
3280  {
3281  const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA;
3283  {
3284  // TRANSLATORS: popup menu item
3285  // TRANSLATORS: kick monster
3286  mBrowserBox->addRow("/kick :'BEINGID'", _("Kick"));
3287  }
3289  {
3290  // TRANSLATORS: popup menu item
3291  // TRANSLATORS: spawn monster
3292  mBrowserBox->addRow("/spawn 'BEINGSUBTYPEID'", _("Spawn same"));
3293  }
3294  if (!legacy)
3295  {
3297  {
3298  mBrowserBox->addRow("/spawnslave 'BEINGSUBTYPEID'",
3299  // TRANSLATORS: popup menu item
3300  // TRANSLATORS: spawn slave monster
3301  _("Spawn slave"));
3302  }
3304  {
3305  mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'",
3306  // TRANSLATORS: popup menu item
3307  // TRANSLATORS: disguise to monster
3308  _("Disguise"));
3309  }
3310  mBrowserBox->addSeparator("##3---");
3312  {
3313  mBrowserBox->addRow("/monsterinfo 'BEINGSUBTYPEID'",
3314  // TRANSLATORS: popup menu item
3315  // TRANSLATORS: show monster information
3316  _("Info"));
3317  }
3319  {
3320  mBrowserBox->addRow("/mobsearch 'BEINGSUBTYPEID'",
3321  // TRANSLATORS: popup menu item
3322  // TRANSLATORS: show selected monster in current map
3323  _("Search"));
3324  }
3326  {
3327  mBrowserBox->addRow("/mobspawnsearch 'BEINGSUBTYPEID'",
3328  // TRANSLATORS: popup menu item
3329  // TRANSLATORS: show selected monster spawns in all maps
3330  _("Search spawns"));
3331  }
3332  }
3333  }
3334 }
#define _(s)
Definition: gettext.h:34
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:159
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
BeingId mBeingId
Definition: popupmenu.h:288
ServerTypeT getNetworkType()
Definition: net.cpp:184
const BeingId BeingId_zero
Definition: beingid.h:29
void addRow(const std::string &row, const bool atTop)

◆ showMuteCommands()

void PopupMenu::showMuteCommands ( )
private

Definition at line 3170 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), BeingId_zero, StaticBrowserBox::clearRows(), Net::getNetworkType(), Widget::getX(), Widget::getY(), isAllowCommand(), mBeingId, mBrowserBox, mName, ServerCommandType::mute, showPopup(), strprintf(), and ServerType::TMWATHENA.

Referenced by handleLink().

3171 {
3173  // TRANSLATORS: popup menu header
3174  mBrowserBox->addRow(strprintf(_("Mute %s"),
3175  mName.c_str()),
3176  false);
3177  if (mBeingId != BeingId_zero &&
3180  {
3181  mBrowserBox->addRow("mute_+1",
3182  // TRANSLATORS: popup menu item
3183  // TRANSLATORS: mute player
3184  strprintf(_("Mute %d"), 1).c_str());
3185  mBrowserBox->addRow("mute_+5",
3186  // TRANSLATORS: popup menu item
3187  // TRANSLATORS: mute player
3188  strprintf(_("Mute %d"), 5).c_str());
3189  mBrowserBox->addRow("mute_+10",
3190  // TRANSLATORS: popup menu item
3191  // TRANSLATORS: mute player
3192  strprintf(_("Mute %d"), 10).c_str());
3193  mBrowserBox->addRow("mute_+15",
3194  // TRANSLATORS: popup menu item
3195  // TRANSLATORS: mute player
3196  strprintf(_("Mute %d"), 15).c_str());
3197  mBrowserBox->addRow("mute_+30",
3198  // TRANSLATORS: popup menu item
3199  // TRANSLATORS: mute player
3200  strprintf(_("Mute %d"), 30).c_str());
3201 
3202  mBrowserBox->addRow("mute_-1",
3203  // TRANSLATORS: popup menu item
3204  // TRANSLATORS: mute player
3205  strprintf(_("Unmute %d"), 1).c_str());
3206  mBrowserBox->addRow("mute_-5",
3207  // TRANSLATORS: popup menu item
3208  // TRANSLATORS: mute player
3209  strprintf(_("Unmute %d"), 5).c_str());
3210  mBrowserBox->addRow("mute_-10",
3211  // TRANSLATORS: popup menu item
3212  // TRANSLATORS: mute player
3213  strprintf(_("Unmute %d"), 10).c_str());
3214  mBrowserBox->addRow("mute_-15",
3215  // TRANSLATORS: popup menu item
3216  // TRANSLATORS: mute player
3217  strprintf(_("Unmute %d"), 15).c_str());
3218  mBrowserBox->addRow("mute_-30",
3219  // TRANSLATORS: popup menu item
3220  // TRANSLATORS: mute player
3221  strprintf(_("Unmute %d"), 30).c_str());
3222  mBrowserBox->addSeparator("##3---");
3223  }
3224  // TRANSLATORS: popup menu item
3225  // TRANSLATORS: back to gm menu
3226  mBrowserBox->addRow("gm", _("Back"));
3227  // TRANSLATORS: popup menu item
3228  // TRANSLATORS: close menu
3229  mBrowserBox->addRow("cancel", _("Cancel"));
3230  showPopup(getX(), getY());
3231 }
#define _(s)
Definition: gettext.h:34
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:159
int getY() const
Definition: widget.h:287
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
std::string mName
Definition: popupmenu.h:303
BeingId mBeingId
Definition: popupmenu.h:288
ServerTypeT getNetworkType()
Definition: net.cpp:184
int getX() const
Definition: widget.h:268
const BeingId BeingId_zero
Definition: beingid.h:29
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showNavigationPopup()

void PopupMenu::showNavigationPopup ( )

Definition at line 3580 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), addSocialMenu(), mBrowserBox, mX, mY, and showPopup().

Referenced by SocialWindow::action().

3581 {
3582  addSocialMenu();
3583 
3584  // TRANSLATORS: popup menu item
3585  // TRANSLATORS: close menu
3586  mBrowserBox->addRow("cancel", _("Cancel"));
3587  showPopup(mX, mY);
3588 }
#define _(s)
Definition: gettext.h:34
void addSocialMenu()
Definition: popupmenu.cpp:3508
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showNpcDialogPopup()

void PopupMenu::showNpcDialogPopup ( const BeingId  npcId,
const int  x,
const int  y 
)

Definition at line 2244 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), StaticBrowserBox::clearRows(), initPopup(), mBeingId, mBrowserBox, mX, mY, showPopup(), x, and y.

Referenced by NpcDialog::mousePressed().

2246 {
2247  initPopup();
2248  mBeingId = npcId;
2249  mX = x;
2250  mY = y;
2252  // TRANSLATORS: popup menu item
2253  // TRANSLATORS: copy npc text to clipboard
2254  mBrowserBox->addRow("/npcclipboard 'X' 'Y'", _("Copy to clipboard"));
2255  mBrowserBox->addSeparator("##3---");
2256  // TRANSLATORS: popup menu item
2257  // TRANSLATORS: close menu
2258  mBrowserBox->addRow("cancel", _("Cancel"));
2259 
2260  showPopup(x, y);
2261 }
#define _(s)
Definition: gettext.h:34
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
BeingId mBeingId
Definition: popupmenu.h:288
void initPopup()
Definition: popupmenu.cpp:151
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showNpcGMCommands()

void PopupMenu::showNpcGMCommands ( )
private

Definition at line 3233 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), BeingId_zero, ServerCommandType::disguise, Net::getNetworkType(), ServerCommandType::hidenpc, isAllowCommand(), ServerCommandType::kick, mBeingId, mBrowserBox, ServerCommandType::npcmove, ServerType::TMWATHENA, and ServerCommandType::tonpc.

Referenced by showGMPopup().

3234 {
3235  if (mBeingId != BeingId_zero)
3236  {
3238  {
3239  // TRANSLATORS: popup menu item
3240  // TRANSLATORS: kick player
3241  mBrowserBox->addRow("/kick :'BEINGID'", _("Kick"));
3242  }
3243  const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA;
3244  if (!legacy)
3245  {
3247  {
3248  // TRANSLATORS: popup menu item
3249  // TRANSLATORS: hide npc
3250  mBrowserBox->addRow("/hidenpc 'EXTNAME'", _("Hide"));
3251  }
3252  mBrowserBox->addSeparator("##3---");
3254  {
3255  mBrowserBox->addRow("/npcmove 'EEXTNAME' 'PLAYERX' 'PLAYERY'",
3256  // TRANSLATORS: popup menu item
3257  // TRANSLATORS: warp npc to player location
3258  _("Recall"));
3259  }
3261  {
3262  mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'",
3263  // TRANSLATORS: popup menu item
3264  // TRANSLATORS: disguise to npc
3265  _("Disguise"));
3266  }
3268  {
3269  // TRANSLATORS: popup menu item
3270  // TRANSLATORS: warp to npc
3271  mBrowserBox->addRow("/gotonpc 'EXTNAME'", _("Goto"));
3272  }
3273  }
3274  }
3275 }
#define _(s)
Definition: gettext.h:34
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:159
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
BeingId mBeingId
Definition: popupmenu.h:288
ServerTypeT getNetworkType()
Definition: net.cpp:184
const BeingId BeingId_zero
Definition: beingid.h:29
void addRow(const std::string &row, const bool atTop)

◆ showOutfitsWindowPopup()

void PopupMenu::showOutfitsWindowPopup ( const int  x,
const int  y 
)

Definition at line 852 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), addWindowMenu(), StaticBrowserBox::clearRows(), initPopup(), mBrowserBox, mCallerWindow, mX, mY, outfitWindow, showPopup(), x, and y.

Referenced by OutfitWindow::mousePressed().

853 {
854  initPopup();
855  mX = x;
856  mY = y;
858 
860 
861  // TRANSLATORS: popup menu header
862  mBrowserBox->addRow(_("Outfits"), false);
863  // TRANSLATORS: popup menu item
864  // TRANSLATORS: copy selected outfit to chat input
865  mBrowserBox->addRow("/outfittochat", _("Add to chat"));
866  mBrowserBox->addSeparator("##3---");
867  // TRANSLATORS: popup menu item
868  // TRANSLATORS: copy equipment from player to outfit
869  mBrowserBox->addRow("/itemstooutfit", _("Copy from player"));
870  mBrowserBox->addSeparator("##3---");
871  // TRANSLATORS: popup menu item
872  // TRANSLATORS: clear selected outfit
873  mBrowserBox->addRow("/clearoutfit", _("Clear outfit"));
874  mBrowserBox->addSeparator("##3---");
875 
877  mBrowserBox->addSeparator("##3---");
878 
879  // TRANSLATORS: popup menu item
880  // TRANSLATORS: close menu
881  mBrowserBox->addRow("cancel", _("Cancel"));
882 
883  showPopup(x, y);
884 }
#define _(s)
Definition: gettext.h:34
OutfitWindow * outfitWindow
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
Window * mCallerWindow
Definition: popupmenu.h:297
void initPopup()
Definition: popupmenu.cpp:151
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addWindowMenu(const Window *const window)
Definition: popupmenu.cpp:1184
void addRow(const std::string &row, const bool atTop)

◆ showPartyPopup()

void PopupMenu::showPartyPopup ( )

Definition at line 3546 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), addSocialMenu(), mBrowserBox, mX, mY, and showPopup().

Referenced by SocialWindow::action().

3547 {
3548  addSocialMenu();
3549 
3550  // TRANSLATORS: popup menu item
3551  // TRANSLATORS: close menu
3552  mBrowserBox->addRow("cancel", _("Cancel"));
3553  showPopup(mX, mY);
3554 }
#define _(s)
Definition: gettext.h:34
void addSocialMenu()
Definition: popupmenu.cpp:3508
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showPetGMCommands()

void PopupMenu::showPetGMCommands ( )
private

Definition at line 3452 of file popupmenu.cpp.

Referenced by showGMPopup().

3453 {
3454 }

◆ showPickupItemPopup()

void PopupMenu::showPickupItemPopup ( const int  x,
const int  y,
const std::string &  name 
)

Definition at line 2101 of file popupmenu.cpp.

References _, actorManager, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), BeingTypeId_zero, StaticBrowserBox::clearRows(), ActorType::FloorItem, initPopup(), localPlayer, mBrowserBox, mExtName, mName, mSubType, mType, mX, mY, showPopup(), x, and y.

Referenced by AvatarListBox::mousePressed().

2103 {
2104  if ((localPlayer == nullptr) || (actorManager == nullptr))
2105  return;
2106 
2107  initPopup();
2108  mName = name;
2109  mExtName = name;
2112  mX = x;
2113  mY = y;
2114 
2116 
2117  if (name.empty())
2118  {
2119  // TRANSLATORS: popup menu header
2120  mBrowserBox->addRow(_("(default)"), false);
2121  }
2122  else
2123  {
2124  mBrowserBox->addRow(name, false);
2125  }
2126 
2127  // TRANSLATORS: popup menu item
2128  // TRANSLATORS: remove item from pickup filter
2129  mBrowserBox->addRow("/removepickup 'NAME'", _("Remove"));
2130  mBrowserBox->addSeparator("##3---");
2131  // TRANSLATORS: popup menu item
2132  // TRANSLATORS: close menu
2133  mBrowserBox->addRow("cancel", _("Cancel"));
2134 
2135  showPopup(x, y);
2136 }
#define _(s)
Definition: gettext.h:34
std::string mExtName
Definition: popupmenu.h:304
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void addSeparator(const std::string &row)
std::string mName
Definition: popupmenu.h:303
LocalPlayer * localPlayer
void initPopup()
Definition: popupmenu.cpp:151
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
ActorTypeT mType
Definition: popupmenu.h:306
ActorManager * actorManager
void addRow(const std::string &row, const bool atTop)
BeingTypeId mSubType
Definition: popupmenu.h:307

◆ showPickupPopup()

void PopupMenu::showPickupPopup ( )

Definition at line 3590 of file popupmenu.cpp.

References _, StaticBrowserBox::addRow(), addSocialMenu(), mBrowserBox, mX, mY, and showPopup().

Referenced by SocialWindow::action().

3591 {
3592  addSocialMenu();
3593 
3594  // TRANSLATORS: popup menu item
3595  // TRANSLATORS: close menu
3596  mBrowserBox->addRow("cancel", _("Cancel"));
3597  showPopup(mX, mY);
3598 }
#define _(s)
Definition: gettext.h:34
void addSocialMenu()
Definition: popupmenu.cpp:3508
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:285
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:202
void addRow(const std::string &row, const bool atTop)

◆ showPlayerGMCommands()

void PopupMenu::showPlayerGMCommands ( const std::string &  name)
private

Definition at line 2962 of file popupmenu.cpp.

References _, actorManager, StaticBrowserBox::addRow(), StaticBrowserBox::addSeparator(), ServerCommandType::alive, BeingId_zero, ServerCommandType::breakguild, ServerCommandType::changeleader, ServerCommandType::clone, ServerCommandType::evilclone, ActorManager::findBeingByName(), Being::getGuildName(), Being::getName(), Net::getNetworkType(), Being::getParty(), Being::getPartyName(), ServerCommandType::guildrecall, ServerCommandType::heal, ServerCommandType::hide, isAllowCommand(), isAllowOtherCommand(), Being::isInParty(), Party::isMember(), ServerCommandType::jail, ServerCommandType::jump, ServerCommandType::jumpto, ServerCommandType::kick, ServerCommandType::kill, ServerCommandType::killable, ServerCommandType::killer, ServerCommandType::load, localPlayer, mBeingId, mBrowserBox, mName, ServerCommandType::monsterignore, ServerCommandType::nuke, party, ServerCommandType::partyrecall, ActorType::Player, ServerCommandType::recall, ServerCommandType::save, ServerCommandType::slaveclone, ServerType::TMWATHENA, ServerCommandType::unjail, and ServerCommandType::where.

Referenced by showGMPopup().

2963 {
2964  if (localPlayer == nullptr)
2965  return;
2966  const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA;
2967  if (!legacy && isAllowCommand(ServerCommandType::where))
2968  {
2969  // TRANSLATORS: popup menu item
2970  // TRANSLATORS: find player position
2971  mBrowserBox->addRow("/locateplayer 'NAME'", _("Locate"));
2972  }
2973  if (legacy)
2974  {
2975  // TRANSLATORS: popup menu item
2976  // TRANSLATORS: check player ip
2977  mBrowserBox->addRow("/ipcheck 'NAME'", _("Check ip"));
2978  }
2980  {
2981  // TRANSLATORS: popup menu item
2982  // TRANSLATORS: go to player position
2983  mBrowserBox->addRow("/gotopc 'NAME'", _("Goto"));
2984  }
2986  {
2987  // TRANSLATORS: popup menu item
2988  // TRANSLATORS: recall player to current position
2989  mBrowserBox->addRow("/recallpc 'NAME'", _("Recall"));
2990  }
2992  {
2993  // TRANSLATORS: popup menu item
2994  // TRANSLATORS: revive player
2995  mBrowserBox->addRow("/alive 'NAME'", _("Revive"));
2996  }
2997  if (!legacy)
2998  {
2999  Being *const being = actorManager->findBeingByName(name,
3001  if (being != nullptr && being == localPlayer)
3002  {
3003  if (!being->getPartyName().empty() &&
3005  {
3006  mBrowserBox->addRow("/partyrecall 'PARTY'",
3007  // TRANSLATORS: popup menu item
3008  // TRANSLATORS: recall all party members to player location
3009  _("Recall party"));
3010  }
3011  if (!being->getGuildName().empty() &&
3013  {
3014  mBrowserBox->addRow("/guildrecall 'PARTY'",
3015  // TRANSLATORS: popup menu item
3016  // TRANSLATORS: recall all guild members to player location
3017  _("Recall guild"));
3018  }
3019  }
3020  if (localPlayer->isInParty())
3021  {
3022  const Party *const party = localPlayer->getParty();
3023  if (party != nullptr &&
3024  party->isMember(name) &&
3026  {
3027  mBrowserBox->addRow("/gmpartyleader 'NAME'",
3028  // TRANSLATORS: popup menu item
3029  // TRANSLATORS: give party leader status
3030  _("Give party leader"));
3031  }
3032  }
3033 
3035  {
3036  // TRANSLATORS: popup menu item
3037  // TRANSLATORS: nuke player
3038  mBrowserBox->addRow("/gmnuke 'NAME'", _("Nuke"));
3039  }
3041  {
3042  // TRANSLATORS: popup menu item
3043  // TRANSLATORS: kill player
3044  mBrowserBox->addRow("/kill 'NAME'", _("Kill"));
3045  }
3046  if (mBeingId != BeingId_zero)
3047  {
3048  mBrowserBox->addSeparator("##3---");
3049  // TRANSLATORS: popup menu item
3050  // TRANSLATORS: show menu
3051  mBrowserBox->addRow("show", _("Show..."));
3052  // TRANSLATORS: popup menu item
3053  // TRANSLATORS: mute menu
3054  mBrowserBox->addRow("mute", _("Mute..."));
3055  }
3056  }
3057  if (legacy)
3058  {
3059  if (localPlayer->getName() == mName)
3060  {
3061  // TRANSLATORS: popup menu item
3062  // TRANSLATORS: hide player
3063  mBrowserBox->addRow("/hide", _("Hide"));
3064  mBrowserBox->addSeparator("##3---");
3065  }
3066  }
3067  else
3068  {
3070  {
3071  // TRANSLATORS: popup menu item
3072  // TRANSLATORS: heal player
3073  mBrowserBox->addRow("/gmheal 'NAME'", _("Heal"));
3074  }
3076  {
3077  // TRANSLATORS: popup menu item
3078  // TRANSLATORS: enable immortal mode for player
3079  mBrowserBox->addRow("/immortal 'NAME'", _("Immortal"));
3080  }
3082  {
3083  // TRANSLATORS: popup menu item
3084  // TRANSLATORS: send player to jail
3085  mBrowserBox->addRow("/jail 'NAME'", _("Jail"));
3086  }
3088  {
3089  // TRANSLATORS: popup menu item
3090  // TRANSLATORS: restore player from jail
3091  mBrowserBox->addRow("/unjail 'NAME'", _("Unjail"));
3092  }
3093  if (name == localPlayer->getName() &&
3095  {
3096  // TRANSLATORS: popup menu item
3097  // TRANSLATORS: hide player
3098  mBrowserBox->addRow("/hide 'NAME'", _("Hide"));
3099  }
3100  mBrowserBox->addSeparator("##3---");
3102  {
3103  // TRANSLATORS: popup menu item
3104  // TRANSLATORS: set player as killer
3105  mBrowserBox->addRow("/killer 'NAME'", _("Killer"));
3106  }
3108  {
3109  // TRANSLATORS: popup menu item
3110  // TRANSLATORS: set player as killable
3111  mBrowserBox->addRow("/killable 'NAME'", _("Killable"));
3112  }
3114  {
3115  // TRANSLATORS: popup menu item
3116  // TRANSLATORS: set player save position
3117  mBrowserBox->addRow("/savepos 'NAME'", _("Set save"));
3118  }