From: Luca P. <lpa...@us...> - 2005-08-03 20:02:32
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27662 Modified Files: adminmanager.cpp Log Message: /info now works on items also. Index: adminmanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/adminmanager.cpp,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** adminmanager.cpp 2 Aug 2005 20:14:19 -0000 1.183 --- adminmanager.cpp 3 Aug 2005 20:02:08 -0000 1.184 *************** *** 529,543 **** if ( client->GetSecurityLevel() < GM_LEVEL_1 ) { ! psserver->SendSystemError(me->clientnum, "Access denied. Only GMs can view player info."); return; } ! char ipaddr[50]={0}; ! csString name, ipAddress; ! int playerId = 0, accountId = 0; ! float timeConnected = 0.0f; Client* targetclient = NULL; ! gemActor *target = NULL; if (msg.player.Length() > 0) { --- 529,543 ---- if ( client->GetSecurityLevel() < GM_LEVEL_1 ) { ! psserver->SendSystemError(me->clientnum, "Access denied. Only GMs can view object/player info."); return; } ! char ipaddr[50]={0}; ! csString name, ipAddress; ! int playerId = 0, accountId = 0; ! float timeConnected = 0.0f; Client* targetclient = NULL; ! gemObject *target = NULL; if (msg.player.Length() > 0) { *************** *** 555,565 **** { iResultRow& row = result[0]; ! name = row["name"]; if (row["lastname"] != "") { ! name.Append(" "); ! name.Append(row["lastname"]); } ! playerId = row.GetUInt32("id"); accountId = row.GetUInt32("account_id"); ipAddress = "(player not online)"; --- 555,565 ---- { iResultRow& row = result[0]; ! name = row["name"]; if (row["lastname"] != "") { ! name.Append(" "); ! name.Append(row["lastname"]); } ! playerId = row.GetUInt32("id"); accountId = row.GetUInt32("account_id"); ipAddress = "(player not online)"; *************** *** 567,573 **** } } ! else { ! target = targetclient->GetActor(); name = targetclient->GetName(); --- 567,573 ---- } } ! else { ! target = targetclient->GetActor(); name = targetclient->GetName(); *************** *** 579,623 **** } } 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) ! { ! name = targetclient ? targetclient->GetName() : target->GetName(); ! playerId = target->GetPlayerID(); ! accountId = targetclient ? targetclient->GetAccountID() : 0; ! if (targetclient) ! { ! targetclient->GetIPAddress(ipaddr); ! ipAddress = ipaddr; ! } ! else ! { ! ipAddress = "(none)"; ! } ! timeConnected = target->GetCharacterData()->GetTimeConnected() / 3600; ! } ! targetclient = clients->Find( target->GetCharacterData()->GetCharName() ); } if (playerId != 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.", ! name.GetData(), ! playerId, ! accountId, ! ipAddress.GetData(), ! timeConnected); } else --- 579,635 ---- } } + // no msg.player else { ! gemObject *targetobj; ! targetobj = client->GetTargetObject(); ! if (!targetobj) ! { ! psserver->SendSystemError(client->GetClientNum(), "You must specify a player name or have something targeted." ); ! return; ! } ! // search a player or NPC ! target = dynamic_cast<gemActor*>(targetobj); ! if (target) ! { ! name = targetclient ? targetclient->GetName() : target->GetName(); ! playerId = target->GetPlayerID(); ! accountId = targetclient ? targetclient->GetAccountID() : 0; ! if (targetclient) ! { ! targetclient->GetIPAddress(ipaddr); ! ipAddress = ipaddr; ! } ! else ! { ! ipAddress = "(none)"; ! } ! timeConnected = target->GetCharacterData()->GetTimeConnected() / 3600; ! } ! // search a generic object ! gemItem *gItem = dynamic_cast<gemItem*>(targetobj); ! if (gItem) { ! psItem *pItem = gItem->GetItem(); ! psserver->SendSystemInfo(client->GetClientNum(),"Object name: %s with instanceID: %d and ID: %u .", ! pItem->GetName(), ! pItem->GetBaseStats()->GetUID(), ! pItem->GetUID()); ! return; ! } ! // ??? targetclient = clients->Find( target->GetCharacterData()->GetCharName() ); } if (playerId != 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.", ! name.GetData(), ! playerId, ! accountId, ! ipAddress.GetData(), ! timeConnected); } else |