mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9710] Add gm possibilities reset talents for all specs.
* At login reset '.reset all talents' will reset all spec talents. * New command '.reset specs' will reset its online/offline. * Command '.reset talents' now not support offline player case.
This commit is contained in:
parent
15e4d337c3
commit
6ef88699d1
11 changed files with 83 additions and 18 deletions
|
|
@ -3666,13 +3666,13 @@ uint32 Player::resetTalentsCost() const
|
|||
}
|
||||
}
|
||||
|
||||
bool Player::resetTalents(bool no_cost)
|
||||
bool Player::resetTalents(bool no_cost, bool all_specs)
|
||||
{
|
||||
// not need after this call
|
||||
if(HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
|
||||
if(HasAtLoginFlag(AT_LOGIN_RESET_TALENTS) && all_specs)
|
||||
RemoveAtLoginFlag(AT_LOGIN_RESET_TALENTS,true);
|
||||
|
||||
if (m_usedTalentCount == 0)
|
||||
if (m_usedTalentCount == 0 && !all_specs)
|
||||
{
|
||||
UpdateFreeTalentPoints(false); // for fix if need counter
|
||||
return false;
|
||||
|
|
@ -3730,6 +3730,33 @@ bool Player::resetTalents(bool no_cost)
|
|||
iter = m_talents[m_activeSpec].begin();
|
||||
}
|
||||
|
||||
// for not current spec just mark removed all saved to DB case and drop not saved
|
||||
if (all_specs)
|
||||
{
|
||||
for (uint8 spec = 0; spec < MAX_TALENT_SPEC_COUNT; ++spec)
|
||||
{
|
||||
if (spec == m_activeSpec)
|
||||
continue;
|
||||
|
||||
for (PlayerTalentMap::iterator iter = m_talents[spec].begin(); iter != m_talents[spec].end();)
|
||||
{
|
||||
switch (iter->second.state)
|
||||
{
|
||||
case PLAYERSPELL_REMOVED:
|
||||
++iter;
|
||||
break;
|
||||
case PLAYERSPELL_NEW:
|
||||
m_talents[spec].erase(iter++);
|
||||
break;
|
||||
default:
|
||||
iter->second.state = PLAYERSPELL_REMOVED;
|
||||
++iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFreeTalentPoints(false);
|
||||
|
||||
if(!no_cost)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue