Skip to content

Commit

Permalink
library color filter multiregion
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Sep 18, 2022
1 parent 8680d61 commit b256ee4
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 102 deletions.
24 changes: 13 additions & 11 deletions ARKBreedingStats/Form1.library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Text.RegularExpressions;
using ARKBreedingStats.library;
using ARKBreedingStats.settings;
using System.Runtime.ConstrainedExecution;

namespace ARKBreedingStats
{
Expand Down Expand Up @@ -1311,30 +1312,31 @@ private void FilterLib(bool selectFirstIfNothingIsSelected = false)
var statFilterRegex = new Regex(@"(\w{2}) ?(<|>|==) ?(\d+)");

// color filter
var colorFilter = new Dictionary<int, int[]>();
var colorFilterRegex = new Regex(@"c([0-5]): ?([\d ]+)");
var colorFilterOr = new Dictionary<int[], int[]>(); // includes creatures that have in one of the regions one of the colors
var colorFilterRegexOr = new Regex(@"c([0-5 ]+): ?([\d ]+)");

// mutation filter
var mutationFilterEqualTo = -1;
var mutationFilterGreaterThan = -1;
var mutationFilterLessThan = -1;

var removeFilterIndex = new List<int>();
var removeFilterIndex = new List<int>(); // remove all filter entries that are added to specific filter properties
// start at the end, so the removed filter indices are also removed from the end
for (var i = filterStrings.Count - 1; i >= 0; i--)
{
var f = filterStrings[i];

// color region filter
var m = colorFilterRegex.Match(f);
var m = colorFilterRegexOr.Match(f);
if (m.Success)
{
var colorRegion = int.Parse(m.Groups[1].Value);
if (colorFilter.ContainsKey(colorRegion)) continue;

var colorIds = m.Groups[2].Value.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(cId => int.Parse(cId)).Distinct().ToArray();
var colorIds = m.Groups[2].Value.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.Select(int.Parse).Distinct().ToArray();
if (!colorIds.Any()) continue;

colorFilter[colorRegion] = colorIds;
var colorRegions = m.Groups[1].Value.Where(r => r != ' ').Select(r => int.Parse(r.ToString())).ToArray();

colorFilterOr[colorRegions] = colorIds;
removeFilterIndex.Add(i);
continue;
}
Expand Down Expand Up @@ -1382,7 +1384,7 @@ private void FilterLib(bool selectFirstIfNothingIsSelected = false)
if (!statGreaterThan.Any()) statGreaterThan = null;
if (!statLessThan.Any()) statLessThan = null;
if (!statEqualTo.Any()) statEqualTo = null;
if (!colorFilter.Any()) colorFilter = null;
if (!colorFilterOr.Any()) colorFilterOr = null;
foreach (var i in removeFilterIndex)
filterStrings.RemoveAt(i);

Expand All @@ -1399,7 +1401,7 @@ private void FilterLib(bool selectFirstIfNothingIsSelected = false)
&& (statGreaterThan?.All(si => c.levelsWild[si.Key] > si.Value) ?? true)
&& (statLessThan?.All(si => c.levelsWild[si.Key] < si.Value) ?? true)
&& (statEqualTo?.All(si => c.levelsWild[si.Key] == si.Value) ?? true)
&& (colorFilter?.All(cr => cr.Value.Contains(c.colors[cr.Key])) ?? true)
&& (colorFilterOr?.All(colorRegions => colorRegions.Key.Any(colorRegion => colorRegions.Value.Contains(c.colors[colorRegion]))) ?? true)
&& (mutationFilterGreaterThan == -1 || mutationFilterGreaterThan < c.Mutations)
&& (mutationFilterLessThan == -1 || mutationFilterLessThan > c.Mutations)
&& (mutationFilterEqualTo == -1 || mutationFilterEqualTo == c.Mutations)
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/local/strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,8 @@ Ark id im Spiel
Server
Tags
Filter nach Stats mit {englische statAbkürzung} [==|&lt;|&gt;] {Wert}, z.B. hp &gt; 20, st == 35
Filter nach Farben mit c{Region}: {FarbCode} {FarbCode2}, z.B. c0: 20, c5: 3 4 5 6, c1: 13 14</value>
Filter nach Farben mit c{Regionen}: {FarbCode} {FarbCode2}, z.B. c0: 20, c5: 3 4 5 6, c1: 13 14
Es ist auch möglich Tiere mit einer Farbe in mehreren möglichen Regionen zu filtern. Z.B. um alle Tiere mit der Farb-Id 10 oder 20 in irgendeiner Region anzuzeigen nutze: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="ClickDisplayFile" xml:space="preserve">
<value>Klicken um Datei im Explorer anzuzeigen</value>
Expand Down
5 changes: 3 additions & 2 deletions ARKBreedingStats/local/strings.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,9 @@ Remarque
Ark id dans le jeu
Serveur
Tags
Filtre pour les stats avec {statAbb} [==|&lt;|&gt;] {value}, par exemple pv &gt; 20, en == 35
Filtre pour les couleurs avec c{region}: {colorValue} {colorValue2}, par exemple c0: 20, c5: 3 4 5 6, c1: 13 14</value>
Filtre pour les stats avec {statAbb} [==|&amp;lt;|&amp;gt;] {value}, par exemple pv &amp;gt; 20, en == 35
Filtre pour les couleurs avec c{region}: {colorValue} {colorValue2}, par exemple c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="ClickDisplayFile" xml:space="preserve">
<value>Cliquer pour afficher le fichier dans l'explorateur</value>
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/local/strings.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,8 @@ BabyCuddleIntervallMultiplierとBabyMatureSpeedMultiplierが正しいか確認
サーバ
タグ
Filter for a stats with {statAbb} [==|&lt;|&gt;] {value}, e.g. hp &gt; 20, st == 35
Filter for colors with c{region}: {colorValue}, e.g. c0: 20, c5: 3</value>
Filter for colors with c{regions}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="ClickDisplayFile" xml:space="preserve">
<value>クリックでファイルをエクスプローラーで表示</value>
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/local/strings.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,8 @@ Identyfikator w grze
Serwer
Tagi
Filter for a stats with {statAbb} [==|&lt;|&gt;] {value}, e.g. hp &gt; 20, st == 35
Filter for colors with c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14</value>
Filter for colors with c{regions}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="WarningMoreStarvingThanFood" xml:space="preserve">
<value>Uwaga: temu zwierzu może zabraknąć jedzenia. Możliwe, że będziesz musiał je nakarmić przed tym czasem, by go nie zagłodzić (sprawdź ekwipunek)!</value>
Expand Down
152 changes: 69 additions & 83 deletions ARKBreedingStats/local/strings.pt-br.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Mude o breeding-mode para "Maior Status" para melhores Sugestões.</value>
<value>Melhor possível</value>
</data>
<data name="BestPossibleSpeciesLibrary" xml:space="preserve">
<value>{0} Melhor possível para essa biblioteca</value>
<value>Melhor possível {0} para essa biblioteca</value>
</data>
<data name="Body" xml:space="preserve">
<value>Corpo</value>
Expand Down Expand Up @@ -1043,30 +1043,6 @@ Alguns descendentes podem ser piores do que no modo de status altos, mas você t
<data name="Status" xml:space="preserve">
<value>Status</value>
</data>
<data name="String" xml:space="preserve">
<value>Add Note Adicionar Nota</value>
</data>
<data name="String1" xml:space="preserve">
<value>BestPossibleSpeciesLibraryFiltered {0} Melhor possivel para esse filtro</value>
</data>
<data name="String10" xml:space="preserve">
<value>Discard changes? Discartar alterações?</value>
</data>
<data name="String11" xml:space="preserve">
<value>Discard changes and load file Descartar as alterações e carregar uma nova biblioteca</value>
</data>
<data name="String12" xml:space="preserve">
<value>Discard changes and new Descartar as alterações e criar uma nova biblioteca</value>
</data>
<data name="String13" xml:space="preserve">
<value>Discard changes and quit Descartar alterações e sair</value>
</data>
<data name="String14" xml:space="preserve">
<value>Fortitude Fortitude</value>
</data>
<data name="String15" xml:space="preserve">
<value>Fortitude_Abb Fr</value>
</data>
<data name="String16" xml:space="preserve">
<value>Certifique-se de que o BabyCuddleIntervallMultiplier e o BabyMatureSpeedMultiplier estão definidos corretamente.</value>
</data>
Expand All @@ -1079,63 +1055,6 @@ Alguns descendentes podem ser piores do que no modo de status altos, mas você t
<data name="String19" xml:space="preserve">
<value>Se um número com um sinal de mais for mostrado, a soma é muito alta e você precisa escolher outra possibilidade nas listas de status amarelos."</value>
</data>
<data name="String2" xml:space="preserve">
<value>BtBeepTopTT Este som ira tocar quando o level de uma criatura com top stat, ex. igual ao atual maior nivel da sua biblioteca</value>
</data>
<data name="String20" xml:space="preserve">
<value>max wild level Lvl max Selvagem</value>
</data>
<data name="String21" xml:space="preserve">
<value>noColor sem cor</value>
</data>
<data name="String22" xml:space="preserve">
<value>Nursing Effectiveness Nursing Effectiveness</value>
</data>
<data name="String23" xml:space="preserve">
<value>Nursing Effectiveness_Abb NE</value>
</data>
<data name="String24" xml:space="preserve">
<value>Remove Note Remover Nota</value>
</data>
<data name="String25" xml:space="preserve">
<value>Temperature Temperatura</value>
</data>
<data name="String26" xml:space="preserve">
<value>Temperature_Abb Te</value>
</data>
<data name="String27" xml:space="preserve">
<value>tsBtAddAsExtractionTest Adic como Teste</value>
</data>
<data name="String28" xml:space="preserve">
<value>until até</value>
</data>
<data name="String29" xml:space="preserve">
<value>Water Água</value>
</data>
<data name="String3" xml:space="preserve">
<value>btUpdateLibraryCreature Atualizar criatura na biblioteca</value>
</data>
<data name="String30" xml:space="preserve">
<value>Water_Abb Wa</value>
</data>
<data name="String4" xml:space="preserve">
<value>Cancel quitting Cancelar saida</value>
</data>
<data name="String5" xml:space="preserve">
<value>Collection changed discard and load? Sua coleção de criaturas foi modificada desde que foi salva pela última vez, tem certeza que deseja descartar as alterações e carregar o arquivo sem salvar primeiro?</value>
</data>
<data name="String6" xml:space="preserve">
<value>Collection changed discard and new? Sua coleção de criaturas foi modificada desde que foi salva pela última vez, tem certeza de que deseja descartar as alterações e criar uma nova biblioteca sem salvar?</value>
</data>
<data name="String7" xml:space="preserve">
<value>Collection changed discard and quit? Sua coleção de criaturas foi modificada desde que foi salva pela última vez, tem certeza de que deseja descartar as alterações e sair sem salvar?</value>
</data>
<data name="String8" xml:space="preserve">
<value>Crafting Speed_Abb Cr</value>
</data>
<data name="String9" xml:space="preserve">
<value>CurrentCreature Criatura atual</value>
</data>
<data name="SystemLanguage" xml:space="preserve">
<value>Idioma do Sistema</value>
</data>
Expand Down Expand Up @@ -1221,7 +1140,8 @@ Ark id no Jogo
Servidor
Tags
Filtrar por status com {statAbb} [==|&amp;lt;|&amp;gt;] {value}, ex. hp &amp;gt; 20, st == 35
Filtrar por cor com c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14</value>
Filtrar por cor com c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="Top" xml:space="preserve">
<value>Top</value>
Expand Down Expand Up @@ -1334,4 +1254,70 @@ Filtrar por cor com c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4
<data name="groupLibraryBySpecies" xml:space="preserve">
<value>Agrupar por Especie</value>
</data>
<data name="Add Note" xml:space="preserve">
<value>Adicionar Nota</value>
</data>
<data name="BestPossibleSpeciesLibraryFiltered" xml:space="preserve">
<value>Melhor possivel {0} para esse filtro</value>
</data>
<data name="Discard changes?" xml:space="preserve">
<value>Discartar alterações?</value>
</data>
<data name="Discard changes and load file" xml:space="preserve">
<value>Descartar as alterações e carregar uma nova biblioteca</value>
</data>
<data name="Discard changes and new" xml:space="preserve">
<value>Descartar as alterações e criar uma nova biblioteca</value>
</data>
<data name="Discard changes and quit" xml:space="preserve">
<value>Descartar alterações e sair</value>
</data>
<data name="max wild level" xml:space="preserve">
<value>Lvl max Selvagem</value>
</data>
<data name="noColor" xml:space="preserve">
<value>sem cor</value>
</data>
<data name="until" xml:space="preserve">
<value>até</value>
</data>
<data name="Water" xml:space="preserve">
<value>Água</value>
</data>
<data name="Water_Abb" xml:space="preserve">
<value>Wa</value>
</data>
<data name="Cancel quitting" xml:space="preserve">
<value>Cancelar saida</value>
</data>
<data name="Temperature" xml:space="preserve">
<value>Temperatura</value>
</data>
<data name="Temperature_Abb" xml:space="preserve">
<value>Te</value>
</data>
<data name="Remove Note" xml:space="preserve">
<value>Remover Nota</value>
</data>
<data name="tsBtAddAsExtractionTest" xml:space="preserve">
<value>Adic como Teste</value>
</data>
<data name="btUpdateLibraryCreature" xml:space="preserve">
<value>Atualizar criatura na biblioteca</value>
</data>
<data name="CurrentCreature" xml:space="preserve">
<value>Criatura atual</value>
</data>
<data name="BtBeepTopTT" xml:space="preserve">
<value>Este som ira tocar quando o level de uma criatura com top stat, ex. igual ao atual maior nivel da sua biblioteca</value>
</data>
<data name="Collection changed discard and quit?" xml:space="preserve">
<value>Sua coleção de criaturas foi modificada desde que foi salva pela última vez, tem certeza de que deseja descartar as alterações e sair sem salvar?</value>
</data>
<data name="Collection changed discard and new?" xml:space="preserve">
<value>Sua coleção de criaturas foi modificada desde que foi salva pela última vez, tem certeza de que deseja descartar as alterações e criar uma nova biblioteca sem salvar?</value>
</data>
<data name="Collection changed discard and load?" xml:space="preserve">
<value>Sua coleção de criaturas foi modificada desde que foi salva pela última vez, tem certeza que deseja descartar as alterações e carregar o arquivo sem salvar primeiro?</value>
</data>
</root>
3 changes: 2 additions & 1 deletion ARKBreedingStats/local/strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,8 @@ Ark id in game
Server
Tags
Filter for a stats with {statAbb} [==|&lt;|&gt;] {value}, e.g. hp &gt; 20, st == 35
Filter for colors with c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14</value>
Filter for colors with c{regions}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="ClickDisplayFile" xml:space="preserve">
<value>Click to show file in explorer</value>
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/local/strings.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,8 @@ Ark id в игре
Сервер
Теги
Filter for a stats with {statAbb} [==|&lt;|&gt;] {value}, e.g. hp &gt; 20, st == 35
Filter for colors with c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14</value>
Filter for colors with c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="ClickDisplayFile" xml:space="preserve">
<value>Нажмите, чтобы показать файл в проводнике</value>
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/local/strings.zh-tw.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,8 @@
伺服器
標籤
使用 {屬性簡稱} [==|&amp;lt;|&amp;gt;] {數值} 過濾屬性,例如: HP &amp;gt; 20, 耐 == 35
使用 c{region} 過濾顏色:{colorValue} {colorValue2},例如: c0: 20, c5: 3 4 5 6, c1: 13 14</value>
使用 c{region} 過濾顏色:{colorValue} {colorValue2},例如: c0: 20, c5: 3 4 5 6, c1: 13 14
It's also possible to filter for creatures with a color in one of multiple possible regions. E.g. to display all creatures with the color 10 or 20 in any region use: c0 1 2 3 4 5: 10 20</value>
</data>
<data name="Top" xml:space="preserve">
<value>最大</value>
Expand Down

0 comments on commit b256ee4

Please sign in to comment.