Skip to content

Commit

Permalink
added option to apply global species selection to library (#879). In …
Browse files Browse the repository at this point in the history
…taming control added input for current food-stat-value for more precise starving-time. added info on how to extract creatures that show wrong stat-values after imprinting. fixed that savegame-imports did not import the ArkId properly. added considering owner-filter from library to breeding-planner (#885). The clear-button in the extractor now clears the ArkId-input. fixed when importing a creature that the tribe's name was saved as the owner's name. Increased the max imprinting bonus value to 100000 % (if more than 100 % IB is allowed via the settings) (#884). fix for disappeared importExport-window (#892). fixed that maturation was not saved when importing exported creatures. in the breeding-planner, the best level now considers the stat-weights. prevent exception if TE is higher than expected (>100 %)(#896). updated taming-food with new kibbles, recipes are not yet included.
  • Loading branch information
cadaei committed Mar 24, 2019
1 parent a27a48f commit 5e4466f
Show file tree
Hide file tree
Showing 27 changed files with 723 additions and 479 deletions.
6 changes: 6 additions & 0 deletions ARKBreedingStats/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@
<setting name="ExportCreatureFolder" serializeAs="String">
<value />
</setting>
<setting name="ApplyGlobalSpeciesToLibrary" serializeAs="String">
<value>False</value>
</setting>
<setting name="UseOwnerFilterForBreedingPlan" serializeAs="String">
<value>False</value>
</setting>
</ARKBreedingStats.Properties.Settings>
</userSettings>
</configuration>
248 changes: 131 additions & 117 deletions ARKBreedingStats/BreedingPlan.Designer.cs

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion ARKBreedingStats/BreedingPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public BreedingPlan()
dontUpdateBreedingPlan = false;

cbServerFilterLibrary.Checked = Properties.Settings.Default.UseServerFilterForBreedingPlan;
cbOwnerFilterLibrary.Checked = Properties.Settings.Default.UseOwnerFilterForBreedingPlan;

tagSelectorList1.OnTagChanged += TagSelectorList1_OnTagChanged;
}
Expand Down Expand Up @@ -219,6 +220,14 @@ private void AsyncCalculateBreedingScoresAndDisplayPairs(BreedingMode breedingMo
chosenM = chosenM.Where(c => (c.server == "" && !creatureCollection.hiddenServers.Contains("n/a"))
|| (c.server != "" && !creatureCollection.hiddenServers.Contains(c.server))).ToList();
}
// filter by owner
if (cbOwnerFilterLibrary.Checked)
{
chosenF = chosenF.Where(c => (c.owner == "" && !creatureCollection.hiddenOwners.Contains("n/a"))
|| (c.owner != "" && !creatureCollection.hiddenOwners.Contains(c.owner))).ToList();
chosenM = chosenM.Where(c => (c.owner == "" && !creatureCollection.hiddenOwners.Contains("n/a"))
|| (c.owner != "" && !creatureCollection.hiddenOwners.Contains(c.owner))).ToList();
}

bool creaturesTagFilteredOut = (crCountF != chosenF.Count)
|| (crCountM != chosenM.Count);
Expand Down Expand Up @@ -650,7 +659,9 @@ public List<Creature> Creatures
{
for (int s = 0; s < 8; s++)
{
if (c.levelsWild[s] > bestLevels[s])
if ((s > 6 || statWeights[s] > 0) && c.levelsWild[s] > bestLevels[s])
bestLevels[s] = c.levelsWild[s];
else if (s < 7 && statWeights[s] < 0 && c.levelsWild[s] >= 0 && (c.levelsWild[s] < bestLevels[s] || bestLevels[s] < 0))
bestLevels[s] = c.levelsWild[s];
}
}
Expand Down Expand Up @@ -978,5 +989,11 @@ private void btShowAllCreatures_Click(object sender, EventArgs e)
chosenCreature = null;
calculateBreedingScoresAndDisplayPairs();
}

private void cbOwnerFilterLibrary_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.UseOwnerFilterForBreedingPlan = cbOwnerFilterLibrary.Checked;
calculateBreedingScoresAndDisplayPairs();
}
}
}
6 changes: 6 additions & 0 deletions ARKBreedingStats/CreatureInfoInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ public DateTime Grown
set => dhmsInputGrown.Timespan = value - DateTime.Now;
}

public void SetTimersToChanged()
{
dhmsInputCooldown.changed = true;
dhmsInputGrown.changed = true;
}

public string[] AutocompleteOwnerList
{
set
Expand Down
34 changes: 17 additions & 17 deletions ARKBreedingStats/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 30 additions & 11 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ public Form1()
}

