From: Keith F. <ven...@us...> - 2005-03-16 08:21:07
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8632 Modified Files: adminmanager.cpp adminmanager.h Log Message: Added a new GM1 command called /info, which gives the GM the database id of the player, the database id of the player's account, his IP address and his time connected. It also works for NPCs. GMs should use this in particular for reporting bugs about NPCs, because knowing the id of the bad npc will help a lot with troubleshooting them. Griefing players can be tracked this way also, and their IPs tracked and/or banned later. Index: adminmanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/adminmanager.cpp,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** adminmanager.cpp 14 Mar 2005 02:55:56 -0000 1.146 --- adminmanager.cpp 16 Mar 2005 08:20:53 -0000 1.147 *************** *** 331,334 **** --- 331,338 ---- ModifyKey(me,msg,client); } + else if (msg.command == "/info") + { + GetInfo(me,msg,client); + } else if (msg.command == "/crystal") { *************** *** 428,431 **** --- 432,491 ---- } } + + + void AdminManager::GetInfo(MsgEntry* me,psAdminCmdMessage& msg,Client *client) + { + if ( client->GetSecurityLevel() < GM_LEVEL_1 ) + { + psserver->SendSystemError(me->clientnum, "Access denied. Only GMs can view player info."); + return; + } + + Client* targetclient = NULL; + gemActor *target = NULL; + if (msg.player.Length() > 0) + { + targetclient = clients->Find(msg.player); + if (!targetclient) + { + psserver->SendSystemError(client->GetClientNum(), "Cannot find player %s.",msg.player.GetData() ); + return; + } + target = targetclient->GetActor(); + } + else + { + gemObject *targetobj; + targetobj = client->GetTargetObject(); + if (!targetobj) + { + psserver->SendSystemError(client->GetClientNum(), "You must specify a player name or have something targeted." ); + return; + } + target = dynamic_cast<gemActor*>(targetobj); + if (target) + targetclient = clients->Find( target->GetCharacterData()->GetCharName() ); + } + + if (target) + { + char ipaddr[50]={0}; + if (targetclient) + targetclient->GetIPAddress(ipaddr); + + psserver->SendSystemInfo(client->GetClientNum(), + "%s has player id %d, account id %d, IP is %s, time connected is %1.1f hours.", + targetclient ? targetclient->GetName() : target->GetName(), + target->GetPlayerID(), + targetclient ? targetclient->GetAccountID() : 0, + targetclient ? ipaddr : "(none)", + (float)target->GetCharacterData()->GetTimeConnected() / 3600); + } + else + { + psserver->SendSystemError(client->GetClientNum(), "This command only works on players or npcs." ); + } + } + void AdminManager::HandlePetitionMessage(MsgEntry *me, psPetitionRequestMessage& msg,Client *client) { *************** *** 1130,1133 **** --- 1190,1194 ---- commandList.Append( "<command name='/unmute' />" ); commandList.Append( "<command name='/show_gm' />" ); + commandList.Append( "<command name='/info' />" ); case GM_LEVEL_0: //commandList.Append( "<command name='/petition' />" ); Index: adminmanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/adminmanager.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** adminmanager.h 13 Mar 2005 09:34:33 -0000 1.48 --- adminmanager.h 16 Mar 2005 08:20:54 -0000 1.49 *************** *** 63,66 **** --- 63,67 ---- void HandleGMGuiMessage(MsgEntry *pMsg, psGMGuiMessage& msg, Client *client); + void GetInfo(MsgEntry* me,psAdminCmdMessage& msg,Client *client); void CreateNPC(MsgEntry *me,psAdminCmdMessage& msg, Client *client); int CopyNPCFromDatabase(int master_id, float x, float y, float z, float angle, const csString & sector); |