diff options
author | Spp <none@none> | 2010-03-09 12:58:48 +0100 |
---|---|---|
committer | Spp <none@none> | 2010-03-09 12:58:48 +0100 |
commit | cef249ff2cec86c4059daa744f2f30e0b999f217 (patch) | |
tree | 4c1e37b4933982278ad60b4ced6ee868683b8f86 /src/game/Mail.cpp | |
parent | 8034a6c48ea565345cd769422bb80acf5df015e4 (diff) |
Add level restrictions to some commands:
say, yell, emote, whisper, channel use, trade, auction, mail, tickets
By azazel. Closes issue #598
--HG--
branch : trunk
Diffstat (limited to 'src/game/Mail.cpp')
-rw-r--r-- | src/game/Mail.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 667b5ef19ec..b0d75eed9c9 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -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); |