More centralised FiR status handing across server
This commit is contained in:
@@ -1128,17 +1128,37 @@ public class ItemHelper(
|
||||
/// Modifies passed in items
|
||||
/// </summary>
|
||||
/// <param name="items">The list of items to mark as FiR</param>
|
||||
public void SetFoundInRaid(List<Item> items)
|
||||
/// <param name="excludeCurrency">Skip adding FiR status to currency items</param>
|
||||
public void SetFoundInRaid(List<Item> items, bool excludeCurrency = true)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Upd == null)
|
||||
item.Upd = new();
|
||||
|
||||
if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
item.Upd ??= new();
|
||||
item.Upd.SpawnedInSession = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mark the passed in list of items as found in raid.
|
||||
/// Modifies passed in items
|
||||
/// </summary>
|
||||
/// <param name="item">The list of items to mark as FiR</param>
|
||||
/// <param name="excludeCurrency">Skip adding FiR status to currency items</param>
|
||||
public void SetFoundInRaid(Item item, bool excludeCurrency = true)
|
||||
{
|
||||
if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.Upd ??= new();
|
||||
item.Upd.SpawnedInSession = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do
|
||||
/// </summary>
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Core.Helpers
|
||||
_itemHelper.AddUpdObjectToItem(rewardItem);
|
||||
|
||||
// Reward items are granted Found in Raid status
|
||||
rewardItem.Upd.SpawnedInSession = true;
|
||||
_itemHelper.SetFoundInRaid(rewardItem);
|
||||
|
||||
// Is root item, fix stacks
|
||||
if (rewardItem.Id == reward.Target)
|
||||
|
||||
@@ -366,11 +366,12 @@ public class CircleOfCultistService(
|
||||
Upd = new Upd
|
||||
{
|
||||
StackObjectsCount = stackSize,
|
||||
SpawnedInSession = true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
_itemHelper.SetFoundInRaid(rewardItem);
|
||||
|
||||
// Edge case - item is ammo container and needs cartridges added
|
||||
if (_itemHelper.IsOfBaseclass(randomItemTplFromPool, BaseClasses.AMMO_BOX))
|
||||
{
|
||||
@@ -454,11 +455,12 @@ public class CircleOfCultistService(
|
||||
Upd = new Upd
|
||||
{
|
||||
StackObjectsCount = stackSize,
|
||||
SpawnedInSession = true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
_itemHelper.SetFoundInRaid(rewardItem);
|
||||
|
||||
// Edge case - item is ammo container and needs cartridges added
|
||||
if (_itemHelper.IsOfBaseclass(rewardTpl, BaseClasses.AMMO_BOX))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user