[7558] Implement command: .learn all_mypettalents Author: VladimirMangos
Also output more correct messages at use .reset talents to pet --HG-- branch : trunk
This commit is contained in:
@@ -231,6 +231,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "all_default", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllDefaultCommand, "", NULL },
|
||||
{ "all_lang", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllLangCommand, "", NULL },
|
||||
{ "all_myclass", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyClassCommand, "", NULL },
|
||||
{ "all_mypettalents",SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyPetTalentsCommand,"", NULL },
|
||||
{ "all_myspells", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMySpellsCommand, "", NULL },
|
||||
{ "all_mytalents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyTalentsCommand, "", NULL },
|
||||
{ "all_recipes", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllRecipesCommand, "", NULL },
|
||||
|
||||
+1
-3
@@ -145,6 +145,7 @@ class ChatHandler
|
||||
bool HandleLearnAllDefaultCommand(const char* args);
|
||||
bool HandleLearnAllLangCommand(const char* args);
|
||||
bool HandleLearnAllMyClassCommand(const char* args);
|
||||
bool HandleLearnAllMyPetTalentsCommand(const char* args);
|
||||
bool HandleLearnAllMySpellsCommand(const char* args);
|
||||
bool HandleLearnAllMyTalentsCommand(const char* args);
|
||||
|
||||
@@ -424,13 +425,10 @@ class ChatHandler
|
||||
bool HandleResetHonorCommand(const char * args);
|
||||
bool HandleResetLevelCommand(const char * args);
|
||||
bool HandleResetSpellsCommand(const char * args);
|
||||
|
||||
bool HandleResetStatsCommand(const char * args);
|
||||
bool HandleResetTalentsCommand(const char * args);
|
||||
|
||||
bool HandleResetAllCommand(const char * args);
|
||||
|
||||
|
||||
// GM ticket command handlers
|
||||
bool HandleGMTicketListCommand(const char* args);
|
||||
bool HandleGMTicketListOnlineCommand(const char* args);
|
||||
|
||||
+6
-1
@@ -757,7 +757,12 @@ enum TrinityStrings
|
||||
LANG_YOU_CHANGE_GENDER = 1120,
|
||||
LANG_YOUR_GENDER_CHANGED = 1121,
|
||||
LANG_SKILL_VALUES = 1122,
|
||||
// Room for more level 3 1123-1199 not used
|
||||
LANG_NO_PET_FOUND = 1123,
|
||||
LANG_WRONG_PET_TYPE = 1124,
|
||||
LANG_COMMAND_LEARN_PET_TALENTS = 1125,
|
||||
LANG_RESET_PET_TALENTS = 1126,
|
||||
LANG_RESET_PET_TALENTS_ONLINE = 1127,
|
||||
// Room for more level 3 1128-1199 not used
|
||||
|
||||
// AV
|
||||
LANG_BG_AV_ALLY = 1200,
|
||||
|
||||
+78
-2
@@ -2324,6 +2324,82 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/)
|
||||
{
|
||||
Player* player = m_session->GetPlayer();
|
||||
|
||||
Pet* pet = player->GetPet();
|
||||
if(!pet)
|
||||
{
|
||||
SendSysMessage(LANG_NO_PET_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureInfo const *ci = pet->GetCreatureInfo();
|
||||
if(!ci)
|
||||
{
|
||||
SendSysMessage(LANG_WRONG_PET_TYPE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
|
||||
if(!pet_family)
|
||||
{
|
||||
SendSysMessage(LANG_WRONG_PET_TYPE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(pet_family->petTalentType < 0) // not hunter pet
|
||||
{
|
||||
SendSysMessage(LANG_WRONG_PET_TYPE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < sTalentStore.GetNumRows(); i++)
|
||||
{
|
||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
|
||||
if(!talentInfo)
|
||||
continue;
|
||||
|
||||
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
|
||||
if(!talentTabInfo)
|
||||
continue;
|
||||
|
||||
// prevent learn talent for different family (cheating)
|
||||
if(((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask)==0)
|
||||
continue;
|
||||
|
||||
// search highest talent rank
|
||||
uint32 spellid = 0;
|
||||
|
||||
for(int rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
||||
{
|
||||
if(talentInfo->RankID[rank]!=0)
|
||||
{
|
||||
spellid = talentInfo->RankID[rank];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!spellid) // ??? none spells in talent
|
||||
continue;
|
||||
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
|
||||
if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
|
||||
continue;
|
||||
|
||||
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
|
||||
pet->learnSpellHighRank(spellid);
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_COMMAND_LEARN_PET_TALENTS);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLearnAllLangCommand(const char* /*args*/)
|
||||
{
|
||||
// skipping UNIVERSAL language (0)
|
||||
@@ -5224,9 +5300,9 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
player = (Player *)owner;
|
||||
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
||||
ChatHandler(player).SendSysMessage(LANG_RESET_PET_TALENTS);
|
||||
if(m_session->GetPlayer()!=player)
|
||||
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,GetNameLink(player).c_str());
|
||||
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink(player).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1748,3 +1748,10 @@ void Pet::CastPetAura(PetAura const* aura)
|
||||
CastSpell(this, auraId, true);
|
||||
}
|
||||
|
||||
void Pet::learnSpellHighRank(uint32 spellid)
|
||||
{
|
||||
learnSpell(spellid,false);
|
||||
|
||||
if(uint32 next = spellmgr.GetNextSpellInChain(spellid))
|
||||
learnSpellHighRank(next);
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ class Pet : public Guardian
|
||||
|
||||
bool addSpell(uint32 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL);
|
||||
bool learnSpell(uint32 spell_id);
|
||||
void learnSpellHighRank(uint32 spellid);
|
||||
void learnLevelupSpells();
|
||||
bool unlearnSpell(uint32 spell_id);
|
||||
bool removeSpell(uint32 spell_id);
|
||||
|
||||
Reference in New Issue
Block a user