summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/inventoryhandler.h23
-rw-r--r--src/net/manaserv/inventoryhandler.cpp11
-rw-r--r--src/net/manaserv/inventoryhandler.h6
3 files changed, 40 insertions, 0 deletions
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index 83ef91a7..24e6dd43 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -45,6 +45,22 @@ const int fallBackBoxesPosition[][2] = {
{ 129, 78 } // EQUIP_PROJECTILE_SLOT
};
+const std::string fallBackBoxesBackground[] = {
+ "equip-box-chest.png",
+ "equip-box-hands.png",
+ "equip-box-head.png",
+ "equip-box-legs.png",
+ "equip-box-feet.png",
+ "equip-box-ring.png",
+ "equip-box-ring.png",
+ "equip-box-neck.png",
+ "equip-box-weapon.png",
+ "equip-box-shield.png",
+ "equip-box-ammo.png"
+};
+
+static const std::string empty = std::string();
+
class InventoryHandler
{
public:
@@ -70,6 +86,13 @@ class InventoryHandler
fallBackBoxesPosition[slotIndex][1]);
return Position(0,0);
}
+
+ virtual const std::string& getBoxBackground(unsigned int slotIndex) const
+ {
+ if (slotIndex < sizeof(fallBackBoxesBackground))
+ return fallBackBoxesBackground[slotIndex];
+ return empty; // The empty string
+ }
};
} // namespace Net
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index 67c79a17..7dd971ab 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -271,6 +271,10 @@ void EquipBackend::readBoxNode(xmlNodePtr slotNode)
int y = XML::getProperty(boxNode, "y" , 0);
mBoxesPositions.push_back(Position(x, y));
+
+ std::string backgroundFile =
+ XML::getProperty(boxNode, "background" , std::string());
+ mBoxesBackgroundFile.push_back(backgroundFile);
}
}
@@ -303,6 +307,13 @@ Position EquipBackend::getBoxPosition(unsigned int slotIndex) const
return Position(0, 0);
}
+const std::string& EquipBackend::getBoxBackground(unsigned int slotIndex) const
+{
+ if (slotIndex < mBoxesBackgroundFile.size())
+ return mBoxesBackgroundFile.at(slotIndex);
+ return Net::empty;
+}
+
InventoryHandler::InventoryHandler()
{
static const Uint16 _messages[] = {
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index 446105ee..c9192525 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -63,6 +63,8 @@ class EquipBackend : public Equipment::Backend, public EventListener
Position getBoxPosition(unsigned int slotIndex) const;
+ const std::string& getBoxBackground(unsigned int slotIndex) const;
+
private:
void readEquipFile();
@@ -114,6 +116,7 @@ class EquipBackend : public Equipment::Backend, public EventListener
typedef std::map<unsigned int, Slot> Slots;
Slots mSlots;
std::vector<Position> mBoxesPositions;
+ std::vector<std::string> mBoxesBackgroundFile;
};
class InventoryHandler : public MessageHandler, Net::InventoryHandler,
@@ -142,6 +145,9 @@ class InventoryHandler : public MessageHandler, Net::InventoryHandler,
Position getBoxPosition(unsigned int slotIndex) const
{ return mEquipBackend.getBoxPosition(slotIndex); }
+ const std::string& getBoxBackground(unsigned int slotIndex) const
+ { return mEquipBackend.getBoxBackground(slotIndex); }
+
private:
EquipBackend mEquipBackend;
};