diff options
Diffstat (limited to 'src/server/game/Handlers/LootHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/LootHandler.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 7c3d9e99eee..692f5b80953 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -83,10 +83,9 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING); - if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) { - player->SendLootRelease(lguid); + player->SendLootError(lguid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL); return; } @@ -156,6 +155,8 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) if (creature->IsAlive()) shareMoney = false; } + else + player->SendLootError(guid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL); break; } default: @@ -403,21 +404,28 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) if (!_player->GetGroup() || _player->GetGroup()->GetMasterLooterGuid() != _player->GetGUID() || _player->GetGroup()->GetLootMethod() != MASTER_LOOT) { - _player->SendLootRelease(GetPlayer()->GetLootGUID()); + _player->SendLootError(lootguid, LOOT_ERROR_DIDNT_KILL); return; } Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER)); if (!target) + { + _player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND); return; + } TC_LOG_DEBUG("network", "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); if (_player->GetLootGUID() != lootguid) + { + _player->SendLootError(lootguid, LOOT_ERROR_DIDNT_KILL); return; + } if (!_player->IsInRaidWith(target) || !_player->IsInMap(target)) { + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); TC_LOG_INFO("loot", "MasterLootItem: Player %s tried to give an item to ineligible player %s !", GetPlayer()->GetName().c_str(), target->GetName().c_str()); return; } @@ -459,16 +467,21 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) msg = EQUIP_ERR_CANT_EQUIP_EVER; if (msg != EQUIP_ERR_OK) { + if (msg == EQUIP_ERR_ITEM_MAX_COUNT) + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_UNIQUE_ITEM); + else if (msg == EQUIP_ERR_INV_FULL) + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_INV_FULL); + else + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); + target->SendEquipError(msg, NULL, NULL, item.itemid); - // send duplicate of error massage to master looter - _player->SendEquipError(msg, NULL, NULL, item.itemid); return; } // list of players allowed to receive this item in trade AllowedLooterSet looters = item.GetAllowedLooters(); - // not move item from loot to target inventory + // now move item from loot to target inventory Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters); target->SendNewItem(newitem, uint32(item.count), false, false, true); target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); @@ -476,8 +489,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count); // mark as looted - item.count=0; - item.is_looted=true; + item.count = 0; + item.is_looted = true; loot->NotifyItemRemoved(slotid); --loot->unlootedCount; |