Пример #1
0
    public bool IsValid(SpawnSessionContext context)
    {
        if (RequiredStatusEffects.Count == 0)
        {
            return(true);
        }

        if (SearchDistance <= 0)
        {
            return(true);
        }

        List <Player> players = PlayerUtils.GetPlayersInRadius(context.SpawnerZdo.GetPosition(), SearchDistance);

        foreach (var player in players)
        {
            SEMan statusEffectManager = player.GetSEMan();

            if (RequiredStatusEffects.Any(x => statusEffectManager.HaveStatusEffect(x)))
            {
                return(true);
            }
        }

        return(false);
    }
    public bool IsValid(SpawnSessionContext context)
    {
        if (ItemsSearchedFor.Count == 0)
        {
            return(true);
        }

        if (SearchDistance <= 0)
        {
            return(true);
        }

        List <Player> players = PlayerUtils.GetPlayersInRadius(context.SpawnerZdo.GetPosition(), SearchDistance);

        foreach (var player in players)
        {
            if (player.IsNull())
            {
                continue;
            }

            var items = player.GetInventory()?.GetAllItems() ?? new(0);

            foreach (var item in items)
            {
                var itemPrefab = item?.m_dropPrefab;

                if (itemPrefab.IsNull())
                {
                    continue;
                }

                string itemName = itemPrefab.name.Trim().ToUpperInvariant();

                if (string.IsNullOrWhiteSpace(itemName))
                {
                    continue;
                }

                if (ItemsSearchedFor.Contains(itemName))
                {
                    return(true);
                }
            }
        }

        return(false);
    }
Пример #3
0
    public bool IsValid(SpawnSessionContext context)
    {
        if (RaritiesRequired.Count == 0)
        {
            return(true);
        }

        if (SearchDistance <= 0)
        {
            return(true);
        }

        List <Player> players = PlayerUtils.GetPlayersInRadius(context.SpawnerZdo.GetPosition(), SearchDistance);

        foreach (var player in players)
        {
            if (player.IsNull())
            {
                continue;
            }

            var items = player.GetInventory()?.GetAllItems() ?? new(0);

#if DEBUG && VERBOSE
            Log.LogTrace($"Player '{player.m_name}': {items.Join(x => x.m_shared.m_name + ":" + x?.Extended()?.GetComponent<MagicItemComponent>()?.MagicItem?.Rarity.ToRarity().ToString() ?? "")}");
#endif

            if (items.Any(x =>
            {
                var magicComponent = x?.Extended()?.GetComponent <MagicItemComponent>();

                if (magicComponent is null)
                {
                    return(false);
                }

                return(RaritiesRequired.Contains(magicComponent.MagicItem.Rarity.ToRarity()));
            }))
            {
                return(true);
            }
        }

        return(false);
    }
Пример #4
0
    public bool IsValid(SpawnSessionContext context)
    {
        if (LegendaryIds.Count == 0)
        {
            return(true);
        }

        if (SearchDistance <= 0)
        {
            return(false);
        }

        List <Player> players = PlayerUtils.GetPlayersInRadius(context.SpawnerZdo.GetPosition(), SearchDistance);

        foreach (var player in players)
        {
            if (player.IsNull())
            {
                continue;
            }

            var items = player.GetInventory()?.GetAllItems() ?? new(0);

            if (items.Any(
                    x =>
            {
                var magicComponent = x?.Extended()?.GetComponent <MagicItemComponent>();

                if (magicComponent is null)
                {
                    return(false);
                }

                return(LegendaryIds.Contains(magicComponent.MagicItem.LegendaryID?.Trim()?.ToUpperInvariant()));
            }))
            {
                return(true);
            }
        }

        return(false);
    }
    public bool IsValid(SpawnSessionContext context)
    {
        if (RequiredValue <= 0)
        {
            return(true);
        }

        if (SearchDistance <= 0)
        {
            return(true);
        }

        List <Player> players = PlayerUtils.GetPlayersInRadius(context.SpawnerZdo.GetPosition(), SearchDistance);

        var valueSum = 0;

        foreach (var player in players)
        {
            if (player.IsNull())
            {
                continue;
            }

            var items = player.GetInventory()?.GetAllItems() ?? Enumerable.Empty <ItemDrop.ItemData>();

#if DEBUG && VERBOSE
            Log.LogTrace($"Player '{player.m_name}': {items.Join(x => x.m_shared?.m_name)}");
#endif

            foreach (var item in items)
            {
                valueSum += item?.GetValue() ?? 0;
            }
        }

        return(valueSum >= RequiredValue);
    }