reactOnSelectionChange = true;

// TODO temporary fix if importExportWindow.Location was set to an invalid value
if (Properties.Settings.Default.importExportedLocation.X < 0)
{
Properties.Settings.Default.importExportedLocation = new Point(0, 0);
Properties.Settings.Default.importExportedSize = new Size(800, 800);
}
}

private void Form1_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -427,6 +434,7 @@ private void clearAll(bool clearExtraCreatureData = true)
creatureInfoInputExtractor.parentListValid = false;
creatureInfoInputExtractor.CreatureGuid = Guid.Empty;
exportedCreatureControl = null;
creatureInfoInputExtractor.SetArkId(0, false);
}
}

Expand Down Expand Up @@ -613,7 +621,7 @@ private void extractionFailed(IssueNotes.Issue issues = IssueNotes.Issue.None)
labelTE.BackColor = Color.Transparent;
llOnlineHelpExtractionIssues.Visible = false;
labelErrorHelp.Visible = false;
labelImprintingFailInfo.Visible = false; // TODO move imprinting-fail to upper note-info
lbImprintingFailInfo.Visible = false; // TODO move imprinting-fail to upper note-info
extractor.possibleIssues = IssueNotes.Issue.None;
}
else
Expand Down Expand Up @@ -675,16 +683,15 @@ private void extractionFailed(IssueNotes.Issue issues = IssueNotes.Issue.None)
lbInfoYellowStats.Visible = false;
if (rbBredExtractor.Checked && numericUpDownImprintingBonusExtractor.Value > 0)
{
labelImprintingFailInfo.Text = "If the creature is imprinted the extraction may fail because the game sometimes \"forgets\" " +
"to increase some stat-values during the imprinting-process. Usually it works after a server-restart.";
labelImprintingFailInfo.Visible = true;
lbImprintingFailInfo.Text = Loc.s("lbImprintingFailInfo");
lbImprintingFailInfo.Visible = true;
}
else if (rbTamedExtractor.Checked && "Procoptodon,Pulmonoscorpius,Troodon".Split(',').ToList().Contains(speciesSelector1.species))
{
// creatures that display wrong stat-values after taming
labelImprintingFailInfo.Text = $"The {speciesSelector1.species} is known for displaying wrong stat-values after taming. " +
lbImprintingFailInfo.Text = $"The {speciesSelector1.species} is known for displaying wrong stat-values after taming. " +
"Please try the extraction again after the server restarted.";
labelImprintingFailInfo.Visible = true;
lbImprintingFailInfo.Visible = true;
}
toolStripButtonSaveCreatureValuesTemp.Visible = true;

