Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Sep 4, 2022
2 parents 92825ba + 8557bff commit 36c7396
Show file tree
Hide file tree
Showing 40 changed files with 448 additions and 444 deletions.
5 changes: 3 additions & 2 deletions ARKBreedingStats/ARKBreedingStats.csproj
Expand Up @@ -888,6 +888,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="settings\MultiplierSetting.resx">
<DependentUpon>MultiplierSetting.cs</DependentUpon>
Expand Down Expand Up @@ -999,8 +1000,8 @@ if $(ConfigurationName) == Release (

powershell -nologo -noprofile -command "$version = (Get-Item '$(TargetPath)').VersionInfo.FileVersion; Compress-Archive -Force -Path '$(TargetDir)*' -DestinationPath """$(SolutionDir)_publish\ARK.Smart.Breeding_$version.zip""" "

if exist "%25ProgramFiles(x86)%25\Inno Setup 5\ISCC.exe" (
"%25ProgramFiles(x86)%25\Inno Setup 5\ISCC.exe" "$(SolutionDir)setup.iss"
if exist "%25ProgramFiles(x86)%25\Inno Setup 6\ISCC.exe" (
"%25ProgramFiles(x86)%25\Inno Setup 6\ISCC.exe" "$(SolutionDir)setup.iss"
) else (
echo Inno Setup command line compiler not found
)
Expand Down
3 changes: 3 additions & 0 deletions ARKBreedingStats/App.config
Expand Up @@ -475,6 +475,9 @@
<setting name="FilterHideNonCooldowns" serializeAs="String">
<value>False</value>
</setting>
<setting name="LibraryGroupBySpecies" serializeAs="String">
<value>True</value>
</setting>
</ARKBreedingStats.Properties.Settings>
</userSettings>
</configuration>
2 changes: 1 addition & 1 deletion ARKBreedingStats/BreedingPlanning/BreedingPlan.cs
Expand Up @@ -999,7 +999,7 @@ private void radioButtonBPHighStats_CheckedChanged(object sender, EventArgs e)
}
}

public void SetSpeciesList(List<Species> species, List<Creature> creatures)
public void SetSpeciesList(IList<Species> species, List<Creature> creatures)
{
Species previouslySelectedSpecies = listViewSpeciesBP.SelectedItems.Count > 0 ? listViewSpeciesBP.SelectedItems[0].Tag as Species : null;

Expand Down
6 changes: 4 additions & 2 deletions ARKBreedingStats/CreatureInfoInput.cs
Expand Up @@ -63,6 +63,8 @@ public partial class CreatureInfoInput : UserControl
/// </summary>
public ParentInheritance ParentInheritance;

internal CreatureCollection.ColorExisting[] ColorAlreadyExistingInformation;

private Button[] ButtonsNamingPattern => new[] { btnGenerateUniqueName, btNamingPattern2, btNamingPattern3, btNamingPattern4, btNamingPattern5, btNamingPattern6 };

public CreatureInfoInput()
Expand Down Expand Up @@ -579,7 +581,7 @@ private void btNamingPatternEditor_Click(object sender, EventArgs e)
public void GenerateCreatureName(Creature creature, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary<string, string> customReplacings, bool showDuplicateNameWarning, int namingPatternIndex)
{
SetCreatureData(creature);
CreatureName = NamePattern.GenerateCreatureName(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings, showDuplicateNameWarning, namingPatternIndex, false);
CreatureName = NamePattern.GenerateCreatureName(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings, showDuplicateNameWarning, namingPatternIndex, false, colorsExisting: ColorAlreadyExistingInformation);
if (CreatureName.Length > 24)
SetMessageLabelText?.Invoke("The generated name is longer than 24 characters, the name will look like this in game:\n" + CreatureName.Substring(0, 24), MessageBoxIcon.Error);
}
Expand All @@ -588,7 +590,7 @@ public void OpenNamePatternEditor(Creature creature, int[] speciesTopLevels, int
{
if (!parentListValid)
ParentListRequested?.Invoke(this);
using (var pe = new PatternEditor(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings, namingPatternIndex, reloadCallback))
using (var pe = new PatternEditor(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, ColorAlreadyExistingInformation, customReplacings, namingPatternIndex, reloadCallback))
{
if (pe.ShowDialog() == DialogResult.OK)
{
Expand Down
58 changes: 39 additions & 19 deletions ARKBreedingStats/Form1.Designer.cs

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

38 changes: 24 additions & 14 deletions ARKBreedingStats/Form1.cs
Expand Up @@ -105,10 +105,6 @@ public delegate void

public Form1()
{
var args = Environment.GetCommandLineArgs();
if (args.Contains("cleanupUpdater"))
FileService.TryDeleteFile(Path.Combine(Path.GetTempPath(), Updater.Updater.UpdaterExe));

// load settings of older version if possible after an upgrade
if (Properties.Settings.Default.UpgradeRequired)
{
Expand Down Expand Up @@ -699,7 +695,6 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged)
_hiddenLevelsCreatureTester = 0;

_tt.SetToolTip(tbSpeciesGlobal, species.DescriptiveNameAndMod + "\n" + species.blueprintPath);
_tt.SetToolTip(LbBlueprintPath, "Click to copy blueprint path to clipboard.");
}

private void numericUpDown_Enter(object sender, EventArgs e)
Expand Down Expand Up @@ -921,6 +916,7 @@ private void UpdateCreatureListings(Species species = null, bool keepCurrentlySe
/// <summary>
/// This function should be called if the creatureCollection is changed, i.e. after loading a file or adding/removing a creature.
/// It updates the listed species in the treeList and in the speciesSelector.
/// Also call after the sort order of the species was changed.
/// </summary>
private void UpdateSpeciesLists(List<Creature> creatures, bool keepCurrentlySelectedSpecies = true)
{
Expand All @@ -941,19 +937,19 @@ private void UpdateSpeciesLists(List<Creature> creatures, bool keepCurrentlySele
}

// sort species according to selected order (can be modified by json/sortNames.txt)
availableSpecies = Values.V.species.Where(sn => availableSpecies.Contains(sn)).ToList();
_speciesInLibraryOrdered = Values.V.species.Where(sn => availableSpecies.Contains(sn)).ToArray();

// add node to show all
listBoxSpeciesLib.BeginUpdate();
listBoxSpeciesLib.Items.Add(Loc.S("All"));
listBoxSpeciesLib.Items.AddRange(availableSpecies.ToArray());
listBoxSpeciesLib.Items.AddRange(_speciesInLibraryOrdered);
listBoxSpeciesLib.EndUpdate();

if (selectedSpeciesLibrary != null)
listBoxSpeciesLib.SelectedItem = selectedSpeciesLibrary;

breedingPlan1.SetSpeciesList(availableSpecies, creatures);
speciesSelector1.SetLibrarySpecies(availableSpecies);
breedingPlan1.SetSpeciesList(_speciesInLibraryOrdered, creatures);
speciesSelector1.SetLibrarySpecies(_speciesInLibraryOrdered);
}

/// <summary>
Expand Down Expand Up @@ -2911,6 +2907,12 @@ private void UpdateTempCreatureDropDown()
}
else
{
CreatureCollection.ColorExisting[] colorAlreadyExistingInformation = null;
if (Properties.Settings.Default.NamingPatterns != null
&& Properties.Settings.Default.NamingPatterns[namingPatternIndex].IndexOf("#colorNew:", StringComparison.InvariantCultureIgnoreCase) != -1)
colorAlreadyExistingInformation = _creatureCollection.ColorAlreadyAvailable(cr.Species, input.RegionColors, out _);
input.ColorAlreadyExistingInformation = colorAlreadyExistingInformation;

input.GenerateCreatureName(cr, _topLevels.TryGetValue(cr.Species, out var tl) ? tl : null,
_lowestLevels.TryGetValue(cr.Species, out var ll) ? ll : null,
_customReplacingNamingPattern, showDuplicateNameWarning, namingPatternIndex);
Expand Down Expand Up @@ -3572,6 +3574,19 @@ private void addRandomCreaturesToolStripMenuItem_Click(object sender, EventArgs
private void resetSortingToolStripMenuItem_Click(object sender, EventArgs e)
{
Values.V.ResetDefaultSpeciesNameSorting();
UpdateSpeciesLists(_creatureCollection.creatures);
}

private void resetSortingToolStripMenuItem1_Click(object sender, EventArgs e)
{
Values.V.ResetSpeciesNameSorting();
UpdateSpeciesLists(_creatureCollection.creatures);
}

private void applyChangedSortingToolStripMenuItem_Click(object sender, EventArgs e)
{
Values.V.ApplySpeciesOrdering();
UpdateSpeciesLists(_creatureCollection.creatures);
}

private void editSortingToolStripMenuItem_Click(object sender, EventArgs e)
Expand All @@ -3584,11 +3599,6 @@ private void helpAboutSpeciesSortingToolStripMenuItem_Click(object sender, Event
RepositoryInfo.OpenWikiPage("Library#order-of-the-species-in-the-library");
}

private void resetSortingToolStripMenuItem1_Click(object sender, EventArgs e)
{
Values.V.ResetSpeciesNameSorting();
}

private void colorDefinitionsToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
{
// copy currently loaded color definitions to the clipboard
Expand Down
17 changes: 12 additions & 5 deletions ARKBreedingStats/Form1.extractor.cs
Expand Up @@ -197,6 +197,7 @@ private void ShowSumOfChosenLevels()
creatureInfoInputExtractor.ButtonEnabled = allValid;
groupBoxRadarChartExtractor.Visible = allValid;
creatureAnalysis1.Visible = allValid;
// update inheritance info
CreatureInfoInput_CreatureDataRequested(creatureInfoInputExtractor, false, true, false, 0);
}

Expand Down Expand Up @@ -908,7 +909,7 @@ private void CopyExtractionToClipboard()
tabControlMain.SelectedTab = tabPageExtractor;

bool creatureAlreadyExists = ExtractValuesInExtractor(cv, exportFilePath, true);
CopyNameToClipboardIfSet(creatureAlreadyExists);
GenerateCreatureNameAndCopyNameToClipboardIfSet(creatureAlreadyExists);

return creatureAlreadyExists;
}
Expand All @@ -917,7 +918,7 @@ private void CopyExtractionToClipboard()
/// Copies the creature name to the clipboard if the conditions according to the user settings are fulfilled.
/// </summary>
/// <param name="creatureAlreadyExists"></param>
private void CopyNameToClipboardIfSet(bool creatureAlreadyExists)
private void GenerateCreatureNameAndCopyNameToClipboardIfSet(bool creatureAlreadyExists)
{
if (Properties.Settings.Default.applyNamePatternOnAutoImportAlways
|| (Properties.Settings.Default.applyNamePatternOnImportIfEmptyName
Expand Down Expand Up @@ -947,7 +948,7 @@ private void ExtractExportedFileInExtractor(importExported.ExportedCreatureContr
return;

bool creatureAlreadyExists = ExtractValuesInExtractor(ecc.creatureValues, ecc.exportedFile, false);
CopyNameToClipboardIfSet(creatureAlreadyExists);
GenerateCreatureNameAndCopyNameToClipboardIfSet(creatureAlreadyExists);

// gets deleted in extractLevels()
_exportedCreatureControl = ecc;
Expand Down Expand Up @@ -1119,8 +1120,14 @@ private void creatureInfoInputExtractor_Add2Library_Clicked(CreatureInfoInput se

private void CreatureInfoInputColorsChanged(CreatureInfoInput input)
{
if (_dontUpdateExtractorVisualData) return;
var newColorStatus = input.SetRegionColorsExisting(_creatureCollection.ColorAlreadyAvailable(speciesSelector1.SelectedSpecies, input.RegionColors, out string infoText));
if (_dontUpdateExtractorVisualData)
{
input.ColorAlreadyExistingInformation = null;
return;
}
var colorAlreadyExisting = _creatureCollection.ColorAlreadyAvailable(speciesSelector1.SelectedSpecies, input.RegionColors, out string infoText);
var newColorStatus = input.SetRegionColorsExisting(colorAlreadyExisting);
input.ColorAlreadyExistingInformation = colorAlreadyExisting;

if (input == creatureInfoInputExtractor)
creatureAnalysis1.SetColorAnalysis(newColorStatus.newInSpecies ? LevelStatus.NewTopLevel : newColorStatus.newInRegion ? LevelStatus.TopLevel : LevelStatus.Neutral, infoText);
Expand Down

0 comments on commit 36c7396

Please sign in to comment.