Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Mar 26, 2023
2 parents 71221cd + febae28 commit 4ace471
Show file tree
Hide file tree
Showing 16 changed files with 151 additions and 65 deletions.
1 change: 1 addition & 0 deletions ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<ApplicationIcon>ARKSmartBreeding.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
Expand Down
10 changes: 7 additions & 3 deletions ARKBreedingStats/CreatureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ void SetParentLabel(Label l, string lbText = null, bool clickable = false)
_tt.SetToolTip(l, clickable ? lbText : null);
}

SetParentLabel(LbFather);

if (_creature.Mother != null || _creature.Father != null)
{
SetParentLabel(LbMotherAndWildInfo, _creature.Mother != null ? $"{Loc.S("Mother")}: {_creature.Mother.name}" : null, _creature.Mother != null);
Expand All @@ -134,12 +136,14 @@ void SetParentLabel(Label l, string lbText = null, bool clickable = false)
else if (_creature.isBred)
{
SetParentLabel(LbMotherAndWildInfo, "bred, click 'edit' to add parents");
SetParentLabel(LbFather);
}
else
else if (_creature.isDomesticated)
{
SetParentLabel(LbMotherAndWildInfo, "found wild " + _creature.levelFound + (_creature.tamingEff >= 0 ? ", tamed with TE: " + (_creature.tamingEff * 100).ToString("N1") + "%" : ", TE unknown."));
SetParentLabel(LbFather);
}
else
{
SetParentLabel(LbMotherAndWildInfo, "found wild " + _creature.levelFound);
}
statsDisplay1.SetCreatureValues(_creature);
labelNotes.Text = _creature.note;
Expand Down
26 changes: 18 additions & 8 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ private void Form1_Load(object sender, EventArgs e)
Environment.Exit(1);
}

statsMultiplierTesting1.SetGameDefaultMultiplier();

for (int s = 0; s < Stats.StatsCount; s++)
{
_statIOs[s].Input = 0;
Expand Down Expand Up @@ -1816,28 +1818,35 @@ private void SetStatusOfSelectedCreatures(CreatureStatus s)

private void SetCreatureStatus(IEnumerable<Creature> cs, CreatureStatus s)
{
bool changed = false;
List<string> speciesBlueprints = new List<string>();
var changed = false;
var deadStatusWasSet = false;
var changedSpecies = new List<Species>();
foreach (Creature c in cs)
{
if (c.Status != s)
{
changed = true;
deadStatusWasSet = deadStatusWasSet || c.Status.HasFlag(CreatureStatus.Dead);
c.Status = s;
if (!speciesBlueprints.Contains(c.speciesBlueprint))
speciesBlueprints.Add(c.speciesBlueprint);
if (!changedSpecies.Contains(c.Species))
changedSpecies.Add(c.Species);
}
}

if (changed)
{
// update list / recalculate topStats
CalculateTopStats(_creatureCollection.creatures
.Where(c => speciesBlueprints.Contains(c.speciesBlueprint)).ToList());
.Where(c => changedSpecies.Contains(c.Species)).ToList());
Species speciesIfOnlyOne = changedSpecies.Count == 1 ? changedSpecies[0] : null;
if (s.HasFlag(CreatureStatus.Dead) ^ deadStatusWasSet)
{
LibraryInfo.ClearInfo();
_creatureCollection.ResetExistingColors(speciesIfOnlyOne);
}
FilterLibRecalculate();
UpdateStatusBar();
SetCollectionChanged(true,
speciesBlueprints.Count == 1 ? Values.V.SpeciesByBlueprint(speciesBlueprints[0]) : null);
SetCollectionChanged(true, speciesIfOnlyOne);
}
}

