diff --git a/Source/Framework/Constants/LootConst.cs b/Source/Framework/Constants/LootConst.cs index 4f2be50f0..5f6713943 100644 --- a/Source/Framework/Constants/LootConst.cs +++ b/Source/Framework/Constants/LootConst.cs @@ -75,14 +75,17 @@ namespace Framework.Constants Pickpocketing = 2, Fishing = 3, Disenchanting = 4, - // Ignored Always By Client + Item = 5, Skinning = 6, - Prospecting = 7, - Milling = 8, + GatheringNode = 8, + Chest = 9, + CorpsePersonal = 14, Fishinghole = 20, // Unsupported By Client, Sending Fishing Instead Insignia = 21, // Unsupported By Client, Sending Corpse Instead - FishingJunk = 22 // unsupported by client, sending LOOT_FISHING instead + FishingJunk = 22, // unsupported by client, sending LOOT_FISHING instead + Prospecting = 23, + Milling = 24 } public enum LootItemType diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 7261eff92..8aac74687 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -445,6 +445,24 @@ namespace Framework.Constants { return slot >= PetSaveMode.FirstStableSlot && slot < PetSaveMode.LastStableSlot; } + + public static LootType GetLootTypeForClient(LootType lootType) + { + switch (lootType) + { + case LootType.Prospecting: + case LootType.Milling: + return LootType.Disenchanting; + case LootType.Insignia: + return LootType.Skinning; + case LootType.Fishinghole: + case LootType.FishingJunk: + return LootType.Fishing; + default: + break; + } + return lootType; + } } public enum Locale diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index a7018a149..a0f83eda3 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -6057,14 +6057,14 @@ namespace Game.Entities { SendNewItem(newitem, item.count, false, false, true); UpdateCriteria(CriteriaType.LootItem, item.itemid, item.count); - UpdateCriteria(CriteriaType.GetLootByType, item.itemid, item.count, (ulong)loot.loot_type); + UpdateCriteria(CriteriaType.GetLootByType, item.itemid, item.count, (uint)SharedConst.GetLootTypeForClient(loot.loot_type)); UpdateCriteria(CriteriaType.LootAnyItem, item.itemid, item.count); } else - aeResult.Add(newitem, item.count, loot.loot_type); + aeResult.Add(newitem, item.count, SharedConst.GetLootTypeForClient(loot.loot_type)); // LootItem is being removed (looted) from the container, delete it from the DB. - if (lootWorldObjectGuid.IsItem() && loot.loot_type == LootType.Corpse) + if (loot.loot_type == LootType.Item) Global.LootItemStorage.RemoveStoredLootItemForContainer(lootWorldObjectGuid.GetCounter(), item.itemid, item.count, item.itemIndex); ApplyItemLootedSpell(newitem, true); @@ -6158,19 +6158,19 @@ namespace Game.Entities if (!go) return true; - if (lootType == LootType.Skinning) + switch (lootType) { - // Disarm Trap - if (!go.IsWithinDistInMap(this, 20.0f)) - return true; - } - else - { - if (lootType != LootType.Fishinghole && ((lootType != LootType.Fishing && lootType != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID()) && !go.IsWithinDistInMap(this)) - return true; - - if (lootType == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault()) - return true; + case LootType.Fishing: + case LootType.FishingJunk: + if (go.GetOwnerGUID() != GetGUID()) + return true; + break; + case LootType.Fishinghole: + break; + default: + if (!go.IsWithinDistInMap(this)) + return true; + break; } return false; @@ -6480,19 +6480,6 @@ namespace Game.Entities } } - // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client - switch (loot_type) - { - case LootType.Insignia: - loot_type = LootType.Skinning; - break; - case LootType.Fishinghole: - case LootType.FishingJunk: - loot_type = LootType.Fishing; - break; - default: break; - } - // need know merged fishing/corpse loot type for achievements if (loot != null) loot.loot_type = loot_type; @@ -6515,14 +6502,14 @@ namespace Game.Entities } } - if (!aeLooting) + if (!guid.IsItem() && !aeLooting) SetLootGUID(guid); LootResponse packet = new(); packet.Owner = guid; packet.LootObj = loot.GetGUID(); packet.LootMethod = _lootMethod; - packet.AcquireReason = (byte)loot_type; + packet.AcquireReason = (byte)SharedConst.GetLootTypeForClient(loot_type); packet.Acquired = true; // false == No Loot (this too^^) packet.AELooting = aeLooting; loot.BuildLootResponse(packet, this, permission); diff --git a/Source/Game/Handlers/LootHandler.cs b/Source/Game/Handlers/LootHandler.cs index 19dece6c7..9048d83e7 100644 --- a/Source/Game/Handlers/LootHandler.cs +++ b/Source/Game/Handlers/LootHandler.cs @@ -257,7 +257,7 @@ namespace Game loot.gold = 0; // Delete the money loot record from the DB - if (guid.IsItem() && loot.loot_type == LootType.Corpse) + if (loot.loot_type == LootType.Item) Global.LootItemStorage.RemoveStoredMoneyForContainer(guid.GetCounter()); // Delete container if empty diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index db9f38f90..c112dafea 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -194,7 +194,7 @@ namespace Game .WithCallback(result => HandleOpenWrappedItemCallback(item.GetPos(), item.GetGUID(), result))); } else - player.SendLoot(item.GetGUID(), LootType.Corpse); + player.SendLoot(item.GetGUID(), LootType.Item); } void HandleOpenWrappedItemCallback(ushort pos, ObjectGuid itemGuid, SQLResult result) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 64a2b1e23..9e81a5a8b 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1349,7 +1349,7 @@ namespace Game.Spells } if (gameObjTarget != null) - SendLoot(guid, LootType.Skinning); + SendLoot(guid, LootType.Chest); else if (itemTarget != null) { itemTarget.SetItemFlag(ItemFieldFlags.Unlocked);