summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-07-27 15:31:21 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-07-27 15:31:21 +0200
commitdcadae652ec89b554e75da8c12b6d4a655ccc888 (patch)
tree99a703881eef3e66cb00d88a052cef07a9f542b2 /src/net/manaserv
parent7342860e6c7b8d817410d886c7b89ff36e5c26f7 (diff)
downloadmana-dcadae652ec89b554e75da8c12b6d4a655ccc888.tar.gz
mana-dcadae652ec89b554e75da8c12b6d4a655ccc888.tar.bz2
mana-dcadae652ec89b554e75da8c12b6d4a655ccc888.tar.xz
mana-dcadae652ec89b554e75da8c12b6d4a655ccc888.zip
Followed server protocol changes.
Also documented a TODO.
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/inventoryhandler.cpp33
-rw-r--r--src/net/manaserv/manaserv_protocol.h12
2 files changed, 23 insertions, 22 deletions
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index c8dae1c3..cf7e8483 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -195,7 +195,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
}
while (msg.getUnreadLength())
{
- int equipSlot = msg.readInt8();
+ int equipSlot = msg.readInt16();
int inventorySlot = msg.readInt16();
mEquipBackend.equip(inventorySlot, equipSlot);
@@ -217,7 +217,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
while (msg.getUnreadLength())
{
int inventorySlot = msg.readInt16();
- int equipSlotCount = msg.readInt8();
+ int equipSlotCount = msg.readInt16();
if (equipSlotCount == 0)
{
@@ -229,8 +229,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
// Otherwise equip the item in the given slots
while (equipSlotCount--)
{
- unsigned int equipSlot = msg.readInt8();
- unsigned int amountUsed = msg.readInt8();
+ unsigned int equipSlot = msg.readInt16();
+ unsigned int amountUsed = msg.readInt16();
mEquipBackend.equip(inventorySlot, equipSlot,
amountUsed);
@@ -256,19 +256,19 @@ void InventoryHandler::event(Event::Channel channel,
if (event.getType() == Event::DoEquip)
{
MessageOut msg(PGMSG_EQUIP);
- msg.writeInt8(index);
+ msg.writeInt16(index);
gameServerConnection->send(msg);
}
else if (event.getType() == Event::DoUnequip)
{
MessageOut msg(PGMSG_UNEQUIP);
- msg.writeInt8(index);
+ msg.writeInt16(index);
gameServerConnection->send(msg);
}
else if (event.getType() == Event::DoUse)
{
MessageOut msg(PGMSG_USE_ITEM);
- msg.writeInt8(index);
+ msg.writeInt16(index);
gameServerConnection->send(msg);
}
else if (event.getType() == Event::DoDrop)
@@ -276,8 +276,8 @@ void InventoryHandler::event(Event::Channel channel,
int amount = event.getInt("amount", 1);
MessageOut msg(PGMSG_DROP);
- msg.writeInt8(index);
- msg.writeInt8(amount);
+ msg.writeInt16(index);
+ msg.writeInt16(amount);
gameServerConnection->send(msg);
}
else if (event.getType() == Event::DoSplit)
@@ -288,9 +288,9 @@ void InventoryHandler::event(Event::Channel channel,
if (newIndex > Inventory::NO_SLOT_INDEX)
{
MessageOut msg(PGMSG_MOVE_ITEM);
- msg.writeInt8(index);
- msg.writeInt8(newIndex);
- msg.writeInt8(amount);
+ msg.writeInt16(index);
+ msg.writeInt16(newIndex);
+ msg.writeInt16(amount);
gameServerConnection->send(msg);
}
}
@@ -304,9 +304,9 @@ void InventoryHandler::event(Event::Channel channel,
return;
MessageOut msg(PGMSG_MOVE_ITEM);
- msg.writeInt8(index);
- msg.writeInt8(newIndex);
- msg.writeInt8(item->getQuantity());
+ msg.writeInt16(index);
+ msg.writeInt16(newIndex);
+ msg.writeInt16(item->getQuantity());
gameServerConnection->send(msg);
}
else
@@ -315,7 +315,8 @@ void InventoryHandler::event(Event::Channel channel,
int destination = event.getInt("destination");
int amount = event.getInt("amount", 1);*/
- // TODO
+ // TODO Support drag'n'drop to the map ground, or with other
+ // windows.
}
}
}
diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h
index 66da57df..1543504e 100644
--- a/src/net/manaserv/manaserv_protocol.h
+++ b/src/net/manaserv/manaserv_protocol.h
@@ -89,13 +89,13 @@ enum {
GPMSG_PLAYER_MAP_CHANGE = 0x0100, // S filename, W x, W y
GPMSG_PLAYER_SERVER_CHANGE = 0x0101, // B*32 token, S game address, W game port
PGMSG_PICKUP = 0x0110, // W*2 position
- PGMSG_DROP = 0x0111, // B slot, B amount
- PGMSG_EQUIP = 0x0112, // B slot
- PGMSG_UNEQUIP = 0x0113, // B slot
- PGMSG_MOVE_ITEM = 0x0114, // B slot1, B slot2, B amount
+ PGMSG_DROP = 0x0111, // W slot, W amount
+ PGMSG_EQUIP = 0x0112, // W slot
+ PGMSG_UNEQUIP = 0x0113, // W slot
+ PGMSG_MOVE_ITEM = 0x0114, // W slot1, W slot2, W amount
GPMSG_INVENTORY = 0x0120, // { W slot, W item id [, W amount] (if item id is nonzero) }*
- GPMSG_INVENTORY_FULL = 0x0121, // W inventory slot count { W slot, W itemId, W amount }, { B equip slot, W invy slot}*
- GPMSG_EQUIP = 0x0122, // { W Invy slot, B equip slot type count { B equip slot, B number used} }*
+ GPMSG_INVENTORY_FULL = 0x0121, // W inventory slot count { W slot, W itemId, W amount }, { W equip slot, W invy slot}*
+ GPMSG_EQUIP = 0x0122, // { W Invy slot, W equip slot type count { W equip slot, W number used} }*
GPMSG_PLAYER_ATTRIBUTE_CHANGE = 0x0130, // { W attribute, D base value (in 1/256ths), D modified value (in 1/256ths)}*
GPMSG_PLAYER_EXP_CHANGE = 0x0140, // { W skill, D exp got, D exp needed }*
GPMSG_LEVELUP = 0x0150, // W new level, W character points, W correction points