MCPcopy Create free account
hub / github.com/Segs/Segs / playerTrain

Function playerTrain

Projects/CoX/Servers/MapServer/DataHelpers.cpp:1559–1588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1557}
1558
1559void 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
1590void sendKiosk(MapClientSession &cl)
1591{

Callers 2

cmdHandler_TrainFunction · 0.85

Calls 11

getLevelFunction · 0.85
dataFunction · 0.85
sendInfoMessageFunction · 0.85
getXPFunction · 0.85
countAllOwnedPowersFunction · 0.85
sendContactDialogCloseFunction · 0.85
sendLevelUpFunction · 0.85
expMaxLevelMethod · 0.80
expForLevelMethod · 0.80
countForLevelMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected