summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-23 16:45:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-23 16:45:46 +0300
commitd20744c0ff83572dc209389df900826b7d088546 (patch)
treeb6a91790f6c52d016e57cfdba687251c1f01409f /src
parenta22d7bce703101ba3ae15cb5b8545381dfe863c4 (diff)
downloadplus-d20744c0ff83572dc209389df900826b7d088546.tar.gz
plus-d20744c0ff83572dc209389df900826b7d088546.tar.bz2
plus-d20744c0ff83572dc209389df900826b7d088546.tar.xz
plus-d20744c0ff83572dc209389df900826b7d088546.zip
Add support for additional slots in net code.
Now projectile slot depend on server.
Diffstat (limited to 'src')
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/equipment.h2
-rw-r--r--src/gui/windows/equipmentwindow.cpp7
-rw-r--r--src/gui/windows/statuswindow.cpp5
-rw-r--r--src/net/ea/eaprotocol.h7
-rw-r--r--src/net/ea/inventoryhandler.cpp4
-rw-r--r--src/net/eathena/inventoryhandler.cpp2
-rw-r--r--src/net/eathena/inventoryhandler.h3
-rw-r--r--src/net/inventoryhandler.h2
-rw-r--r--src/net/tmwa/inventoryhandler.h3
-rw-r--r--src/resources/equipmentslots.h7
11 files changed, 34 insertions, 10 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 60518842d..935b64c70 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2944,7 +2944,7 @@ void LocalPlayer::imitateOutfit(const Being *const player,
const int equipmentSlot = inventoryHandler
->convertFromServerSlot(sprite);
// logger->log("equipmentSlot: " + toString(equipmentSlot));
- if (equipmentSlot == ItemSlot::PROJECTILE_SLOT)
+ if (equipmentSlot == inventoryHandler->getProjectileSlot())
return;
const Item *const item = PlayerInfo::getEquipment(equipmentSlot);
diff --git a/src/equipment.h b/src/equipment.h
index 1adc69136..d9210a2fe 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -23,7 +23,7 @@
#ifndef EQUIPMENT_H
#define EQUIPMENT_H
-static const int EQUIPMENT_SIZE = 22;
+static const int EQUIPMENT_SIZE = 27;
#include "localconsts.h"
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index e37d623d6..a78052404 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -53,11 +53,13 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
+#include "net/inventoryhandler.h"
+
#include "debug.h"
EquipmentWindow *equipmentWindow = nullptr;
EquipmentWindow *beingEquipmentWindow = nullptr;
-static const int BOX_COUNT = 22;
+static const int BOX_COUNT = 27;
std::map<std::string, int> EquipmentWindow::mSlotNames;
EquipmentWindow::EquipmentWindow(Equipment *const equipment,
@@ -241,6 +243,7 @@ void EquipmentWindow::draw(Graphics *graphics)
}
i = 0;
+ const int projSlot = inventoryHandler->getProjectileSlot();
for (std::vector<EquipmentBox*>::const_iterator it = boxes.begin(),
it_end = boxes.end(); it != it_end; ++ it, ++ i)
{
@@ -258,7 +261,7 @@ void EquipmentWindow::draw(Graphics *graphics)
// with maximum opacity
graphics->drawImage(image, box->x + mItemPadding,
box->y + mItemPadding);
- if (i == ItemSlot::PROJECTILE_SLOT)
+ if (i == projSlot)
{
graphics->setColorAll(mLabelsColor, mLabelsColor2);
const std::string str = toString(item->getQuantity());
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 9d979f27f..8803654c8 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -50,8 +50,9 @@
#include "gui/widgets/vertcontainer.h"
#include "gui/widgets/windowcontainer.h"
-#include "net/playerhandler.h"
#include "net/gamehandler.h"
+#include "net/inventoryhandler.h"
+#include "net/playerhandler.h"
#include "utils/delete2.h"
#include "utils/gettext.h"
@@ -585,7 +586,7 @@ void StatusWindow::updateArrowsBar(ProgressBar *const bar)
return;
const Item *const item = equipmentWindow->getEquipment(
- Equipment::EQUIP_PROJECTILE_SLOT);
+ inventoryHandler->getProjectileSlot());
if (item && item->getQuantity() > 0)
bar->setText(toString(item->getQuantity()));
diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h
index 46677f25a..89d8dd791 100644
--- a/src/net/ea/eaprotocol.h
+++ b/src/net/ea/eaprotocol.h
@@ -92,6 +92,13 @@ enum
EA_SPRITE_EVOL3,
EA_SPRITE_EVOL4,
EA_SPRITE_EVOL5,
+ EA_SPRITE_EVOL6,
+ EA_SPRITE_EVOL7,
+ EA_SPRITE_EVOL8,
+ EA_SPRITE_EVOL9,
+ EA_SPRITE_EVOL10,
+ EA_SPRITE_EVOL11,
+ EA_SPRITE_EVOL12,
EA_SPRITE_VECTOREND
};
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 074459841..1f6d0e2a2 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -147,7 +147,7 @@ int InventoryHandler::getSlot(const int eAthenaSlot)
return Equipment::EQUIP_VECTOREND;
if (eAthenaSlot & 0x8000)
- return Equipment::EQUIP_PROJECTILE_SLOT;
+ return inventoryHandler->getProjectileSlot();
unsigned int mask = 1;
int position = 0;
@@ -327,7 +327,7 @@ void InventoryHandler::processPlayerArrowEquip(Net::MessageIn &msg)
return;
index -= INVENTORY_OFFSET;
- mEquips.setEquipment(Equipment::EQUIP_PROJECTILE_SLOT, index);
+ mEquips.setEquipment(inventoryHandler->getProjectileSlot(), index);
ArrowsListener::distributeEvent();
BLOCK_END("InventoryHandler::processPlayerArrowEquip")
}
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index af08fa1b2..384ca86b2 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -57,7 +57,7 @@ const Equipment::Slot EQUIP_CONVERT[] =
Equipment::EQUIP_FIGHT1_SLOT, // 10 SPRITE_WEAPON
Equipment::EQUIP_FIGHT2_SLOT, // 11 SPRITE_SHIELD
Equipment::EQUIP_EVOL_RING2_SLOT, // 12
- Equipment::EQUIP_EVOL_RING2_SLOT, // 13 SPRITE_EVOL2
+ Equipment::EQUIP_PROJECTILE_SLOT, // 13 SPRITE_EVOL2
Equipment::EQUIP_COSTUME_ROBE_SLOT, // 14 SPRITE_EVOL3
Equipment::EQUIP_MISSING1_SLOT, // 15 SPRITE_EVOL4
};
diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h
index 272d3a82b..794f9ca7a 100644
--- a/src/net/eathena/inventoryhandler.h
+++ b/src/net/eathena/inventoryhandler.h
@@ -71,6 +71,9 @@ class InventoryHandler final : public MessageHandler,
int convertFromServerSlot(const int serverSlot)
const override final A_WARN_UNUSED;
+ int getProjectileSlot() const override final
+ { return 23; }
+
protected:
static void processPlayerEquipment(Net::MessageIn &msg);
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index ec822531a..13b2c847f 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -84,6 +84,8 @@ class InventoryHandler notfinal
const bool favorite) const = 0;
virtual void selectEgg(const Item *const item) const = 0;
+
+ virtual int getProjectileSlot() const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index 84f6dd974..d8caf7a84 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -71,6 +71,9 @@ class InventoryHandler final : public MessageHandler,
int convertFromServerSlot(const int serverSlot)
const override final A_WARN_UNUSED;
+ int getProjectileSlot() const override final
+ { return 10; }
+
protected:
static void processPlayerEquipment(Net::MessageIn &msg);
diff --git a/src/resources/equipmentslots.h b/src/resources/equipmentslots.h
index 31373a8e4..6b7db61c4 100644
--- a/src/resources/equipmentslots.h
+++ b/src/resources/equipmentslots.h
@@ -85,7 +85,12 @@ static const EquipmentSlotMap equipmentSlots[] =
{"slot18", 18},
{"slot19", 19},
{"slot20", 20},
- {"slot21", 21}
+ {"slot21", 21},
+ {"slot22", 22},
+ {"slot23", 23},
+ {"slot24", 24},
+ {"slot25", 25},
+ {"slot26", 26}
};
#endif // RESOURCES_EQUIPMENTSLOTS_H