Expand Down Expand Up @@ -1010,6 +1017,11 @@ private void SpeciesSelector1_onSpeciesChanged()
statPotentials1.setLevels(testingIOs.Select(s => s.LevelWild).ToArray(), true);
setTesterInfoInputCreature();
}
else if (tabControlMain.SelectedTab == tabPageLibrary)
{
if (Properties.Settings.Default.ApplyGlobalSpeciesToLibrary)
listBoxSpeciesLib.SelectedIndex = listBoxSpeciesLib.Items.IndexOf(speciesSelector1.species);
}
else if (tabControlMain.SelectedTab == tabPageTaming)
{
tamingControl1.setSpeciesIndex(speciesSelector1.speciesIndex);
Expand Down Expand Up @@ -1424,7 +1436,7 @@ private void applySettingsToValues()
ArkOCR.OCR.waitBeforeScreenCapture = Properties.Settings.Default.waitBeforeScreenCapture;
ocrControl1.setWhiteThreshold(Properties.Settings.Default.OCRWhiteThreshold);

int maxImprintingPercentage = creatureCollection.allowMoreThanHundredImprinting ? 1000 : 100;
int maxImprintingPercentage = creatureCollection.allowMoreThanHundredImprinting ? 100000 : 100;
numericUpDownImprintingBonusExtractor.Maximum = maxImprintingPercentage;
numericUpDownImprintingBonusTester.Maximum = maxImprintingPercentage;

Expand Down Expand Up @@ -3345,7 +3357,9 @@ private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
}
else if (tabControlMain.SelectedTab == tabPageLibrary)
{
if (libraryNeedsUpdate)
if (Properties.Settings.Default.ApplyGlobalSpeciesToLibrary)
listBoxSpeciesLib.SelectedIndex = listBoxSpeciesLib.Items.IndexOf(speciesSelector1.species);
else if (libraryNeedsUpdate)
filterLib();
}
else if (tabControlMain.SelectedTab == tabPagePedigree)
Expand Down Expand Up @@ -3449,8 +3463,8 @@ private void editCreatureInTester(Creature c, bool virtualCreature = false)
if (c != null)
{
speciesSelector1.setSpecies(c.species);
NumericUpDownTestingTE.Value = c.tamingEff >= 0 ? (decimal)c.tamingEff * 100 : 0;
numericUpDownImprintingBonusTester.Value = (decimal)c.imprintingBonus * 100;
NumericUpDownTestingTE.ValueSave = c.tamingEff >= 0 ? (decimal)c.tamingEff * 100 : 0;
numericUpDownImprintingBonusTester.ValueSave = (decimal)c.imprintingBonus * 100;
if (c.isBred)
rbBredTester.Checked = true;
else if (c.tamingEff > 0 || c.tamingEff == -2) // -2 is unknown (e.g. Giganotosaurus)
Expand Down Expand Up @@ -4651,7 +4665,7 @@ private void chkbToggleOverlay_CheckedChanged(object sender, EventArgs e)
private void toolStripButtonCopy2Tester_Click_1(object sender, EventArgs e)
{
double te = extractor.uniqueTE();
NumericUpDownTestingTE.Value = (decimal)(te >= 0 ? te * 100 : 80);
NumericUpDownTestingTE.ValueSave = (decimal)(te >= 0 ? te * 100 : 80);
numericUpDownImprintingBonusTester.Value = numericUpDownImprintingBonusExtractor.Value;
if (rbBredExtractor.Checked)
rbBredTester.Checked = true;
Expand Down Expand Up @@ -5082,6 +5096,8 @@ private void setCreatureValuesToInfoInput(CreatureValues cv, CreatureInfoInput i
input.Cooldown = cv.cooldownUntil;
input.MotherArkId = cv.motherArkId;
input.FatherArkId = cv.fatherArkId;
input.CreatureNote = "";
input.SetTimersToChanged();
}

private void toolStripButtonSaveCreatureValuesTemp_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -5389,6 +5405,8 @@ private void extractExportedFileInExtractor(string exportFile)

private void extractExportedFileInExtractor(importExported.ExportedCreatureControl ecc, bool updateParentVisuals = false)
{
if (ecc == null) return;

setCreatureValuesToExtractor(ecc.creatureValues, false, false);
extractLevels();
// gets deleted in extractLevels()
Expand Down Expand Up @@ -5546,6 +5564,7 @@ private void setLocalizations(bool init = true)
Loc.ControlText(lbExtractorDomLevel, "domLvl");
Loc.ControlText(lbSum);
Loc.ControlText(lbShouldBe);
Loc.ControlText(lbImprintingFailInfo);
Loc.ControlText(cbExactlyImprinting, tt);
Loc.ControlText(btExtractLevels);
Loc.ControlText(cbQuickWildCheck, tt);
Expand Down
22 changes: 13 additions & 9 deletions ARKBreedingStats/ImportSavegame.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using ARKBreedingStats.species;
using ARKBreedingStats.species;
using SavegameToolkit;
using SavegameToolkit.Arrays;
using SavegameToolkit.Structs;
using SavegameToolkit.Types;
using SavegameToolkitAdditions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ARKBreedingStats {
namespace ARKBreedingStats
{

public class ImportSavegame
{
Expand Down Expand Up @@ -179,6 +180,8 @@ private Creature convertGameObject(GameObject creatureObject, int? levelStep)
{
imprinterName = creatureObject.GetPropertyValue<string>("ImprinterName"),
guid = Utils.ConvertArkIdToGuid(creatureObject.GetDinoId()),
ArkId = creatureObject.GetDinoId(),
ArkIdImported = true,
domesticatedAt = DateTime.Now, // TODO: convert ingame-time to realtime?
addedToLibrary = DateTime.Now,
mutationsMaternal = creatureObject.GetPropertyValue<int>("RandomMutationsFemale"),
Expand Down Expand Up @@ -250,7 +253,8 @@ private string convertSpecies(string species)

// Use fuzzy matching to convert between the two slightly different naming schemes
// This doesn't handle spaces well, so we simply remove them and then it works perfectly
var scores = Values.V.speciesNames.Select(n => new {
var scores = Values.V.speciesNames.Select(n => new
{
Score = DiceCoefficient.diceCoefficient(n.Replace(" ", string.Empty), species.Replace(" ", string.Empty)),
Name = n
});
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.30.0.0")]
[assembly: AssemblyFileVersion("0.30.1.0")]
[assembly: NeutralResourcesLanguage("en")]

Loading

0 comments on commit 5e4466f

Please sign in to comment.