Exemple #1
0
        private async Task ProcessKill(JsonZKill.Killmail kill)
        {
            try
            {
                // kill = JsonConvert.DeserializeObject<JsonZKill.Killmail>(File.ReadAllText("testkm.txt"));

                var hasBeenPosted = false;
                foreach (var(groupName, group) in Settings.LiveKillFeedModule.Groups)
                {
                    if (Settings.ZKBSettingsModule.AvoidDupesAcrossAllFeeds && ZKillLiveFeedModule.IsInSharedPool(kill.killmail_id))
                    {
                        return;
                    }

                    if (hasBeenPosted && Settings.LiveKillFeedModule.StopOnFirstGroupMatch)
                    {
                        break;
                    }

                    if (UpdateLastPosted(groupName, kill.killmail_id))
                    {
                        continue;
                    }

                    var isPveKill = kill.zkb.npc;
                    var isPvpKill = !kill.zkb.npc;

                    if ([email protected] && isPveKill || [email protected] && isPvpKill)
                    {
                        continue;
                    }
                    if (!group.FeedAwoxKills && kill.zkb.awox)
                    {
                        continue;
                    }
                    if (!group.FeedNotAwoxKills && !kill.zkb.awox)
                    {
                        continue;
                    }
                    if (!group.FeedSoloKills && kill.zkb.solo)
                    {
                        continue;
                    }
                    if (!group.FeedGroupKills && !kill.zkb.solo)
                    {
                        continue;
                    }

                    foreach (var(filterName, filter) in group.Filters)
                    {
                        var isInclusive       = filter.Inclusive;
                        var isLoss            = false;
                        var isPassed          = false;
                        var isFirstMatchOnly  = !filter.AllMustMatch;
                        var isCertifiedToFeed = false;

                        #region Person checks
                        //exclusions
                        var exList = GetTier2CharacterIds(ParsedExcludeAttackersLists, groupName, filterName);
                        if (exList.ContainsAnyFromList(kill.attackers.Select(a => a.character_id).Distinct()))
                        {
                            continue;
                        }
                        exList = GetTier2CorporationIds(ParsedExcludeAttackersLists, groupName, filterName);
                        if (exList.ContainsAnyFromList(kill.attackers.Select(a => a.corporation_id).Distinct()))
                        {
                            continue;
                        }
                        exList = GetTier2AllianceIds(ParsedExcludeAttackersLists, groupName, filterName);
                        if (exList.ContainsAnyFromList(kill.attackers.Where(a => a.alliance_id > 0).Select(a => a.alliance_id).Distinct()))
                        {
                            continue;
                        }

                        exList = GetTier2CharacterIds(ParsedExcludeVictimsLists, groupName, filterName);
                        if (exList.Contains(kill.victim.character_id))
                        {
                            continue;
                        }
                        exList = GetTier2CorporationIds(ParsedExcludeVictimsLists, groupName, filterName);
                        if (exList.Contains(kill.victim.corporation_id))
                        {
                            continue;
                        }
                        if (kill.victim.alliance_id > 0)
                        {
                            exList = GetTier2AllianceIds(ParsedExcludeVictimsLists, groupName, filterName);
                            if (exList.Contains(kill.victim.alliance_id))
                            {
                                continue;
                            }
                        }

                        exList = GetTier2SystemIds(ParsedExcludeLocationLists, groupName, filterName);
                        if (exList.Contains(kill.solar_system_id))
                        {
                            continue;
                        }

                        var rSystem = await APIHelper.ESIAPI.GetSystemData(Reason, kill.solar_system_id);

                        exList = GetTier2ConstellationIds(ParsedExcludeLocationLists, groupName, filterName);
                        if (rSystem != null && exList.Contains(rSystem.constellation_id))
                        {
                            continue;
                        }
                        exList = GetTier2RegionIds(ParsedExcludeLocationLists, groupName, filterName);
                        if (rSystem?.DB_RegionId != null && exList.Contains(rSystem.DB_RegionId.Value))
                        {
                            continue;
                        }

                        exList = GetTier2TypeIds(ParsedExcludeShipsLists, groupName, filterName);
                        if (exList.Contains(kill.victim.ship_type_id))
                        {
                            continue;
                        }

                        //character check
                        var fChars = GetTier2CharacterIds(ParsedAttackersLists, groupName, filterName);
                        if (fChars.Any())
                        {
                            var attackers = kill.attackers.Select(a => a.character_id);
                            if (isInclusive)
                            {
                                if (!fChars.ContainsAnyFromList(attackers))
                                {
                                    if (!isFirstMatchOnly)
                                    {
                                        continue;
                                    }
                                }
                                else
                                {
                                    isPassed          = true;
                                    isCertifiedToFeed = isFirstMatchOnly;
                                }
                            }
                            if (!isInclusive && fChars.ContainsAnyFromList(attackers))
                            {
                                continue;
                            }
                        }

                        if (!isCertifiedToFeed)
                        {
                            fChars = GetTier2CharacterIds(ParsedVictimsLists, groupName, filterName);
                            if (fChars.Any())
                            {
                                if (isInclusive)
                                {
                                    if (!fChars.Contains(kill.victim.character_id))
                                    {
                                        if (!isFirstMatchOnly)
                                        {
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        isLoss            = true;
                                        isPassed          = true;
                                        isCertifiedToFeed = isFirstMatchOnly;
                                    }
                                }
                                if (!isInclusive && fChars.Contains(kill.victim.character_id))
                                {
                                    continue;
                                }
                            }
                        }


                        //corp check
                        if (!isPassed && !isCertifiedToFeed)
                        {
                            fChars = GetTier2CorporationIds(ParsedAttackersLists, groupName, filterName);
                            if (fChars.Any())
                            {
                                var attackers = kill.attackers.Select(a => a.corporation_id);
                                if (isInclusive)
                                {
                                    if (!fChars.ContainsAnyFromList(attackers))
                                    {
                                        if (!isFirstMatchOnly)
                                        {
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        isPassed          = true;
                                        isCertifiedToFeed = isFirstMatchOnly;
                                    }
                                }
                                if (!isInclusive && fChars.ContainsAnyFromList(attackers))
                                {
                                    continue;
                                }
                            }

                            if (!isCertifiedToFeed)
                            {
                                fChars = GetTier2CorporationIds(ParsedVictimsLists, groupName, filterName);
                                if (fChars.Any())
                                {
                                    if (isInclusive)
                                    {
                                        if (!fChars.Contains(kill.victim.corporation_id))
                                        {
                                            if (!isFirstMatchOnly)
                                            {
                                                continue;
                                            }
                                        }
                                        else
                                        {
                                            isLoss            = true;
                                            isPassed          = true;
                                            isCertifiedToFeed = isFirstMatchOnly;
                                        }
                                    }
                                    if (!isInclusive && fChars.Contains(kill.victim.corporation_id))
                                    {
                                        continue;
                                    }
                                }
                            }
                        }

                        //alliance check
                        if (!isPassed && !isCertifiedToFeed)
                        {
                            fChars = GetTier2AllianceIds(ParsedAttackersLists, groupName, filterName);
                            if (fChars.Any())
                            {
                                var attackers = kill.attackers.Where(a => a.alliance_id > 0).Select(a => a.alliance_id);
                                if (isInclusive)
                                {
                                    if (!fChars.ContainsAnyFromList(attackers))
                                    {
                                        if (!isFirstMatchOnly)
                                        {
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        isPassed          = true;
                                        isCertifiedToFeed = isFirstMatchOnly;
                                    }
                                }

                                if (!isInclusive && fChars.ContainsAnyFromList(attackers))
                                {
                                    continue;
                                }
                            }

                            if (!isCertifiedToFeed)
                            {
                                fChars = GetTier2AllianceIds(ParsedVictimsLists, groupName, filterName);
                                if (fChars.Any())
                                {
                                    if (isInclusive)
                                    {
                                        if (!isFirstMatchOnly && kill.victim.alliance_id == 0)
                                        {
                                            continue;
                                        }
                                        if (kill.victim.alliance_id > 0)
                                        {
                                            if (!fChars.Contains(kill.victim.alliance_id))
                                            {
                                                if (!isFirstMatchOnly)
                                                {
                                                    continue;
                                                }
                                            }
                                            else
                                            {
                                                isLoss            = true;
                                                isPassed          = true;
                                                isCertifiedToFeed = isFirstMatchOnly;
                                            }
                                        }
                                    }

                                    if (!isInclusive && fChars.Contains(kill.victim.alliance_id))
                                    {
                                        continue;
                                    }
                                }
                            }
                        }

                        isPassed = false;
                        #endregion

                        //value checks
                        if (!isCertifiedToFeed)
                        {
                            if (isLoss && filter.MinimumLossValue >= kill.zkb.totalValue)
                            {
                                continue;
                            }
                            if (filter.MaximumLossValue > 0 && isLoss && filter.MaximumLossValue <= kill.zkb.totalValue)
                            {
                                continue;
                            }
                            if (!isLoss && filter.MinimumKillValue >= kill.zkb.totalValue)
                            {
                                continue;
                            }
                            if (filter.MaximumKillValue > 0 && !isLoss && filter.MaximumKillValue <= kill.zkb.totalValue)
                            {
                                continue;
                            }

                            if (isFirstMatchOnly && (filter.MinimumKillValue > 0 || filter.MinimumLossValue > 0 || filter.MaximumLossValue > 0 || filter.MaximumKillValue > 0))
                            {
                                isCertifiedToFeed = true;
                            }
                        }

                        #region Location checks (except system radius)

                        if (!isCertifiedToFeed)
                        {
                            var check = CheckLocation(rSystem, kill, isInclusive, groupName, filterName);
                            //if have some location criteria
                            if (check != null)
                            {
                                if (check == false)
                                {
                                    if (filter.Radius == 0 && !isFirstMatchOnly)
                                    {
                                        continue;
                                    }
                                }
                                else if (isInclusive && isFirstMatchOnly)
                                {
                                    isCertifiedToFeed = true;
                                }
                            }
                        }

                        #endregion

                        #region Type checks

                        var types = GetTier2TypeIds(ParsedShipsLists, groupName, filterName);
                        if (types.Any() && !isCertifiedToFeed)
                        {
                            if (isInclusive && !types.Contains(kill.victim.ship_type_id))
                            {
                                if (!isFirstMatchOnly)
                                {
                                    continue;
                                }
                            }
                            if (!isInclusive && types.Contains(kill.victim.ship_type_id))
                            {
                                continue;
                            }
                            if (isInclusive && isFirstMatchOnly)
                            {
                                isCertifiedToFeed = true;
                            }
                        }
                        #endregion

                        //haven't hit any criteria for 1-hit mode
                        if (!isCertifiedToFeed && isFirstMatchOnly)
                        {
                            continue;
                        }

                        var discordChannels = filter.DiscordChannels.Any() ? filter.DiscordChannels : group.DiscordChannels;

                        if (filter.Radius > 0)
                        {
                            #region Process system radius check

                            var msgType = MessageTemplateType.KillMailRadius;
                            var isDone  = false;
                            foreach (var radiusSystemId in GetTier2SystemIds(ParsedLocationLists, groupName, filterName))
                            {
                                if (await ProcessLocation(radiusSystemId, kill, group, filter, groupName))
                                {
                                    isDone        = true;
                                    hasBeenPosted = true;
                                    if (Settings.ZKBSettingsModule.AvoidDupesAcrossAllFeeds)
                                    {
                                        ZKillLiveFeedModule.UpdateSharedIdPool(kill.killmail_id);
                                    }
                                    await LogHelper.LogInfo($"Posting     {(isLoss ? "RLoss" : "RKill")}: {kill.killmail_id}  Value: {kill.zkb.totalValue:n0} ISK", Category);

                                    break;
                                }
                            }

                            if (isDone && group.StopOnFirstFilterMatch)
                            {
                                break;                                         //goto next group
                            }
                            #endregion
                        }
                        else
                        {
                            if (group.FeedUrlsOnly)
                            {
                                foreach (var channel in discordChannels)
                                {
                                    await APIHelper.DiscordAPI.SendMessageAsync(channel, kill.zkb.url);
                                }
                            }
                            else
                            {
                                var hasTemplate = !string.IsNullOrWhiteSpace(group.MessageTemplateFileName);
                                var msgColor    = isLoss ? new Color(0xD00000) : new Color(0x00FF00);
                                var msgType     = !hasTemplate ? MessageTemplateType.KillMailGeneral : MessageTemplateType.Custom;
                                var km          = new KillDataEntry();

                                if (await km.Refresh(Reason, kill))
                                {
                                    km.dic["{isLoss}"] = isLoss ? "true" : "false";
                                    var isDone = hasTemplate
                                        ? await TemplateHelper.PostTemplatedMessage(group.MessageTemplateFileName, km.dic, discordChannels, group.ShowGroupName?groupName : " ")
                                                 : await TemplateHelper.PostTemplatedMessage(msgType, km.dic, discordChannels,
                                                                                             group.ShowGroupName?groupName : " ");

                                    if (!isDone)
                                    {
                                        await APIHelper.DiscordAPI.SendEmbedKillMessage(discordChannels, msgColor, km, null);
                                    }
                                }
                            }

                            if (Settings.ZKBSettingsModule.AvoidDupesAcrossAllFeeds)
                            {
                                ZKillLiveFeedModule.UpdateSharedIdPool(kill.killmail_id);
                            }
                            await LogHelper.LogInfo($"Posting     {(isLoss ? "Loss" : "Kill")}: {kill.killmail_id}  Value: {kill.zkb.totalValue:n0} ISK", Category);

                            hasBeenPosted = true;
                            if (group.StopOnFirstFilterMatch)
                            {
                                break;                              //goto next group
                            }
                        }

                        continue; //goto next filter
                    }
                }
            }
            catch (Exception ex)
            {
                await LogHelper.LogEx(ex.Message, ex, Category);

                await LogHelper.LogWarning($"Error processing kill ID {kill?.killmail_id} ! Msg: {ex.Message}", Category);
            }
        }
Exemple #2
0
        private async Task ProcessKill(JsonZKill.Killmail kill)
        {
            try
            {
                RunningRequestCount++;
                // var text = JsonConvert.SerializeObject(kill);
                //kill = JsonConvert.DeserializeObject<JsonZKill.Killmail>(File.ReadAllText("testkm_pvp.txt"));

                var hasBeenPosted = false;
                foreach (var(groupName, group) in Settings.LiveKillFeedModule.GetEnabledGroups())
                {
                    if (Settings.ZKBSettingsModule.AvoidDupesAcrossAllFeeds &&
                        ZKillLiveFeedModule.IsInSharedPool(kill.killmail_id))
                    {
                        return;
                    }

                    if (hasBeenPosted && Settings.LiveKillFeedModule.StopOnFirstGroupMatch)
                    {
                        break;
                    }

                    if (UpdateLastPosted(groupName, kill.killmail_id))
                    {
                        continue;
                    }

                    var isPveKill = kill.zkb.npc;
                    var isPvpKill = !kill.zkb.npc;

                    if ([email protected] && isPveKill || [email protected] && isPvpKill)
                    {
                        continue;
                    }
                    if (!group.FeedAwoxKills && kill.zkb.awox)
                    {
                        continue;
                    }
                    if (!group.FeedNotAwoxKills && !kill.zkb.awox)
                    {
                        continue;
                    }
                    if (!group.FeedSoloKills && kill.zkb.solo)
                    {
                        continue;
                    }
                    if (!group.FeedGroupKills && !kill.zkb.solo)
                    {
                        continue;
                    }

                    foreach (var(filterName, filter) in group.Filters)
                    {
                        var isLoss            = false;
                        var isCertifiedToFeed = false;

                        #region Person & Value checks

                        #region Exclusions

                        var exList = GetTier2CharacterIds(ParsedExcludeAttackersLists, groupName, filterName);
                        if (exList.ContainsAnyFromList(kill.attackers.Select(a => a.character_id).Distinct()))
                        {
                            continue;
                        }
                        exList = GetTier2CorporationIds(ParsedExcludeAttackersLists, groupName, filterName);
                        if (exList.ContainsAnyFromList(kill.attackers.Select(a => a.corporation_id).Distinct()))
                        {
                            continue;
                        }
                        exList = GetTier2AllianceIds(ParsedExcludeAttackersLists, groupName, filterName);
                        if (exList.ContainsAnyFromList(kill.attackers.Where(a => a.alliance_id > 0)
                                                       .Select(a => a.alliance_id).Distinct()))
                        {
                            continue;
                        }

                        exList = GetTier2CharacterIds(ParsedExcludeVictimsLists, groupName, filterName);
                        if (exList.Contains(kill.victim.character_id))
                        {
                            continue;
                        }
                        exList = GetTier2CorporationIds(ParsedExcludeVictimsLists, groupName, filterName);
                        if (exList.Contains(kill.victim.corporation_id))
                        {
                            continue;
                        }
                        if (kill.victim.alliance_id > 0)
                        {
                            exList = GetTier2AllianceIds(ParsedExcludeVictimsLists, groupName, filterName);
                            if (exList.Contains(kill.victim.alliance_id))
                            {
                                continue;
                            }
                        }

                        exList = GetTier2SystemIds(ParsedExcludeLocationLists, groupName, filterName);
                        if (exList.Contains(kill.solar_system_id))
                        {
                            continue;
                        }

                        var rSystem = await APIHelper.ESIAPI.GetSystemData(Reason, kill.solar_system_id);

                        exList = GetTier2ConstellationIds(ParsedExcludeLocationLists, groupName, filterName);
                        if (rSystem != null && exList.Contains(rSystem.constellation_id))
                        {
                            continue;
                        }
                        exList = GetTier2RegionIds(ParsedExcludeLocationLists, groupName, filterName);
                        if (rSystem?.DB_RegionId != null && exList.Contains(rSystem.DB_RegionId.Value))
                        {
                            continue;
                        }

                        exList = GetTier2TypeIds(ParsedExcludeVictimShipsLists, groupName, filterName);
                        if (exList.Contains(kill.victim.ship_type_id))
                        {
                            continue;
                        }
                        exList = GetTier2TypeIds(ParsedExcludeAttackerShipsLists, groupName, filterName);
                        if (kill.attackers.Select(a => a.ship_type_id).ContainsAnyFromList(exList))
                        {
                            continue;
                        }


                        #endregion

                        //value checks
                        if (filter.MinimumIskValue > kill.zkb.totalValue)
                        {
                            continue;
                        }
                        if (filter.MaximumIskValue > 0 && filter.MaximumIskValue < kill.zkb.totalValue)
                        {
                            continue;
                        }

                        //if (filter.EnableMatchOnFirstConditionMet && (filter.MinimumIskValue > 0 || filter.MaximumIskValue > 0 ))
                        //    isCertifiedToFeed = true;

                        //character check
                        var         hasAttackerMatch = false;
                        var         hasPartyCheck    = false;
                        List <long> entityIds;
                        if (!isCertifiedToFeed)
                        {
                            entityIds = GetTier2CharacterIds(ParsedAttackersLists, groupName, filterName);
                            if (entityIds.Any())
                            {
                                hasPartyCheck = true;
                                var attackers = kill.attackers.Select(a => a.character_id);
                                if (entityIds.ContainsAnyFromList(attackers))
                                {
                                    if (filter.EnableMatchOnFirstConditionMet)
                                    {
                                        isCertifiedToFeed = true;
                                    }
                                    hasAttackerMatch = true;
                                }
                            }
                        }

                        var hasVictimMatch = false;
                        if (!isCertifiedToFeed)
                        {
                            entityIds = GetTier2CharacterIds(ParsedVictimsLists, groupName, filterName);
                            if (entityIds.Any())
                            {
                                hasPartyCheck = true;
                                if (entityIds.Contains(kill.victim.character_id))
                                {
                                    if (filter.EnableMatchOnFirstConditionMet)
                                    {
                                        isCertifiedToFeed = true;
                                    }
                                    hasVictimMatch = true;
                                    isLoss         = true;
                                }
                            }
                        }

                        //corp check
                        if ((!hasVictimMatch || !hasAttackerMatch) && !isCertifiedToFeed)
                        {
                            if (!hasAttackerMatch)
                            {
                                entityIds = GetTier2CorporationIds(ParsedAttackersLists, groupName, filterName);
                                if (entityIds.Any())
                                {
                                    hasPartyCheck = true;
                                    var attackers = kill.attackers.Select(a => a.corporation_id);
                                    if (entityIds.ContainsAnyFromList(attackers))
                                    {
                                        if (filter.EnableMatchOnFirstConditionMet)
                                        {
                                            isCertifiedToFeed = true;
                                        }
                                        hasAttackerMatch = true;
                                    }
                                }
                            }

                            if (!isCertifiedToFeed && !hasVictimMatch)
                            {
                                entityIds = GetTier2CorporationIds(ParsedVictimsLists, groupName, filterName);
                                if (entityIds.Any())
                                {
                                    hasPartyCheck = true;
                                    if (entityIds.Contains(kill.victim.corporation_id))
                                    {
                                        if (filter.EnableMatchOnFirstConditionMet)
                                        {
                                            isCertifiedToFeed = true;
                                        }
                                        hasVictimMatch = true;
                                        isLoss         = true;
                                    }
                                }
                            }
                        }

                        //alliance check
                        if ((!hasVictimMatch || !hasAttackerMatch) && !isCertifiedToFeed)
                        {
                            if (!hasAttackerMatch)
                            {
                                entityIds = GetTier2AllianceIds(ParsedAttackersLists, groupName, filterName);
                                if (entityIds.Any())
                                {
                                    hasPartyCheck = true;
                                    var attackers = kill.attackers.Where(a => a.alliance_id > 0)
                                                    .Select(a => a.alliance_id);
                                    if (entityIds.ContainsAnyFromList(attackers))
                                    {
                                        if (filter.EnableMatchOnFirstConditionMet)
                                        {
                                            isCertifiedToFeed = true;
                                        }
                                        hasAttackerMatch = true;
                                    }
                                }
                            }

                            if (!isCertifiedToFeed && !hasVictimMatch)
                            {
                                entityIds = GetTier2AllianceIds(ParsedVictimsLists, groupName, filterName);
                                if (entityIds.Any())
                                {
                                    hasPartyCheck = true;
                                    if (entityIds.Contains(kill.victim.alliance_id))
                                    {
                                        if (filter.EnableMatchOnFirstConditionMet)
                                        {
                                            isCertifiedToFeed = true;
                                        }
                                        hasVictimMatch = true;
                                        isLoss         = true;
                                    }
                                }
                            }
                        }

                        //has no strict match = continue
                        if (hasPartyCheck && !isCertifiedToFeed && filter.EnableStrictPartiesCheck &&
                            (!hasAttackerMatch || !hasVictimMatch))
                        {
                            continue;
                        }

                        //has no party match on check
                        if (hasPartyCheck && !isCertifiedToFeed && !filter.EnableStrictPartiesCheck &&
                            !hasAttackerMatch && !hasVictimMatch)
                        {
                            continue;
                        }

                        #endregion

                        #region Location checks (except system radius)

                        if (!isCertifiedToFeed)
                        {
                            var check = CheckLocation(rSystem, kill, filter, groupName, filterName);
                            //if have some location criteria
                            if (check != null)
                            {
                                if (check.Value) //match
                                {
                                    if (filter.EnableMatchOnFirstConditionMet)
                                    {
                                        isCertifiedToFeed = true;
                                    }
                                }
                                else //no match
                                {
                                    //no radius checks planned
                                    if (filter.Radius == 0)
                                    {
                                        continue;
                                    }
                                }
                            }
                        }

                        #endregion

                        #region Type checks

                        bool hasTypesCheck        = false;
                        bool hasVictimTypeMatch   = false;
                        bool hasAttackerTypeMatch = false;
                        var  types = GetTier2TypeIds(ParsedVictimShipsLists, groupName, filterName);
                        if (types.Any() && !isCertifiedToFeed)
                        {
                            hasTypesCheck = true;
                            if (types.Contains(kill.victim.ship_type_id))
                            {
                                hasVictimTypeMatch = true;
                                if (filter.EnableMatchOnFirstConditionMet)
                                {
                                    isCertifiedToFeed = true;
                                }
                            }
                        }

                        types = GetTier2TypeIds(ParsedAttackerShipsLists, groupName, filterName);
                        if (types.Any() && !isCertifiedToFeed)
                        {
                            hasTypesCheck = true;
                            if (types.ContainsAnyFromList(kill.attackers.Select(a => a.ship_type_id)))
                            {
                                hasAttackerTypeMatch = true;
                                if (filter.EnableMatchOnFirstConditionMet)
                                {
                                    isCertifiedToFeed = true;
                                }
                            }
                        }

                        if (hasTypesCheck && !isCertifiedToFeed && filter.EnableStrictShipTypesCheck && (!hasAttackerTypeMatch || !hasVictimTypeMatch))
                        {
                            continue;
                        }

                        if (hasTypesCheck && !isCertifiedToFeed && !filter.EnableStrictShipTypesCheck && !hasAttackerTypeMatch && !hasVictimTypeMatch)
                        {
                            continue;
                        }

                        #endregion

                        //haven't hit any criteria for 1-hit mode
                        // if(!isCertifiedToFeed && filter.EnableMatchOnFirstConditionMet) continue;

                        var discordChannels = filter.DiscordChannels.Any()
                            ? filter.DiscordChannels
                            : group.DiscordChannels;

                        if (filter.Radius > 0)
                        {
                            #region Process system radius check

                            //var msgType = MessageTemplateType.KillMailRadius;
                            var isDone = false;
                            foreach (var radiusSystemId in GetTier2SystemIds(ParsedLocationLists, groupName, filterName))
                            {
                                if (await ProcessLocation(radiusSystemId, kill, group, filter, groupName))
                                {
                                    isDone        = true;
                                    hasBeenPosted = true;
                                    if (Settings.ZKBSettingsModule.AvoidDupesAcrossAllFeeds)
                                    {
                                        ZKillLiveFeedModule.UpdateSharedIdPool(kill.killmail_id);
                                    }
                                    await LogHelper.LogInfo(
                                        $"Posting     {(isLoss ? "RLoss" : "RKill")}: {kill.killmail_id}  Value: {kill.zkb.totalValue:n0} ISK",
                                        Category);

                                    break;
                                }
                            }

                            if (isDone && group.StopOnFirstFilterMatch)
                            {
                                break;                                         //goto next group
                            }
                            #endregion
                        }
                        else
                        {
                            if (group.FeedUrlsOnly)
                            {
                                foreach (var channel in discordChannels)
                                {
                                    await APIHelper.DiscordAPI.SendMessageAsync(channel, kill.zkb.url);
                                }
                                await LogHelper.LogInfo(
                                    $"U.Posted     {(isLoss ? "Loss" : "Kill")}: {kill.killmail_id}  Value: {kill.zkb.totalValue:n0} ISK",
                                    Category);
                            }
                            else
                            {
                                var hasTemplate = !string.IsNullOrWhiteSpace(group.MessageTemplateFileName);
                                var msgColor    = isLoss ? new Color(0xD00000) : new Color(0x00FF00);
                                var km          = new KillDataEntry();

                                if (await km.Refresh(Reason, kill))
                                {
                                    km.dic["{isLoss}"] = isLoss ? "true" : "false";
                                    if (hasTemplate)
                                    {
                                        hasBeenPosted = await TemplateHelper.PostTemplatedMessage(
                                            group.MessageTemplateFileName, km.dic, discordChannels,
                                            group.ShowGroupName?groupName : " ");

                                        if (hasBeenPosted)
                                        {
                                            await LogHelper.LogInfo(
                                                $"T.Posted     {(isLoss ? "Loss" : "Kill")}: {kill.killmail_id}  Value: {kill.zkb.totalValue:n0} ISK",
                                                Category);
                                        }
                                    }
                                    else
                                    {
                                        await SendEmbedKillMessage(discordChannels, msgColor, km,
                                                                   group.ShowGroupName?groupName : " ");

                                        hasBeenPosted = true;
                                        await LogHelper.LogInfo(
                                            $"N.Posted     {(isLoss ? "Loss" : "Kill")}: {kill.killmail_id}  Value: {kill.zkb.totalValue:n0} ISK",
                                            Category);
                                    }
                                }
                            }

                            if (Settings.ZKBSettingsModule.AvoidDupesAcrossAllFeeds)
                            {
                                ZKillLiveFeedModule.UpdateSharedIdPool(kill.killmail_id);
                            }

                            if (group.StopOnFirstFilterMatch)
                            {
                                break;                               //goto next group
                            }
                        }

                        continue; //goto next filter
                    }
                }
            }
            catch (Exception ex)
            {
                await LogHelper.LogEx(ex.Message, ex, Category);

                await LogHelper.LogWarning($"Error processing kill ID {kill?.killmail_id} ! Msg: {ex.Message}",
                                           Category);
            }
            finally
            {
                RunningRequestCount--;
            }
        }