mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[6982] Implemented gmlevel-based command security
This is just a simple check if target's gmlevel is lesser than the caller's one. If it is, an error is returned. Offline checks for some commands are included. That in simple words means no further .goname to a gmlevel 3 player from a gmlevel 2 or 1 account, so gmlevel 3 can work in peace. Signed-off-by: freghar <compmancz@gmail.com>
This commit is contained in:
parent
bc0a840e6a
commit
73ca2b7a54
8 changed files with 229 additions and 1 deletions
|
|
@ -111,6 +111,10 @@ bool ChatHandler::HandleNpcWhisperCommand(const char* args)
|
|||
|
||||
uint64 receiver_guid= atol(receiver_str);
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(objmgr.GetPlayer(receiver_guid), 0))
|
||||
return false;
|
||||
|
||||
pCreature->Whisper(text,receiver_guid);
|
||||
|
||||
return true;
|
||||
|
|
@ -342,6 +346,10 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
Player *chr = objmgr.GetPlayer(name.c_str());
|
||||
if (chr)
|
||||
{
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
||||
|
|
@ -402,6 +410,10 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
}
|
||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
||||
{
|
||||
// check offline security
|
||||
if (HasLowerSecurity(NULL, guid))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_SUMMONING, name.c_str(),GetMangosString(LANG_OFFLINE));
|
||||
|
||||
// in point where GM stay
|
||||
|
|
@ -442,6 +454,10 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
|||
Player *chr = objmgr.GetPlayer(name.c_str());
|
||||
if (chr)
|
||||
{
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
Map* cMap = chr->GetMap();
|
||||
if(cMap->IsBattleGroundOrArena())
|
||||
{
|
||||
|
|
@ -535,6 +551,10 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
|||
|
||||
if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
||||
{
|
||||
// check offline security
|
||||
if (HasLowerSecurity(NULL, guid))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_APPEARING_AT, name.c_str());
|
||||
|
||||
// to point where player stay (if loaded)
|
||||
|
|
@ -574,6 +594,10 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
|||
chr = getSelectedPlayer();
|
||||
if(!chr)
|
||||
chr = m_session->GetPlayer();
|
||||
|
||||
// check online security
|
||||
else if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -594,6 +618,10 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
|||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(chr->IsBeingTeleported())
|
||||
|
|
@ -632,6 +660,10 @@ bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
uint64 titles2 = titles;
|
||||
|
||||
for(int i=1; i < sCharTitlesStore.GetNumRows(); ++i)
|
||||
|
|
@ -681,6 +713,10 @@ bool ChatHandler::HandleModifyHPCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_HP, chr->GetName(), hp, hpm);
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetName(), hp, hpm);
|
||||
|
|
@ -725,6 +761,10 @@ bool ChatHandler::HandleModifyManaCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_MANA, chr->GetName(), mana, manam);
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MANA_CHANGED, GetName(), mana, manam);
|
||||
|
|
@ -770,6 +810,10 @@ bool ChatHandler::HandleModifyEnergyCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_ENERGY, chr->GetName(), energy/10, energym/10);
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, GetName(), energy/10, energym/10);
|
||||
|
|
@ -817,6 +861,10 @@ bool ChatHandler::HandleModifyRageCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_RAGE, chr->GetName(), rage/10, ragem/10);
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, GetName(), rage/10, ragem/10);
|
||||
|
|
@ -975,6 +1023,10 @@ bool ChatHandler::HandleModifySpellCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, chr->GetName());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, GetName(), spellflatid, val, mark);
|
||||
|
|
@ -1005,6 +1057,11 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
|
|||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
player->SetFreeTalentPoints(tp);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1029,6 +1086,10 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args)
|
|||
chr=m_session->GetPlayer();
|
||||
}
|
||||
|
||||
// check online security
|
||||
else if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if (argstr == "on")
|
||||
{
|
||||
chr->SetTaxiCheater(true);
|
||||
|
|
@ -1076,6 +1137,10 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->isInFlight())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chr->GetName());
|
||||
|
|
@ -1118,6 +1183,10 @@ bool ChatHandler::HandleModifySpeedCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->isInFlight())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chr->GetName());
|
||||
|
|
@ -1157,6 +1226,10 @@ bool ChatHandler::HandleModifySwimCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->isInFlight())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chr->GetName());
|
||||
|
|
@ -1196,6 +1269,10 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->isInFlight())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chr->GetName());
|
||||
|
|
@ -1235,6 +1312,10 @@ bool ChatHandler::HandleModifyFlyCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, chr->GetName());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetName(), FSpeed);
|
||||
|
|
@ -1266,6 +1347,10 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, chr->GetName());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, GetName(), Scale);
|
||||
|
|
@ -1509,6 +1594,10 @@ bool ChatHandler::HandleModifyMountCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_GIVE_MOUNT, chr->GetName());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_MOUNT_GIVED, GetName());
|
||||
|
|
@ -1546,6 +1635,10 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
int32 addmoney = atoi((char*)args);
|
||||
|
||||
uint32 moneyuser = chr->GetMoney();
|
||||
|
|
@ -1598,6 +1691,10 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
char* pField = strtok((char*)args, " ");
|
||||
if (!pField)
|
||||
return false;
|
||||
|
|
@ -1650,6 +1747,10 @@ bool ChatHandler::HandleModifyHonorCommand (const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
int32 amount = (uint32)atoi(args);
|
||||
|
||||
target->ModifyHonorPoints(amount);
|
||||
|
|
@ -1990,6 +2091,9 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
|||
Player *chr = objmgr.GetPlayer(name.c_str());
|
||||
if (chr)
|
||||
{
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->IsBeingTeleported()==true)
|
||||
{
|
||||
|
|
@ -2016,6 +2120,10 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
|||
}
|
||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str()))
|
||||
{
|
||||
// check offline security
|
||||
if (HasLowerSecurity(NULL, guid))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
|
||||
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y),guid);
|
||||
}
|
||||
|
|
@ -2039,6 +2147,10 @@ bool ChatHandler::HandleGroupTeleCommand(const char * args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = extractGameTeleFromLink((char*)args);
|
||||
if(!tele)
|
||||
|
|
@ -2063,6 +2175,10 @@ bool ChatHandler::HandleGroupTeleCommand(const char * args)
|
|||
if(!pl || !pl->GetSession() )
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(pl, 0))
|
||||
return false;
|
||||
|
||||
if(pl->IsBeingTeleported())
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, pl->GetName());
|
||||
|
|
@ -2112,6 +2228,10 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
Group *grp = player->GetGroup();
|
||||
|
||||
if(!grp)
|
||||
|
|
@ -2142,6 +2262,10 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
|||
if(!pl || pl==m_session->GetPlayer() || !pl->GetSession() )
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(pl, 0))
|
||||
return false;
|
||||
|
||||
if(pl->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, pl->GetName());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue