Core/Loot: Refactored Player::SendLoot to accept Loot object directly

Port From (https://github.com/TrinityCore/TrinityCore/commit/cbf2064c62137d9f0c0397956592f3ab9700480c)
This commit is contained in:
hondacrx
2022-09-18 22:22:44 -04:00
parent 6c7991c28f
commit 40f06a3fb0
6 changed files with 33 additions and 75 deletions
+3 -1
View File
@@ -99,11 +99,12 @@ namespace Game.Loots
public bool LoadStoredLoot(Item item, Player player)
{
Loot loot = item.GetLootForPlayer(player);
if (!_lootItemStorage.ContainsKey(item.GetGUID().GetCounter()))
return false;
var container = _lootItemStorage[item.GetGUID().GetCounter()];
Loot loot = new(player.GetMap(), item.GetGUID(), LootType.Item, null);
loot.gold = container.GetMoney();
LootTemplate lt = LootStorage.Items.GetLootFor(item.GetEntry());
@@ -141,6 +142,7 @@ namespace Game.Loots
}
// Mark the item if it has loot so it won't be generated again on open
item.loot = loot;
item.m_lootGenerated = true;
return true;
}