aboutsummaryrefslogtreecommitdiff
path: root/src/game/Level3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Level3.cpp')
-rw-r--r--src/game/Level3.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index adb904dbbbe..a50b551398c 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -5374,42 +5374,51 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
uint64 target_guid;
std::string target_name;
if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ {
+ // Try reset talents as Hunter Pet
+ Creature* creature = getSelectedCreature();
+ if (!*args && creature && creature->isPet())
+ {
+ Unit *owner = creature->GetOwner();
+ if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor((Player*)owner))
+ {
+ ((Pet *)creature)->resetTalents(true);
+ ((Player*)owner)->SendTalentsInfoData(true);
+
+ ChatHandler((Player*)owner).SendSysMessage(LANG_RESET_PET_TALENTS);
+ if(!m_session || m_session->GetPlayer()!=((Player*)owner))
+ PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink((Player*)owner).c_str());
+ }
+ return true;
+ }
+ SendSysMessage(LANG_NO_CHAR_SELECTED);
+ SetSentErrorMessage(true);
return false;
+ }
if (target)
{
target->resetTalents(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)
{
- CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",uint32(AT_LOGIN_RESET_TALENTS), GUID_LOPART(target_guid) );
+ uint32 at_flags = AT_LOGIN_NONE | 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;
}
- // Try reset talents as Hunter Pet
- Creature* creature = getSelectedCreature();
- if (creature && creature->isPet() && ((Pet *)creature)->getPetType() == HUNTER_PET)
- {
- ((Pet *)creature)->resetTalents(true);
- Unit *owner = creature->GetOwner();
- if (owner && owner->GetTypeId() == TYPEID_PLAYER)
- {
- Player* owner_player = (Player *)owner;
- ChatHandler(owner_player).SendSysMessage(LANG_RESET_PET_TALENTS);
- if(!m_session || m_session->GetPlayer()!=owner_player)
- PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink(owner_player).c_str());
- }
- return true;
- }
-
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
@@ -5434,21 +5443,11 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
}
else if(casename=="talents")
{
- atLogin = AT_LOGIN_RESET_TALENTS;
+ atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS);
sWorld.SendWorldText(LANG_RESETALL_TALENTS);
if(!m_session)
SendSysMessage(LANG_RESETALL_TALENTS);
}
- else if(casename=="pet_spells")
- {
- CharacterDatabase.PExecute("UPDATE character_pet SET load_flags = load_flags | '%u' WHERE (load_flags & '%u') = '0'",uint32(AT_LOAD_RESET_SPELLS),uint32(AT_LOAD_RESET_SPELLS));
- HashMapHolder<Player>::MapType const& plist = ObjectAccessor::Instance().GetPlayers();
- for(HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
- if (itr->second->GetPet())
- itr->second->SetPetAtLoginFlag(AT_LOAD_RESET_SPELLS);
- sWorld.SendWorldText(LANG_RESETALL_PET_SPELLS);
- return true;
- }
else
{
PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE,args);