mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +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
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`creature_ai_version` varchar(120) default NULL,
|
`creature_ai_version` varchar(120) default NULL,
|
||||||
`cache_id` int(10) default '0',
|
`cache_id` int(10) default '0',
|
||||||
`required_9704_01_mangos_achievement_reward` bit(1) default NULL
|
`required_9710_01_mangos_command` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
@ -731,7 +731,8 @@ INSERT INTO `command` VALUES
|
||||||
('reset level',3,'Syntax: .reset level [Playername]\r\n Reset level to 1 including reset stats and talents. Equipped items with greater level requirement can be lost.'),
|
('reset level',3,'Syntax: .reset level [Playername]\r\n Reset level to 1 including reset stats and talents. Equipped items with greater level requirement can be lost.'),
|
||||||
('reset spells',3,'Syntax: .reset spells [Playername]\r\n Removes all non-original spells from spellbook.\r\n. Playername can be name of offline character.'),
|
('reset spells',3,'Syntax: .reset spells [Playername]\r\n Removes all non-original spells from spellbook.\r\n. Playername can be name of offline character.'),
|
||||||
('reset stats',3,'Syntax: .reset stats [Playername]\r\n Resets(recalculate) all stats of the targeted player to their original VALUESat current level.'),
|
('reset stats',3,'Syntax: .reset stats [Playername]\r\n Resets(recalculate) all stats of the targeted player to their original VALUESat current level.'),
|
||||||
('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents of the targeted player or pet or named player. Playername can be name of offline character. With player talents also will be reset talents for all character\'s pets if any.'),
|
('reset specs',3,'Syntax: .reset specs [Playername]\r\n Removes all talents (for all specs) of the targeted player or named player. Playername can be name of offline character. With player talents also will be reset talents for all character\'s pets if any.'),
|
||||||
|
('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents (current spec) of the targeted player or pet or named player. With player talents also will be reset talents for all character\'s pets if any.'),
|
||||||
('respawn',3,'Syntax: .respawn\r\n\r\nRespawn selected creature or respawn all nearest creatures (if none selected) and GO without waiting respawn time expiration.'),
|
('respawn',3,'Syntax: .respawn\r\n\r\nRespawn selected creature or respawn all nearest creatures (if none selected) and GO without waiting respawn time expiration.'),
|
||||||
('revive',3,'Syntax: .revive\r\n\r\nRevive the selected player. If no player is selected, it will revive you.'),
|
('revive',3,'Syntax: .revive\r\n\r\nRevive the selected player. If no player is selected, it will revive you.'),
|
||||||
('save',0,'Syntax: .save\r\n\r\nSaves your character.'),
|
('save',0,'Syntax: .save\r\n\r\nSaves your character.'),
|
||||||
|
|
|
||||||
6
sql/updates/9710_01_mangos_command.sql
Normal file
6
sql/updates/9710_01_mangos_command.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_9704_01_mangos_achievement_reward required_9710_01_mangos_command bit;
|
||||||
|
|
||||||
|
DELETE FROM command WHERE name IN ('reset specs','reset talents');
|
||||||
|
INSERT INTO command VALUES
|
||||||
|
('reset specs',3,'Syntax: .reset specs [Playername]\r\n Removes all talents (for all specs) of the targeted player or named player. Playername can be name of offline character. With player talents also will be reset talents for all character\'s pets if any.'),
|
||||||
|
('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents (current spec) of the targeted player or pet or named player. With player talents also will be reset talents for all character\'s pets if any.');
|
||||||
|
|
@ -111,6 +111,7 @@ pkgdata_DATA = \
|
||||||
9692_03_mangos_spell_proc_event.sql \
|
9692_03_mangos_spell_proc_event.sql \
|
||||||
9702_01_characters_item.sql \
|
9702_01_characters_item.sql \
|
||||||
9704_01_mangos_achievement_reward.sql \
|
9704_01_mangos_achievement_reward.sql \
|
||||||
|
9710_01_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -202,4 +203,5 @@ EXTRA_DIST = \
|
||||||
9692_03_mangos_spell_proc_event.sql \
|
9692_03_mangos_spell_proc_event.sql \
|
||||||
9702_01_characters_item.sql \
|
9702_01_characters_item.sql \
|
||||||
9704_01_mangos_achievement_reward.sql \
|
9704_01_mangos_achievement_reward.sql \
|
||||||
|
9710_01_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -768,7 +768,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
||||||
|
|
||||||
if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
|
if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
|
||||||
{
|
{
|
||||||
pCurrChar->resetTalents(true);
|
pCurrChar->resetTalents(true,true);
|
||||||
pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state
|
pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state
|
||||||
SendNotification(LANG_RESET_TALENTS); // we can use SMSG_TALENTS_INVOLUNTARILY_RESET here
|
SendNotification(LANG_RESET_TALENTS); // we can use SMSG_TALENTS_INVOLUNTARILY_RESET here
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -484,6 +484,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
{ "achievements", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAchievementsCommand, "", NULL },
|
{ "achievements", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAchievementsCommand, "", NULL },
|
||||||
{ "honor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetHonorCommand, "", NULL },
|
{ "honor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetHonorCommand, "", NULL },
|
||||||
{ "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetLevelCommand, "", NULL },
|
{ "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetLevelCommand, "", NULL },
|
||||||
|
{ "specs", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetSpecsCommand, "", NULL },
|
||||||
{ "spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetSpellsCommand, "", NULL },
|
{ "spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetSpellsCommand, "", NULL },
|
||||||
{ "stats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetStatsCommand, "", NULL },
|
{ "stats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetStatsCommand, "", NULL },
|
||||||
{ "talents", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetTalentsCommand, "", NULL },
|
{ "talents", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetTalentsCommand, "", NULL },
|
||||||
|
|
|
||||||
|
|
@ -402,6 +402,7 @@ class ChatHandler
|
||||||
bool HandleResetAllCommand(const char * args);
|
bool HandleResetAllCommand(const char * args);
|
||||||
bool HandleResetHonorCommand(const char * args);
|
bool HandleResetHonorCommand(const char * args);
|
||||||
bool HandleResetLevelCommand(const char * args);
|
bool HandleResetLevelCommand(const char * args);
|
||||||
|
bool HandleResetSpecsCommand(const char * args);
|
||||||
bool HandleResetSpellsCommand(const char * args);
|
bool HandleResetSpellsCommand(const char * args);
|
||||||
bool HandleResetStatsCommand(const char * args);
|
bool HandleResetStatsCommand(const char * args);
|
||||||
bool HandleResetTalentsCommand(const char * args);
|
bool HandleResetTalentsCommand(const char * args);
|
||||||
|
|
|
||||||
|
|
@ -4534,12 +4534,47 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
bool ChatHandler::HandleResetSpecsCommand(const char * args)
|
||||||
{
|
{
|
||||||
Player* target;
|
Player* target;
|
||||||
uint64 target_guid;
|
uint64 target_guid;
|
||||||
std::string target_name;
|
std::string target_name;
|
||||||
if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
|
if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
target->resetTalents(true,true);
|
||||||
|
target->SendTalentsInfoData(false);
|
||||||
|
ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
|
||||||
|
if (!m_session || m_session->GetPlayer() != target)
|
||||||
|
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,GetNameLink(target).c_str());
|
||||||
|
|
||||||
|
Pet* pet = target->GetPet();
|
||||||
|
Pet::resetTalentsForAllPetsOf(target, pet);
|
||||||
|
if(pet)
|
||||||
|
target->SendTalentsInfoData(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (target_guid)
|
||||||
|
{
|
||||||
|
uint32 at_flags = AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS;
|
||||||
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", at_flags, GUID_LOPART(target_guid) );
|
||||||
|
std::string nameLink = playerLink(target_name);
|
||||||
|
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||||
|
{
|
||||||
|
Player* target;
|
||||||
|
std::string target_name;
|
||||||
|
if (!extractPlayerTarget((char*)args, &target, NULL, &target_name))
|
||||||
{
|
{
|
||||||
// Try reset talents as Hunter Pet
|
// Try reset talents as Hunter Pet
|
||||||
Creature* creature = getSelectedCreature();
|
Creature* creature = getSelectedCreature();
|
||||||
|
|
@ -4577,14 +4612,6 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||||
target->SendTalentsInfoData(true);
|
target->SendTalentsInfoData(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (target_guid)
|
|
||||||
{
|
|
||||||
uint32 at_flags = AT_LOGIN_RESET_PET_TALENTS;
|
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", at_flags, GUID_LOPART(target_guid) );
|
|
||||||
std::string nameLink = playerLink(target_name);
|
|
||||||
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 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);
|
RemoveAtLoginFlag(AT_LOGIN_RESET_TALENTS,true);
|
||||||
|
|
||||||
if (m_usedTalentCount == 0)
|
if (m_usedTalentCount == 0 && !all_specs)
|
||||||
{
|
{
|
||||||
UpdateFreeTalentPoints(false); // for fix if need counter
|
UpdateFreeTalentPoints(false); // for fix if need counter
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -3730,6 +3730,33 @@ bool Player::resetTalents(bool no_cost)
|
||||||
iter = m_talents[m_activeSpec].begin();
|
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);
|
UpdateFreeTalentPoints(false);
|
||||||
|
|
||||||
if(!no_cost)
|
if(!no_cost)
|
||||||
|
|
|
||||||
|
|
@ -1570,7 +1570,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
|
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
|
||||||
void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); }
|
void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); }
|
||||||
void UpdateFreeTalentPoints(bool resetIfNeed = true);
|
void UpdateFreeTalentPoints(bool resetIfNeed = true);
|
||||||
bool resetTalents(bool no_cost = false);
|
bool resetTalents(bool no_cost = false, bool all_specs = false);
|
||||||
uint32 resetTalentsCost() const;
|
uint32 resetTalentsCost() const;
|
||||||
void InitTalentForLevel();
|
void InitTalentForLevel();
|
||||||
void BuildPlayerTalentsInfoData(WorldPacket *data);
|
void BuildPlayerTalentsInfoData(WorldPacket *data);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9709"
|
#define REVISION_NR "9710"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __REVISION_SQL_H__
|
#ifndef __REVISION_SQL_H__
|
||||||
#define __REVISION_SQL_H__
|
#define __REVISION_SQL_H__
|
||||||
#define REVISION_DB_CHARACTERS "required_9702_01_characters_item"
|
#define REVISION_DB_CHARACTERS "required_9702_01_characters_item"
|
||||||
#define REVISION_DB_MANGOS "required_9704_01_mangos_achievement_reward"
|
#define REVISION_DB_MANGOS "required_9710_01_mangos_command"
|
||||||
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
|
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
|
||||||
#endif // __REVISION_SQL_H__
|
#endif // __REVISION_SQL_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue