potinho
Advanced OT User
For some reason, the Magic Level on my OTXServer 2 limits the Magic Level. The original values are considerably high, but I would like players to have the possibility to got higher Magic Levels. Actually the limit (for use spells, without consider item bonus, etc) is something around 156 for mages and 14 for knights, for example.
I guess that can be related to those codes:
I'm using OTCv8, so i guess client it will be not a problem, since skills are going through 255+
I guess that can be related to those codes:
C++:
void Player::addManaSpent(uint64_t amount, bool useMultiplier/* = true*/)
{
if(!amount)
return;
uint64_t currReqMana = vocation->getReqMana(magLevel), nextReqMana = vocation->getReqMana(magLevel + 1);
if(magLevel > 0 && currReqMana > nextReqMana) //player has reached max magic level
return;
if(useMultiplier)
amount = uint64_t((double)amount * rates[SKILL__MAGLEVEL] * g_config.getDouble(ConfigManager::RATE_MAGIC));
std::stringstream s;
while(manaSpent + amount >= nextReqMana)
{
amount -= nextReqMana - manaSpent;
manaSpent = 0;
s.str("");
s << "You advanced to magic level " << ++magLevel << ".";
sendTextMessage(MSG_EVENT_ADVANCE, s.str());
CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__MAGLEVEL, (magLevel - 1), magLevel);
currReqMana = nextReqMana;
nextReqMana = vocation->getReqMana(magLevel + 1);
if(currReqMana > nextReqMana)
{
amount = 0;
break;
}
}
if(amount)
manaSpent += amount;
uint16_t newPercent = Player::getPercentLevel(manaSpent, nextReqMana);
if(magLevelPercent != newPercent)
{
magLevelPercent = newPercent;
sendStats();
}
else if(!s.str().empty())
sendStats();
}
C++:
uint64_t Vocation::getReqMana(uint32_t magLevel)
{
if(!magLevel)
return 0;
cacheMap::iterator it = cacheMana.find(magLevel);
if(it != cacheMana.end())
return it->second;
cacheMana[magLevel] = (uint64_t)(1600 * std::pow(formulaMultipliers[MULTIPLIER_MANA], (float)(magLevel - 1)));
return cacheMana[magLevel];
}
I'm using OTCv8, so i guess client it will be not a problem, since skills are going through 255+