Skip to content

Commit 364f7c8

Browse files
committed
Merge branch 'dev'
2 parents 112809e + 1c54c36 commit 364f7c8

19 files changed

+1809
-1647
lines changed

ARKBreedingStats/ARKBreedingStats.csproj

+5
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<Compile Include="library\DummyCreatures.cs" />
108108
<Compile Include="NamePatterns\JavaScriptNamePattern.cs" />
109109
<Compile Include="NamePatterns\TokenModel.cs" />
110+
<Compile Include="species\CanHaveWildLevelExceptions.cs" />
110111
<Compile Include="StatsOptions\StatsOptionsControl.cs">
111112
<SubType>Component</SubType>
112113
</Compile>
@@ -707,6 +708,7 @@
707708
<Compile Include="utils\ExceptionMessages.cs" />
708709
<Compile Include="utils\ExtensionMethods.cs" />
709710
<Compile Include="utils\CreatureListSorter.cs" />
711+
<Compile Include="utils\Logging.cs" />
710712
<Compile Include="utils\MessageBoxes.cs" />
711713
<Compile Include="NamePatterns\NamePatternFunctions.cs" />
712714
<Compile Include="utils\NaturalComparer.cs" />
@@ -719,6 +721,9 @@
719721
<Compile Include="values\Values.cs" />
720722
<Compile Include="utils\Win32API.cs" />
721723
<Compile Include="values\ValuesFile.cs" />
724+
<None Include="json\canHaveWildLevelExceptions.json">
725+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
726+
</None>
722727
<None Include="json\values\ASA-values.json">
723728
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
724729
</None>

ARKBreedingStats/App.config

+3
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@
529529
<setting name="OverlayImportPattern" serializeAs="String">
530530
<value />
531531
</setting>
532+
<setting name="ExtractorConvertWildTorporTotalLevel" serializeAs="String">
533+
<value>True</value>
534+
</setting>
532535
</ARKBreedingStats.Properties.Settings>
533536
</userSettings>
534537
</configuration>

ARKBreedingStats/Form1.cs

