Changeset 42 for trunk/src/game/Chat.cpp

Show
Ignore:
Timestamp:
11/19/08 13:27:05 (17 years ago)
Author:
yumileroy
Message:

[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.

Original author: Seline
Date: 2008-10-12 18:26:26-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Chat.cpp

    r40 r42  
    215215    }; 
    216216 
     217    static ChatCommand groupCommandTable[] = 
     218    { 
     219        { "leader",         SEC_ADMINISTRATOR,  &ChatHandler::HandleGroupLeaderCommand,         "", NULL }, 
     220        { "disband",        SEC_ADMINISTRATOR,  &ChatHandler::HandleGroupDisbandCommand,        "", NULL }, 
     221        { "remove",         SEC_ADMINISTRATOR,  &ChatHandler::HandleGroupRemoveCommand,         "", NULL }, 
     222        { NULL,             0,                  NULL,                                           "", NULL } 
     223    }; 
     224 
    217225    static ChatCommand lookupPlayerCommandTable[] = 
    218226    { 
     
    341349        { "move",           SEC_GAMEMASTER,     &ChatHandler::HandleMoveObjectCommand,          "", NULL }, 
    342350        { "near",           SEC_ADMINISTRATOR,  &ChatHandler::HandleNearObjectCommand,          "", NULL }, 
     351        { "state",          SEC_ADMINISTRATOR,  &ChatHandler::HandleObjectStateCommand,         "", NULL }, 
    343352        { NULL,             0,                  NULL,                                           "", NULL } 
    344353    }; 
     
    389398        { "lookup",         SEC_ADMINISTRATOR,  NULL,                                           "", lookupCommandTable }, 
    390399        { "pdump",          SEC_ADMINISTRATOR,  NULL,                                           "", pdumpCommandTable }, 
     400        { "group",          SEC_ADMINISTRATOR,  NULL,                                           "", groupCommandTable }, 
    391401        { "guild",          SEC_ADMINISTRATOR,  NULL,                                           "", guildCommandTable }, 
    392402        { "cast",           SEC_ADMINISTRATOR,  NULL,                                           "", castCommandTable }, 
     
    10851095    return objmgr.GetGameTele(cId); 
    10861096} 
     1097 
     1098bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline) 
     1099{ 
     1100    plr  = NULL; 
     1101    guid = 0; 
     1102 
     1103    if(cname) 
     1104    { 
     1105        std::string name = cname; 
     1106        if(!name.empty()) 
     1107        { 
     1108            if(!normalizePlayerName(name)) 
     1109            { 
     1110                PSendSysMessage(LANG_PLAYER_NOT_FOUND); 
     1111                SetSentErrorMessage(true); 
     1112                return false; 
     1113            } 
     1114 
     1115            plr = objmgr.GetPlayer(name.c_str()); 
     1116            if(offline) 
     1117                guid = objmgr.GetPlayerGUIDByName(name.c_str()); 
     1118        } 
     1119    } 
     1120 
     1121    if(plr) 
     1122    { 
     1123        group = plr->GetGroup(); 
     1124        if(!guid || !offline) 
     1125            guid = plr->GetGUID(); 
     1126    } 
     1127    else 
     1128    { 
     1129        if(getSelectedPlayer()) 
     1130            plr = getSelectedPlayer(); 
     1131        else 
     1132            plr = m_session->GetPlayer(); 
     1133 
     1134        if(!guid || !offline) 
     1135            guid  = plr->GetGUID(); 
     1136        group = plr->GetGroup(); 
     1137    } 
     1138 
     1139    return true; 
     1140}