summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-09-09 18:37:19 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-09-09 18:37:19 +0200
commit4f5053f463fd8da0de1615ca6b0f212f02f3d653 (patch)
treef940290563d9da428773f97db3fcea1d92f9defd
parentfa79fe2a419ac53b87d06b8231b04ee4776c3bfd (diff)
downloadmanaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.tar.gz
manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.tar.bz2
manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.tar.xz
manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.zip
Send equipment data for character selection
-rw-r--r--src/account-server/accounthandler.cpp23
-rw-r--r--src/common/manaserv_protocol.h5
2 files changed, 19 insertions, 9 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 9271c0ab..90d1092f 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -283,15 +283,24 @@ void AccountHandler::sendCharacterData(AccountClient &client,
charInfo.writeInt16(ch.getAttributePoints());
charInfo.writeInt16(ch.getCorrectionPoints());
- for (AttributeMap::const_iterator it = ch.mAttributes.begin(),
- it_end = ch.mAttributes.end();
- it != it_end;
- ++it)
+ auto &possessions = ch.getPossessions();
+ auto &equipData = possessions.getEquipment();
+ auto &inventoryData = possessions.getInventory();
+ charInfo.writeInt8(equipData.size());
+
+ for (int itemSlot : equipData)
+ {
+ const auto &it = inventoryData.find(itemSlot);
+ charInfo.writeInt16(itemSlot);
+ charInfo.writeInt16(it->second.itemId);
+ }
+
+ for (auto &it : ch.getAttributes())
{
// {id, base value in 256ths, modified value in 256ths }*
- charInfo.writeInt32(it->first);
- charInfo.writeInt32((int) (it->second.base * 256));
- charInfo.writeInt32((int) (it->second.modified * 256));
+ charInfo.writeInt32(it.first);
+ charInfo.writeInt32((int) (it.second.base * 256));
+ charInfo.writeInt32((int) (it.second.modified * 256));
}
client.send(charInfo);
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index b34a99ec..86f6196c 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -29,7 +29,7 @@
namespace ManaServ {
enum {
- PROTOCOL_VERSION = 7,
+ PROTOCOL_VERSION = 8,
SUPPORTED_DB_VERSION = 25
};
@@ -83,7 +83,8 @@ enum {
PAMSG_CHAR_DELETE = 0x0022, // B slot
APMSG_CHAR_DELETE_RESPONSE = 0x0023, // B error
// B slot, S name, B gender, B hair style, B hair color,
- // W character points, W correction points,
+ // W character points, W correction points, B amount of items equipped,
+ // { W slot, W itemId }*
// {D attr id, D base value (in 1/256ths) D mod value (in 256ths) }*
APMSG_CHAR_INFO = 0x0024, // ^
PAMSG_CHAR_SELECT = 0x0026, // B slot