diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-09 18:37:19 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-09 18:37:19 +0200 |
commit | 4f5053f463fd8da0de1615ca6b0f212f02f3d653 (patch) | |
tree | f940290563d9da428773f97db3fcea1d92f9defd /src/account-server/accounthandler.cpp | |
parent | fa79fe2a419ac53b87d06b8231b04ee4776c3bfd (diff) | |
download | manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.tar.gz manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.tar.bz2 manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.tar.xz manaserv-4f5053f463fd8da0de1615ca6b0f212f02f3d653.zip |
Send equipment data for character selection
Diffstat (limited to 'src/account-server/accounthandler.cpp')
-rw-r--r-- | src/account-server/accounthandler.cpp | 23 |
1 files changed, 16 insertions, 7 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); |