[svn] * Send ShutdownMsg to console using outstring_log.
* Prevent Client Crashes when MOVEMENTFLAG_ONTRANSPORT and MOVEMENTFLAG_SPLINE2 is set on creatures.
* Implement four new SEC_ADMINISTRATOR commands:
- Group (.group [leader]/[disband]/[remove]) commands.
- GameObject State (.gobject state <guid> <state>) command.
--HG--
branch : trunk
This commit is contained in:
1 parent
fdcf5cc406
commit
63af34886b
7 files changed
+145
-3
No files matched your search
+1
-1
@@ -159,7 +159,7 @@ CREATE TABLE `command` (
|
||||
|
||||
/*Data for the table `command` */
|
||||
|
||||
insert into `command`(`name`,`security`,`help`) values ('acct',0,'Syntax: .acct\r\n\r\nDisplay the access level of your account.'),('additem',3,'Syntax: .additem #itemid/[#itemname]/#shift-click-item-link #itemcount\r\n\r\nAdds the specified number of items of id #itemid (or exact (!) name $itemname in brackets, or link created by shift-click at item in inventory or recipe) to your or selected character inventory. If #itemcount is omitted, only one item will be added.\r\n.'),('additemset',3,'Syntax: .additemset #itemsetid\r\n\r\nAdd items from itemset of id #itemsetid to your or selected character inventory. Will add by one example each item from itemset.'),('addmove',2,'Syntax: .addmove #creature_guid [#waittime]\r\n\r\nAdd your current location as a waypoint for creature with guid #creature_guid. And optional add wait time.'),('announce',1,'Syntax: .announce $MessageToBroadcast\r\n\r\nSend a global message to all players online in chat log.'),('aura',3,'Syntax: .aura #spellid\r\n\r\nAdd the aura from spell #spellid to the selected Unit.'),('ban',3,'Syntax is: ban <account|ip|character> $NameOrIp $bantime $reason\r\nBan account or IP and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),('baninfo',3,'Syntax is: baninfo <account|ip|character>\r\nWatch full information about a specific ban.'),('bank',3,'Syntax: .bank\r\n\r\nShow your bank inventory.'),('banlist',3,'Syntax is: banlist <account|ip|character> $NameOrIp\r\nsearches the banlist for a pattern.'),('cast',3,'Syntax: .cast #spellid [triggered]\r\n Cast #spellid to selected target. If no target selected cast to self. If \'trigered\' or part provided then spell casted with triggered flag.'),('cast back',3,'Syntax: .cast back #spellid [triggered]\r\n Selected target will cast #spellid to your character. If \'trigered\' or part provided then spell casted with triggered flag.'),('cast dist',3,'Syntax: .cast dist #spellid [#dist [triggered]]\r\n You will cast spell to pint at distance #dist. If \'trigered\' or part provided then spell casted with triggered flag. Not all spells can be casted as area spells.'),('cast self',3,'Syntax: .cast self #spellid [triggered]\r\nCast #spellid by target at target itself. If \'trigered\' or part provided then spell casted with triggered flag.'),('cast target',3,'Syntax: .cast target #spellid [triggered]\r\n Selected target will cast #spellid to his victim. If \'trigered\' or part provided then spell casted with triggered flag.'),('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.'),('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).'),('damage',3,'Syntax: .damage $damage_amount [$school [$spellid]]\r\n\r\nApply $damage to target. If not $school and $spellid provided then this flat clean melee damage without any modifiers. If $school provided then damage modified by armor reduction (if school physical), and target absorbing modifiers and result applied as melee damage to target. If spell provided then damage modified and applied as spell damage. $spellid can be shift-link.'),('debug anim',2,'Syntax: .debug anim #emoteid\r\n\r\nPlay emote #emoteid for your character.'),('debug getvalue',3,'Syntax: .debug getvalue #field #isInt\r\n\r\nGet the field #field of the selected creature. If no creature is selected, get the content of your field.\r\n\r\nUse a #isInt of value 1 if the expected field content is an integer.'),('debug playsound',1,'Syntax: .debug playsound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'),('debug setvalue',3,'Syntax: .debug setvalue #field #value #isInt\r\n\r\nSet the field #field of the selected creature with value #value. If no creature is selected, set the content of your field.\r\n\r\nUse a #isInt of value 1 if #value is an integer.'),('debug standstate',2,'Syntax: .debug standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'),('debug update',3,'Syntax: .debug update #field #value\r\n\r\nUpdate the field #field of the selected character or creature with value #value.\r\n\r\nIf no #value is provided, display the content of field #field.'),('flusharenapoints',3,'Syntax: .flusharenapoints\r\n\r\nUse it to distribute arena points based on arena team ratings, and start a new week.'),('delticket',2,'Syntax: .delticket all\r\n .delticket #num\r\n .delticket $character_name\r\n\rall to dalete all tickets at server, $character_name to delete ticket of this character, #num to delete ticket #num.'),('demorph',2,'SyLine truncated
|
||||
insert into `command`(`name`,`security`,`help`) values ('acct',0,'Syntax: .acct\r\n\r\nDisplay the access level of your account.'),('additem',3,'Syntax: .additem #itemid/[#itemname]/#shift-click-item-link #itemcount\r\n\r\nAdds the specified number of items of id #itemid (or exact (!) name $itemname in brackets, or link created by shift-click at item in inventory or recipe) to your or selected character inventory. If #itemcount is omitted, only one item will be added.\r\n.'),('additemset',3,'Syntax: .additemset #itemsetid\r\n\r\nAdd items from itemset of id #itemsetid to your or selected character inventory. Will add by one example each item from itemset.'),('addmove',2,'Syntax: .addmove #creature_guid [#waittime]\r\n\r\nAdd your current location as a waypoint for creature with guid #creature_guid. And optional add wait time.'),('announce',1,'Syntax: .announce $MessageToBroadcast\r\n\r\nSend a global message to all players online in chat log.'),('aura',3,'Syntax: .aura #spellid\r\n\r\nAdd the aura from spell #spellid to the selected Unit.'),('ban',3,'Syntax is: ban <account|ip|character> $NameOrIp $bantime $reason\r\nBan account or IP and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),('baninfo',3,'Syntax is: baninfo <account|ip|character>\r\nWatch full information about a specific ban.'),('bank',3,'Syntax: .bank\r\n\r\nShow your bank inventory.'),('banlist',3,'Syntax is: banlist <account|ip|character> $NameOrIp\r\nsearches the banlist for a pattern.'),('cast',3,'Syntax: .cast #spellid [triggered]\r\n Cast #spellid to selected target. If no target selected cast to self. If \'trigered\' or part provided then spell casted with triggered flag.'),('cast back',3,'Syntax: .cast back #spellid [triggered]\r\n Selected target will cast #spellid to your character. If \'trigered\' or part provided then spell casted with triggered flag.'),('cast dist',3,'Syntax: .cast dist #spellid [#dist [triggered]]\r\n You will cast spell to pint at distance #dist. If \'trigered\' or part provided then spell casted with triggered flag. Not all spells can be casted as area spells.'),('cast self',3,'Syntax: .cast self #spellid [triggered]\r\nCast #spellid by target at target itself. If \'trigered\' or part provided then spell casted with triggered flag.'),('cast target',3,'Syntax: .cast target #spellid [triggered]\r\n Selected target will cast #spellid to his victim. If \'trigered\' or part provided then spell casted with triggered flag.'),('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.'),('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).'),('damage',3,'Syntax: .damage $damage_amount [$school [$spellid]]\r\n\r\nApply $damage to target. If not $school and $spellid provided then this flat clean melee damage without any modifiers. If $school provided then damage modified by armor reduction (if school physical), and target absorbing modifiers and result applied as melee damage to target. If spell provided then damage modified and applied as spell damage. $spellid can be shift-link.'),('debug anim',2,'Syntax: .debug anim #emoteid\r\n\r\nPlay emote #emoteid for your character.'),('debug getvalue',3,'Syntax: .debug getvalue #field #isInt\r\n\r\nGet the field #field of the selected creature. If no creature is selected, get the content of your field.\r\n\r\nUse a #isInt of value 1 if the expected field content is an integer.'),('debug playsound',1,'Syntax: .debug playsound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'),('debug setvalue',3,'Syntax: .debug setvalue #field #value #isInt\r\n\r\nSet the field #field of the selected creature with value #value. If no creature is selected, set the content of your field.\r\n\r\nUse a #isInt of value 1 if #value is an integer.'),('debug standstate',2,'Syntax: .debug standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'),('debug update',3,'Syntax: .debug update #field #value\r\n\r\nUpdate the field #field of the selected character or creature with value #value.\r\n\r\nIf no #value is provided, display the content of field #field.'),('flusharenapoints',3,'Syntax: .flusharenapoints\r\n\r\nUse it to distribute arena points based on arena team ratings, and start a new week.'),('delticket',2,'Syntax: .delticket all\r\n .delticket #num\r\n .delticket $character_name\r\n\rall to dalete all tickets at server, $character_name to delete ticket of this character, #num to delete ticket #num.'),('demorph',2,'SyLine truncated
|
||||
|
||||
/*Table structure for table `creature` */
|
||||
|
||||
|
||||
@@ -214,6 +214,14 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ NULL, 0, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand groupCommandTable[] =
|
||||
{
|
||||
{ "leader", SEC_ADMINISTRATOR, &ChatHandler::HandleGroupLeaderCommand, "", NULL },
|
||||
{ "disband", SEC_ADMINISTRATOR, &ChatHandler::HandleGroupDisbandCommand, "", NULL },
|
||||
{ "remove", SEC_ADMINISTRATOR, &ChatHandler::HandleGroupRemoveCommand, "", NULL },
|
||||
{ NULL, 0, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand lookupPlayerCommandTable[] =
|
||||
{
|
||||
{ "ip", SEC_GAMEMASTER, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL },
|
||||
@@ -340,6 +348,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "turn", SEC_GAMEMASTER, &ChatHandler::HandleTurnObjectCommand, "", NULL },
|
||||
{ "move", SEC_GAMEMASTER, &ChatHandler::HandleMoveObjectCommand, "", NULL },
|
||||
{ "near", SEC_ADMINISTRATOR, &ChatHandler::HandleNearObjectCommand, "", NULL },
|
||||
{ "state", SEC_ADMINISTRATOR, &ChatHandler::HandleObjectStateCommand, "", NULL },
|
||||
{ NULL, 0, NULL, "", NULL }
|
||||
};
|
||||
|
||||
@@ -388,6 +397,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "list", SEC_ADMINISTRATOR, NULL, "", listCommandTable },
|
||||
{ "lookup", SEC_ADMINISTRATOR, NULL, "", lookupCommandTable },
|
||||
{ "pdump", SEC_ADMINISTRATOR, NULL, "", pdumpCommandTable },
|
||||
{ "group", SEC_ADMINISTRATOR, NULL, "", groupCommandTable },
|
||||
{ "guild", SEC_ADMINISTRATOR, NULL, "", guildCommandTable },
|
||||
{ "cast", SEC_ADMINISTRATOR, NULL, "", castCommandTable },
|
||||
{ "reset", SEC_ADMINISTRATOR, NULL, "", resetCommandTable },
|
||||
@@ -1084,3 +1094,47 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text)
|
||||
|
||||
return objmgr.GetGameTele(cId);
|
||||
}
|
||||
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline)
|
||||
{
|
||||
plr = NULL;
|
||||
guid = 0;
|
||||
|
||||
if(cname)
|
||||
{
|
||||
std::string name = cname;
|
||||
if(!name.empty())
|
||||
{
|
||||
if(!normalizePlayerName(name))
|
||||
{
|
||||
PSendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
plr = objmgr.GetPlayer(name.c_str());
|
||||
if(offline)
|
||||
guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(plr)
|
||||
{
|
||||
group = plr->GetGroup();
|
||||
if(!guid || !offline)
|
||||
guid = plr->GetGUID();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(getSelectedPlayer())
|
||||
plr = getSelectedPlayer();
|
||||
else
|
||||
plr = m_session->GetPlayer();
|
||||
|
||||
if(!guid || !offline)
|
||||
guid = plr->GetGUID();
|
||||
group = plr->GetGroup();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -239,6 +239,7 @@ class ChatHandler
|
||||
bool HandleMoveCreatureCommand(const char* args);
|
||||
bool HandleMoveObjectCommand(const char* args);
|
||||
bool HandleTurnObjectCommand(const char* args);
|
||||
bool HandleObjectStateCommand(const char* args);
|
||||
bool HandlePInfoCommand(const char* args);
|
||||
bool HandlePLimitCommand(const char* args);
|
||||
bool HandleMuteCommand(const char* args);
|
||||
@@ -314,6 +315,10 @@ class ChatHandler
|
||||
bool HandleAddItemCommand(const char* args);
|
||||
bool HandleAddItemSetCommand(const char* args);
|
||||
|
||||
bool HandleGroupLeaderCommand(const char* args);
|
||||
bool HandleGroupDisbandCommand(const char* args);
|
||||
bool HandleGroupRemoveCommand(const char* args);
|
||||
|
||||
bool HandleGuildCreateCommand(const char* args);
|
||||
bool HandleGuildInviteCommand(const char* args);
|
||||
bool HandleGuildUninviteCommand(const char* args);
|
||||
@@ -393,6 +398,7 @@ class ChatHandler
|
||||
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL);
|
||||
uint32 extractSpellIdFromLink(char* text);
|
||||
GameTele const* extractGameTeleFromLink(char* text);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline = false);
|
||||
|
||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry);
|
||||
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args)
|
||||
WorldPacket data;
|
||||
if(!*args)
|
||||
return false;
|
||||
char str[1024];
|
||||
//char str[1024];
|
||||
//sprintf(str, GetMangosString(LANG_ANNOUNCE_COLOR), m_session->GetPlayer()->GetName(), args);
|
||||
sWorld.SendWorldText(LANG_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args);
|
||||
return true;
|
||||
|
||||
@@ -2175,6 +2175,44 @@ bool ChatHandler::HandleNearObjectCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleObjectStateCommand(const char* args)
|
||||
{
|
||||
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
|
||||
char* cId = extractKeyFromLink((char*)args, "Hgameobject");
|
||||
if(!cId)
|
||||
return false;
|
||||
|
||||
uint32 lowguid = atoi(cId);
|
||||
if(!lowguid)
|
||||
return false;
|
||||
|
||||
GameObject* gobj = NULL;
|
||||
|
||||
if(GameObjectData const* goData = objmgr.GetGOData(lowguid))
|
||||
gobj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, goData->id);
|
||||
|
||||
if(!gobj)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* cstate = strtok(NULL, " ");
|
||||
if(!cstate)
|
||||
return false;
|
||||
|
||||
int32 state = atoi(cstate);
|
||||
if(state < 0)
|
||||
gobj->SendObjectDeSpawnAnim(gobj->GetGUID());
|
||||
else
|
||||
gobj->SetGoState(state);
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleListCreatureCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
@@ -5472,3 +5510,45 @@ bool ChatHandler::HandleFlushArenaPointsCommand(const char * /*args*/)
|
||||
sBattleGroundMgr.DistributeArenaPoints();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGroupLeaderCommand(const char* args)
|
||||
{
|
||||
Player* plr = NULL;
|
||||
Group* group = NULL;
|
||||
uint64 guid = 0;
|
||||
char* cname = strtok((char*)args, " ");
|
||||
|
||||
if(GetPlayerGroupAndGUIDByName(cname, plr, group, guid))
|
||||
if(group && group->GetLeaderGUID() != guid)
|
||||
group->ChangeLeader(guid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGroupDisbandCommand(const char* args)
|
||||
{
|
||||
Player* plr = NULL;
|
||||
Group* group = NULL;
|
||||
uint64 guid = 0;
|
||||
char* cname = strtok((char*)args, " ");
|
||||
|
||||
if(GetPlayerGroupAndGUIDByName(cname, plr, group, guid))
|
||||
if(group)
|
||||
group->Disband();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGroupRemoveCommand(const char* args)
|
||||
{
|
||||
Player* plr = NULL;
|
||||
Group* group = NULL;
|
||||
uint64 guid = 0;
|
||||
char* cname = strtok((char*)args, " ");
|
||||
|
||||
if(GetPlayerGroupAndGUIDByName(cname, plr, group, guid, true))
|
||||
if(group)
|
||||
group->RemoveMember(guid, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -264,6 +264,8 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
flags2 = ((Unit*)this)->GetUnitMovementFlags();
|
||||
flags2 &= ~MOVEMENTFLAG_ONTRANSPORT;
|
||||
flags2 &= ~MOVEMENTFLAG_SPLINE2;
|
||||
}
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
|
||||
+1
-1
@@ -2426,7 +2426,7 @@ void World::ShutdownMsg(bool show, Player* player)
|
||||
uint32 msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME;
|
||||
|
||||
SendServerMessage(msgid,str.c_str(),player);
|
||||
DEBUG_LOG("Server is %s in %s",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"),str.c_str());
|
||||
outstring_log("Server will %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shutdown"), str.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user