Skip to content

Commit

Permalink
breeding-plan automatically shows currently globally selected species…
Browse files Browse the repository at this point in the history
…. fix so that species without wild speed-levels get the recommended high-stats breeding-mode in the planner, even if the speed-level is 0 and not a top-stat. fix for notes to save correctly. return and tab now can be used in the notes. fix for sex and appended unique number in name-generator. added phoenix-data.
  • Loading branch information
cadaei committed Sep 9, 2017
1 parent f18806a commit f610730
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 57 deletions.
24 changes: 19 additions & 5 deletions ARKBreedingStats/BreedingPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,13 @@ public void drawBestParents(BreedingMode breedingMode, bool updateBreedingData =
bool bestCreatureAlreadyAvailable = true;
Creature bestCreature = null;
List<Creature> femalesAndMales = females.Concat(males).ToList();
bool noWildSpeedLevels = Values.V.species[speciesIndex].NoImprintingForSpeed == true;
foreach (Creature cr in femalesAndMales)
{
bestCreatureAlreadyAvailable = true;
for (int s = 0; s < 7; s++)
{
if (!cr.topBreedingStats[s])
if (!cr.topBreedingStats[s] && !(s == 6 && noWildSpeedLevels))
{
bestCreatureAlreadyAvailable = false;
break;
Expand All @@ -369,11 +370,11 @@ public void drawBestParents(BreedingMode breedingMode, bool updateBreedingData =
}

if (bestCreatureAlreadyAvailable)
MessageBox.Show("There is already a creature in your library that has all the available top-stats ("
if (MessageBox.Show("There is already a creature in your library that has all the available top-stats ("
+ bestCreature.name + " " + Utils.sexSymbol(bestCreature.gender) + ")."
+ "\nThe currently selected conservative-breeding-mode might show some suggestions that may seem non-optimal.\n\n"
+ "Change the breeding-mode to \"High Stats\" for better suggestions.",
"Top-creature already available", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ "Change the breeding-mode to \"High Stats\" for better suggestions.\nDo you want to change the breeding-mode to \"High Stats\"?",
"Top-creature already available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) radioButtonBPHighStats.Checked = true;
}
}
else
Expand Down Expand Up @@ -612,6 +613,19 @@ public string CurrentSpecies
get { return currentSpecies; }
}

public void setSpecies(string species)
{
for (int i = 0; i < listViewSpeciesBP.Items.Count; i++)
{
if ((string)listViewSpeciesBP.Items[i].Text == species)
{
listViewSpeciesBP.Items[i].Focused = true;
listViewSpeciesBP.Items[i].Selected = true;
break;
}
}
}

public int maxWildLevels { set { offspringPossibilities1.maxWildLevel = value; } }

private void buttonApplyNewWeights_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -673,7 +687,7 @@ public void setSpeciesList(List<string> speciesNames, List<Creature> creatures)
{
for (int i = 0; i < listViewSpeciesBP.Items.Count; i++)
{
if ((string)listViewSpeciesBP.Items[i].Tag == selectedSpecies)
if ((string)listViewSpeciesBP.Items[i].Text == selectedSpecies)
{
listViewSpeciesBP.Items[i].Focused = true;
listViewSpeciesBP.Items[i].Selected = true;
Expand Down
1 change: 1 addition & 0 deletions ARKBreedingStats/CreatureInfoInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ private void setCreatureData(Creature cr)
cr.Mother = mother;
cr.Father = father;
cr.species = Values.V.species[speciesIndex].name;
cr.gender = sex;
cr.mutationCounter = (int)numericUpDownMutations.Value;
}

Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
// lower/upper Bound of each stat (wild has no upper bound as wild-speed and sometimes oxygen is unknown)
if (postTamed)
{
domFreeMin = Math.Max(0, level - levelWildFromTorporRange[1] - 1 - (Values.V.speciesNames[speciesI] == "Plesiosaur" ? 34 : 0)); // creatures starts with level 1, Plesiosaur starts at level 35
domFreeMax = Math.Max(0, level - levelWildFromTorporRange[0] - 1 - (Values.V.speciesNames[speciesI] == "Plesiosaur" ? 34 : 0)); // creatures starts with level 1, Plesiosaur starts at level 35
domFreeMin = Math.Max(0, level - levelWildFromTorporRange[1] - 1);
domFreeMax = Math.Max(0, level - levelWildFromTorporRange[0] - 1);
}
levelDomFromTorporAndTotalRange[0] = domFreeMin;
levelDomFromTorporAndTotalRange[1] = domFreeMax;
Expand Down
9 changes: 4 additions & 5 deletions ARKBreedingStats/Form1.Designer.cs

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

10 changes: 7 additions & 3 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ private bool extractLevels(bool autoExtraction = false)
continue;
for (int r = 0; r < extractor.results[s].Count; r++)
{
if (extractor.results[s][r].TE < minTECheck)
if (extractor.results[s][r].TEMin < minTECheck)
extractor.results[s].RemoveAt(r--);
}
}
Expand Down Expand Up @@ -726,7 +726,6 @@ private void showSumOfChosenLevels()
bool allValid = valid && inbound && extractor.validResults;
if (allValid)
{
creatureInfoInputExtractor.parentListValid = false;
radarChartExtractor.setLevels(statIOs.Select(s => s.LevelWild).ToArray());
toolStripButtonSaveCreatureValuesTemp.Visible = false;
}
Expand Down Expand Up @@ -2561,7 +2560,12 @@ private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
}
else if (tabControlMain.SelectedTab == tabPageBreedingPlan)
{
breedingPlan1.updateIfNeeded();
if (breedingPlan1.CurrentSpecies == comboBoxSpeciesGlobal.SelectedItem.ToString())
breedingPlan1.updateIfNeeded();
else
{
breedingPlan1.setSpecies(comboBoxSpeciesGlobal.SelectedItem.ToString());
}
}
else if (tabControlMain.SelectedTab == tabPageRaising)
{
Expand Down
46 changes: 23 additions & 23 deletions ARKBreedingStats/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,6 @@ The TE can differ 0.1% due to ingame-rounding.</value>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="labelErrorHelp.Text" xml:space="preserve">
<value>Extraction failed, common causes:

1. If the creature is bred, check the "Bred Creature"-radiobutton

2. Taming-Effectiveness-Range too narrow, increase the upper and / or decrase the lower bound

3. Typo, double-check the input values

4. Uncheck all Lock-to-Zero-buttons in the stats (all lock-symbols should be green and opened)

5. If you have enabled the Singleplayer-Settings in the game, make sure the checkbox is enabled in the settings in this program as well

6. Uncheck the "Consider Wild-level-steps" in the settings.

7. The maximal wild level is set too low, go to the settings and adjust it

8. The multipliers in the Settings (File - Settings) are not set to the multipliers of the server. Ask your admin for the correct multipliers and adjust them in the Settings.

9. The stats of the creature were changed recently and the game displays the old values. Level up a stat, that should trigger a recalculation of the values.

10. The stat-values in this tool are wrong or the game does show wrong stats. You can via reddit or github send me a screenshot that contains the stats of the creature ingame and the extractor with the typed in values along with the stat-multipliers in the settings.</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="radarChart1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down Expand Up @@ -230,6 +207,29 @@ The TE can differ 0.1% due to ingame-rounding.</value>
3EnWcIqXZLIQ3XdChGq+ixGgOCJFOf//oGNZTLqel4VLSA4ga5BrcTbyRIRIsQqUtViLEDTXxpd0hLgu
a4ywyrbxQbAB3Ak3qLu41mHMfwCWaqdyEzp1TQAAAABJRU5ErkJggg==
</value>
</data>
<data name="labelErrorHelp.Text" xml:space="preserve">
<value>Extraction failed, common causes:

1. If the creature is bred, check the "Bred Creature"-radiobutton

2. Taming-Effectiveness-Range too narrow, increase the upper and / or decrase the lower bound

3. Typo, double-check the input values

4. Uncheck all Lock-to-Zero-buttons in the stats (all lock-symbols should be green and opened)

5. If you have enabled the Singleplayer-Settings in the game, make sure the checkbox is enabled in the settings in this program as well

6. Uncheck the "Consider Wild-level-steps" in the settings.

7. The maximal wild level is set too low, go to the settings and adjust it

8. The multipliers in the Settings (File - Settings) are not set to the multipliers of the server. Ask your admin for the correct multipliers and adjust them in the Settings.

9. The stats of the creature were changed recently and the game displays the old values. Level up a stat, that should trigger a recalculation of the values.

10. The stat-values in this tool are wrong or the game does show wrong stats. You can via reddit or github send me a screenshot that contains the stats of the creature ingame and the extractor with the typed in values along with the stat-multipliers in the settings.</value>
</data>
<data name="radarChartLibrary.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
1 change: 1 addition & 0 deletions ARKBreedingStats/NotesControl.Designer.cs

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

12 changes: 10 additions & 2 deletions ARKBreedingStats/NotesControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public NotesControl()

public List<Note> NoteList
{
get { return noteList; }
//get { return noteList; }
set
{
listViewNoteTitles.Items.Clear();
Expand All @@ -48,13 +48,13 @@ private void listViewNoteTitles_SelectedIndexChanged(object sender, EventArgs e)
selectedNote = (Note)listViewNoteTitles.SelectedItems[0].Tag;
tbNoteTitle.Text = selectedNote.Title;
richTextBoxNote.Text = selectedNote.Text;

}
}

public void AddNote()
{
Note n = new Note("<new note>");
noteList.Add(n);
ListViewItem lvi = new ListViewItem(n.Title);
lvi.Tag = n;
listViewNoteTitles.Items.Add(lvi);
Expand All @@ -71,6 +71,14 @@ public void RemoveSelectedNote()
Note n = (Note)listViewNoteTitles.SelectedItems[0].Tag;
noteList.Remove(n);
listViewNoteTitles.Items.Remove(listViewNoteTitles.SelectedItems[0]);
if (listViewNoteTitles.Items.Count > 0)
listViewNoteTitles.Items[0].Selected = true;
else
{
richTextBoxNote.Text = "";
tbNoteTitle.Text = "";
}
changed?.Invoke();
}
}

Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.23.16")]
[assembly: AssemblyFileVersion("0.23.17")]
2 changes: 1 addition & 1 deletion ARKBreedingStats/json/values.json

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions ARKBreedingStats/uiControls/NamePatterns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ static public string generateCreatureName(Creature creature, List<Creature> fema
{
try
{
var names = new List<string>();
var tokenDictionary = createTokenDictionary(creature, females, males, names);
// collect creatures of the same species
var sameSpecies = (females ?? new List<Creature> { }).Concat((males ?? new List<Creature> { })).ToList();
var creatureNames = sameSpecies.Select(x => x.name).ToList();

var tokenDictionary = createTokenDictionary(creature, creatureNames);
var name = assemblePatternedName(tokenDictionary);

if (name.Contains("{n}"))
Expand All @@ -33,10 +36,10 @@ static public string generateCreatureName(Creature creature, List<Creature> fema
{
name = string.Concat(patternStart, n, patternEnd);
n++;
} while (names.Contains(name, StringComparer.OrdinalIgnoreCase));
} while (creatureNames.Contains(name, StringComparer.OrdinalIgnoreCase));
}

if (names.Contains(name, StringComparer.OrdinalIgnoreCase))
if (creatureNames.Contains(name, StringComparer.OrdinalIgnoreCase))
{
MessageBox.Show("WARNING: The generated name for the creature already exists in the database.");
}
Expand All @@ -58,17 +61,10 @@ static public string generateCreatureName(Creature creature, List<Creature> fema
/// This method creates the token dictionary for the dynamic creature name generation.
/// </summary>
/// <param name="creature">Creature with the data</param>
/// <param name="females">List<Creature> of all females of the current species</param>
/// <param name="males">List<Creature> of all males of the current species</param>
/// <param name="creatureNames">A list of all names of the currently stored creatures of the species</param>
/// <returns>A dictionary containing all tokens and their replacements</returns>
static public Dictionary<string, string> createTokenDictionary(Creature creature, List<Creature> females, List<Creature> males, List<string> creatureNames = null)
static public Dictionary<string, string> createTokenDictionary(Creature creature, List<string> creatureNames)
{

// collect creatures of the same species
var sameSpecies = (females ?? new List<Creature> { }).Concat((males ?? new List<Creature> { })).ToList();
creatureNames = sameSpecies.Select(x => x.name).ToList();

var date_short = DateTime.Now.ToString("yy-MM-dd");
var date_compressed = date_short.Replace("-", "");
var time_short = DateTime.Now.ToString("hh:mm:ss");
Expand Down
8 changes: 6 additions & 2 deletions ARKBreedingStats/uiControls/PatternEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void Initialization(Creature creature = null, List<Creature> females = n
{"times_compressed","hhmmss"},
{"time_short","hh:mm"},
{"time_compressed","hhmm"},
{"n","if the name is not unique, the smallest possible number is appended"},
{"n","if the name is not unique, the smallest possible number is appended (only creatues with a given sex are considered."},
{"hp","Health"},
{"stam","Stamina"},
{"oxy","Oxygen"},
Expand All @@ -61,7 +61,11 @@ private void Initialization(Creature creature = null, List<Creature> females = n
{"tn","number of creatures of the current species in the library + 1"}
};

var examples = uiControls.NamePatterns.createTokenDictionary(creature, females, males);
// collect creatures of the same species
var sameSpecies = (females ?? new List<Creature> { }).Concat((males ?? new List<Creature> { })).ToList();
var creatureNames = sameSpecies.Select(x => x.name).ToList();

var examples = uiControls.NamePatterns.createTokenDictionary(creature, creatureNames);

int i = 0;
foreach (KeyValuePair<string, string> p in patternList)
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/ver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
267.21,0.23.16
268.22,0.23.17

0 comments on commit f610730

Please sign in to comment.