aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Chat.cpp1
-rw-r--r--src/game/Chat.h4
-rw-r--r--src/game/Language.h7
-rw-r--r--src/game/Level3.cpp80
-rw-r--r--src/game/Pet.cpp7
-rw-r--r--src/game/Pet.h1
6 files changed, 94 insertions, 6 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 8c570efb3e3..d9cc85fd972 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -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 },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index f584af40bd2..4a4f0df5c56 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -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);
diff --git a/src/game/Language.h b/src/game/Language.h
index 3ebf52ce5d3..785ef9edf40 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -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,
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index d3aa1d1a070..e1dd468158e 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -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;
}
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index b2bc134a2c0..cf489a0b8e1 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -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);
+}
diff --git a/src/game/Pet.h b/src/game/Pet.h
index 845ac089b71..5879208a6b8 100644
--- a/src/game/Pet.h
+++ b/src/game/Pet.h
@@ -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);