+22-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using ARKBreedingStats.mods;
1919
using ARKBreedingStats.NamePatterns;
2020
using ARKBreedingStats.StatsOptions;
21-
using ARKBreedingStats.StatsOptions.LevelColorSettings;
2221
using ARKBreedingStats.StatsOptions.TopStatsSettings;
2322
using ARKBreedingStats.utils;
2423
using static ARKBreedingStats.settings.Settings;
@@ -2228,13 +2227,18 @@ private void StatIOQuickWildLevelCheck(StatIO sIo)
22282227
{
22292228
_clearExtractionCreatureData =
22302229
true; // as soon as the user changes stat-values, it's assumed it's not an exported creature anymore
2231-
if (sIo.statIndex == Stats.Torpidity && rbWildExtractor.Checked)
2230+
2231+
if (sIo.statIndex == Stats.Torpidity
2232+
&& rbWildExtractor.Checked
2233+
&& Properties.Settings.Default.ExtractorConvertWildTorporTotalLevel
2234+
&& speciesSelector1.SelectedSpecies?.stats is SpeciesStat[] speciesStats)
22322235
{
2233-
if (!(speciesSelector1.SelectedSpecies?.stats is SpeciesStat[] speciesStats)) return;
2234-
var trp = speciesStats[Stats.Torpidity];
2235-
if (trp == null || trp.BaseValue == 0 || trp.IncPerWildLevel == 0) return;
2236-
numericUpDownLevel.ValueSaveDouble = (sIo.Input / trp.BaseValue - 1) / trp.IncPerWildLevel;
2237-
return;
2236+
var torpidity = speciesStats[Stats.Torpidity];
2237+
if (torpidity != null && torpidity.BaseValue != 0 && torpidity.IncPerWildLevel != 0)
2238+
{
2239+
numericUpDownLevel.ValueSaveDouble =
2240+
Math.Round((sIo.Input / torpidity.BaseValue - 1) / torpidity.IncPerWildLevel + 1);
2241+
}
22382242
}
22392243

22402244
if (!cbQuickWildCheck.Checked) return;
@@ -3733,16 +3737,19 @@ private async void DisplayUpdateModules(bool onlyShowDialogIfUpdatesAreAvailable
37333737
{
37343738
if (!modules.UpdateAvailable && !selectDefaultImagesIfNotYet && onlyShowDialogIfUpdatesAreAvailable)
37353739
{
3736-
if (initializeImages) InitializeImages();
3740+
InitializeImages(!initializeImages);
37373741
return;
37383742
}
37393743

37403744
if (selectDefaultImagesIfNotYet)
37413745
modules.SelectDefaultImages();
37423746

37433747
modules.ShowDialog();
3744-
if (modules.DialogResult != DialogResult.OK)
3745-
return;
3748+
var dialogResult = modules.DialogResult;
3749+
3750+
InitializeImages(true);
3751+
3752+
if (dialogResult != DialogResult.OK) return;
37463753

37473754
var result = await modules.DownloadRequestedModulesAsync();
37483755

@@ -3757,12 +3764,15 @@ private async void DisplayUpdateModules(bool onlyShowDialogIfUpdatesAreAvailable
37573764
InitializeImages();
37583765
}
37593766

3760-
void InitializeImages()
3767+
void InitializeImages(bool onlyIfNotYetSet = false)
37613768
{
3769+
if (onlyIfNotYetSet && !string.IsNullOrEmpty(Properties.Settings.Default.SpeciesImagesFolder))
3770+
return;
3771+
37623772
Properties.Settings.Default.SpeciesImagesFolder = modules.GetSpeciesImagesFolder();
37633773
CreatureColored.InitializeSpeciesImageLocation();
37643774

3765-
if (Properties.Settings.Default.SpeciesImagesFolder != null)
3775+
if (!string.IsNullOrEmpty(Properties.Settings.Default.SpeciesImagesFolder))
37663776
speciesSelector1.InitializeSpeciesImages(Values.V.species);
37673777
}
37683778
}

ARKBreedingStats/Form1.extractor.cs

+10-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using ARKBreedingStats.utils;
1414
using ARKBreedingStats.ocr;
1515
using ARKBreedingStats.uiControls;
16-
using System.Reflection;
1716

1817
namespace ARKBreedingStats
1918
{
@@ -443,6 +442,11 @@ private bool ExtractLevels(bool autoExtraction = false, bool statInputsHighPreci
443442
{
444443
possibleExtractionIssues |= IssueNotes.Issue.SinglePlayer;
445444
}
445+
// if the stat is speed, the allowSpeedLeveling could be set incorrectly. For bred creatures that setting affects if speed is changed by imprinting.
446+
if (s == Stats.SpeedMultiplier && rbBredExtractor.Checked && numericUpDownImprintingBonusExtractor.Value > 0)
447+
{
448+
possibleExtractionIssues |= IssueNotes.Issue.SpeedLevelingSetting;
449+
}
446450
}
447451
}
448452
if (!_extractor.ValidResults)
@@ -1554,10 +1558,13 @@ private void BtSetImprinting100_Click(object sender, EventArgs e)
15541558

15551559
private void numericUpDownLevel_ValueChanged(object sender, EventArgs e)
15561560
{
1557-
if (!(rbWildExtractor.Checked && speciesSelector1.SelectedSpecies is Species species)) return;
1561+
if (!(Properties.Settings.Default.ExtractorConvertWildTorporTotalLevel
1562+
&& rbWildExtractor.Checked
1563+
&& speciesSelector1.SelectedSpecies is Species species
1564+
)) return;
15581565

15591566
_statIOs[Stats.Torpidity].Input = StatValueCalculation.CalculateValue(species,
1560-
Stats.Torpidity, (int)numericUpDownLevel.Value, 0, 0, false);
1567+
Stats.Torpidity, (int)numericUpDownLevel.Value - 1, 0, 0, false);
15611568
}
15621569
}
15631570
}

ARKBreedingStats/Properties/AssemblyInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
// Revision
3131
//
3232
[assembly: AssemblyVersion("1.0.0.0")]
33-
[assembly: AssemblyFileVersion("0.64.0.0")]
33+
[assembly: AssemblyFileVersion("0.64.1.0")]
3434
[assembly: NeutralResourcesLanguage("en")]
3535

ARKBreedingStats/Properties/Settings.Designer.cs

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ARKBreedingStats/Properties/Settings.settings

+3
Original file line numberDiff line numberDiff line change
@@ -596,5 +596,8 @@
596596
<Setting Name="OverlayImportPattern" Type="System.String" Scope="User">
597597
<Value Profile="(Default)" />
598598
</Setting>
599+
<Setting Name="ExtractorConvertWildTorporTotalLevel" Type="System.Boolean" Scope="User">
600+
<Value Profile="(Default)">True</Value>
601+
</Setting>
599602
</Settings>
600603
</SettingsFile>

