Implement new commands for add/remove/lookup titles.

Autor Vladimir.

--HG--
branch : trunk
This commit is contained in:
win32
2010-01-21 11:19:34 +02:00
parent ce620223eb
commit 19ac6f6a3c
11 changed files with 368 additions and 44 deletions
+9
View File
@@ -0,0 +1,9 @@
DELETE FROM command where name IN ('character titles','modify titles','titles add','titles current','titles remove','lookup title');
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'),
('lookup title',2,'Syntax: .lookup title $$namepart\r\n\r\nLooks up a title by $namepart, and returns all matches with their title ID\'s and index\'s.');
+11
View File
@@ -0,0 +1,11 @@
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);
+13 -1
View File
@@ -352,6 +352,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.'),
('cometome','3','SYntax: .cometome $parameter\nMake selected creature come to your current location (new position not saved to DB).'), ('cometome','3','SYntax: .cometome $parameter\nMake selected creature come to your current location (new position not saved to DB).'),
('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.'),
@@ -493,7 +494,6 @@ INSERT INTO `command` VALUES
('modify spell','1','TODO'), ('modify spell','1','TODO'),
('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 50.'), ('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 50.'),
('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 [$reason]\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 [$reason]\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'),
@@ -672,6 +672,10 @@ INSERT INTO `command` VALUES
('ticket unassign','3','Usage: .ticket unassign $ticketid.\r\nUnassigns the specified ticket from the current assigned Game Master.'), ('ticket unassign','3','Usage: .ticket unassign $ticketid.\r\nUnassigns the specified ticket from the current assigned Game Master.'),
('ticket viewid','1','Usage: .ticket viewid $ticketid.\r\nReturns details about specified ticket. Ticket must be open and not deleted.'), ('ticket viewid','1','Usage: .ticket viewid $ticketid.\r\nReturns details about specified ticket. Ticket must be open and not deleted.'),
('ticket viewname','1','Usage: .ticket viewname $creatorname. \r\nReturns details about specified ticket. Ticket must be open and not deleted.'), ('ticket viewname','1','Usage: .ticket viewname $creatorname. \r\nReturns details about specified ticket. Ticket must be open and not deleted.'),
('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','3','Syntax: .unban $subcommand\nType .unban to see the list of possible subcommands or .help unban $subcommand to see info on subcommands'), ('unban','3','Syntax: .unban $subcommand\nType .unban to see the list of possible subcommands or .help unban $subcommand to see info on subcommands'),
('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.'),
@@ -7138,6 +7142,14 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
(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),
+13 -1
View File
@@ -58,6 +58,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;
@@ -126,6 +127,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 }
}; };
@@ -317,6 +319,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 },
{ "map", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupMapCommand, "", NULL }, { "map", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupMapCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL } { NULL, 0, false, NULL, "", NULL }
}; };
@@ -339,7 +342,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 },
@@ -598,6 +600,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 },
@@ -647,6 +658,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 },
+7 -1
View File
@@ -137,6 +137,7 @@ class TRINITY_DLL_SPEC 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);
@@ -264,8 +265,8 @@ class TRINITY_DLL_SPEC ChatHandler
bool HandleLookupTaxiNodeCommand(const char * args); bool HandleLookupTaxiNodeCommand(const char * args);
bool HandleLookupTeleCommand(const char * args); bool HandleLookupTeleCommand(const char * args);
bool HandleLookupMapCommand(const char* args); bool HandleLookupMapCommand(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);
@@ -459,6 +460,11 @@ class TRINITY_DLL_SPEC 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);
+1 -1
View File
@@ -625,7 +625,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
+1 -1
View File
@@ -32,7 +32,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";
+9 -1
View File
@@ -330,7 +330,15 @@ enum TrinityStrings
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,
-36
View File
@@ -1074,42 +1074,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)
{ {
+302
View File
@@ -20,6 +20,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 "Player.h" #include "Player.h"
#include "Item.h" #include "Item.h"
@@ -4242,3 +4243,304 @@ bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, pCreature->GetDBTableGUIDLow()); PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, pCreature->GetDBTableGUIDLow());
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) ? GetTrinityString(LANG_KNOWN) : "";
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE)==titleInfo->bit_index
? GetTrinityString(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 = GetTrinityString(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
? GetTrinityString(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;
}
+2 -2
View File
@@ -1612,7 +1612,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;
} }
@@ -1623,7 +1623,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;
} }