diff options
author | Philipp Sehmisch <mana@crushnet.org> | 2010-07-09 15:21:50 +0200 |
---|---|---|
committer | Philipp Sehmisch <mana@crushnet.org> | 2010-07-09 15:22:11 +0200 |
commit | 26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2 (patch) | |
tree | 6d7ea0ebe8be228a61315f72122eed3f2f995a0b /src/serialize | |
parent | 2627acefebc688d9d9733abe23ba5aae79f66ea0 (diff) | |
download | manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.gz manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.xz manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.zip |
Added LUA script bindings for manipulating the specials available to a character.
Added script call for getting the cost of a special (recharge only for now)
Deleting specials works server-sided but the client isn't informed about it properly. Specials without recharge cost don't appear for the player. Both of these features require an additional netcode message.
Reviewed-by: Freeyorp
Diffstat (limited to 'src/serialize')
-rw-r--r-- | src/serialize/characterdata.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/serialize/characterdata.hpp b/src/serialize/characterdata.hpp index 44e2c29..50acc8e 100644 --- a/src/serialize/characterdata.hpp +++ b/src/serialize/characterdata.hpp @@ -81,6 +81,14 @@ void serializeCharacterData(const T &data, MessageOut &msg) msg.writeLong(kills_it->second); } + // character specials + std::map<int, Special*>::const_iterator special_it; + msg.writeShort(data.getSpecialSize()); + for (special_it = data.getSpecialBegin(); special_it != data.getSpecialEnd() ; special_it++) + { + msg.writeLong(special_it->first); + } + // inventory - must be last because size isn't transmitted const Possessions &poss = data.getPossessions(); msg.writeLong(poss.money); @@ -152,6 +160,14 @@ void deserializeCharacterData(T &data, MessageIn &msg) data.setKillCount(monsterId, kills); } + // character specials + int specialSize = msg.readShort(); + data.clearSpecials(); + for (int i = 0; i < specialSize; i++) + { + data.giveSpecial(msg.readLong()); + } + // inventory - must be last because size isn't transmitted Possessions &poss = data.getPossessions(); poss.money = msg.readLong(); |