Core/Loot: Send DungeonEncounter id in SMSG_ITEM_PUSH_RESULT
Port From (https://github.com/TrinityCore/TrinityCore/commit/5a516fb6549e460e68b45005a17ec1b6217fefa5)
This commit is contained in:
@@ -547,8 +547,17 @@ namespace Game.AI
|
|||||||
summons.DespawnAll();
|
summons.DespawnAll();
|
||||||
_scheduler.CancelAll();
|
_scheduler.CancelAll();
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
|
{
|
||||||
|
if (me.loot != null)
|
||||||
|
{
|
||||||
|
DungeonEncounterRecord dungeonEncounter = instance.GetBossDungeonEncounter(_bossId);
|
||||||
|
if (dungeonEncounter != null)
|
||||||
|
me.loot.SetDungeonEncounterId(dungeonEncounter.Id);
|
||||||
|
}
|
||||||
|
|
||||||
instance.SetBossState(_bossId, EncounterState.Done);
|
instance.SetBossState(_bossId, EncounterState.Done);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void _JustEngagedWith(Unit who)
|
public void _JustEngagedWith(Unit who)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2502,7 +2502,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public void SendNewItem(Item item, uint quantity, bool pushed, bool created, bool broadcast = false)
|
public void SendNewItem(Item item, uint quantity, bool pushed, bool created, bool broadcast = false, uint dungeonEncounterId = 0)
|
||||||
{
|
{
|
||||||
if (item == null) // prevent crash
|
if (item == null) // prevent crash
|
||||||
return;
|
return;
|
||||||
@@ -2519,7 +2519,6 @@ namespace Game.Entities
|
|||||||
//packet.QuestLogItemID;
|
//packet.QuestLogItemID;
|
||||||
packet.Quantity = quantity;
|
packet.Quantity = quantity;
|
||||||
packet.QuantityInInventory = GetItemCount(item.GetEntry());
|
packet.QuantityInInventory = GetItemCount(item.GetEntry());
|
||||||
//packet.DungeonEncounterID;
|
|
||||||
packet.BattlePetSpeciesID = (int)item.GetModifier(ItemModifier.BattlePetSpeciesId);
|
packet.BattlePetSpeciesID = (int)item.GetModifier(ItemModifier.BattlePetSpeciesId);
|
||||||
packet.BattlePetBreedID = (int)item.GetModifier(ItemModifier.BattlePetBreedData) & 0xFFFFFF;
|
packet.BattlePetBreedID = (int)item.GetModifier(ItemModifier.BattlePetBreedData) & 0xFFFFFF;
|
||||||
packet.BattlePetBreedQuality = (item.GetModifier(ItemModifier.BattlePetBreedData) >> 24) & 0xFF;
|
packet.BattlePetBreedQuality = (item.GetModifier(ItemModifier.BattlePetBreedData) >> 24) & 0xFF;
|
||||||
@@ -2531,7 +2530,13 @@ namespace Game.Entities
|
|||||||
packet.DisplayText = ItemPushResult.DisplayType.Normal;
|
packet.DisplayText = ItemPushResult.DisplayType.Normal;
|
||||||
packet.Created = created;
|
packet.Created = created;
|
||||||
//packet.IsBonusRoll;
|
//packet.IsBonusRoll;
|
||||||
//packet.IsEncounterLoot;
|
|
||||||
|
if (dungeonEncounterId != 0)
|
||||||
|
{
|
||||||
|
packet.DisplayText = ItemPushResult.DisplayType.EncounterLoot;
|
||||||
|
packet.DungeonEncounterID = (int)dungeonEncounterId;
|
||||||
|
packet.IsEncounterLoot = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (broadcast && GetGroup() && !item.GetTemplate().HasFlag(ItemFlags3.DontReportLootLogToParty))
|
if (broadcast && GetGroup() && !item.GetTemplate().HasFlag(ItemFlags3.DontReportLootLogToParty))
|
||||||
GetGroup().BroadcastPacket(packet, true);
|
GetGroup().BroadcastPacket(packet, true);
|
||||||
@@ -6020,13 +6025,13 @@ namespace Game.Entities
|
|||||||
// if aeLooting then we must delay sending out item so that it appears properly stacked in chat
|
// if aeLooting then we must delay sending out item so that it appears properly stacked in chat
|
||||||
if (aeResult == null)
|
if (aeResult == null)
|
||||||
{
|
{
|
||||||
SendNewItem(newitem, item.count, false, false, true);
|
SendNewItem(newitem, item.count, false, false, true, loot.GetDungeonEncounterId());
|
||||||
UpdateCriteria(CriteriaType.LootItem, item.itemid, item.count);
|
UpdateCriteria(CriteriaType.LootItem, item.itemid, item.count);
|
||||||
UpdateCriteria(CriteriaType.GetLootByType, item.itemid, item.count, (uint)SharedConst.GetLootTypeForClient(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, SharedConst.GetLootTypeForClient(loot.loot_type));
|
aeResult.Add(newitem, item.count, SharedConst.GetLootTypeForClient(loot.loot_type), loot.GetDungeonEncounterId());
|
||||||
|
|
||||||
// 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 (loot.loot_type == LootType.Item)
|
if (loot.loot_type == LootType.Item)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
foreach (var resultValue in aeResult.GetByOrder())
|
foreach (var resultValue in aeResult.GetByOrder())
|
||||||
{
|
{
|
||||||
player.SendNewItem(resultValue.item, resultValue.count, false, false, true);
|
player.SendNewItem(resultValue.item, resultValue.count, false, false, true, resultValue.dungeonEncounterId);
|
||||||
player.UpdateCriteria(CriteriaType.LootItem, resultValue.item.GetEntry(), resultValue.count);
|
player.UpdateCriteria(CriteriaType.LootItem, resultValue.item.GetEntry(), resultValue.count);
|
||||||
player.UpdateCriteria(CriteriaType.GetLootByType, resultValue.item.GetEntry(), resultValue.count, (ulong)resultValue.lootType);
|
player.UpdateCriteria(CriteriaType.GetLootByType, resultValue.item.GetEntry(), resultValue.count, (ulong)resultValue.lootType);
|
||||||
player.UpdateCriteria(CriteriaType.LootAnyItem, resultValue.item.GetEntry(), resultValue.count);
|
player.UpdateCriteria(CriteriaType.LootAnyItem, resultValue.item.GetEntry(), resultValue.count);
|
||||||
@@ -445,7 +445,7 @@ namespace Game
|
|||||||
|
|
||||||
// now move item from loot to target inventory
|
// now move item from loot to target inventory
|
||||||
Item newitem = target.StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
Item newitem = target.StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||||
aeResult.Add(newitem, item.count, loot.loot_type);
|
aeResult.Add(newitem, item.count, loot.loot_type, loot.GetDungeonEncounterId());
|
||||||
|
|
||||||
// mark as looted
|
// mark as looted
|
||||||
item.count = 0;
|
item.count = 0;
|
||||||
|
|||||||
@@ -1087,6 +1087,9 @@ namespace Game.Loots
|
|||||||
|
|
||||||
public ObjectGuid GetLootMasterGUID() { return _lootMaster; }
|
public ObjectGuid GetLootMasterGUID() { return _lootMaster; }
|
||||||
|
|
||||||
|
public uint GetDungeonEncounterId() { return _dungeonEncounterId; }
|
||||||
|
public void SetDungeonEncounterId(uint dungeonEncounterId) { _dungeonEncounterId = dungeonEncounterId; }
|
||||||
|
|
||||||
public MultiMap<ObjectGuid, NotNormalLootItem> GetPlayerFFAItems() { return PlayerFFAItems; }
|
public MultiMap<ObjectGuid, NotNormalLootItem> GetPlayerFFAItems() { return PlayerFFAItems; }
|
||||||
|
|
||||||
public List<LootItem> items = new();
|
public List<LootItem> items = new();
|
||||||
@@ -1108,11 +1111,12 @@ namespace Game.Loots
|
|||||||
ObjectGuid _lootMaster;
|
ObjectGuid _lootMaster;
|
||||||
List<ObjectGuid> _allowedLooters = new();
|
List<ObjectGuid> _allowedLooters = new();
|
||||||
bool _wasOpened; // true if at least one player received the loot content
|
bool _wasOpened; // true if at least one player received the loot content
|
||||||
|
uint _dungeonEncounterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AELootResult
|
public class AELootResult
|
||||||
{
|
{
|
||||||
public void Add(Item item, byte count, LootType lootType)
|
public void Add(Item item, byte count, LootType lootType, uint dungeonEncounterId)
|
||||||
{
|
{
|
||||||
var id = _byItem.LookupByKey(item);
|
var id = _byItem.LookupByKey(item);
|
||||||
if (id != 0)
|
if (id != 0)
|
||||||
@@ -1127,6 +1131,7 @@ namespace Game.Loots
|
|||||||
value.item = item;
|
value.item = item;
|
||||||
value.count = count;
|
value.count = count;
|
||||||
value.lootType = lootType;
|
value.lootType = lootType;
|
||||||
|
value.dungeonEncounterId = dungeonEncounterId;
|
||||||
_byOrder.Add(value);
|
_byOrder.Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1144,6 +1149,7 @@ namespace Game.Loots
|
|||||||
public Item item;
|
public Item item;
|
||||||
public byte count;
|
public byte count;
|
||||||
public LootType lootType;
|
public LootType lootType;
|
||||||
|
public uint dungeonEncounterId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -693,6 +693,11 @@ namespace Game.Maps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DungeonEncounterRecord GetBossDungeonEncounter(uint id)
|
||||||
|
{
|
||||||
|
return id < bosses.Count ? bosses[id].GetDungeonEncounterForDifficulty(instance.GetDifficultyID()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target = null, uint miscvalue1 = 0)
|
public virtual bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target = null, uint miscvalue1 = 0)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Server, "Achievement system call CheckAchievementCriteriaMeet but instance script for map {0} not have implementation for achievement criteria {1}",
|
Log.outError(LogFilter.Server, "Achievement system call CheckAchievementCriteriaMeet but instance script for map {0} not have implementation for achievement criteria {1}",
|
||||||
|
|||||||
@@ -1267,6 +1267,8 @@ namespace Game.Spells
|
|||||||
if (addon != null)
|
if (addon != null)
|
||||||
loot.GenerateMoneyLoot(addon.Mingold, addon.Maxgold);
|
loot.GenerateMoneyLoot(addon.Mingold, addon.Maxgold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loot.SetDungeonEncounterId(gameObjTarget.GetGoInfo().Chest.DungeonEncounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo possible must be moved to loot release (in different from linked triggering)
|
/// @todo possible must be moved to loot release (in different from linked triggering)
|
||||||
|
|||||||
Reference in New Issue
Block a user