Expand Down Expand Up @@ -2855,7 +2864,8 @@ private void SetCreatureValuesToInfoInput(CreatureValues cv, CreatureInfoInput i

private void toolStripButtonSaveCreatureValuesTemp_Click(object sender, EventArgs e)
{
_creatureCollection.creaturesValues.Add(GetCreatureValuesFromExtractor());
_creatureCollection.creaturesValues = _creatureCollection.creaturesValues.Append(GetCreatureValuesFromExtractor())
.OrderBy(c => c.Species?.DescriptiveNameAndMod).ThenBy(c => c.name).ToList();
SetCollectionChanged(true);
UpdateTempCreatureDropDown();
}
Expand Down
1 change: 0 additions & 1 deletion ARKBreedingStats/Form1.extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ private void ShowSumOfChosenLevels()
if (allValid)
{
radarChartExtractor.SetLevels(_statIOs.Select(s => s.LevelWild).ToArray());
toolStripButtonSaveCreatureValuesTemp.Visible = false;
cbExactlyImprinting.BackColor = Color.Transparent;
var species = speciesSelector1.SelectedSpecies;
var checkTopLevels = _topLevels.TryGetValue(species, out int[] topSpeciesLevels);
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Form1.library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private Creature AddCreatureToCollection(bool fromExtractor = true, long motherA
{
input = creatureInfoInputExtractor;
bred = rbBredExtractor.Checked;
te = _extractor.UniqueTamingEffectiveness();
te = rbWildExtractor.Checked ? -3 : _extractor.UniqueTamingEffectiveness();
imprinting = _extractor.ImprintingBonus;
}
else
Expand Down
8 changes: 4 additions & 4 deletions ARKBreedingStats/Form1.tester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ private void PbCreatureColorsExtractor_Click(object sender, EventArgs e)
{
Species = speciesSelector1.SelectedSpecies,
levelsWild = GetCurrentWildLevels(true),
levelsDom = GetCurrentDomLevels(true)
levelsDom = GetCurrentDomLevels(true),
tamingEff = _extractor.UniqueTamingEffectiveness(),
isBred = rbBredExtractor.Checked,
imprintingBonus = _extractor.ImprintingBonus
};

creature.tamingEff = _extractor.UniqueTamingEffectiveness();
creature.isBred = rbBredExtractor.Checked;
creature.imprintingBonus = _extractor.ImprintingBonus;
creatureInfoInputExtractor.SetCreatureData(creature);
creature.RecalculateAncestorGenerations();
creature.RecalculateNewMutations();
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.51.0.0")]
[assembly: AssemblyFileVersion("0.51.1.0")]
[assembly: NeutralResourcesLanguage("en")]

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.51.0.0"
"version": "0.51.1.0"
},
"SpeciesColorImages": {
"Id": "SpeciesColorImages",
Expand Down
12 changes: 6 additions & 6 deletions ARKBreedingStats/json/values/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"mod": { "id": "1139775728", "tag": "Confuciusornis", "title": "Confuciusornis" }
},
"1169020368-Trex.json": {
"version": "357.3.1678038097",
"version": "357.4.1679236349",
"mod": { "id": "1169020368", "tag": "Trex", "title": "Ark Creature Rebalance (AG Reborn)" }
},
"1178308359-ShadDragon.json": {
Expand Down Expand Up @@ -72,7 +72,7 @@
"mod": { "id": "1356703358", "tag": "Primal_Fear_Noxious_Creatures", "title": "Primal Fear Noxious Creatures" }
},
"1373744537-AC2.json": {
"version": "356.11.1676323618",
"version": "357.4.1679590122",
"mod": { "id": "1373744537", "tag": "AC2", "title": "Additional Creatures 2: Wild Ark" }
},
"1379111008-RealismPlus.json": {
Expand Down Expand Up @@ -104,7 +104,7 @@
"mod": { "id": "1522327484", "tag": "Additions_Pack", "title": "ARK Additions!" }
},
"1523045986-Paranoia.json": {
"version": "356.5.1668722824",
"version": "357.4.1679444826",
"mod": { "id": "1523045986", "tag": "Paranoia", "title": "Additional Creatures 2: Paranoia!" }
},
"1565015734-BetterDinosTest.json": {
Expand Down Expand Up @@ -145,7 +145,7 @@
"mod": { "id": "1662691167", "tag": "Senior", "title": "Additional Creatures: Senior Class" }
},
"1675895024-NoUntameables.json": {
"version": "356.5.1675695969",
"version": "357.4.1678903474",
"mod": { "id": "1675895024", "tag": "NoUntameables", "title": "No Untameables" }
},
"1676159020-Aquaria.json": {
Expand Down Expand Up @@ -243,7 +243,7 @@
"mod": { "id": "2000326197", "tag": "ExtraResources", "title": "Event Assets" }
},
"2003934830-Beasts.json": {
"version": "356.12.1677099299",
"version": "357.4.1678923214",
"mod": { "id": "2003934830", "tag": "Beasts", "title": "Prehistoric Beasts" }
},
"2019846325-ApexMod.json": {
Expand Down Expand Up @@ -331,7 +331,7 @@
"mod": { "id": "883957187", "tag": "WyvernWorld", "title": "Wyvern World" }
},
"893735676-AE.json": {
"version": "356.5.1675949309",
"version": "357.5.1679775865",
"mod": { "id": "893735676", "tag": "AE", "title": "Ark Eternal" }
},
"895711211-ClassicFlyers.json": {
Expand Down
7 changes: 7 additions & 0 deletions ARKBreedingStats/library/Creature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ public override int GetHashCode()
public void CalculateLevelFound(int? levelStep)
{
levelFound = 0;

if (!isDomesticated)
{
levelFound = LevelHatched;
return;
}

if (isBred || tamingEff < 0) return;

if (levelStep.HasValue)
Expand Down
6 changes: 4 additions & 2 deletions ARKBreedingStats/library/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using ARKBreedingStats.mods;

namespace ARKBreedingStats.Library
Expand Down Expand Up @@ -484,7 +483,10 @@ internal ColorExisting[] ColorAlreadyAvailable(Species species, byte[] colorIds,
for (int i = 0; i < usedColorCount + 1; i++) speciesExistingColors[i] = new List<int>();
foreach (Creature c in creatures)
{
if (c.flags.HasFlag(CreatureFlags.Placeholder) || c.Species == null || c.speciesBlueprint != species.blueprintPath)
if (c.flags.HasFlag(CreatureFlags.Placeholder)
|| c.flags.HasFlag(CreatureFlags.Dead)
|| c.Species == null
|| c.speciesBlueprint != species.blueprintPath)
continue;

for (int i = 0; i < usedColorCount; i++)
Expand Down

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

60 changes: 47 additions & 13 deletions ARKBreedingStats/multiplierTesting/StatMultiplierTestingControl.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using ARKBreedingStats.miscClasses;
using ARKBreedingStats.uiControls;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;

namespace ARKBreedingStats.multiplierTesting
{
Expand Down Expand Up @@ -68,7 +68,14 @@ public partial class StatMultiplierTestingControl : UserControl
/// Singleplayer extra multiplier for taming multiplier.
/// </summary>
private double _spTm;
/// <summary>
/// Values of currently saved settings.
/// </summary>
private double[] _multipliersOfSettings;
/// <summary>
/// Values of default game values.
/// </summary>
public double[] StatMultipliersGameDefault;

/// <summary>
/// The values of this stat. 0: Base, 1: Iw, 2: Id, 3: Ta, 4: Tm
Expand Down Expand Up @@ -490,30 +497,57 @@ private void calculateIBMToolStripMenuItem_Click(object sender, EventArgs e)

private void resetIwMToolStripMenuItem_Click(object sender, EventArgs e)
{
nudIwM.Value = (decimal)_multipliersOfSettings[3];
ResetMultiplier(3, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void resetTaMToolStripMenuItem_Click(object sender, EventArgs e)
{
nudTaM.Value = (decimal)_multipliersOfSettings[0];
ResetMultiplier(0, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void resetTmMToolStripMenuItem_Click(object sender, EventArgs e)
{
nudTmM.Value = (decimal)_multipliersOfSettings[1];
ResetMultiplier(1, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void resetIdMToolStripMenuItem_Click(object sender, EventArgs e)
{
nudIdM.Value = (decimal)_multipliersOfSettings[2];
ResetMultiplier(2, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void resetAllMultiplierOfThisStatToolStripMenuItem_Click(object sender, EventArgs e)
{
nudTaM.Value = (decimal)_multipliersOfSettings[0];
nudTmM.Value = (decimal)_multipliersOfSettings[1];
nudIdM.Value = (decimal)_multipliersOfSettings[2];
nudIwM.Value = (decimal)_multipliersOfSettings[3];
ResetMultiplier(-1, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

/// <summary>
/// Reset multiplier value to the current value in the settings, if gameDefault is true, the game default values are used.
/// </summary>
private void ResetMultiplier(int index, bool gameDefault = false)
{
var multipliersToUse = gameDefault ? StatMultipliersGameDefault : _multipliersOfSettings;
switch (index)
{
case 0:
nudTaM.Value = (decimal)multipliersToUse[0];
return;
case 1:
nudTmM.Value = (decimal)multipliersToUse[1];
return;
case 2:
nudIdM.Value = (decimal)multipliersToUse[2];
return;
case 3:
nudIwM.Value = (decimal)multipliersToUse[3];
return;
case -1:
// set all
nudTaM.Value = (decimal)multipliersToUse[0];
nudTmM.Value = (decimal)multipliersToUse[1];
nudIdM.Value = (decimal)multipliersToUse[2];
nudIwM.Value = (decimal)multipliersToUse[3];
return;
}
}

private void setWildLevelToClosestValueToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -711,7 +745,7 @@ private void btCalculateIwM_Click(object sender, EventArgs e)

private void btResetIwM_Click(object sender, EventArgs e)
{
nudIwM.Value = (decimal)_multipliersOfSettings[3];
ResetMultiplier(3, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void btCalculateTaM_Click(object sender, EventArgs e)
Expand All @@ -721,7 +755,7 @@ private void btCalculateTaM_Click(object sender, EventArgs e)

private void btResetTaM_Click(object sender, EventArgs e)
{
nudTaM.Value = (decimal)_multipliersOfSettings[0];
ResetMultiplier(0, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void btCalculateTmM_Click(object sender, EventArgs e)
Expand All @@ -731,7 +765,7 @@ private void btCalculateTmM_Click(object sender, EventArgs e)

private void btResetTmM_Click(object sender, EventArgs e)
{
nudTmM.Value = (decimal)_multipliersOfSettings[1];
ResetMultiplier(1, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void btCalculateDomLevel_Click(object sender, EventArgs e)
Expand All @@ -746,7 +780,7 @@ private void btCalculateIdM_Click(object sender, EventArgs e)

private void btResetIdM_Click(object sender, EventArgs e)
{
nudIdM.Value = (decimal)_multipliersOfSettings[2];
ResetMultiplier(2, Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control));
}

private void btCalculateTE_Click(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit 4ace471

Please sign in to comment.