public void Modify(ref ItemDrop.ItemData drop, DropTemplate template, Vector3 position)
        {
            EpicLootItemConfiguration config = GetConfig(template);

            if (config is null)
            {
#if DEBUG
                Log.LogDebug("Found no config for drop template.");
#endif

                return;
            }

            if (drop is null)
            {
                return;
            }

#if DEBUG
            Log.LogDebug("Adding magic modifiers.");
#endif

            var magicItemData = ItemRoller.Roll(
                drop,
                position,
                config);

            if (magicItemData is not null)
            {
#if DEBUG
                Log.LogTrace($"Assigning magickified drop '{drop.m_shared.m_name}'.");
#endif
                drop = magicItemData;
            }
        }
Exemplo n.º 2
0
        private static void ModifyDrop(GameObject drop)
        {
            try
            {
                DropTemplate template = DropTemplateCache.GetTemplate(_currentWrapped);

                if (template is null)
                {
                    return;
                }

                DropModificationContext context = new DropModificationContext(drop, template);

                foreach (var modifier in template.Modifiers)
                {
                    try
                    {
                        modifier.Modify(context);
                    }
                    catch (Exception e)
                    {
                        Log.LogError($"Error while attempting to apply modifier '{modifier.GetType().Name}' to drop '{drop}'. Skipping modifier.", e);
                    }
                }
            }
            catch (Exception e)
            {
                Log.LogError($"Error while preparing to modify drop '{drop}'. Skipping modifiers.", e);
            }

            _currentWrapped = null;
        }
Exemplo n.º 3
0
        public bool ShouldFilter(DropSourceTemplateLink context, DropTemplate template)
        {
            if (IsValid(context.Source.transform.position, template?.Config))
            {
                return(false);
            }

            Log.LogTrace($"Filtered drop '{template.Drop.m_item.name}' due being outside required altitude.");
            return(true);
        }
        public bool ShouldFilter(DropSourceTemplateLink context, DropTemplate template)
        {
            if (IsValid(template.Config))
            {
                return(false);
            }

            Log.LogTrace($"Filtered drop '{template.Drop.m_item.name}' due to not finding required global key.");
            return(true);
        }
Exemplo n.º 5
0
        public bool ShouldFilter(DropSourceTemplateLink context, DropTemplate template)
        {
            if (IsValid(template?.Config))
            {
                return(false);
            }

            Log.LogTrace($"Filtered drop '{template.Drop.m_item.name}' due being outside allowed time of day.");
            return(true);
        }
        public bool ShouldFilter(DropSourceTemplateLink context, DropTemplate template)
        {
            if (IsValid(context.Source.transform.position, template?.Config))
            {
                return(false);
            }

            Log.LogTrace($"Filtered drop '{template.Drop.m_item.name}' due not being within required distance to center of map.");
            return(true);
        }
        public bool ShouldFilter(DropSourceTemplateLink context, DropTemplate template)
        {
            if (IsValid(template.Config))
            {
                return(false);
            }

            Log.LogTrace($"Filtered drop '{template.Drop.m_item.name}' due to current environment.");
            return(true);
        }
        public bool ShouldFilter(DropSourceTemplateLink context, DropTemplate template)
        {
            if (IsValid(template?.Config))
            {
                return(false);
            }

            Log.LogTrace($"Filtered drop '{template.Drop.m_item.name}' due to not being within required CLLC world level.");
            return(true);
        }
Exemplo n.º 9
0
        public void Modify(ref ItemDrop.ItemData drop, DropTemplate template, Vector3 position)
        {
            int qualityLevel = template.Config?.SetQualityLevel ?? 0;

            if (qualityLevel <= 0)
            {
                return;
            }

            drop.m_quality = qualityLevel;
        }
Exemplo n.º 10
0
    public void Modify(ref ItemDrop.ItemData drop, DropTemplate template, Vector3 position)
    {
        float durability = template.Config?.SetDurability ?? -1f;

        if (durability < 0)
        {
            return;
        }

        drop.m_durability = durability;
    }
Exemplo n.º 11
0
        private EpicLootItemConfiguration GetConfig(DropTemplate template)
        {
            if (template is null)
            {
                return(null);
            }

            if (template.Config.TryGet(EpicLootItemConfiguration.ModName, out Config cfg) && cfg is EpicLootItemConfiguration modConfig)
            {
                return(modConfig);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 12
0
        private static ItemDrop.ItemData ModifyContainerItem(ItemDrop.ItemData item, Container container)
        {
            try
            {
                // Make sure item has its prefab unwrapped.
                item.m_dropPrefab = item.m_dropPrefab.Unwrap();

                DropTemplate template = DropTemplateCache.GetTemplate(item);

                if (template is null)
                {
#if DEBUG
                    Log.LogDebug($"Failed to find template for {item?.m_dropPrefab}");
#endif
                    return(item);
                }

                foreach (var modifier in template.Modifiers)
                {
                    try
                    {
#if DEBUG
                        Log.LogTrace($"Applying modifier '{modifier.GetType().Name}'");
#endif

                        modifier.Modify(ref item, template, container.transform.position);
                    }
                    catch (Exception e)
                    {
                        Log.LogError($"Error while attempting to apply modifier '{modifier.GetType().Name}' to drop '{item.m_dropPrefab.name}'. Skipping modifier.", e);
                    }
                }
            }
            catch (Exception e)
            {
                Log.LogError($"Error while preparing to modify drop '{item.m_dropPrefab.name}'. Skipping modifiers.", e);
            }

            return(item);
        }