Core/Loot: Updated LootType enum for 9.2.7

Port From (https://github.com/TrinityCore/TrinityCore/commit/74dbed1d0ea11373b5765a4c53b1a762203fcbd2)
This commit is contained in:
hondacrx
2022-09-02 14:22:40 -04:00
parent 7bba4bdd79
commit 2cb4ea2ff2
6 changed files with 45 additions and 37 deletions
+7 -4
View File
@@ -75,14 +75,17 @@ namespace Framework.Constants
Pickpocketing = 2, Pickpocketing = 2,
Fishing = 3, Fishing = 3,
Disenchanting = 4, Disenchanting = 4,
// Ignored Always By Client Item = 5,
Skinning = 6, Skinning = 6,
Prospecting = 7, GatheringNode = 8,
Milling = 8, Chest = 9,
CorpsePersonal = 14,
Fishinghole = 20, // Unsupported By Client, Sending Fishing Instead Fishinghole = 20, // Unsupported By Client, Sending Fishing Instead
Insignia = 21, // Unsupported By Client, Sending Corpse 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 public enum LootItemType
+18
View File
@@ -445,6 +445,24 @@ namespace Framework.Constants
{ {
return slot >= PetSaveMode.FirstStableSlot && slot < PetSaveMode.LastStableSlot; 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 public enum Locale
+17 -30
View File
@@ -6057,14 +6057,14 @@ namespace Game.Entities
{ {
SendNewItem(newitem, item.count, false, false, true); SendNewItem(newitem, item.count, false, false, true);
UpdateCriteria(CriteriaType.LootItem, item.itemid, item.count); 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); UpdateCriteria(CriteriaType.LootAnyItem, item.itemid, item.count);
} }
else 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. // 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); Global.LootItemStorage.RemoveStoredLootItemForContainer(lootWorldObjectGuid.GetCounter(), item.itemid, item.count, item.itemIndex);
ApplyItemLootedSpell(newitem, true); ApplyItemLootedSpell(newitem, true);
@@ -6158,19 +6158,19 @@ namespace Game.Entities
if (!go) if (!go)
return true; return true;
if (lootType == LootType.Skinning) switch (lootType)
{ {
// Disarm Trap case LootType.Fishing:
if (!go.IsWithinDistInMap(this, 20.0f)) case LootType.FishingJunk:
return true; if (go.GetOwnerGUID() != GetGUID())
} return true;
else break;
{ case LootType.Fishinghole:
if (lootType != LootType.Fishinghole && ((lootType != LootType.Fishing && lootType != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID()) && !go.IsWithinDistInMap(this)) break;
return true; default:
if (!go.IsWithinDistInMap(this))
if (lootType == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault()) return true;
return true; break;
} }
return false; 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 // need know merged fishing/corpse loot type for achievements
if (loot != null) if (loot != null)
loot.loot_type = loot_type; loot.loot_type = loot_type;
@@ -6515,14 +6502,14 @@ namespace Game.Entities
} }
} }
if (!aeLooting) if (!guid.IsItem() && !aeLooting)
SetLootGUID(guid); SetLootGUID(guid);
LootResponse packet = new(); LootResponse packet = new();
packet.Owner = guid; packet.Owner = guid;
packet.LootObj = loot.GetGUID(); packet.LootObj = loot.GetGUID();
packet.LootMethod = _lootMethod; packet.LootMethod = _lootMethod;
packet.AcquireReason = (byte)loot_type; packet.AcquireReason = (byte)SharedConst.GetLootTypeForClient(loot_type);
packet.Acquired = true; // false == No Loot (this too^^) packet.Acquired = true; // false == No Loot (this too^^)
packet.AELooting = aeLooting; packet.AELooting = aeLooting;
loot.BuildLootResponse(packet, this, permission); loot.BuildLootResponse(packet, this, permission);
+1 -1
View File
@@ -257,7 +257,7 @@ namespace Game
loot.gold = 0; loot.gold = 0;
// Delete the money loot record from the DB // 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()); Global.LootItemStorage.RemoveStoredMoneyForContainer(guid.GetCounter());
// Delete container if empty // Delete container if empty
+1 -1
View File
@@ -194,7 +194,7 @@ namespace Game
.WithCallback(result => HandleOpenWrappedItemCallback(item.GetPos(), item.GetGUID(), result))); .WithCallback(result => HandleOpenWrappedItemCallback(item.GetPos(), item.GetGUID(), result)));
} }
else else
player.SendLoot(item.GetGUID(), LootType.Corpse); player.SendLoot(item.GetGUID(), LootType.Item);
} }
void HandleOpenWrappedItemCallback(ushort pos, ObjectGuid itemGuid, SQLResult result) void HandleOpenWrappedItemCallback(ushort pos, ObjectGuid itemGuid, SQLResult result)
+1 -1
View File
@@ -1349,7 +1349,7 @@ namespace Game.Spells
} }
if (gameObjTarget != null) if (gameObjTarget != null)
SendLoot(guid, LootType.Skinning); SendLoot(guid, LootType.Chest);
else if (itemTarget != null) else if (itemTarget != null)
{ {
itemTarget.SetItemFlag(ItemFieldFlags.Unlocked); itemTarget.SetItemFlag(ItemFieldFlags.Unlocked);