| 1557 | } |
| 1558 | |
| 1559 | void playerTrain(MapClientSession &sess) |
| 1560 | { |
| 1561 | uint level = getLevel(*sess.m_ent->m_char) + 1; // must be +1 |
| 1562 | GameDataStore &data(getGameData()); |
| 1563 | if(level > data.expMaxLevel()) |
| 1564 | { |
| 1565 | QString msg = "You are already at the max level!"; |
| 1566 | qCDebug(logSlashCommand) << msg; |
| 1567 | sendInfoMessage(MessageChannel::USER_ERROR, msg, sess); |
| 1568 | return; |
| 1569 | } |
| 1570 | |
| 1571 | // XP must be high enough for the level you're advancing to |
| 1572 | if(getXP(*sess.m_ent->m_char) < data.expForLevel(level)) |
| 1573 | { |
| 1574 | QString msg = "You do not have enough Experience Points to train to the next level!"; |
| 1575 | qCDebug(logSlashCommand) << msg; |
| 1576 | sendInfoMessage(MessageChannel::USER_ERROR, msg, sess); |
| 1577 | return; |
| 1578 | } |
| 1579 | |
| 1580 | qCDebug(logPowers) << "LEVELUP" << sess.m_ent->name() << "to" << level+1 |
| 1581 | << "NumPowers:" << countAllOwnedPowers(sess.m_ent->m_char->m_char_data, false) // no temps |
| 1582 | << "NumPowersAtLevel:" << data.countForLevel(level, data.m_pi_schedule.m_Power); |
| 1583 | |
| 1584 | // send levelup pkt to client |
| 1585 | sess.m_ent->m_char->m_client_window_state = ClientWindowState::Training; // flag character so we can handle dialog response |
| 1586 | sendContactDialogClose(sess); |
| 1587 | sendLevelUp(sess); |
| 1588 | } |
| 1589 | |
| 1590 | void sendKiosk(MapClientSession &cl) |
| 1591 | { |
no test coverage detected