[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:
+8
-2
@@ -22,7 +22,7 @@
|
||||
DROP TABLE IF EXISTS `db_version`;
|
||||
CREATE TABLE `db_version` (
|
||||
`version` varchar(120) default NULL,
|
||||
`required_7544_01_mangos_uptime` bit(1) default NULL
|
||||
`required_7558_02_mangos_command` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
@@ -331,6 +331,7 @@ INSERT INTO `command` VALUES
|
||||
('learn all_gm',2,'Syntax: .learn all_gm\r\n\r\nLearn all default spells for Game Masters.'),
|
||||
('learn all_lang',1,'Syntax: .learn all_lang\r\n\r\nLearn all languages'),
|
||||
('learn all_myclass',3,'Syntax: .learn all_myclass\r\n\r\nLearn all spells and talents available for his class.'),
|
||||
('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).'),
|
||||
('learn all_myspells',3,'Syntax: .learn all_myspells\r\n\r\nLearn all spells (except talents and spells with first rank learned as talent) available for his class.'),
|
||||
('learn all_mytalents',3,'Syntax: .learn all_mytalents\r\n\r\nLearn all talents (and spells with first rank learned as talent) available for his class.'),
|
||||
('learn all_recipes',2,'Syntax: .learn all_recipes [$profession]\r\rLearns all recipes of specified profession and sets skill level to max.\rExample: .learn all_recipes enchanting'),
|
||||
@@ -2913,7 +2914,12 @@ INSERT INTO `mangos_string` VALUES
|
||||
(1119,'You must use male or female as gender.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1120,'You change gender of %s to %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1121,'Your gender changed to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1122,'(%u/%u +perm %u +temp %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
(1122,'(%u/%u +perm %u +temp %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1123,'Not pet found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1124,'Wrong pet type',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
ALTER TABLE db_version CHANGE COLUMN required_7544_01_mangos_uptime required_7558_01_mangos_mangos_string bit;
|
||||
|
||||
DELETE FROM mangos_string WHERE entry IN (1123,1124,1125);
|
||||
INSERT INTO mangos_string VALUES
|
||||
(1123,'Not pet found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1124,'Wrong pet type',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE db_version CHANGE COLUMN required_7558_01_mangos_mangos_string required_7558_02_mangos_command bit;
|
||||
|
||||
DELETE FROM `command` WHERE `name` IN ('learn all_mypettalents');
|
||||
|
||||
INSERT INTO `command` VALUES
|
||||
('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).');
|
||||
@@ -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