diff options
author | Subv <s.v.h21@hotmail.com> | 2012-08-22 17:26:53 -0500 |
---|---|---|
committer | Subv <s.v.h21@hotmail.com> | 2012-08-22 17:26:53 -0500 |
commit | dc95ce61b46ce2d542ee4c4dbdf35a9e854c4316 (patch) | |
tree | e673101dc6554a76dfacb5cf3497dd1d2bde4f41 /src/server/game/Handlers/MailHandler.cpp | |
parent | cecaab7948d5289439d1334d7bedcaae90e1fe3a (diff) | |
parent | 85ed0e32a9b2b029c1db3cf1a914b3940cf72b9b (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Conflicts:
dep/PackageList.txt
src/server/game/Movement/MotionMaster.cpp
src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
src/server/game/Movement/Spline/MoveSplineInit.h
src/server/game/World/World.h
Diffstat (limited to 'src/server/game/Handlers/MailHandler.cpp')
-rwxr-xr-x | src/server/game/Handlers/MailHandler.cpp | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index c30cbaa622e..ae04444a118 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -89,13 +89,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (!rc) { - sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", + sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND); return; } - sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); if (player->GetGUID() == rc) { @@ -107,7 +107,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) uint32 reqmoney = cost + money; - if (!player->HasEnoughMoney(reqmoney)) + if (!player->HasEnoughMoney(reqmoney) && !player->isGameMaster()) { player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY); return; @@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)", - GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account); + GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account); } item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable @@ -284,7 +284,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)", - GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account); + GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account); } } @@ -479,7 +479,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) sender_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); } sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", - GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); + GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); } else if (!receive) sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid); @@ -573,8 +573,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr) { - // packet send mail count as uint8, prevent overflow - if (mailsCount >= 254) + // Only first 50 mails are displayed + if (mailsCount >= 50) { realCount += 1; continue; @@ -586,7 +586,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) uint8 item_count = (*itr)->items.size(); // max count is MAX_MAIL_ITEMS (12) - size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+7*3*4+4+4+4+4+4+4+1); + size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1); if (data.wpos()+next_mail_size > maxPacketSize) { @@ -614,7 +614,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) } data << uint32((*itr)->COD); // COD - data << uint32(0); // probably changed in 3.3.3 + data << uint32(0); // package (Package.dbc) data << uint32((*itr)->stationery); // stationery (Stationery.dbc) data << uint32((*itr)->money); // Gold data << uint32((*itr)->checked); // flags @@ -655,8 +655,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) data << uint8(0); } - realCount += 1; - mailsCount += 1; + ++realCount; + ++mailsCount; } data.put<uint32>(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount @@ -713,7 +713,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data) bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender); bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK); - sLog->outDetail("HandleMailCreateTextItem mailid=%u", mailId); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleMailCreateTextItem mailid=%u", mailId); ItemPosCountVec dest; uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false); @@ -743,11 +743,12 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/) if (_player->unReadMails > 0) { - data << uint32(0); // float + data << float(0); // float data << uint32(0); // count uint32 count = 0; time_t now = time(NULL); + std::set<uint32> sentSenders; for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { Mail* m = (*itr); @@ -759,36 +760,29 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/) if (now < m->deliver_time) continue; - if (m->messageType) - data << uint64(m->sender); // player guid - else - data << uint32(m->sender); // creature entry + // only send each mail sender once + if (sentSenders.count(m->sender)) + continue; - switch (m->messageType) - { - case MAIL_AUCTION: - data << uint32(2); - data << uint32(2); - data << uint32(m->stationery); - break; - default: - data << uint32(0); - data << uint32(0); - data << uint32(m->stationery); - break; - } - data << uint32(0xC6000000); // float unk, time or something + data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid + data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries + data << uint32(m->messageType); + data << uint32(m->stationery); + data << float(m->deliver_time - now); + sentSenders.insert(m->sender); ++count; if (count == 2) // do not display more than 2 mails break; } + data.put<uint32>(4, count); } else { - data << uint32(0xC7A8C000); - data << uint32(0x00000000); + data << float(-DAY); + data << uint32(0); } + SendPacket(&data); } |