mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9656] Implement '.list talents' command.
Command show really know by selected player talent ranks, including bugged cases like 2 rank same talent known and etc. Also command claculated count of talents and total used talent points cost of known talent ranks. Can be helpful in bug debuging and cheating cases.
This commit is contained in:
parent
db22a0a9fb
commit
034da8f6d4
10 changed files with 114 additions and 47 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_9651_01_mangos_quest_poi` bit(1) default NULL
|
||||
`required_9656_02_mangos_mangos_string` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -626,6 +626,7 @@ INSERT INTO `command` VALUES
|
|||
('list creature',3,'Syntax: .list creature #creature_id [#max_count]\r\n\r\nOutput creatures with creature id #creature_id found in world. Output creature guids and coordinates sorted by distance from character. Will be output maximum #max_count creatures. If #max_count not provided use 10 as default value.'),
|
||||
('list item',3,'Syntax: .list item #item_id [#max_count]\r\n\r\nOutput items with item id #item_id found in all character inventories, mails, auctions, and guild banks. Output item guids, item owner guid, owner account and owner name (guild name and guid in case guild bank). Will be output maximum #max_count items. If #max_count not provided use 10 as default value.'),
|
||||
('list object',3,'Syntax: .list object #gameobject_id [#max_count]\r\n\r\nOutput gameobjects with gameobject id #gameobject_id found in world. Output gameobject guids and coordinates sorted by distance from character. Will be output maximum #max_count gameobject. If #max_count not provided use 10 as default value.'),
|
||||
('list talents',3,'Syntax: .list talents\r\n\r\nShow list all really known (as learned spells) talent rank spells for selected player or self.'),
|
||||
('loadscripts',3,'Syntax: .loadscripts $scriptlibraryname\r\n\r\nUnload current and load the script library $scriptlibraryname or reload current if $scriptlibraryname omitted, in case you changed it while the server was running.'),
|
||||
('lookup area',1,'Syntax: .lookup area $namepart\r\n\r\nLooks up an area by $namepart, and returns all matches with their area ID\'s.'),
|
||||
('lookup creature',3,'Syntax: .lookup creature $namepart\r\n\r\nLooks up a creature by $namepart, and returns all matches with their creature ID\'s.'),
|
||||
|
|
@ -3612,6 +3613,8 @@ INSERT INTO `mangos_string` VALUES
|
|||
(1132,' Follow player %s (lowguid %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1133,' Follow creature %s (lowguid %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1134,' Follow <NULL>',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1135,'List known talents:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1136,' (Found talents: %u used talent points: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
||||
|
|
|
|||
5
sql/updates/9656_01_mangos_command.sql
Normal file
5
sql/updates/9656_01_mangos_command.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_9651_01_mangos_quest_poi required_9656_01_mangos_command bit;
|
||||
|
||||
DELETE FROM command WHERE name IN ('list talents');
|
||||
INSERT INTO command VALUES
|
||||
('list talents',3,'Syntax: .list talents\r\n\r\nShow list all really known (as learned spells) talent rank spells for selected player or self.');
|
||||
7
sql/updates/9656_02_mangos_mangos_string.sql
Normal file
7
sql/updates/9656_02_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_9656_01_mangos_command required_9656_02_mangos_mangos_string bit;
|
||||
|
||||
DELETE FROM mangos_string WHERE entry in (1135,1136);
|
||||
|
||||
INSERT INTO mangos_string VALUES
|
||||
(1135,'List known talents:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1136,' (Found talents: %u used talent points: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
|
|
@ -98,6 +98,8 @@ pkgdata_DATA = \
|
|||
9636_01_mangos_item_template.sql \
|
||||
9646_01_characters_characters.sql \
|
||||
9651_01_mangos_quest_poi.sql \
|
||||
9656_01_mangos_command.sql \
|
||||
9656_02_mangos_mangos_string.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -176,4 +178,6 @@ EXTRA_DIST = \
|
|||
9636_01_mangos_item_template.sql \
|
||||
9646_01_characters_characters.sql \
|
||||
9651_01_mangos_quest_poi.sql \
|
||||
9656_01_mangos_command.sql \
|
||||
9656_02_mangos_mangos_string.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -266,10 +266,11 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
|
||||
static ChatCommand listCommandTable[] =
|
||||
{
|
||||
{ "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL },
|
||||
{ "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListCreatureCommand, "", NULL },
|
||||
{ "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListItemCommand, "", NULL },
|
||||
{ "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListObjectCommand, "", NULL },
|
||||
{ "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL },
|
||||
{ "talents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListTalentsCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ class ChatHandler
|
|||
bool HandleListCreatureCommand(const char* args);
|
||||
bool HandleListItemCommand(const char* args);
|
||||
bool HandleListObjectCommand(const char* args);
|
||||
bool HandleListTalentsCommand(const char * args);
|
||||
|
||||
bool HandleLookupAreaCommand(const char* args);
|
||||
bool HandleLookupCreatureCommand(const char* args);
|
||||
|
|
@ -542,6 +543,7 @@ class ChatHandler
|
|||
bool HandleUnBanHelper(BanMode mode,char const* args);
|
||||
void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel);
|
||||
void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id);
|
||||
void ShowSpellListHelper(Player* target, SpellEntry const* spellInfo, LocaleConstant loc);
|
||||
|
||||
void SetSentErrorMessage(bool val){ sentErrorMessage = val;};
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -819,7 +819,9 @@ enum MangosStrings
|
|||
LANG_MOVEGENS_FOLLOW_PLAYER = 1132,
|
||||
LANG_MOVEGENS_FOLLOW_CREATURE = 1133,
|
||||
LANG_MOVEGENS_FOLLOW_NULL = 1134,
|
||||
// Room for more level 3 1135-1199 not used
|
||||
LANG_LIST_TALENTS_TITLE = 1135,
|
||||
LANG_LIST_TALENTS_COUNT = 1136,
|
||||
// Room for more level 3 1137-1199 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||
|
|
|
|||
|
|
@ -2864,6 +2864,53 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInfo, LocaleConstant loc)
|
||||
{
|
||||
uint32 id = spellInfo->Id;
|
||||
|
||||
bool known = target && target->HasSpell(id);
|
||||
bool learn = (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL);
|
||||
|
||||
uint32 talentCost = GetTalentSpellCost(id);
|
||||
|
||||
bool talent = (talentCost > 0);
|
||||
bool passive = IsPassiveSpell(id);
|
||||
bool active = target && target->HasAura(id);
|
||||
|
||||
// unit32 used to prevent interpreting uint8 as char at output
|
||||
// find rank of learned spell for learning spell, or talent rank
|
||||
uint32 rank = talentCost ? talentCost : sSpellMgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[EFFECT_INDEX_0] : id);
|
||||
|
||||
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
|
||||
std::ostringstream ss;
|
||||
if (m_session)
|
||||
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << spellInfo->SpellName[loc];
|
||||
else
|
||||
ss << id << " - " << spellInfo->SpellName[loc];
|
||||
|
||||
// include rank in link name
|
||||
if(rank)
|
||||
ss << GetMangosString(LANG_SPELL_RANK) << rank;
|
||||
|
||||
if (m_session)
|
||||
ss << " " << localeNames[loc] << "]|h|r";
|
||||
else
|
||||
ss << " " << localeNames[loc];
|
||||
|
||||
if(talent)
|
||||
ss << GetMangosString(LANG_TALENT);
|
||||
if(passive)
|
||||
ss << GetMangosString(LANG_PASSIVE);
|
||||
if(learn)
|
||||
ss << GetMangosString(LANG_LEARN);
|
||||
if(known)
|
||||
ss << GetMangosString(LANG_KNOWN);
|
||||
if(active)
|
||||
ss << GetMangosString(LANG_ACTIVE);
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLookupSpellCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
|
|
@ -2913,48 +2960,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args)
|
|||
|
||||
if(loc < MAX_LOCALE)
|
||||
{
|
||||
bool known = target && target->HasSpell(id);
|
||||
bool learn = (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL);
|
||||
|
||||
uint32 talentCost = GetTalentSpellCost(id);
|
||||
|
||||
bool talent = (talentCost > 0);
|
||||
bool passive = IsPassiveSpell(id);
|
||||
bool active = target && target->HasAura(id);
|
||||
|
||||
// unit32 used to prevent interpreting uint8 as char at output
|
||||
// find rank of learned spell for learning spell, or talent rank
|
||||
uint32 rank = talentCost ? talentCost : sSpellMgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[EFFECT_INDEX_0] : id);
|
||||
|
||||
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
|
||||
std::ostringstream ss;
|
||||
if (m_session)
|
||||
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
|
||||
else
|
||||
ss << id << " - " << name;
|
||||
|
||||
// include rank in link name
|
||||
if(rank)
|
||||
ss << GetMangosString(LANG_SPELL_RANK) << rank;
|
||||
|
||||
if (m_session)
|
||||
ss << " " << localeNames[loc] << "]|h|r";
|
||||
else
|
||||
ss << " " << localeNames[loc];
|
||||
|
||||
if(talent)
|
||||
ss << GetMangosString(LANG_TALENT);
|
||||
if(passive)
|
||||
ss << GetMangosString(LANG_PASSIVE);
|
||||
if(learn)
|
||||
ss << GetMangosString(LANG_LEARN);
|
||||
if(known)
|
||||
ss << GetMangosString(LANG_KNOWN);
|
||||
if(active)
|
||||
ss << GetMangosString(LANG_ACTIVE);
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
|
||||
ShowSpellListHelper(target, spellInfo, LocaleConstant(loc));
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
|
@ -4346,6 +4352,43 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleListTalentsCommand (const char * /*args*/)
|
||||
{
|
||||
Player *player = getSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_LIST_TALENTS_TITLE);
|
||||
uint32 count = 0;
|
||||
uint32 cost = 0;
|
||||
PlayerSpellMap const& uSpells = player->GetSpellMap();
|
||||
for (PlayerSpellMap::const_iterator itr = uSpells.begin(); itr != uSpells.end(); ++itr)
|
||||
{
|
||||
if (itr->second.state == PLAYERSPELL_REMOVED)
|
||||
continue;
|
||||
|
||||
uint32 cost_itr = GetTalentSpellCost(itr->first);
|
||||
|
||||
if (cost_itr == 0)
|
||||
continue;
|
||||
|
||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(itr->first);
|
||||
if (!spellEntry)
|
||||
continue;
|
||||
|
||||
ShowSpellListHelper(player, spellEntry, GetSessionDbcLocale());
|
||||
++count;
|
||||
cost += cost_itr;
|
||||
}
|
||||
PSendSysMessage(LANG_LIST_TALENTS_COUNT, count, cost);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleResetAchievementsCommand (const char * args)
|
||||
{
|
||||
Player* target;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9655"
|
||||
#define REVISION_NR "9656"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_9646_01_characters_characters"
|
||||
#define REVISION_DB_MANGOS "required_9651_01_mangos_quest_poi"
|
||||
#define REVISION_DB_MANGOS "required_9656_02_mangos_mangos_string"
|
||||
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue