[8833] Implement new commands for add/remove/lookup titles.

Inspired by patch suggested by LordJZ.
This commit is contained in:
VladimirMangos 2009-11-19 07:11:43 +03:00
parent f66f0a0914
commit b5980f061a
14 changed files with 377 additions and 47 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `cache_id` int(10) default '0',
`required_8828_02_mangos_instance_template` bit(1) default NULL `required_8833_02_mangos_command` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -541,6 +541,7 @@ INSERT INTO `command` VALUES
('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'), ('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'),
('character rename',2,'Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'), ('character rename',2,'Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'),
('character reputation',2,'Syntax: .character reputation [$player_name]\r\n\r\nShow reputation information for selected player or player find by $player_name.'), ('character reputation',2,'Syntax: .character reputation [$player_name]\r\n\r\nShow reputation information for selected player or player find by $player_name.'),
('character titles',2,'Syntax: .character titles [$player_name]\r\n\r\nShow known titles list for selected player or player find by $player_name.'),
('combatstop',2,'Syntax: .combatstop [$playername]\r\nStop combat for selected character. If selected non-player then command applied to self. If $playername provided then attempt applied to online player $playername.'), ('combatstop',2,'Syntax: .combatstop [$playername]\r\nStop combat for selected character. If selected non-player then command applied to self. If $playername provided then attempt applied to online player $playername.'),
('commands',0,'Syntax: .commands\r\n\r\nDisplay a list of available commands for your account level.'), ('commands',0,'Syntax: .commands\r\n\r\nDisplay a list of available commands for your account level.'),
('cooldown',3,'Syntax: .cooldown [#spell_id]\r\n\r\nRemove all (if spell_id not provided) or #spel_id spell cooldown from selected character or you (if no selection).'), ('cooldown',3,'Syntax: .cooldown [#spell_id]\r\n\r\nRemove all (if spell_id not provided) or #spel_id spell cooldown from selected character or you (if no selection).'),
@ -665,7 +666,6 @@ INSERT INTO `command` VALUES
('modify spell',1,''), ('modify spell',1,''),
('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'), ('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'),
('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'), ('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'),
('modify titles',1,'Syntax: .modify titles #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'),
('modify tp',1,'Syntax: .modify tp #amount\r\n\r\nSet free talent pointes for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'), ('modify tp',1,'Syntax: .modify tp #amount\r\n\r\nSet free talent pointes for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'),
('movegens',3,'Syntax: .movegens\r\n Show movement generators stack for selected creature or player.'), ('movegens',3,'Syntax: .movegens\r\n Show movement generators stack for selected creature or player.'),
('mute',1,'Syntax: .mute [$playerName] $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'), ('mute',1,'Syntax: .mute [$playerName] $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'),
@ -753,6 +753,10 @@ INSERT INTO `command` VALUES
('tele group',1,'Syntax: .tele group#location\r\n\r\nTeleport a selected player and his group members to a given location.'), ('tele group',1,'Syntax: .tele group#location\r\n\r\nTeleport a selected player and his group members to a given location.'),
('tele name',1,'Syntax: .tele name [#playername] #location\r\n\r\nTeleport the given character to a given location. Character can be offline.'), ('tele name',1,'Syntax: .tele name [#playername] #location\r\n\r\nTeleport the given character to a given location. Character can be offline.'),
('ticket',2,'Syntax: .ticket on\r\n .ticket off\r\n .ticket #num\r\n .ticket $character_name\r\n\r\non/off for GMs to show or not a new ticket directly, $character_name to show ticket of this character, #num to show ticket #num.'), ('ticket',2,'Syntax: .ticket on\r\n .ticket off\r\n .ticket #num\r\n .ticket $character_name\r\n\r\non/off for GMs to show or not a new ticket directly, $character_name to show ticket of this character, #num to show ticket #num.'),
('titles add',2,'Syntax: .titles add #title\r\nAdd title #title (id or shift-link) to known titles list for selected player.'),
('titles current',2,'Syntax: .titles current #title\r\nSet title #title (id or shift-link) as current selected titl for selected player. If title not in known title list for player then it will be added to list.'),
('titles remove',2,'Syntax: .titles remove #title\r\nRemove title #title (id or shift-link) from known titles list for selected player.'),
('titles setmask',2,'Syntax: .titles setmask #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'),
('unaura',3,'Syntax: .unaura #spellid\r\n\r\nRemove aura due to spell #spellid from the selected Unit.'), ('unaura',3,'Syntax: .unaura #spellid\r\n\r\nRemove aura due to spell #spellid from the selected Unit.'),
('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'), ('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'),
('unban character',3,'Syntax: .unban character $Name\r\nUnban accounts for character name pattern.'), ('unban character',3,'Syntax: .unban character $Name\r\nUnban accounts for character name pattern.'),
@ -3067,6 +3071,14 @@ INSERT INTO `mangos_string` VALUES
(346,'Forced customize for player %s (GUID #%u) will be requested at next login.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (346,'Forced customize for player %s (GUID #%u) will be requested at next login.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(347,'TaxiNode ID %u not found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (347,'TaxiNode ID %u not found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(348,'Game Object (Entry: %u) have invalid data and can\'t be spawned',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (348,'Game Object (Entry: %u) have invalid data and can\'t be spawned',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(349,'%d (idx:%d) - |cffffffff|Htitle:%d|h[%s %s]|h|r %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(350,'%d (idx:%d) - [%s %s] %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(351,'No titles found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(352,'Invalid title id: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(353,'Title %u (%s) added to known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(354,'Title %u (%s) removed from known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(355,'Title %u (%s) set as current seelcted title for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(356,'Current selected title for player %s reset as not known now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(400,'|cffff0000[System Message]:|rScripts reloaded',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (400,'|cffff0000[System Message]:|rScripts reloaded',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(401,'You change security level of account %s to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (401,'You change security level of account %s to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(402,'%s changed your security level to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (402,'%s changed your security level to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),

View file

@ -0,0 +1,13 @@
ALTER TABLE db_version CHANGE COLUMN required_8828_02_mangos_instance_template required_8833_01_mangos_mangos_string bit;
DELETE FROM mangos_string WHERE entry in (349, 350, 351, 352, 353, 354, 355, 356);
INSERT INTO mangos_string VALUES
(349,'%d (idx:%d) - |cffffffff|Htitle:%d|h[%s %s]|h|r %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(350,'%d (idx:%d) - [%s %s] %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(351,'No titles found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(352,'Invalid title id: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(353,'Title %u (%s) added to known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(354,'Title %u (%s) removed from known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(355,'Title %u (%s) set as current seelcted title for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(356,'Current selected title for player %s reset as not known now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View file

@ -0,0 +1,10 @@
ALTER TABLE db_version CHANGE COLUMN required_8833_01_mangos_mangos_string required_8833_02_mangos_command bit;
DELETE FROM command where name IN ('character titles','modify titles','titles add','titles current','titles remove');
INSERT INTO `command` VALUES
('character titles',2,'Syntax: .character titles [$player_name]\r\n\r\nShow known titles list for selected player or player find by $player_name.'),
('titles add',2,'Syntax: .titles add #title\r\nAdd title #title (id or shift-link) to known titles list for selected player.'),
('titles current',2,'Syntax: .titles current #title\r\nSet title #title (id or shift-link) as current selected titl for selected player. If title not in known title list for player then it will be added to list.'),
('titles remove',2,'Syntax: .titles remove #title\r\nRemove title #title (id or shift-link) from known titles list for selected player.'),
('titles setmask',2,'Syntax: .titles setmask #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field');

View file

@ -160,6 +160,8 @@ pkgdata_DATA = \
8818_01_mangos_mangos_string.sql \ 8818_01_mangos_mangos_string.sql \
8828_01_characters_instance_reset.sql \ 8828_01_characters_instance_reset.sql \
8828_02_mangos_instance_template.sql \ 8828_02_mangos_instance_template.sql \
8833_01_mangos_mangos_string.sql \
8833_02_mangos_command.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -300,4 +302,6 @@ EXTRA_DIST = \
8818_01_mangos_mangos_string.sql \ 8818_01_mangos_mangos_string.sql \
8828_01_characters_instance_reset.sql \ 8828_01_characters_instance_reset.sql \
8828_02_mangos_instance_template.sql \ 8828_02_mangos_instance_template.sql \
8833_01_mangos_mangos_string.sql \
8833_02_mangos_command.sql \
README README

View file

@ -55,6 +55,7 @@
// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click // |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click
// |color|Htaxinode:id|h[name]|h|r // |color|Htaxinode:id|h[name]|h|r
// |color|Htele:id|h[name]|h|r // |color|Htele:id|h[name]|h|r
// |color|Htitle:id|h[name]|h|r
// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click // |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click
bool ChatHandler::load_command_table = true; bool ChatHandler::load_command_table = true;
@ -122,6 +123,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleCharacterLevelCommand, "", NULL }, { "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleCharacterLevelCommand, "", NULL },
{ "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL }, { "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL },
{ "reputation", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterReputationCommand, "", NULL }, { "reputation", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterReputationCommand, "", NULL },
{ "titles", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterTitlesCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL } { NULL, 0, false, NULL, "", NULL }
}; };
@ -294,6 +296,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL }, { "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL },
{ "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL }, { "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL },
{ "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL }, { "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL },
{ "title", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupTitleCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL } { NULL, 0, false, NULL, "", NULL }
}; };
@ -315,7 +318,6 @@ ChatCommand * ChatHandler::getCommandTable()
{ "faction", SEC_MODERATOR, false, &ChatHandler::HandleModifyFactionCommand, "", NULL }, { "faction", SEC_MODERATOR, false, &ChatHandler::HandleModifyFactionCommand, "", NULL },
{ "spell", SEC_MODERATOR, false, &ChatHandler::HandleModifySpellCommand, "", NULL }, { "spell", SEC_MODERATOR, false, &ChatHandler::HandleModifySpellCommand, "", NULL },
{ "tp", SEC_MODERATOR, false, &ChatHandler::HandleModifyTalentCommand, "", NULL }, { "tp", SEC_MODERATOR, false, &ChatHandler::HandleModifyTalentCommand, "", NULL },
{ "titles", SEC_MODERATOR, false, &ChatHandler::HandleModifyKnownTitlesCommand, "", NULL },
{ "mount", SEC_MODERATOR, false, &ChatHandler::HandleModifyMountCommand, "", NULL }, { "mount", SEC_MODERATOR, false, &ChatHandler::HandleModifyMountCommand, "", NULL },
{ "honor", SEC_MODERATOR, false, &ChatHandler::HandleModifyHonorCommand, "", NULL }, { "honor", SEC_MODERATOR, false, &ChatHandler::HandleModifyHonorCommand, "", NULL },
{ "rep", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyRepCommand, "", NULL }, { "rep", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyRepCommand, "", NULL },
@ -552,6 +554,15 @@ ChatCommand * ChatHandler::getCommandTable()
{ NULL, 0, false, NULL, "", NULL } { NULL, 0, false, NULL, "", NULL }
}; };
static ChatCommand titlesCommandTable[] =
{
{ "add", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesAddCommand, "", NULL },
{ "current", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesCurrentCommand, "", NULL },
{ "remove", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesRemoveCommand, "", NULL },
{ "setmask", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesSetMaskCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand unbanCommandTable[] = static ChatCommand unbanCommandTable[] =
{ {
{ "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL }, { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL },
@ -585,6 +596,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable }, { "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable },
{ "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable },
{ "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, { "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable },
{ "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable },
{ "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable },
{ "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable },
{ "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },

View file

@ -126,6 +126,7 @@ class ChatHandler
bool HandleCharacterLevelCommand(const char* args); bool HandleCharacterLevelCommand(const char* args);
bool HandleCharacterRenameCommand(const char * args); bool HandleCharacterRenameCommand(const char * args);
bool HandleCharacterReputationCommand(const char* args); bool HandleCharacterReputationCommand(const char* args);
bool HandleCharacterTitlesCommand(const char* args);
bool HandleDebugAnimCommand(const char* args); bool HandleDebugAnimCommand(const char* args);
bool HandleDebugArenaCommand(const char * args); bool HandleDebugArenaCommand(const char * args);
@ -238,8 +239,8 @@ class ChatHandler
bool HandleLookupSpellCommand(const char* args); bool HandleLookupSpellCommand(const char* args);
bool HandleLookupTaxiNodeCommand(const char * args); bool HandleLookupTaxiNodeCommand(const char * args);
bool HandleLookupTeleCommand(const char * args); bool HandleLookupTeleCommand(const char * args);
bool HandleLookupTitleCommand(const char * args);
bool HandleModifyKnownTitlesCommand(const char* args);
bool HandleModifyHPCommand(const char* args); bool HandleModifyHPCommand(const char* args);
bool HandleModifyManaCommand(const char* args); bool HandleModifyManaCommand(const char* args);
bool HandleModifyRageCommand(const char* args); bool HandleModifyRageCommand(const char* args);
@ -420,6 +421,11 @@ class ChatHandler
bool HandleTeleGroupCommand(const char* args); bool HandleTeleGroupCommand(const char* args);
bool HandleTeleNameCommand(const char* args); bool HandleTeleNameCommand(const char* args);
bool HandleTitlesAddCommand(const char* args);
bool HandleTitlesCurrentCommand(const char* args);
bool HandleTitlesRemoveCommand(const char* args);
bool HandleTitlesSetMaskCommand(const char* args);
bool HandleUnBanAccountCommand(const char* args); bool HandleUnBanAccountCommand(const char* args);
bool HandleUnBanCharacterCommand(const char* args); bool HandleUnBanCharacterCommand(const char* args);
bool HandleUnBanIPCommand(const char* args); bool HandleUnBanIPCommand(const char* args);

View file

@ -597,7 +597,7 @@ struct CharTitlesEntry
{ {
uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId() uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId()
//uint32 unk1; // 1 flags? //uint32 unk1; // 1 flags?
//char* name[16]; // 2-17, unused char* name[16]; // 2-17
// 18 string flag, unused // 18 string flag, unused
//char* name2[16]; // 19-34, unused //char* name2[16]; // 19-34, unused
// 35 string flag, unused // 35 string flag, unused

View file

@ -29,7 +29,7 @@ const char BankBagSlotPricesEntryfmt[]="ni";
const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii"; const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
const char BattlemasterListEntryfmt[]="niiiiiiiiiiiixxxssssssssssssssssxxx"; const char BattlemasterListEntryfmt[]="niiiiiiiiiiiixxxssssssssssssssssxxx";
const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; const char CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx"; const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";
// ChatChannelsEntryfmt, index not used (more compact store) // ChatChannelsEntryfmt, index not used (more compact store)
const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";

View file

@ -332,7 +332,15 @@ enum MangosStrings
LANG_CUSTOMIZE_PLAYER_GUID = 346, LANG_CUSTOMIZE_PLAYER_GUID = 346,
LANG_COMMAND_GOTAXINODENOTFOUND = 347, LANG_COMMAND_GOTAXINODENOTFOUND = 347,
LANG_GAMEOBJECT_HAVE_INVALID_DATA = 348, LANG_GAMEOBJECT_HAVE_INVALID_DATA = 348,
// Room for more level 2 349-399 not used LANG_TITLE_LIST_CHAT = 349,
LANG_TITLE_LIST_CONSOLE = 350,
LANG_COMMAND_NOTITLEFOUND = 351,
LANG_INVALID_TITLE_ID = 352,
LANG_TITLE_ADD_RES = 353,
LANG_TITLE_REMOVE_RES = 354,
LANG_TITLE_CURRENT_RES = 355,
LANG_CURRENT_TITLE_RESET = 356,
// Room for more level 2 357-399 not used
// level 3 chat // level 3 chat
LANG_SCRIPTS_RELOADED = 400, LANG_SCRIPTS_RELOADED = 400,

View file

@ -637,42 +637,6 @@ bool ChatHandler::HandleRecallCommand(const char* args)
return true; return true;
} }
//Edit Player KnownTitles
bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args)
{
if(!*args)
return false;
uint64 titles = 0;
sscanf((char*)args, UI64FMTD, &titles);
Player *chr = getSelectedPlayer();
if (!chr)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(chr, 0))
return false;
uint64 titles2 = titles;
for(uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
titles2 &= ~(uint64(1) << tEntry->bit_index);
titles &= ~titles2; // remove not existed titles
chr->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles);
SendSysMessage(LANG_DONE);
return true;
}
//Edit Player HP //Edit Player HP
bool ChatHandler::HandleModifyHPCommand(const char* args) bool ChatHandler::HandleModifyHPCommand(const char* args)
{ {

View file

@ -18,6 +18,7 @@
#include "Common.h" #include "Common.h"
#include "Database/DatabaseEnv.h" #include "Database/DatabaseEnv.h"
#include "DBCStores.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "ObjectDefines.h" #include "ObjectDefines.h"
#include "Player.h" #include "Player.h"
@ -4203,3 +4204,303 @@ bool ChatHandler::HandleWaterwalkCommand(const char* args)
return true; return true;
} }
bool ChatHandler::HandleLookupTitleCommand(const char* args)
{
if(!*args)
return false;
// can be NULL in console call
Player* target = getSelectedPlayer();
// title name have single string arg for player name
char const* targetName = target ? target->GetName() : "NAME";
std::string namepart = args;
std::wstring wnamepart;
if(!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
wstrToLower( wnamepart );
uint32 counter = 0; // Counter for figure out that we found smth.
// Search in CharTitles.dbc
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
{
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
if(titleInfo)
{
int loc = GetSessionDbcLocale();
std::string name = titleInfo->name[loc];
if(name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if(loc==GetSessionDbcLocale())
continue;
name = titleInfo->name[loc];
if(name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
break;
}
}
if(loc < MAX_LOCALE)
{
char const* knownStr = target && target->HasTitle(titleInfo) ? GetMangosString(LANG_KNOWN) : "";
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE)==titleInfo->bit_index
? GetMangosString(LANG_ACTIVE)
: "";
char titleNameStr[80];
snprintf(titleNameStr,80,name.c_str(),targetName);
// send title in "id (idx:idx) - [namedlink locale]" format
if (m_session)
PSendSysMessage(LANG_TITLE_LIST_CHAT,id,titleInfo->bit_index,id,titleNameStr,localeNames[loc],knownStr,activeStr);
else
PSendSysMessage(LANG_TITLE_LIST_CONSOLE,id,titleInfo->bit_index,titleNameStr,localeNames[loc],knownStr,activeStr);
++counter;
}
}
}
if (counter == 0) // if counter == 0 then we found nth
SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
return true;
}
bool ChatHandler::HandleTitlesAddCommand(const char* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = extractKeyFromLink((char*)args,"Htitle");
if(!id_p)
return false;
int32 id = atoi(id_p);
if (id <= 0)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
return false;
}
Player * target = getSelectedPlayer();
if(!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(target, 0))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if(!titleInfo)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
return false;
}
std::string tNameLink = GetNameLink(target);
char const* targetName = target->GetName();
char titleNameStr[80];
snprintf(titleNameStr,80,titleInfo->name[GetSessionDbcLocale()],targetName);
target->SetTitle(titleInfo);
PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str());
return true;
}
bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = extractKeyFromLink((char*)args,"Htitle");
if(!id_p)
return false;
int32 id = atoi(id_p);
if (id <= 0)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
return false;
}
Player * target = getSelectedPlayer();
if(!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(target, 0))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if(!titleInfo)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
return false;
}
target->SetTitle(titleInfo,true);
std::string tNameLink = GetNameLink(target);
char const* targetName = target->GetName();
char titleNameStr[80];
snprintf(titleNameStr,80,titleInfo->name[GetSessionDbcLocale()],targetName);
PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
{
target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0);
PSendSysMessage(LANG_CURRENT_TITLE_RESET, tNameLink.c_str());
}
return true;
}
//Edit Player KnownTitles
bool ChatHandler::HandleTitlesSetMaskCommand(const char* args)
{
if(!*args)
return false;
uint64 titles = 0;
sscanf((char*)args, UI64FMTD, &titles);
Player *target = getSelectedPlayer();
if (!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(target, 0))
return false;
uint64 titles2 = titles;
for(uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
titles2 &= ~(uint64(1) << tEntry->bit_index);
titles &= ~titles2; // remove not existed titles
target->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles);
SendSysMessage(LANG_DONE);
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
{
target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0);
PSendSysMessage(LANG_CURRENT_TITLE_RESET,GetNameLink(target).c_str());
}
return true;
}
bool ChatHandler::HandleCharacterTitlesCommand(const char* args)
{
Player* target;
if(!extractPlayerTarget((char*)args,&target))
return false;
LocaleConstant loc = GetSessionDbcLocale();
char const* targetName = target->GetName();
char const* knownStr = GetMangosString(LANG_KNOWN);
// Search in CharTitles.dbc
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
{
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
if (titleInfo && target->HasTitle(titleInfo))
{
std::string name = titleInfo->name[loc];
if(name.empty())
continue;
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE)==titleInfo->bit_index
? GetMangosString(LANG_ACTIVE)
: "";
char titleNameStr[80];
snprintf(titleNameStr,80,name.c_str(),targetName);
// send title in "id (idx:idx) - [namedlink locale]" format
if (m_session)
PSendSysMessage(LANG_TITLE_LIST_CHAT,id,titleInfo->bit_index,id,titleNameStr,localeNames[loc],knownStr,activeStr);
else
PSendSysMessage(LANG_TITLE_LIST_CONSOLE,id,titleInfo->bit_index,name.c_str(),localeNames[loc],knownStr,activeStr);
}
}
return true;
}
bool ChatHandler::HandleTitlesCurrentCommand(const char* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = extractKeyFromLink((char*)args,"Htitle");
if(!id_p)
return false;
int32 id = atoi(id_p);
if (id <= 0)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
return false;
}
Player * target = getSelectedPlayer();
if(!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(target, 0))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if(!titleInfo)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
return false;
}
std::string tNameLink = GetNameLink(target);
target->SetTitle(titleInfo); // to be sure that title now known
target->SetUInt32Value(PLAYER_CHOSEN_TITLE,titleInfo->bit_index);
PSendSysMessage(LANG_TITLE_CURRENT_RES, id, titleInfo->name[GetSessionDbcLocale()], tNameLink.c_str());
return true;
}

View file

@ -1048,7 +1048,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args)
if(!target->GetSkillValue(skill)) if(!target->GetSkillValue(skill))
{ {
PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[0]); PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[GetSessionDbcLocale()]);
SetSentErrorMessage(true); SetSentErrorMessage(true);
return false; return false;
} }
@ -1059,7 +1059,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args)
return false; return false;
target->SetSkill(skill, level, max); target->SetSkill(skill, level, max);
PSendSysMessage(LANG_SET_SKILL, skill, sl->name[0], tNameLink.c_str(), level, max); PSendSysMessage(LANG_SET_SKILL, skill, sl->name[GetSessionDbcLocale()], tNameLink.c_str(), level, max);
return true; return true;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8832" #define REVISION_NR "8833"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_8828_01_characters_instance_reset" #define REVISION_DB_CHARACTERS "required_8828_01_characters_instance_reset"
#define REVISION_DB_MANGOS "required_8828_02_mangos_instance_template" #define REVISION_DB_MANGOS "required_8833_02_mangos_command"
#define REVISION_DB_REALMD "required_8728_01_realmd_account" #define REVISION_DB_REALMD "required_8728_01_realmd_account"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__