ARKBreedingStats/Updater/UpdateModules.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,8 @@ internal async Task<string> DownloadRequestedModulesAsync()
191191
return sb.ToString();
192192
}
193193

194-
public string GetSpeciesImagesFolder()
195-
{
196-
if (!(_checkboxesSelectModule?.Any() ?? false)) return null;
197-
198-
return _checkboxesSelectModule.Where(cb => cb.Checked).Select(cb => cb.Tag as AsbModule)
194+
public string GetSpeciesImagesFolder() =>
195+
_checkboxesSelectModule?.Where(cb => cb.Checked).Select(cb => cb.Tag as AsbModule)
199196
.FirstOrDefault(m => m?.Category == "Species Images")?.LocalPath;
200-
}
201197
}
202198
}

ARKBreedingStats/_manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ARK Smart Breeding": {
55
"Id": "ARK Smart Breeding",
66
"Category": "main",
7-
"version": "0.64.0.0"
7+
"version": "0.64.1.0"
88
},
99
"SpeciesColorImages": {
1010
"Id": "SpeciesColorImages",

ARKBreedingStats/importExportGun/ReadExportFile.cs

+24-7
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,37 @@ public static string ReadFile(string filePath, string expectedStartString, out s
2727
}
2828

2929
const string strProp = "StrProperty";
30-
if (!SearchBytes(br, Encoding.ASCII.GetBytes(strProp)))
30+
if (!SearchBytes(br, Encoding.ASCII.GetBytes(strProp + '\0')))
3131
{
3232
error = $"Expected property {strProp} not found";
3333
return null;
3434
}
3535

36-
br.ReadBytes(9); // skipping to json string length
37-
var jsonLength = br.ReadInt32();
38-
if (jsonLength <= 0)
36+
// Assumption of the next 12 bytes:
37+
// first the length of the string in bytes including 4 leading bytes (i.e. 4 bytes longer than the actual string)
38+
// then four \0 bytes
39+
// the next 4 bytes are the length of the actual string, depending on the encoding:
40+
// If >0 it's the length in bytes and the string uses utf8, if it's <0 it's the negative length of the string in double bytes
41+
var jsonByteLength = br.ReadInt32() - 4; // string length (subtracting the 4 encoding length bytes)
42+
br.ReadBytes(4); // skipping \0 bytes
43+
var jsonCharLength = br.ReadInt32();
44+
var useUtf16 = false;
45+
if (jsonCharLength <= 0)
3946
{
40-
error = $"Json length {jsonLength} at position {(br.BaseStream.Position - 4)} invalid";
41-
return null;
47+
if (jsonCharLength * -2 == jsonByteLength)
48+
{
49+
useUtf16 = true;
50+
}
51+
else
52+
{
53+
error = $"Json length {jsonCharLength} at position {(br.BaseStream.Position - 4)} invalid";
54+
return null;
55+
}
4256
}
43-
return Encoding.UTF8.GetString(br.ReadBytes(jsonLength));
57+
58+
return useUtf16
59+
? Encoding.Unicode.GetString(br.ReadBytes(jsonByteLength))
60+
: Encoding.UTF8.GetString(br.ReadBytes(jsonByteLength));
4461
}
4562
}
4663
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"Karkinos": 8,
3+
"Basilisk": 8
4+
}

ARKBreedingStats/json/values/_manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"mod": { "id": "1139775728", "tag": "Confuciusornis", "title": "Confuciusornis" }
3131
},
3232
"1169020368-Trex.json": {
33-
"version": "358.24.1730042845",
33+
"version": "358.24.1730398078",
3434
"mod": { "id": "1169020368", "tag": "Trex", "title": "Ark Creature Rebalance (AG Reborn)" }
3535
},
3636
"1178308359-ShadDragon.json": {
@@ -370,7 +370,7 @@
370370
"mod": { "id": "814833973", "tag": "Wyvern_Mating", "title": "Wyvern Mating" }
371371
},
372372
"839162288-Primal_Fear.json": {
373-
"version": "358.11.1693416578",
373+
"version": "358.24.1730580742",
374374
"mod": { "id": "839162288", "tag": "Primal_Fear", "title": "Primal Fear" }
375375
},
376376
"883957187-WyvernWorld.json": {

0 commit comments

Comments
 (0)