Core/Loot: Set loot guid and type in Loot constructor
Port From (https://github.com/TrinityCore/TrinityCore/commit/e9d083a2ee59d297271b04f3b7fb63808f7f0c8c)
This commit is contained in:
@@ -5896,7 +5896,7 @@ namespace Game.Entities
|
|||||||
public void AutoStoreLoot(uint loot_id, LootStore store, ItemContext context = 0, bool broadcast = false, bool createdByPlayer = false) { AutoStoreLoot(ItemConst.NullBag, ItemConst.NullSlot, loot_id, store, context, broadcast); }
|
public void AutoStoreLoot(uint loot_id, LootStore store, ItemContext context = 0, bool broadcast = false, bool createdByPlayer = false) { AutoStoreLoot(ItemConst.NullBag, ItemConst.NullSlot, loot_id, store, context, broadcast); }
|
||||||
void AutoStoreLoot(byte bag, byte slot, uint loot_id, LootStore store, ItemContext context = 0, bool broadcast = false, bool createdByPlayer = false)
|
void AutoStoreLoot(byte bag, byte slot, uint loot_id, LootStore store, ItemContext context = 0, bool broadcast = false, bool createdByPlayer = false)
|
||||||
{
|
{
|
||||||
Loot loot = new();
|
Loot loot = new(null, ObjectGuid.Empty, LootType.None);
|
||||||
loot.FillLoot(loot_id, store, this, true, false, LootModes.Default, context);
|
loot.FillLoot(loot_id, store, this, true, false, LootModes.Default, context);
|
||||||
|
|
||||||
uint max_slot = loot.GetMaxSlotInLootFor(this);
|
uint max_slot = loot.GetMaxSlotInLootFor(this);
|
||||||
@@ -6015,9 +6015,9 @@ namespace Game.Entities
|
|||||||
qitem.is_looted = true;
|
qitem.is_looted = true;
|
||||||
//freeforall is 1 if everyone's supposed to get the quest item.
|
//freeforall is 1 if everyone's supposed to get the quest item.
|
||||||
if (item.freeforall || loot.GetPlayerQuestItems().Count == 1)
|
if (item.freeforall || loot.GetPlayerQuestItems().Count == 1)
|
||||||
SendNotifyLootItemRemoved(loot.GetGUID(), lootSlot);
|
SendNotifyLootItemRemoved(loot.GetGUID(), loot.GetOwnerGUID(), lootSlot);
|
||||||
else
|
else
|
||||||
loot.NotifyQuestItemRemoved(qitem.index);
|
loot.NotifyQuestItemRemoved(qitem.index, GetMap());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -6025,14 +6025,14 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
//freeforall case, notify only one player of the removal
|
//freeforall case, notify only one player of the removal
|
||||||
ffaitem.is_looted = true;
|
ffaitem.is_looted = true;
|
||||||
SendNotifyLootItemRemoved(loot.GetGUID(), lootSlot);
|
SendNotifyLootItemRemoved(loot.GetGUID(), loot.GetOwnerGUID(), lootSlot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//not freeforall, notify everyone
|
//not freeforall, notify everyone
|
||||||
if (conditem != null)
|
if (conditem != null)
|
||||||
conditem.is_looted = true;
|
conditem.is_looted = true;
|
||||||
loot.NotifyItemRemoved(lootSlot);
|
loot.NotifyItemRemoved(lootSlot, GetMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6105,8 +6105,7 @@ namespace Game.Entities
|
|||||||
// Now we must make bones lootable, and send player loot
|
// Now we must make bones lootable, and send player loot
|
||||||
bones.SetCorpseDynamicFlag(CorpseDynFlags.Lootable);
|
bones.SetCorpseDynamicFlag(CorpseDynFlags.Lootable);
|
||||||
|
|
||||||
bones.loot = new Loot();
|
bones.loot = new Loot(GetMap(), bones.GetGUID(), LootType.Insignia);
|
||||||
bones.loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, GetMapId(), 0, GetMap().GenerateLowGuid(HighGuid.LootObject)));
|
|
||||||
|
|
||||||
// For AV Achievement
|
// For AV Achievement
|
||||||
Battleground bg = GetBattleground();
|
Battleground bg = GetBattleground();
|
||||||
@@ -6203,8 +6202,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loot = new Loot();
|
loot = new Loot(GetMap(), guid, loot_type);
|
||||||
loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, go.GetMapId(), 0, go.GetMap().GenerateLowGuid(HighGuid.LootObject)));
|
|
||||||
if (go.GetMap().Is25ManRaid())
|
if (go.GetMap().Is25ManRaid())
|
||||||
loot.maxDuplicates = 3;
|
loot.maxDuplicates = 3;
|
||||||
|
|
||||||
@@ -6305,8 +6303,7 @@ namespace Game.Entities
|
|||||||
if (!item.m_lootGenerated && !Global.LootItemStorage.LoadStoredLoot(item, this))
|
if (!item.m_lootGenerated && !Global.LootItemStorage.LoadStoredLoot(item, this))
|
||||||
{
|
{
|
||||||
item.m_lootGenerated = true;
|
item.m_lootGenerated = true;
|
||||||
loot = new Loot();
|
loot = new Loot(GetMap(), guid, loot_type);
|
||||||
loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, GetMapId(), 0, GetMap().GenerateLowGuid(HighGuid.LootObject)));
|
|
||||||
item.loot = loot;
|
item.loot = loot;
|
||||||
|
|
||||||
switch (loot_type)
|
switch (loot_type)
|
||||||
@@ -6480,10 +6477,6 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// need know merged fishing/corpse loot type for achievements
|
|
||||||
if (loot != null)
|
|
||||||
loot.loot_type = loot_type;
|
|
||||||
|
|
||||||
if (permission != PermissionTypes.None)
|
if (permission != PermissionTypes.None)
|
||||||
{
|
{
|
||||||
LootMethod _lootMethod = LootMethod.FreeForAll;
|
LootMethod _lootMethod = LootMethod.FreeForAll;
|
||||||
@@ -6543,11 +6536,11 @@ namespace Game.Entities
|
|||||||
SendPacket(packet);
|
SendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendNotifyLootItemRemoved(ObjectGuid lootObj, byte lootSlot)
|
public void SendNotifyLootItemRemoved(ObjectGuid lootObj, ObjectGuid owner, byte lootSlot)
|
||||||
{
|
{
|
||||||
LootRemoved packet = new();
|
LootRemoved packet = new();
|
||||||
packet.Owner = GetLootWorldObjectGUID(lootObj);
|
|
||||||
packet.LootObj = lootObj;
|
packet.LootObj = lootObj;
|
||||||
|
packet.Owner = owner;
|
||||||
packet.LootListID = (byte)(lootSlot + 1);
|
packet.LootListID = (byte)(lootSlot + 1);
|
||||||
SendPacket(packet);
|
SendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -776,9 +776,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (creature)
|
if (creature)
|
||||||
{
|
{
|
||||||
creature.loot = new Loot();
|
creature.loot = new Loot(creature.GetMap(), creature.GetGUID(), LootType.Corpse);
|
||||||
Loot loot = creature.loot;
|
Loot loot = creature.loot;
|
||||||
loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, creature.GetMapId(), 0, creature.GetMap().GenerateLowGuid(HighGuid.LootObject)));
|
|
||||||
if (creature.GetMap().Is25ManRaid())
|
if (creature.GetMap().Is25ManRaid())
|
||||||
loot.maxDuplicates = 3;
|
loot.maxDuplicates = 3;
|
||||||
|
|
||||||
|
|||||||
@@ -1272,7 +1272,7 @@ namespace Game.Groups
|
|||||||
if (msg == InventoryResult.Ok)
|
if (msg == InventoryResult.Ok)
|
||||||
{
|
{
|
||||||
item.is_looted = true;
|
item.is_looted = true;
|
||||||
roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
|
roll.GetLoot().NotifyItemRemoved(roll.itemSlot, allowedMap);
|
||||||
roll.GetLoot().unlootedCount--;
|
roll.GetLoot().unlootedCount--;
|
||||||
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||||
}
|
}
|
||||||
@@ -1338,7 +1338,7 @@ namespace Game.Groups
|
|||||||
if (msg == InventoryResult.Ok)
|
if (msg == InventoryResult.Ok)
|
||||||
{
|
{
|
||||||
item.is_looted = true;
|
item.is_looted = true;
|
||||||
roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
|
roll.GetLoot().NotifyItemRemoved(roll.itemSlot, allowedMap);
|
||||||
roll.GetLoot().unlootedCount--;
|
roll.GetLoot().unlootedCount--;
|
||||||
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||||
}
|
}
|
||||||
@@ -1352,7 +1352,7 @@ namespace Game.Groups
|
|||||||
else if (rollVote == RollType.Disenchant)
|
else if (rollVote == RollType.Disenchant)
|
||||||
{
|
{
|
||||||
item.is_looted = true;
|
item.is_looted = true;
|
||||||
roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
|
roll.GetLoot().NotifyItemRemoved(roll.itemSlot, allowedMap);
|
||||||
roll.GetLoot().unlootedCount--;
|
roll.GetLoot().unlootedCount--;
|
||||||
player.UpdateCriteria(CriteriaType.CastSpell, 13262); // Disenchant
|
player.UpdateCriteria(CriteriaType.CastSpell, 13262); // Disenchant
|
||||||
|
|
||||||
@@ -1364,7 +1364,7 @@ namespace Game.Groups
|
|||||||
player.AutoStoreLoot(disenchant.Id, LootStorage.Disenchant, ItemContext.None, true);
|
player.AutoStoreLoot(disenchant.Id, LootStorage.Disenchant, ItemContext.None, true);
|
||||||
else // If the player's inventory is full, send the disenchant result in a mail.
|
else // If the player's inventory is full, send the disenchant result in a mail.
|
||||||
{
|
{
|
||||||
Loot loot = new();
|
Loot loot = new(allowedMap, roll.GetLoot().GetOwnerGUID(), LootType.Disenchanting);
|
||||||
loot.FillLoot(disenchant.Id, LootStorage.Disenchant, player, true);
|
loot.FillLoot(disenchant.Id, LootStorage.Disenchant, player, true);
|
||||||
|
|
||||||
uint max_slot = loot.GetMaxSlotInLootFor(player);
|
uint max_slot = loot.GetMaxSlotInLootFor(player);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace Game
|
|||||||
if (loot == null)
|
if (loot == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
loot.NotifyMoneyRemoved();
|
loot.NotifyMoneyRemoved(player.GetMap());
|
||||||
if (shareMoney && player.GetGroup() != null) //item, pickpocket and players can be looted only single player
|
if (shareMoney && player.GetGroup() != null) //item, pickpocket and players can be looted only single player
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -578,7 +578,7 @@ namespace Game
|
|||||||
item.count = 0;
|
item.count = 0;
|
||||||
item.is_looted = true;
|
item.is_looted = true;
|
||||||
|
|
||||||
loot.NotifyItemRemoved(slotid);
|
loot.NotifyItemRemoved(slotid, GetPlayer().GetMap());
|
||||||
--loot.unlootedCount;
|
--loot.unlootedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-44
@@ -23,6 +23,7 @@ using Game.Groups;
|
|||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Game.Maps;
|
||||||
|
|
||||||
namespace Game.Loots
|
namespace Game.Loots
|
||||||
{
|
{
|
||||||
@@ -165,16 +166,17 @@ namespace Game.Loots
|
|||||||
|
|
||||||
public class Loot
|
public class Loot
|
||||||
{
|
{
|
||||||
public Loot()
|
public Loot(Map map, ObjectGuid owner, LootType type)
|
||||||
{
|
{
|
||||||
gold = 0;
|
loot_type = type;
|
||||||
unlootedCount = 0;
|
|
||||||
loot_type = LootType.None;
|
|
||||||
maxDuplicates = 1;
|
maxDuplicates = 1;
|
||||||
|
_guid = map ? ObjectGuid.Create(HighGuid.LootObject, map.GetId(), 0, map.GenerateLowGuid(HighGuid.LootObject)) : ObjectGuid.Empty;
|
||||||
|
_owner = owner;
|
||||||
|
_itemContext = ItemContext.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inserts the item into the loot (called by LootTemplate processors)
|
// Inserts the item into the loot (called by LootTemplate processors)
|
||||||
public void AddItem(LootStoreItem item)
|
public void AddItem(LootStoreItem item, Player player)
|
||||||
{
|
{
|
||||||
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(item.itemid);
|
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(item.itemid);
|
||||||
if (proto == null)
|
if (proto == null)
|
||||||
@@ -202,23 +204,19 @@ namespace Game.Loots
|
|||||||
|
|
||||||
// In some cases, a dropped item should be visible/lootable only for some players in group
|
// In some cases, a dropped item should be visible/lootable only for some players in group
|
||||||
bool canSeeItemInLootWindow = false;
|
bool canSeeItemInLootWindow = false;
|
||||||
Player player = Global.ObjAccessor.FindPlayer(lootOwnerGUID);
|
Group group = player.GetGroup();
|
||||||
if (player != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
Group group = player.GetGroup();
|
for (GroupReference itr = group.GetFirstMember(); itr != null; itr = itr.Next())
|
||||||
if (group != null)
|
|
||||||
{
|
{
|
||||||
for (GroupReference itr = group.GetFirstMember(); itr != null; itr = itr.Next())
|
Player member = itr.GetSource();
|
||||||
{
|
if (member != null)
|
||||||
Player member = itr.GetSource();
|
if (generatedLoot.AllowedForPlayer(member))
|
||||||
if (member != null)
|
canSeeItemInLootWindow = true;
|
||||||
if (generatedLoot.AllowedForPlayer(member))
|
|
||||||
canSeeItemInLootWindow = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generatedLoot.AllowedForPlayer(player))
|
|
||||||
canSeeItemInLootWindow = true;
|
|
||||||
}
|
}
|
||||||
|
else if (generatedLoot.AllowedForPlayer(player))
|
||||||
|
canSeeItemInLootWindow = true;
|
||||||
|
|
||||||
if (!canSeeItemInLootWindow)
|
if (!canSeeItemInLootWindow)
|
||||||
continue;
|
continue;
|
||||||
@@ -250,8 +248,6 @@ namespace Game.Loots
|
|||||||
if (lootOwner == null)
|
if (lootOwner == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lootOwnerGUID = lootOwner.GetGUID();
|
|
||||||
|
|
||||||
LootTemplate tab = store.GetLootFor(lootId);
|
LootTemplate tab = store.GetLootFor(lootId);
|
||||||
if (tab == null)
|
if (tab == null)
|
||||||
{
|
{
|
||||||
@@ -262,7 +258,7 @@ namespace Game.Loots
|
|||||||
|
|
||||||
_itemContext = context;
|
_itemContext = context;
|
||||||
|
|
||||||
tab.Process(this, store.IsRatesAllowed(), (byte)lootMode); // Processing is done there, callback via Loot.AddItem()
|
tab.Process(this, store.IsRatesAllowed(), (byte)lootMode, 0, lootOwner); // Processing is done there, callback via Loot.AddItem()
|
||||||
|
|
||||||
// Setting access rights for group loot case
|
// Setting access rights for group loot case
|
||||||
Group group = lootOwner.GetGroup();
|
Group group = lootOwner.GetGroup();
|
||||||
@@ -396,34 +392,21 @@ namespace Game.Loots
|
|||||||
return ql;
|
return ql;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyItemRemoved(byte lootIndex)
|
public void NotifyItemRemoved(byte lootIndex, Map map)
|
||||||
{
|
{
|
||||||
// notify all players that are looting this that the item was removed
|
// notify all players that are looting this that the item was removed
|
||||||
// convert the index to the slot the player sees
|
// convert the index to the slot the player sees
|
||||||
for (int i = 0; i < PlayersLooting.Count; ++i)
|
for (int i = 0; i < PlayersLooting.Count; ++i)
|
||||||
{
|
{
|
||||||
Player player = Global.ObjAccessor.FindPlayer(PlayersLooting[i]);
|
Player player = Global.ObjAccessor.GetPlayer(map, PlayersLooting[i]);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
player.SendNotifyLootItemRemoved(GetGUID(), lootIndex);
|
player.SendNotifyLootItemRemoved(GetGUID(), GetOwnerGUID(), lootIndex);
|
||||||
else
|
else
|
||||||
PlayersLooting.RemoveAt(i);
|
PlayersLooting.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyMoneyRemoved()
|
public void NotifyQuestItemRemoved(byte questIndex, Map map)
|
||||||
{
|
|
||||||
// notify all players that are looting this that the money was removed
|
|
||||||
for (var i = 0; i < PlayersLooting.Count; ++i)
|
|
||||||
{
|
|
||||||
Player player = Global.ObjAccessor.FindPlayer(PlayersLooting[i]);
|
|
||||||
if (player != null)
|
|
||||||
player.SendNotifyLootMoneyRemoved(GetGUID());
|
|
||||||
else
|
|
||||||
PlayersLooting.RemoveAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void NotifyQuestItemRemoved(byte questIndex)
|
|
||||||
{
|
{
|
||||||
// when a free for all questitem is looted
|
// when a free for all questitem is looted
|
||||||
// all players will get notified of it being removed
|
// all players will get notified of it being removed
|
||||||
@@ -431,7 +414,7 @@ namespace Game.Loots
|
|||||||
// bit inefficient but isn't called often
|
// bit inefficient but isn't called often
|
||||||
for (var i = 0; i < PlayersLooting.Count; ++i)
|
for (var i = 0; i < PlayersLooting.Count; ++i)
|
||||||
{
|
{
|
||||||
Player player = Global.ObjAccessor.FindPlayer(PlayersLooting[i]);
|
Player player = Global.ObjAccessor.GetPlayer(map, PlayersLooting[i]);
|
||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
var pql = PlayerQuestItems.LookupByKey(player.GetGUID());
|
var pql = PlayerQuestItems.LookupByKey(player.GetGUID());
|
||||||
@@ -443,7 +426,7 @@ namespace Game.Loots
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (j < pql.Count)
|
if (j < pql.Count)
|
||||||
player.SendNotifyLootItemRemoved(GetGUID(), (byte)(items.Count + j));
|
player.SendNotifyLootItemRemoved(GetGUID(), GetOwnerGUID(), (byte)(items.Count + j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -451,6 +434,19 @@ namespace Game.Loots
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NotifyMoneyRemoved(Map map)
|
||||||
|
{
|
||||||
|
// notify all players that are looting this that the money was removed
|
||||||
|
for (var i = 0; i < PlayersLooting.Count; ++i)
|
||||||
|
{
|
||||||
|
Player player = Global.ObjAccessor.GetPlayer(map, PlayersLooting[i]);
|
||||||
|
if (player != null)
|
||||||
|
player.SendNotifyLootMoneyRemoved(GetGUID());
|
||||||
|
else
|
||||||
|
PlayersLooting.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void GenerateMoneyLoot(uint minAmount, uint maxAmount)
|
public void GenerateMoneyLoot(uint minAmount, uint maxAmount)
|
||||||
{
|
{
|
||||||
if (maxAmount > 0)
|
if (maxAmount > 0)
|
||||||
@@ -835,8 +831,8 @@ namespace Game.Loots
|
|||||||
public void AddLooter(ObjectGuid guid) { PlayersLooting.Add(guid); }
|
public void AddLooter(ObjectGuid guid) { PlayersLooting.Add(guid); }
|
||||||
public void RemoveLooter(ObjectGuid guid) { PlayersLooting.Remove(guid); }
|
public void RemoveLooter(ObjectGuid guid) { PlayersLooting.Remove(guid); }
|
||||||
|
|
||||||
public ObjectGuid GetGUID() { return _GUID; }
|
public ObjectGuid GetGUID() { return _guid; }
|
||||||
public void SetGUID(ObjectGuid guid) { _GUID = guid; }
|
public ObjectGuid GetOwnerGUID() { return _owner; }
|
||||||
|
|
||||||
public MultiMap<ObjectGuid, NotNormalLootItem> GetPlayerQuestItems() { return PlayerQuestItems; }
|
public MultiMap<ObjectGuid, NotNormalLootItem> GetPlayerQuestItems() { return PlayerQuestItems; }
|
||||||
public MultiMap<ObjectGuid, NotNormalLootItem> GetPlayerFFAItems() { return PlayerFFAItems; }
|
public MultiMap<ObjectGuid, NotNormalLootItem> GetPlayerFFAItems() { return PlayerFFAItems; }
|
||||||
@@ -847,7 +843,6 @@ namespace Game.Loots
|
|||||||
public uint gold;
|
public uint gold;
|
||||||
public byte unlootedCount;
|
public byte unlootedCount;
|
||||||
public ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
|
public ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
|
||||||
ObjectGuid lootOwnerGUID;
|
|
||||||
public LootType loot_type; // required for achievement system
|
public LootType loot_type; // required for achievement system
|
||||||
public byte maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
|
public byte maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
|
||||||
|
|
||||||
@@ -860,7 +855,8 @@ namespace Game.Loots
|
|||||||
LootValidatorRefManager i_LootValidatorRefManager = new();
|
LootValidatorRefManager i_LootValidatorRefManager = new();
|
||||||
|
|
||||||
// Loot GUID
|
// Loot GUID
|
||||||
ObjectGuid _GUID;
|
ObjectGuid _guid;
|
||||||
|
ObjectGuid _owner; // The WorldObject that holds this loot
|
||||||
ItemContext _itemContext;
|
ItemContext _itemContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -707,7 +707,7 @@ namespace Game.Loots
|
|||||||
Entries.Add(item);
|
Entries.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(Loot loot, bool rate, ushort lootMode, byte groupId = 0)
|
public void Process(Loot loot, bool rate, ushort lootMode, byte groupId, Player player)
|
||||||
{
|
{
|
||||||
if (groupId != 0) // Group reference uses own processing of the group
|
if (groupId != 0) // Group reference uses own processing of the group
|
||||||
{
|
{
|
||||||
@@ -717,7 +717,7 @@ namespace Game.Loots
|
|||||||
if (Groups[groupId - 1] == null)
|
if (Groups[groupId - 1] == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Groups[groupId - 1].Process(loot, lootMode);
|
Groups[groupId - 1].Process(loot, lootMode, player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,17 +738,17 @@ namespace Game.Loots
|
|||||||
|
|
||||||
uint maxcount = (uint)(item.maxcount * WorldConfig.GetFloatValue(WorldCfg.RateDropItemReferencedAmount));
|
uint maxcount = (uint)(item.maxcount * WorldConfig.GetFloatValue(WorldCfg.RateDropItemReferencedAmount));
|
||||||
for (uint loop = 0; loop < maxcount; ++loop) // Ref multiplicator
|
for (uint loop = 0; loop < maxcount; ++loop) // Ref multiplicator
|
||||||
Referenced.Process(loot, rate, lootMode, item.groupid);
|
Referenced.Process(loot, rate, lootMode, item.groupid, player);
|
||||||
}
|
}
|
||||||
else // Plain entries (not a reference, not grouped)
|
else // Plain entries (not a reference, not grouped)
|
||||||
loot.AddItem(item); // Chance is already checked, just add
|
loot.AddItem(item, player); // Chance is already checked, just add
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now processing groups
|
// Now processing groups
|
||||||
foreach (var group in Groups.Values)
|
foreach (var group in Groups.Values)
|
||||||
{
|
{
|
||||||
if (group != null)
|
if (group != null)
|
||||||
group.Process(loot, lootMode);
|
group.Process(loot, lootMode, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void CopyConditions(List<Condition> conditions)
|
public void CopyConditions(List<Condition> conditions)
|
||||||
@@ -971,11 +971,11 @@ namespace Game.Loots
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(Loot loot, ushort lootMode)
|
public void Process(Loot loot, ushort lootMode, Player player)
|
||||||
{
|
{
|
||||||
LootStoreItem item = Roll(loot, lootMode);
|
LootStoreItem item = Roll(loot, lootMode);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
loot.AddItem(item);
|
loot.AddItem(item, player);
|
||||||
}
|
}
|
||||||
float RawTotalChance()
|
float RawTotalChance()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Game.Mails
|
|||||||
if (m_mailTemplateId == 123)
|
if (m_mailTemplateId == 123)
|
||||||
m_money = 1000000;
|
m_money = 1000000;
|
||||||
|
|
||||||
Loot mailLoot = new();
|
Loot mailLoot = new(null, ObjectGuid.Empty, LootType.None);
|
||||||
|
|
||||||
// can be empty
|
// can be empty
|
||||||
mailLoot.FillLoot(m_mailTemplateId, LootStorage.Mail, receiver, true, true, LootModes.Default, ItemContext.None);
|
mailLoot.FillLoot(m_mailTemplateId, LootStorage.Mail, receiver, true, true, LootModes.Default, ItemContext.None);
|
||||||
|
|||||||
Reference in New Issue
Block a user