Core/Loot: Implemented currency loot

Port From (https://github.com/TrinityCore/TrinityCore/commit/3e28ee080a1cf3c7cd332a8d1e0808505b4ea9d4)
This commit is contained in:
Hondacrx
2024-10-09 00:18:14 -04:00
parent 57858e1bed
commit 4c3074d462
11 changed files with 494 additions and 214 deletions
+7 -1
View File
@@ -427,11 +427,17 @@ namespace Game
if (req.LootListID >= loot.items.Count)
{
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterOther);
Log.outDebug(LogFilter.Loot, $"MasterLootItem: Player {GetPlayer().GetName()} might be using a hack! (slot {req.LootListID}, size {loot.items.Count})");
return;
}
LootItem item = loot.items[req.LootListID];
if (item.type != LootItemType.Item)
{
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterOther);
return;
}
List<ItemPosCount> dest = new();
InventoryResult msg = target.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count);
@@ -452,7 +458,7 @@ namespace Game
// now move item from loot to target inventory
Item newitem = target.StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
if (newitem != null)
aeResult.Add(newitem, item.count, loot.loot_type, loot.GetDungeonEncounterId());
aeResult.Add(newitem, (byte)item.count, loot.loot_type, loot.GetDungeonEncounterId());
else
target.ApplyItemLootedSpell(Global.ObjectMgr.GetItemTemplate(item.itemid));