Changeset 28 for trunk/src/game/MiscHandler.cpp
- Timestamp:
- 11/19/08 13:24:39 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/MiscHandler.cpp
r9 r28 1427 1427 GetPlayer()->TeleportTo(mapid,PositionX,PositionY,PositionZ,Orientation); 1428 1428 else 1429 SendNotification( "You do not have permission to perform that function");1429 SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); 1430 1430 sLog.outDebug("Received worldport command from player %s", GetPlayer()->GetName()); 1431 1431 } … … 1436 1436 1437 1437 sLog.outDebug("Received opcode CMSG_WHOIS"); 1438 std::string charname , acc, email, lastip, msg;1438 std::string charname; 1439 1439 recv_data >> charname; 1440 1440 1441 1441 if (GetSecurity() < SEC_ADMINISTRATOR) 1442 1442 { 1443 SendNotification( "You do not have permission to perform that function");1443 SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); 1444 1444 return; 1445 1445 } … … 1447 1447 if(charname.empty()) 1448 1448 { 1449 SendNotification("Please provide character name"); 1450 return; 1451 } 1452 1453 uint32 accid; 1454 Field *fields; 1449 SendNotification(LANG_NEED_CHARACTER_NAME); 1450 return; 1451 } 1455 1452 1456 1453 Player *plr = objmgr.GetPlayer(charname.c_str()); 1457 1454 1458 if(plr) 1459 accid = plr->GetSession()->GetAccountId(); 1460 else 1461 { 1462 SendNotification("Player %s not found or offline", charname.c_str()); 1463 return; 1464 } 1465 1466 if(!accid) 1467 { 1468 SendNotification("Account for character %s not found", charname.c_str()); 1469 return; 1470 } 1455 if(!plr) 1456 { 1457 SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str()); 1458 return; 1459 } 1460 1461 uint32 accid = plr->GetSession()->GetAccountId(); 1471 1462 1472 1463 QueryResult *result = loginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid); 1473 if(result) 1474 { 1475 fields = result->Fetch(); 1476 acc = fields[0].GetCppString(); 1477 if(acc.empty()) 1478 acc = "Unknown"; 1479 email = fields[1].GetCppString(); 1480 if(email.empty()) 1481 email = "Unknown"; 1482 lastip = fields[2].GetCppString(); 1483 if(lastip.empty()) 1484 lastip = "Unknown"; 1485 msg = charname + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip; 1486 1487 WorldPacket data(SMSG_WHOIS, msg.size()+1); 1488 data << msg; 1489 _player->GetSession()->SendPacket(&data); 1490 } 1491 else 1492 SendNotification("Account for character %s not found", charname.c_str()); 1464 if(!result) 1465 { 1466 SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str()); 1467 return; 1468 } 1469 1470 Field *fields = result->Fetch(); 1471 std::string acc = fields[0].GetCppString(); 1472 if(acc.empty()) 1473 acc = "Unknown"; 1474 std::string email = fields[1].GetCppString(); 1475 if(email.empty()) 1476 email = "Unknown"; 1477 std::string lastip = fields[2].GetCppString(); 1478 if(lastip.empty()) 1479 lastip = "Unknown"; 1480 1481 std::string msg = charname + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip; 1482 1483 WorldPacket data(SMSG_WHOIS, msg.size()+1); 1484 data << msg; 1485 _player->GetSession()->SendPacket(&data); 1493 1486 1494 1487 delete result; 1488 1495 1489 sLog.outDebug("Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str()); 1496 1490 }