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 11, 2024
2 parents 61333e5 + afe86af commit b329503
Show file tree
Hide file tree
Showing 25 changed files with 244 additions and 49 deletions.
2 changes: 1 addition & 1 deletion ARKBreedingStats/CreatureInfoInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ public void SetCreatureData(Creature cr)
cr.growingUntil = GrowingUntil;
cr.domesticatedAt = DomesticatedAt;
cr.ArkId = ArkId;
cr.InitializeArkInGame();
cr.InitializeArkIdInGame();
}

private void textBoxOwner_Leave(object sender, EventArgs e)
Expand Down
3 changes: 3 additions & 0 deletions ARKBreedingStats/Form1.Designer.cs

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

9 changes: 8 additions & 1 deletion ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,9 @@ private void numericUpDown_Enter(object sender, EventArgs e)
/// </summary>
private void ApplySettingsToValues()
{
if (_creatureCollection.serverMultipliers == null)
return; // nothing to apply from, settings are loaded soon, then applied

// apply multipliers
Values.V.ApplyMultipliers(_creatureCollection, cbEventMultipliers.Checked);
tamingControl1.SetServerMultipliers(Values.V.currentServerMultipliers);
Expand Down Expand Up @@ -1131,9 +1134,13 @@ private async void CheckForUpdates(bool silentCheck = false, bool selectDefaultI

if (valuesUpdated)
{
var statsLoaded = LoadStatAndKibbleValues(forceReload: true);
var statsLoaded = LoadStatAndKibbleValues(false, true);
if (statsLoaded.statValuesLoaded)
{
_creatureCollection.modListHash = 0;
ReloadModValuesOfCollectionIfNeeded(true, false, false, false);
ApplySettingsToValues();

MessageBox.Show(Loc.S("downloadingValuesSuccess"),
Loc.S("updateSuccessTitle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
ApplySpeciesObjectsToCollection(_creatureCollection);
Expand Down
6 changes: 4 additions & 2 deletions ARKBreedingStats/Form1.extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ private void ShowSumOfChosenLevels(int levelsImpossibleToDistribute)
if (levelsImpossibleToDistribute != 0
&& _statIOs.All(s => s.Status != StatIOStatus.NonUnique))
{
ExtractionFailed(IssueNotes.Issue.SpeedLevelingSetting);
ExtractionFailed(IssueNotes.Issue.SpeedLevelingSetting
| IssueNotes.Issue.TamingEffectivenessRange
| IssueNotes.Issue.ImpossibleTe);
}

bool allValid = valid && inbound && torporLevelValid && _extractor.ValidResults;
Expand Down Expand Up @@ -1201,7 +1203,7 @@ private Creature GetCreatureFromInput(bool fromExtractor, Species species, int?
};

creature.ArkIdImported = Utils.IsArkIdImported(creature.ArkId, creature.guid);
creature.InitializeArkInGame();
creature.InitializeArkIdInGame();

creature.InitializeFlags();

Expand Down
7 changes: 6 additions & 1 deletion ARKBreedingStats/Form1.tester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ private void SetTesterInfoInputCreature(Creature c = null, bool virtualCreature
creatureInfoInputTester.AddedToLibraryAt = c.addedToLibrary;
creatureInfoInputTester.CreatureFlags = c.flags;
creatureInfoInputTester.RegionColors = c.colors;
creatureInfoInputTester.ColorIdsAlsoPossible = c.ColorIdsAlsoPossible;
creatureInfoInputTester.CreatureGuid = c.guid;
creatureInfoInputTester.SetArkId(c.ArkId, c.ArkIdImported);
UpdateParentListInput(creatureInfoInputTester);
Expand All @@ -286,6 +287,7 @@ private void SetTesterInfoInputCreature(Creature c = null, bool virtualCreature
creatureInfoInputTester.AddedToLibraryAt = null;
creatureInfoInputTester.CreatureFlags = CreatureFlags.None;
creatureInfoInputTester.RegionColors = new byte[Ark.ColorRegionCount];
creatureInfoInputTester.ColorIdsAlsoPossible = null;
creatureInfoInputTester.CreatureGuid = Guid.Empty;
creatureInfoInputTester.SetArkId(0, false);
creatureInfoInputTester.MutationCounterMother = 0;
Expand Down Expand Up @@ -340,12 +342,15 @@ private void SetRandomWildLevels(object sender, EventArgs e)
if (species == null) return;

var difficulty = (CreatureCollection.CurrentCreatureCollection?.maxWildLevel ?? 150) / 30;
var creature = DummyCreatures.CreateCreature(species, difficulty, false);
var creature = DummyCreatures.CreateCreature(species, difficulty, !rbWildTester.Checked);

for (int si = 0; si < Stats.StatsCount; si++)
{
_testingIOs[si].LevelWild = creature.levelsWild[si];
}

if (rbTamedTester.Checked)
NumericUpDownTestingTE.ValueSaveDouble = creature.tamingEff * 100;
}

private void pictureBoxColorRegionsTester_Click(object sender, EventArgs e)
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/NamePatterns/NamePattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ public static Dictionary<string, string> CreateTokenDictionary(Creature creature
{ "dom", dom},
{ "arkid", arkid },
{ "alreadyexists", speciesCreatures.Contains(creature) ? "1" : string.Empty },
{ "isflyer", creature.Species.isFlyer ? "1" : string.Empty }
{ "isflyer", creature.Species.isFlyer ? "1" : string.Empty },
{ "status", creature.Status.ToString() }
};

// stat index and according level
Expand Down
1 change: 1 addition & 0 deletions ARKBreedingStats/NamePatterns/PatternEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ private void InsertText(string text)
{ "arkid", "the Ark-Id (as entered or seen in-game)"},
{ "alreadyExists", "returns 1 if the creature is already in the library, can be used with {{#if: }}"},
{ "isFlyer", "returns 1 if the creature's species is a flyer"},
{ "status", "returns the status of the creature, e.g. Available, Obelisk, Dead"},
{ "highest1l", "the highest stat-level of this creature (excluding torpidity)" },
{ "highest2l", "the second highest stat-level of this creature (excluding torpidity)" },
{ "highest3l", "the third highest stat-level of this creature (excluding torpidity)" },
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.60.3.0")]
[assembly: AssemblyFileVersion("0.60.4.0")]
[assembly: NeutralResourcesLanguage("en")]

8 changes: 4 additions & 4 deletions ARKBreedingStats/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
"ARK Smart Breeding": {
"Id": "ARK Smart Breeding",
"Category": "main",
"version": "0.60.3.0"
"version": "0.60.4.0"
},
"SpeciesColorImages": {
"Id": "SpeciesColorImages",
"Category": "Species Images",
"Name": "Species Images",
"Author": "cadaei and Myrmecoleon",
"Description": "Download this package to have a visualization for the colors of creatures (~20 MB), uncheck if you don't want to download these files.",
"Author": "cadaei, Myrmecoleon, coldino",
"Description": "Download this package to have a visualization for the colors of creatures (~21 MB), uncheck if you don't want to download these files.",
"Url": "https://github.com/cadon/ARKStatsExtractor/raw/master/speciesImages/speciesImages.zip",
"LocalPath": "images/speciesImages",
"IsFolder": true,
"Selectable": true,
"version": "2022.11.13"
"version": "2024.03.11"
},
"NamePatternTemplates": {
"Id": "NamePatternTemplates",
Expand Down
6 changes: 3 additions & 3 deletions ARKBreedingStats/_manifest.tt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ string appVersion = Regex.Match(File.ReadAllText(Host.ResolvePath("Properties/As
"Id": "SpeciesColorImages",
"Category": "Species Images",
"Name": "Species Images",
"Author": "cadaei and Myrmecoleon",
"Description": "Download this package to have a visualization for the colors of creatures (~20 MB), uncheck if you don't want to download these files.",
"Author": "cadaei, Myrmecoleon, coldino",
"Description": "Download this package to have a visualization for the colors of creatures (~21 MB), uncheck if you don't want to download these files.",
"Url": "https://github.com/cadon/ARKStatsExtractor/raw/master/speciesImages/speciesImages.zip",
"LocalPath": "images/speciesImages",
"IsFolder": true,
"Selectable": true,
"version": "2022.11.13"
"version": "2024.03.11"
},
"NamePatternTemplates": {
"Id": "NamePatternTemplates",
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/importExportGun/ExportGunServerFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class ExportGunServerFile
public double[] TameAdd { get; set; }
public double[] TameAff { get; set; }
public double WildLevelStepSize { get; set; }
public int MaxWildLevel { get; set; }
public double MaxWildLevel { get; set; }
public int DestroyTamesOverLevelClamp { get; set; }
public double TamingSpeedMultiplier { get; set; } = 1;
public double WildDinoTorporDrainMultiplier { get; set; } = 1;
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/importExportGun/ImportExportGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ internal static bool SetServerMultipliers(CreatureCollection cc, ExportGunServer
cc.serverMultipliers.statMultipliers[s][Stats.IndexLevelWild] = Math.Round(esm.WildLevel[s], roundToDigits);
cc.serverMultipliers.statMultipliers[s][Stats.IndexLevelDom] = Math.Round(esm.TameLevel[s], roundToDigits);
}
cc.maxWildLevel = esm.MaxWildLevel;
cc.maxWildLevel = (int)Math.Ceiling(esm.MaxWildLevel);
cc.maxServerLevel = esm.DestroyTamesOverLevelClamp;
cc.serverMultipliers.TamingSpeedMultiplier = Math.Round(esm.TamingSpeedMultiplier, roundToDigits);
cc.serverMultipliers.DinoCharacterFoodDrainMultiplier = Math.Round(esm.DinoCharacterFoodDrainMultiplier, roundToDigits);
Expand Down
8 changes: 4 additions & 4 deletions ARKBreedingStats/json/values/ASA-values.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.11.468631",
"version": "32.11.468632",
"format": "1.15-asa",
"mod": {
"id": "ASA",
Expand Down Expand Up @@ -1594,13 +1594,13 @@
"incubationTime": 5999.52004,
"eggTempMin": 26,
"eggTempMax": 32,
"maturationTime": 416666.667,
"maturationTime": 166666.667,
"matingCooldownMin": 64800,
"matingCooldownMax": 172800
},
"taming": {
"nonViolent": false,
"violent": true,
"nonViolent": true,
"violent": false,
"tamingIneffectiveness": 0.06,
"affinityNeeded0": 6800,
"affinityIncreasePL": 160,
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/json/values/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
"mod": { "id": "919470289", "tag": "SSFlyer", "title": "SSFlyer" }
},
"ASA-values.json": {
"version": "32.11.468631",
"version": "32.11.468632",
"format": "1.15-asa",
"mod": { "id": "ASA", "tag": "", "title": "Ark: Survival Ascended", "shortTitle": "ASA" }
},
Expand All @@ -407,7 +407,7 @@
"mod": { "id": "CrystalIsles", "tag": "CrystalIsles", "title": "CrystalIsles", "official": true, "expansion": true }
},
"values.json": {
"version": "358.6.11410860"
"version": "358.17.12291776"
}
}
}
6 changes: 4 additions & 2 deletions ARKBreedingStats/json/values/values.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "358.6.11410860",
"version": "358.17.12291776",
"format": "1.14-flyerspeed",
"species": [
{
Expand Down Expand Up @@ -105510,11 +105510,13 @@
}
],
"taming": {
"nonViolent": false,
"nonViolent": true,
"violent": false,
"tamingIneffectiveness": 0.9375,
"affinityNeeded0": 6850,
"affinityIncreasePL": 300,
"wakeAffinityMult": 1.6,
"wakeFoodDeplMult": 2,
"foodConsumptionBase": 0.001543,
"foodConsumptionMult": 216.0294,
"babyFoodConsumptionMult": 510
Expand Down
7 changes: 7 additions & 0 deletions ARKBreedingStats/library/AddDummyCreaturesSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ private void BtOk_Click(object sender, EventArgs e)
{
if (NudAmount.Value > 0)
{
if (NudAmount.Value > 1000
&& NudBreedForGenerations.Value > 0
&& MessageBox.Show("Adding many creatures and simulate breeding may take a long time. Continue?",
"Continue possible lengthy action?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
!= DialogResult.Yes)
return;

DialogResult = DialogResult.OK;
Settings = new DummyCreatureCreationSettings
{
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/library/Creature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,15 +570,15 @@ public double Maturation
[OnDeserialized]
private void Initialize(StreamingContext ct)
{
InitializeArkInGame();
InitializeArkIdInGame();
if (flags.HasFlag(CreatureFlags.Placeholder)) return;
InitializeArrays();
}

/// <summary>
/// Set the string of ArkIdInGame depending on the real ArkId or the user input number.
/// </summary>
internal void InitializeArkInGame() => ArkIdInGame = ArkIdImported ? Utils.ConvertImportedArkIdToIngameVisualization(ArkId) : ArkId.ToString();
internal void InitializeArkIdInGame() => ArkIdInGame = ArkIdImported ? Utils.ConvertImportedArkIdToIngameVisualization(ArkId) : ArkId.ToString();

private void InitializeArrays()
{
Expand Down
6 changes: 5 additions & 1 deletion ARKBreedingStats/library/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ public class CreatureCollection

[JsonProperty]
public ServerMultipliers serverMultipliers;

/// <summary>
/// Only the taming and breeding multipliers of this are used.
/// </summary>
[JsonProperty]
public ServerMultipliers serverMultipliersEvents; // only the taming and breeding multipliers of this are used
public ServerMultipliers serverMultipliersEvents;

/// <summary>
/// Deprecated setting, remove on 2025-01-01
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/oldLibraryFormat/FormatConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void UpgradeFormatTo12Stats(CreatureCollectionOld ccOld, CreatureC
tamingEff = c.tamingEff,
tribe = c.tribe
};
newC.InitializeArkInGame();
newC.InitializeArkIdInGame();
ccNew.creatures.Add(newC);

if (c.IsPlaceholder) newC.flags |= CreatureFlags.Placeholder;
Expand Down
25 changes: 16 additions & 9 deletions ARKBreedingStats/settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,10 @@ private void ExtractSettingsFromText(string text, bool doMergeSettings = false)

for (int s = 0; s < Stats.StatsCount; s++)
{
ParseAndSetStatMultiplier(0, @"PerLevelStatsMultiplier_DinoTamed_Add\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(1, @"PerLevelStatsMultiplier_DinoTamed_Affinity\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(2, @"PerLevelStatsMultiplier_DinoTamed\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(3, @"PerLevelStatsMultiplier_DinoWild\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(Stats.IndexTamingAdd, @"PerLevelStatsMultiplier_DinoTamed_Add\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(Stats.IndexTamingMult, @"PerLevelStatsMultiplier_DinoTamed_Affinity\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(Stats.IndexLevelDom, @"PerLevelStatsMultiplier_DinoTamed\[" + s + @"\] ?= ?(\d*\.?\d+)");
ParseAndSetStatMultiplier(Stats.IndexLevelWild, @"PerLevelStatsMultiplier_DinoWild\[" + s + @"\] ?= ?(\d*\.?\d+)");

void ParseAndSetStatMultiplier(int multiplierIndex, string regexPattern)
{
Expand All @@ -859,6 +859,9 @@ void ParseAndSetStatMultiplier(int multiplierIndex, string regexPattern)
}
}
}
// some server files have a different value for wild level torpor increase, but ARK ignores that value.
// reset that value, so no error message pops up, so user is not confused. Error message only on manual input
_multSetter[Stats.Torpidity].SetMultiplier(Stats.IndexLevelWild, 1);

// breeding
ParseAndSetValue(nudMatingInterval, @"MatingIntervalMultiplier ?= ?(\d*\.?\d+)");
Expand Down Expand Up @@ -971,13 +974,17 @@ private void LoadServerMultipliersFromSavFile(string filePath)
const int roundToDigits = 6;
for (int s = 0; s < Stats.StatsCount; s++)
{
_multSetter[s].SetMultiplier(0, Math.Round(esm.TameAdd[s], roundToDigits));
_multSetter[s].SetMultiplier(1, Math.Round(esm.TameAff[s], roundToDigits));
_multSetter[s].SetMultiplier(2, Math.Round(esm.TameLevel[s], roundToDigits));
_multSetter[s].SetMultiplier(3, Math.Round(esm.WildLevel[s], roundToDigits));
_multSetter[s].SetMultiplier(Stats.IndexTamingAdd, Math.Round(esm.TameAdd[s], roundToDigits));
_multSetter[s].SetMultiplier(Stats.IndexTamingMult, Math.Round(esm.TameAff[s], roundToDigits));
_multSetter[s].SetMultiplier(Stats.IndexLevelDom, Math.Round(esm.TameLevel[s], roundToDigits));
_multSetter[s].SetMultiplier(Stats.IndexLevelWild, Math.Round(esm.WildLevel[s], roundToDigits));
}
// some server files have a different value for wild level torpor increase, but ARK ignores that value.
// reset that value, so no error message pops up, so user is not confused. Error message only on manual input
_multSetter[Stats.Torpidity].SetMultiplier(Stats.IndexLevelWild, 1);

nudMaxWildLevels.ValueSave = esm.MaxWildLevel;
nudMaxWildLevels.ValueSaveDouble = Math.Ceiling(esm.MaxWildLevel);
nudWildLevelStep.ValueSaveDouble = Math.Round(esm.WildLevelStepSize, roundToDigits);
nudMaxServerLevel.ValueSave = esm.DestroyTamesOverLevelClamp;
nudTamingSpeed.ValueSaveDouble = Math.Round(esm.TamingSpeedMultiplier, roundToDigits);
nudDinoCharacterFoodDrain.ValueSaveDouble = Math.Round(esm.DinoCharacterFoodDrainMultiplier, roundToDigits);
Expand Down
4 changes: 4 additions & 0 deletions ARKBreedingStats/uiControls/ColorPickerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ private void ColorChosen(object sender, EventArgs e)
}

SelectedColorId = (byte)((Button)sender).Tag;
// if selected color was alternative selected color, remove alternative color
if (SelectedColorId == SelectedColorIdAlternative)
SelectedColorIdAlternative = 0;

if (sender is NoPaddingButton bts)
{
_buttonSelectedColor = bts;
Expand Down
Loading

0 comments on commit b329503

Please sign in to comment.