Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Nov 23, 2023
2 parents 3ec4e1b + 22d64a2 commit ff40fb2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 22 deletions.
5 changes: 3 additions & 2 deletions ARKBreedingStats/FileSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ public FileSync(string fileName, Action callback)
UpdateProperties();
}

/// <summary>
/// Update the FileSystemWatcher properties
/// </summary>
public void ChangeFile(string newFileName)
{
_currentFile = newFileName;

// Update the FileSystemWatcher properties
UpdateProperties();
}

Expand Down
16 changes: 13 additions & 3 deletions ARKBreedingStats/Form1.collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ private void NewCollection(bool resetCollection = false)
serverMultipliers = oldMultipliers,
ModList = new List<Mod>()
};
_currentFileName = null;
_fileSync?.ChangeFile(_currentFileName);

if (asaMode)
{
_creatureCollection.Game = Ark.Asa;
ReloadModValuesOfCollectionIfNeeded(true, false, false);
ReloadModValuesOfCollectionIfNeeded(true, false, false, false);
}

pedigree1.Clear();
Expand All @@ -84,8 +86,6 @@ private void NewCollection(bool resetCollection = false)
UpdateCreatureListings();
creatureBoxListView.Clear();
Properties.Settings.Default.LastSaveFile = null;
_currentFileName = null;
_fileSync?.ChangeFile(_currentFileName);
SetCollectionChanged(false);
}

Expand Down Expand Up @@ -877,6 +877,16 @@ private bool ImportExportGunFiles(string[] filePaths, out bool creatureAdded, ou
+ serverImportResult);

SetMessageLabelText(resultText, importFailedCounter > 0 || multipliersImportSuccessful == false ? MessageBoxIcon.Error : MessageBoxIcon.Information, lastCreatureFilePath);

if (lastAddedCreature != null)
{
tabControlMain.SelectedTab = tabPageLibrary;
if (listBoxSpeciesLib.SelectedItem != null &&
listBoxSpeciesLib.SelectedItem != lastAddedCreature.Species)
listBoxSpeciesLib.SelectedItem = lastAddedCreature.Species;
SelectCreatureInLibrary(lastAddedCreature);
}

return creatureAlreadyExists;
}

Expand Down
23 changes: 15 additions & 8 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ private void OpenSettingsDialog(SettingsTabPages page = SettingsTabPages.Unknown
{
// ASA setting changed
var loadAsa = gameSettingBefore != Ark.Asa;
ReloadModValuesOfCollectionIfNeeded(loadAsa, false, false);
ReloadModValuesOfCollectionIfNeeded(loadAsa, false, false, false);
}

ApplySettingsToValues();
Expand Down Expand Up @@ -2757,7 +2757,7 @@ private void loadAdditionalValuesToolStripMenuItem_Click(object sender, EventArg
/// Loads mod value files according to the ModList of the library.
/// </summary>
/// <param name="onlyAdd">If true the values are not reset to the default first.</param>
private void ReloadModValuesOfCollectionIfNeeded(bool onlyAdd = false, bool showResult = true, bool applySettings = true)
private void ReloadModValuesOfCollectionIfNeeded(bool onlyAdd = false, bool showResult = true, bool applySettings = true, bool setCollectionChanged = true)
{
// if the mods for the library changed,
// first check if all mod value files are available and load missing files if possible,
Expand All @@ -2774,7 +2774,8 @@ private void ReloadModValuesOfCollectionIfNeeded(bool onlyAdd = false, bool show
else
UpdateAsaIndicator();

SetCollectionChanged(true);
if (setCollectionChanged)
SetCollectionChanged(true);
}
}

Expand Down Expand Up @@ -3226,11 +3227,17 @@ private void tsBtAddAsExtractionTest_Click(object sender, EventArgs e)

private void copyToMultiplierTesterToolStripButton_Click(object sender, EventArgs e)
{
bool fromExtractor = tabControlMain.SelectedTab == tabPageExtractor;
var tamed = fromExtractor ? rbTamedExtractor.Checked : rbTamedTester.Checked;
var bred = fromExtractor ? rbBredExtractor.Checked : rbBredTester.Checked;

double[] statValues = new double[Stats.StatsCount];
for (int s = 0; s < Stats.StatsCount; s++)
statValues[s] = _statIOs[s].Input;

bool fromExtractor = tabControlMain.SelectedTab == tabPageExtractor;
{
statValues[s] = _statIOs[s].IsActive
? _statIOs[s].Input
: StatValueCalculation.CalculateValue(speciesSelector1.SelectedSpecies, s, 0, 0, tamed || bred);
}

var wildLevels = GetCurrentWildLevels(false);
// the torpor level of the tester is only the sum of the recognized stats. Use the level of the extractor, if that value was recognized.
Expand All @@ -3245,8 +3252,8 @@ private void copyToMultiplierTesterToolStripButton_Click(object sender, EventArg
(double)(fromExtractor
? numericUpDownImprintingBonusExtractor.Value
: numericUpDownImprintingBonusTester.Value) / 100,
fromExtractor ? rbTamedExtractor.Checked : rbTamedTester.Checked,
fromExtractor ? rbBredExtractor.Checked : rbBredTester.Checked,
tamed,
bred,
speciesSelector1.SelectedSpecies);
tabControlMain.SelectedTab = tabPageMultiplierTesting;
}
Expand Down
3 changes: 0 additions & 3 deletions ARKBreedingStats/Form1.importExported.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ private Creature ImportExportedAddIfPossible(string filePath)
copiedNameToClipboard = true;
}
}

