From f90d1a1bcd8b82886cf8ae07f0d0d83e11e2f53d Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sat, 19 May 2012 13:11:59 +0200 Subject: Fixed skill display for manaserv - shows manaserv skills at all - shows the progress bar for manaserv skills again - shows the level for this skills (server side patch needed) TODO: URGENT: Fix attributes and skills getting stored in same list. Reviewed-by: Bertram. --- src/gui/skilldialog.cpp | 13 +++++++++---- src/net/manaserv/manaserv_protocol.h | 2 +- src/net/manaserv/playerhandler.cpp | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 68993220..485d5d5b 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -278,8 +278,7 @@ void SkillDialog::update() for (SkillMap::iterator it = mSkills.begin(); it != mSkills.end(); it++) { - if ((*it).second->modifiable) - (*it).second->update(); + (*it).second->update(); } } @@ -292,6 +291,12 @@ void SkillDialog::event(Event::Channel channel, const Event &event) update(); } } + else if (event.getType() == Event::UpdateStat) + { + SkillMap::iterator it = mSkills.find(event.getInt("id")); + if (it != mSkills.end()) + it->second->update(); + } } void SkillDialog::clearSkills() @@ -476,8 +481,8 @@ void SkillInfo::update() if (exp.second) { - skillExp = strprintf("%d / %d", exp.first, exp.second); - progress = (float) exp.first / exp.second; + progress = exp.second != 0 ? (float) exp.first / exp.second : 0; + skillExp = strprintf("%.2f%%", progress * 100); } else { diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h index 5f94b726..bfa737d8 100644 --- a/src/net/manaserv/manaserv_protocol.h +++ b/src/net/manaserv/manaserv_protocol.h @@ -114,7 +114,7 @@ enum { GPMSG_INVENTORY_FULL = 0x0121, // W inventory slot count { W slot, W itemId, W amount }, { W equip slot, W item Id, W item Instance}* GPMSG_EQUIP = 0x0122, // W item Id, W equip slot type count //{ W equip slot, W capacity used}*//<- When equipping, //{ W item instance, W 0}*//<- When unequipping 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_PLAYER_EXP_CHANGE = 0x0140, // { W skill, D exp got, D exp needed, W skill level }* GPMSG_LEVELUP = 0x0150, // W new level, W character points, W correction points GPMSG_LEVEL_PROGRESS = 0x0151, // B percent completed to next levelup PGMSG_RAISE_ATTRIBUTE = 0x0160, // W attribute diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 841ead56..c2c491d5 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -140,8 +140,10 @@ void PlayerHandler::handleMessage(MessageIn &msg) int skill = msg.readInt16(); int current = msg.readInt32(); int next = msg.readInt32(); + int level = msg.readInt16(); PlayerInfo::setStatExperience(skill, current, next); + PlayerInfo::setStatBase(skill, level); } } break; -- cgit v1.2.3-70-g09d2