72 "equipment_playerbox.xml",
73 "equipment_selectedplayerbox.xml")),
79 mSlotHighlightedBackground(),
83 mHighlightColor(getThemeColor(
ThemeColorId::HIGHLIGHT, 255U)),
86 mLabelsColor2(getThemeColor(
ThemeColorId::LABEL_OUTLINE, 255U)),
88 mItemPadding(getOption(
"itemPadding", 0)),
89 mBoxSize(getOption(
"boxSize", 0)),
90 mButtonPadding(getOption(
"buttonPadding", 5)),
98 mHaveDefaultPage(false)
165 STD_VECTOR<EquipmentBox*> &boxes = (*it)->boxes;
190 const int fontHeight = font->
getHeight();
196 FOR_EACH (STD_VECTOR<EquipmentBox*>::const_iterator, it, boxes)
230 for (STD_VECTOR<EquipmentBox*>::const_iterator it = boxes.begin(),
231 it_end = boxes.end(); it != it_end; ++ it, ++ i)
241 if (image !=
nullptr)
243 image->setAlpha(1.0F);
255 box->
y - fontHeight);
259 else if (box->
image !=
nullptr)
277 const int fontHeight = font->
getHeight();
280 for (STD_VECTOR<EquipmentBox*>::const_iterator it = boxes.begin(),
281 it_end = boxes.end(); it != it_end; ++ it, ++ i)
305 for (STD_VECTOR<EquipmentBox*>::const_iterator it = boxes.begin(),
306 it_end = boxes.end(); it != it_end; ++ it, ++ i)
316 if (image !=
nullptr)
318 image->setAlpha(1.0F);
330 box->
y - fontHeight);
334 else if (box->
image !=
nullptr)
346 const std::string &eventId =
event.getId();
347 if (eventId ==
"unequip")
356 else if (eventId.find(
"tab_") == 0U)
358 Button *
const button =
dynamic_cast<Button*
>(
event.getSource());
359 if (button ==
nullptr)
364 else if (eventId ==
"playerbox")
374 if (inventory ==
nullptr)
413 for (STD_VECTOR<EquipmentBox*>::const_iterator it = boxes.begin(),
414 it_end = boxes.end(); it != it_end; ++ it, ++ i)
435 const int x =
event.getX();
436 const int y =
event.getY();
451 for (STD_VECTOR<EquipmentBox*>::const_iterator it = boxes.begin(),
452 it_end = boxes.end(); it != it_end; ++ it, ++ i)
485 const int mx =
x +
getX();
486 const int my =
y +
getY();
517 if (inventory ==
nullptr)
537 const int x =
event.getX();
538 const int y =
event.getY();
540 for (STD_VECTOR<EquipmentBox*>::const_iterator
541 it = boxes.begin(), it_end = boxes.end();
569 const int x =
event.getX();
570 const int y =
event.getY();
609 if (being ==
nullptr)
635 XmlNodeConstPtr root = doc->
rootNode();
647 root,
"image",
"equipmentbox.png"), 32, 32);
651 if (xmlNameEqual(node,
"page"))
677 const int page =
addPage(name);
680 if (xmlNameEqual(childNode,
"playerbox"))
682 else if (xmlNameEqual(childNode,
"slot"))
701 if (imageset ==
nullptr)
711 Image *image =
nullptr;
713 if (imageIndex >= 0 && imageIndex <
CAST_S32(imageset->
size()))
714 image = imageset->
get(imageIndex);
716 STD_VECTOR<EquipmentBox*> &boxes =
mPages[page]->boxes;
717 if (boxes[slot] !=
nullptr)
744 XmlNodeConstPtrConst root = doc.
rootNode();
750 if (!xmlNameEqual(slotNode,
"slot"))
762 reportAlways(
"Wrong slot id '%d' for slot with name '%s'",
786 "equipmentbox.png", 32, 32);
805 Image *image =
nullptr;
807 if ((
mImageSet !=
nullptr) && imageIndex >= 0 && imageIndex
815 STD_VECTOR<EquipmentBox*> &boxes =
mPages[0]->boxes;
841 STD_VECTOR<EquipmentBox*> &boxes = page->
boxes;
845 boxes.push_back(
nullptr);
#define fromBool(val, name)
#define reportAlways(...)
virtual void add(Widget *const widget)
Equipment * getEquipment()
std::string getStringValue(const std::string &key) const
int getIntValue(const std::string &key) const
void dragItem(const Item *const item, const DragDropSourceT source, const int tag)
DragDropSourceT getSource() const
ItemColor getItemColor() const
void setBeing(Being *const being)
ImageCollection * mVertexes
void setSelected(const int index)
std::vector< EquipmentPage * > mPages
void loadPlayerBox(const xmlNodePtr playerBoxNode, const int page)
void draw(Graphics *const graphics)
static void prepareSlotNames()
static StringIntMap mSlotNames
void mousePressed(MouseEvent &event)
static int parseSlotName(const std::string &name)
void loadSlot(const xmlNodePtr slotNode, const ImageSet *const imageset, const int page)
void action(const ActionEvent &event)
Image * mSlotHighlightedBackground
void mouseExited(MouseEvent &event)
EquipmentWindow(Equipment *const equipment, Being *const being, const bool foring)
void safeDraw(Graphics *const graphics)
void resetBeing(const Being *const being)
int addPage(const std::string &name)
void mouseReleased(MouseEvent &event)
const Item * getItem(const int x, const int y) const
void mouseMoved(MouseEvent &event)
void addBox(const int idx, int x, int y, const int imageIndex)
void updateBeing(Being *const being)
void loadPage(const xmlNodePtr node)
const Backend * getBackend() const
const Item * getEquipment(const int index) const
int getWidth(const std::string &text) const
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
virtual void drawTileCollection(const ImageCollection *const vertCol)=0
virtual void calcTileCollection(ImageCollection *const vertCol, const Image *const image, int x, int y)=0
virtual void finalize(ImageCollection *const col)
Image * get(const size_type i) const
Item * findItem(const int itemId, const ItemColor color) const
Equipm isEquipment() const
Equipped isEquipped() const
MouseButtonT getButton() const
virtual int getProjectileSlot() const =0
void setPlayer(Being *being)
bool isPointInRect(const int x_, const int y_) const
void registerWindowForReset(Window *const window)
void loadRect(ImageRect &image, const std::string &name, const std::string &name2, const int start, const int end)
static ImageSet * getImageSetFromTheme(const std::string &path, const int w, const int h)
void safeDraw(Graphics *const graphics)
void mouseReleased(MouseEvent &event)
void setSaveVisible(const bool save)
void setWindowName(const std::string &name)
int getOption(const std::string &name, const int def) const
unsigned int getTitleBarHeight() const
void mouseMoved(MouseEvent &event)
void mousePressed(MouseEvent &event)
void enableVisibleSound(bool b)
void draw(Graphics *const graphics)
void setCloseButton(const bool flag)
void setStickyButtonLock(const bool sticky)
DragDropSource ::T DragDropSourceT
void delete_all(Container &c)
static const int BOX_COUNT
EquipmentWindow * equipmentWindow
EquipmentWindow * beingEquipmentWindow
const bool Equipped_false
#define FOR_EACH(type, iter, array)
Net::InventoryHandler * inventoryHandler
#define for_each_xml_child_node(var, parent)
LocalPlayer * localPlayer
std::string toString(T const &value)
converts any type to a string
Inventory * getInventory()
void equipItem(const Item *const item, const Sfx sfx)
void unequipItem(const Item *const item, const Sfx sfx)
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
std::vector< std::string > mPages
#define BLOCK_START(name)
SetupWindow * setupWindow
const bool SkipError_false
std::map< std::string, int > StringIntMap
StringIntMap::const_iterator StringIntMapCIter
std::vector< EquipmentBox * > boxes
const bool UseVirtFs_true