Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Player::addManaSpent(unsigned long long int spent)
- {
- if(spent == 0 || this->afkCheckFailed == true || this->getIP() == 0) {
- return;
- }
- uint64_t spentMultiplier = (uint64_t)g_game.getMagicLevelStage(this).multiplier;
- spent *= spentMultiplier;
- if (this->access < g_serverconfig.getInt("access->staffcharacter"))
- {
- bool downgraded = FALSE;
- //Setting Max Magic Levels for Vocations
- int mlvl;
- int prevmlvl;
- switch(this->vocation)
- {
- case 1:
- mlvl = 1600; // max magic level for mage
- if (this->maglevel < mlvl)
- this->manaspent += spent;
- else
- {
- if (this->manaspent != 0)
- this->manaspent = 0;
- if (this->maglevel > mlvl)
- {
- prevmlvl = this->maglevel;
- this->maglevel = mlvl;
- downgraded = TRUE;
- }
- }
- break;
- case 3:
- mlvl = 450; // max magic level for paladin
- if (this->maglevel < mlvl)
- this->manaspent += spent;
- else
- {
- if (this->manaspent != 0)
- this->manaspent = 0;
- if (this->maglevel > mlvl)
- {
- prevmlvl = this->maglevel;
- this->maglevel = mlvl;
- downgraded = TRUE;
- }
- }
- break;
- case 4:
- mlvl = 100; // max magic level for knight
- if (this->maglevel < mlvl)
- this->manaspent += spent;
- else
- {
- if (this->manaspent != 0)
- this->manaspent = 0;
- if (this->maglevel > mlvl)
- {
- prevmlvl = this->maglevel;
- this->maglevel = mlvl;
- downgraded = TRUE;
- }
- }
- break;
- }
- //Downgraded Magic Level Message
- if (downgraded == TRUE)
- {
- std::stringstream MaglvMsg;
- MaglvMsg << "You were downgraded from magic level " << prevmlvl << " to magic level " << mlvl << ".";
- this->sendTextMessage(MSG_ADVANCE, MaglvMsg.str().c_str());
- }
- }
- //Magic Level Advance
- unsigned long long int reqMana = this->getReqMana(this->maglevel+1, this->vocation);
- if (this->access < g_serverconfig.getInt("access->staffcharacter") && this->manaspent >= reqMana)
- {
- this->manaspent -= reqMana;
- this->maglevel++;
- std::stringstream MaglvMsg;
- //this->manaspent = 0;
- MaglvMsg << "You advanced from magic level " << (this->maglevel - 1) << " to magic level " << this->maglevel << ".";
- this->sendTextMessage(MSG_ADVANCE, MaglvMsg.str().c_str());
- this->sendStats();
- }
- //End Magic Level Advance*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement