aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxinef1 <w.szyszko2@gmail.com>2017-02-04 14:58:50 +0100
committerShauren <shauren.trinity@gmail.com>2017-02-04 14:58:50 +0100
commitab6ac42bf032b723167c37caed875c76a1295ec6 (patch)
treef0e8b93195cbf239d7486534b180c6eaf69c6964 /src
parentce774918a7959b7780d6af9e095b3b5fcdbccfe2 (diff)
Core/Loot: Only allow the roll winner to loot the item he won in case it cannot be added to inventory instantly (full or any other reason) (#19037)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp7
-rw-r--r--src/server/game/Groups/Group.cpp8
-rw-r--r--src/server/game/Loot/LootMgr.cpp8
-rw-r--r--src/server/game/Loot/LootMgr.h1
4 files changed, 21 insertions, 3 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 9866d1e4af9..2edff5f9527 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -24515,6 +24515,13 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
return;
}
+ // dont allow protected item to be looted by someone else
+ if (!item->rollWinnerGUID.IsEmpty() && item->rollWinnerGUID != GetGUID())
+ {
+ SendLootRelease(GetLootGUID());
+ return;
+ }
+
ItemPosCountVec dest;
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
if (msg == EQUIP_ERR_OK)
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index d5d32f3a494..11d29ba8b62 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -1412,7 +1412,8 @@ void Group::CountTheRoll(Rolls::iterator rollI)
else
{
item->is_blocked = false;
- player->SendEquipError(msg, NULL, NULL, roll->itemid);
+ item->rollWinnerGUID = player->GetGUID();
+ player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
}
}
}
@@ -1464,7 +1465,8 @@ void Group::CountTheRoll(Rolls::iterator rollI)
else
{
item->is_blocked = false;
- player->SendEquipError(msg, NULL, NULL, roll->itemid);
+ item->rollWinnerGUID = player->GetGUID();
+ player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
}
}
else if (rollvote == DISENCHANT)
@@ -1488,7 +1490,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
for (uint32 i = 0; i < max_slot; ++i)
{
LootItem* lootItem = loot.LootItemInSlot(i, player);
- player->SendEquipError(msg, NULL, NULL, lootItem->itemid);
+ player->SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
player->SendItemRetrievalMail(lootItem->itemid, lootItem->count);
}
}
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 03545894a8a..d25eca4b036 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -365,6 +365,7 @@ LootItem::LootItem(LootStoreItem const& li)
is_blocked = 0;
is_underthreshold = 0;
is_counted = 0;
+ rollWinnerGUID = ObjectGuid::Empty;
canSave = true;
}
@@ -921,6 +922,13 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
continue;
}
}
+ else if (!l.items[i].rollWinnerGUID.IsEmpty())
+ {
+ if (l.items[i].rollWinnerGUID == lv.viewer->GetGUID())
+ slot_type = LOOT_SLOT_TYPE_OWNER;
+ else
+ continue;
+ }
else if (l.roundRobinPlayer.IsEmpty() || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold)
{
// no round robin owner or he has released the loot
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 7f4c9d0e920..cb66025b21a 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -155,6 +155,7 @@ struct TC_GAME_API LootItem
int32 randomPropertyId;
ConditionContainer conditions; // additional loot condition
AllowedLooterSet allowedGUIDs;
+ ObjectGuid rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list!
uint8 count : 8;
bool is_looted : 1;
bool is_blocked : 1;