SelectCreatureInLibrary(creature);

break;
default: return null;
}
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.58.0.0")]
[assembly: AssemblyFileVersion("0.58.1.0")]
[assembly: NeutralResourcesLanguage("en")]

6 changes: 3 additions & 3 deletions ARKBreedingStats/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static class StatValueCalculation
{
//private const double ROUND_UP_DELTA = 0.0001; // remove for now. Rounding issues should be handled during extraction with value-ranges.

public static double CalculateValue(Species species, int stat, int levelWild, int levelDom, bool dom, double tamingEff, double imprintingBonus, bool roundToIngamePrecision = true)
public static double CalculateValue(Species species, int stat, int levelWild, int levelDom, bool dom, double tamingEff = 0, double imprintingBonus = 0, bool roundToIngamePrecision = true)
{
if (species == null)
return 0;
Expand Down Expand Up @@ -71,8 +71,8 @@ public static float DisplayedAberration(double displayedStatValue, int displayed
// always consider at least an error of. When using only the float-precision often the stat-calculations increase the resulting error to be much larger.
const float minValueError = 0.001f;

// the error can increase due to the stat-calculation. Assume a factor of 10 for now, values lower than 6 were too low.
const float calculationErrorFactor = 11;
// the error can increase due to the stat-calculation. Assume a factor of 10 for now, values lower than 6 were too low. ASA needs it set to at least 18, using 20 for now.
const float calculationErrorFactor = 20;

return highPrecisionInput || displayedStatValue * (displayedDecimals == 3 ? 100 : 1) > 1e6
? Math.Max(minValueError, ((float)displayedStatValue).FloatPrecision() * calculationErrorFactor)
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ARK Smart Breeding": {
"Id": "ARK Smart Breeding",
"Category": "main",
"version": "0.58.0.0"
"version": "0.58.1.0"
},
"SpeciesColorImages": {
"Id": "SpeciesColorImages",
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/json/values/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"mod": { "id": "1139775728", "tag": "Confuciusornis", "title": "Confuciusornis" }
},
"1169020368-Trex.json": {
"version": "357.11.1680434574",
"version": "358.17.1700597183",
"mod": { "id": "1169020368", "tag": "Trex", "title": "Ark Creature Rebalance (AG Reborn)" }
},
"1178308359-ShadDragon.json": {
Expand Down
1 change: 1 addition & 0 deletions ARKBreedingStats/uiControls/StatIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public bool IsActive
Height = value ? 50 : 16;
Enabled = value;
}
get => Enabled;
}

public void Clear()
Expand Down

0 comments on commit ff40fb2

Please sign in to comment.