mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7558] Implement command: .learn all_mypettalents
Also output more correct messages at use .reset talents to pet
This commit is contained in:
parent
4e66d61da9
commit
2dd36d688f
11 changed files with 125 additions and 8 deletions
|
|
@ -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';
|
||||
|
||||
--
|
||||
|
|
@ -332,6 +332,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'),
|
||||
|
|
@ -2914,7 +2915,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;
|
||||
|
||||
|
|
|
|||
9
sql/updates/7558_01_mangos_mangos_string.sql
Normal file
9
sql/updates/7558_01_mangos_mangos_string.sql
Normal file
|
|
@ -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);
|
||||
6
sql/updates/7558_02_mangos_command.sql
Normal file
6
sql/updates/7558_02_mangos_command.sql
Normal file
|
|
@ -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).');
|
||||
|
|
@ -206,6 +206,8 @@ pkgdata_DATA = \
|
|||
7544_02_characters_uptime.sql \
|
||||
7546_01_characters_uptime.sql \
|
||||
7546_02_realmd_uptime.sql \
|
||||
7558_01_mangos_mangos_string.sql \
|
||||
7558_02_mangos_command.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -392,4 +394,6 @@ EXTRA_DIST = \
|
|||
7544_02_characters_uptime.sql \
|
||||
7546_01_characters_uptime.sql \
|
||||
7546_02_realmd_uptime.sql \
|
||||
7558_01_mangos_mangos_string.sql \
|
||||
7558_02_mangos_command.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -217,6 +217,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 },
|
||||
|
|
|
|||
|
|
@ -135,6 +135,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);
|
||||
|
||||
|
|
@ -391,11 +392,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);
|
||||
|
||||
bool HandleTicketCommand(const char* args);
|
||||
bool HandleDelTicketCommand(const char* args);
|
||||
bool HandleMaxSkillCommand(const char* args);
|
||||
|
|
|
|||
|
|
@ -755,7 +755,12 @@ enum MangosStrings
|
|||
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
|
||||
|
||||
// FREE IDS 1200-9999
|
||||
|
||||
|
|
|
|||
|
|
@ -1791,6 +1791,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)
|
||||
|
|
@ -4644,9 +4720,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1750,3 +1750,12 @@ void Pet::CastPetAura(PetAura const* aura)
|
|||
else
|
||||
CastSpell(this, auraId, true);
|
||||
}
|
||||
|
||||
void Pet::learnSpellHighRank(uint32 spellid)
|
||||
{
|
||||
learnSpell(spellid);
|
||||
|
||||
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
|
||||
for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr)
|
||||
learnSpellHighRank(itr->second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ class Pet : public Creature
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7557"
|
||||
#define REVISION_NR "7558"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue