Add level restrictions to some commands:

say, yell, emote, whisper, channel use, trade, auction, mail, tickets
By azazel. Closes issue #598

--HG--
branch : trunk
This commit is contained in:
Spp committed 2010-03-09 12:58:48 +01:00
1 parent 8034a6c48e
commit cef249ff2c
11 files changed
+138 -5

No files matched your search

+19
View File
@@ -92,6 +92,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
Player* pl = _player;
if (pl->getLevel() < sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_MAIL_SENDER_REQ), sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ));
return;
}
uint64 rc = 0;
if (normalizePlayerName(receiver))
rc = objmgr.GetPlayerGUIDByName(receiver);
@@ -126,11 +132,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
uint32 rc_team = 0;
uint8 mails_count = 0; //do not allow to send to one player more than 100 mails
uint8 receiveLevel = 0;
if (receive)
{
rc_team = receive->GetTeam();
mails_count = receive->GetMailSize();
receiveLevel = receive->getLevel();
}
else
{
@@ -140,6 +148,11 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
Field *fields = result->Fetch();
mails_count = fields[0].GetUInt32();
}
if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid = '%u'", GUID_LOPART(rc)))
{
Field *fields = result->Fetch();
receiveLevel = fields[0].GetUInt8();
}
}
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
if (mails_count > 100)
@@ -154,6 +167,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
return;
}
if (receiveLevel < sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_MAIL_RECEIVER_REQ), sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ));
return;
}
uint32 rc_account = receive
? receive->GetSession()->GetAccountId()
: objmgr.GetPlayerAccountIdByGUID(rc);