| 981 | } |
| 982 | |
| 983 | void cmdHandler_LevelUpXp(const QStringList ¶ms, MapClientSession &sess) |
| 984 | { |
| 985 | GameDataStore &data(getGameData()); |
| 986 | |
| 987 | // must adjust level for 0-index array, capped at 49 |
| 988 | uint32_t level = params.value(0).toUInt(); |
| 989 | uint32_t max_level = data.expMaxLevel(); |
| 990 | level = std::max(uint32_t(0), std::min(level, max_level)); |
| 991 | |
| 992 | // XP must be high enough for the level you're advancing to |
| 993 | // since this slash command is forcing a levelup, let's |
| 994 | // increase xp accordingly |
| 995 | if(getXP(*sess.m_ent->m_char) < data.expForLevel(level)) |
| 996 | setXP(*sess.m_ent->m_char, data.expForLevel(level)); |
| 997 | else |
| 998 | return; |
| 999 | |
| 1000 | qCDebug(logPowers) << "LEVELUP" << sess.m_ent->name() << "to" << level + 1 |
| 1001 | << "NumPowers:" << countAllOwnedPowers(sess.m_ent->m_char->m_char_data, false) // no temps |
| 1002 | << "NumPowersAtLevel:" << data.countForLevel(level, data.m_pi_schedule.m_Power); |
| 1003 | |
| 1004 | // send levelup pkt to client |
| 1005 | sess.m_ent->m_char->m_client_window_state = ClientWindowState::Training; // flag character so we can handle dialog response |
| 1006 | sendLevelUp(sess); |
| 1007 | } |
| 1008 | |
| 1009 | void cmdHandler_FaceEntity(const QStringList ¶ms, MapClientSession &sess) |
| 1010 | { |
nothing calls this directly
no test coverage detected