Skip to content

Commit

Permalink
Merge pull request #985 from cadon/dev
Browse files Browse the repository at this point in the history
merge to master
  • Loading branch information
cadon authored Oct 26, 2019
2 parents 1819602 + 86273dd commit 0d7e92e
Show file tree
Hide file tree
Showing 22 changed files with 1,921 additions and 656 deletions.
2 changes: 1 addition & 1 deletion ARKBreedingStats/AboutBox1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
Translations:
* French by Vykan and Yanuut
* Italian by Zaffira
* Italian by Zaffira and Spit-Biago
* German by cadon
* Spanish by KRIPT4";
}
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/Form1.Designer.cs

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

4 changes: 2 additions & 2 deletions ARKBreedingStats/Form1.collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal

// set global species that was set before loading
if (selectedSpecies != null
&& creatureCollection.creatures.Any(c => c.Species.Equals(selectedSpecies))
&& creatureCollection.creatures.Any(c => c.Species != null && c.Species.Equals(selectedSpecies))
)
{
speciesSelector1.SetSpecies(selectedSpecies);
Expand All @@ -428,7 +428,7 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal

// set library species to what it was before loading
if (selectedlibrarySpecies == null
|| !creatureCollection.creatures.Any(c => c.Species.Equals(selectedlibrarySpecies))
|| !creatureCollection.creatures.Any(c => c.Species != null && c.Species.Equals(selectedlibrarySpecies))
)
selectedlibrarySpecies = speciesSelector1.SelectedSpecies;
if (selectedlibrarySpecies != null)
Expand Down
59 changes: 15 additions & 44 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public Form1()
breedingPlan1.ExportToClipboard += ExportAsTextToClipboard;
breedingPlan1.SetMessageLabelText += SetMessageLabelText;
breedingPlan1.SetGlobalSpecies += SetSpecies;
timerList1.onTimerChange += SetCollectionChanged;
timerList1.OnTimerChange += SetCollectionChanged;
breedingPlan1.BindChildrenControlEvents();
raisingControl1.onChange += SetCollectionChanged;
tamingControl1.CreateTimer += CreateTimer;
Expand All @@ -156,13 +156,6 @@ public Form1()
timerGlobal.Tick += TimerGlobal_Tick;

reactOnSelectionChange = true;

// TODO temporary fix if importExportWindow.Location was set to an invalid value
if (Properties.Settings.Default.importExportedLocation.X < 0)
{
Properties.Settings.Default.importExportedLocation = new Point(0, 0);
Properties.Settings.Default.importExportedSize = new Size(800, 800);
}
}

private void Form1_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -267,8 +260,8 @@ private void Form1_Load(object sender, EventArgs e)
autoSaveMinutes = Properties.Settings.Default.autosaveMinutes;

// load weapondamages
tamingControl1.weaponDamages = Properties.Settings.Default.weaponDamages;
tamingControl1.weaponDamagesEnabled = Properties.Settings.Default.weaponDamagesEnabled;
tamingControl1.WeaponDamages = Properties.Settings.Default.weaponDamages;
tamingControl1.WeaponDamagesEnabled = Properties.Settings.Default.weaponDamagesEnabled;

for (int s = 0; s < Values.STATS_COUNT; s++)
{
Expand Down Expand Up @@ -415,7 +408,6 @@ private void Form1_Load(object sender, EventArgs e)
creatureInfoInputExtractor.OwnerLock = Properties.Settings.Default.OwnerNameLocked;
creatureInfoInputExtractor.TribeLock = Properties.Settings.Default.TribeNameLocked;

ClearAll();
// UI loaded

//// initialize controls
Expand Down Expand Up @@ -458,7 +450,7 @@ private void TellTamingData(string speciesName, int level)
speciesSelector1.SelectedSpecies.taming.eats != null &&
speciesSelector1.SelectedSpecies.taming.eats.Count > 0)
{
tamingControl1.setLevel(level, false);
tamingControl1.SetLevel(level, false);
tamingControl1.SetSpecies(speciesSelector1.SelectedSpecies);
overlay?.setInfoText($"{speciesName} ({Loc.s("Level")} {level}):\n{tamingControl1.quickTamingInfos}");
}
Expand Down Expand Up @@ -653,7 +645,7 @@ private void ApplySettingsToValues()
{
// apply multipliers
Values.V.ApplyMultipliers(creatureCollection, cbEventMultipliers.Checked);
tamingControl1.setTamingMultipliers(Values.V.currentServerMultipliers.TamingSpeedMultiplier,
tamingControl1.SetTamingMultipliers(Values.V.currentServerMultipliers.TamingSpeedMultiplier,
Values.V.currentServerMultipliers.DinoCharacterFoodDrainMultiplier);

RecalculateAllCreaturesValues();
Expand Down Expand Up @@ -1137,8 +1129,8 @@ private void Form1_FormClosed(object sender, FormClosedEventArgs e)
Properties.Settings.Default.customStatWeightNames = custWs.ToArray();

// save weapondamages for ko-calculation
Properties.Settings.Default.weaponDamages = tamingControl1.weaponDamages;
Properties.Settings.Default.weaponDamagesEnabled = tamingControl1.weaponDamagesEnabled;
Properties.Settings.Default.weaponDamages = tamingControl1.WeaponDamages;
Properties.Settings.Default.weaponDamagesEnabled = tamingControl1.WeaponDamagesEnabled;

// save last selected species in combobox
Properties.Settings.Default.lastSpecies = speciesSelector1.LastSpecies;
Expand Down Expand Up @@ -1619,27 +1611,7 @@ private void numericUpDownImprintingBonusExtractor_ValueChanged(object sender, E

private void checkBoxQuickWildCheck_CheckedChanged(object sender, EventArgs e)
{
bool enabled = !cbQuickWildCheck.Checked;
if (!enabled)
{
ClearAll();

for (int s = 0; s < Values.STATS_COUNT; s++)
{
int lvlWild = (int)Math.Round((statIOs[s].Input - speciesSelector1.SelectedSpecies.stats[s].BaseValue) / (speciesSelector1.SelectedSpecies.stats[s].BaseValue * speciesSelector1.SelectedSpecies.stats[s].IncPerWildLevel));
statIOs[s].LevelWild = lvlWild < 0 ? 0 : lvlWild;
statIOs[s].LevelDom = 0;
}

tamingControl1.setLevel(statIOs[(int)StatNames.Torpidity].LevelWild + 1, false);
tamingControl1.SetSpecies(speciesSelector1.SelectedSpecies);
labelTamingInfo.Text = tamingControl1.quickTamingInfos;
}
panelWildTamedBred.Enabled = enabled;
groupBoxDetailsExtractor.Enabled = enabled;
numericUpDownLevel.Enabled = enabled;
button2TamingCalc.Visible = !enabled;
groupBoxTamingInfo.Visible = !enabled;
UpdateQuickTamingInfo();
}

private void onlinehelpToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -2009,9 +1981,7 @@ private void StatIOQuickWildLevelCheck(StatIO sIO)
sIO.LevelDom = 0;
if (sIO.statIndex == (int)StatNames.Torpidity)
{
tamingControl1.setLevel(statIOs[(int)StatNames.Torpidity].LevelWild + 1, false);
tamingControl1.SetSpecies(speciesSelector1.SelectedSpecies);
labelTamingInfo.Text = tamingControl1.quickTamingInfos;
SetQuickTamingInfo(statIOs[(int)StatNames.Torpidity].LevelWild + 1);
}
}
}
Expand Down Expand Up @@ -2067,7 +2037,7 @@ private void wildValuesToolStripMenuItem_Click(object sender, EventArgs e)

private void CreateTimer(string name, DateTime time, Creature c, string group)
{
timerList1.addTimer(name, time, c, group);
timerList1.AddTimer(name, time, c, group);
}

private void TestEnteredDragData(object sender, DragEventArgs e)
Expand Down Expand Up @@ -2433,6 +2403,7 @@ private void toolStripButtonCopy2Extractor_Click(object sender, EventArgs e)

creatureInfoInputExtractor.CreatureSex = creatureInfoInputTester.CreatureSex;
creatureInfoInputExtractor.RegionColors = creatureInfoInputTester.RegionColors;

tabControlMain.SelectedTab = tabPageExtractor;
}

Expand Down Expand Up @@ -2537,9 +2508,9 @@ private void button2TamingCalc_Click(object sender, EventArgs e)
{
tamingControl1.SetSpecies(speciesSelector1.SelectedSpecies);
if (cbQuickWildCheck.Checked)
tamingControl1.setLevel(statIOs[(int)StatNames.Torpidity].LevelWild + 1);
tamingControl1.SetLevel(statIOs[(int)StatNames.Torpidity].LevelWild + 1);
else
tamingControl1.setLevel((int)numericUpDownLevel.Value);
tamingControl1.SetLevel((int)numericUpDownLevel.Value);
tabControlMain.SelectedTab = tabPageTaming;
}

Expand Down Expand Up @@ -2711,7 +2682,7 @@ private void ApplyEvolutionMultipliers()
{
Values.V.ApplyMultipliers(creatureCollection, cbEventMultipliers.Checked, false);

tamingControl1.setTamingMultipliers(Values.V.currentServerMultipliers.TamingSpeedMultiplier,
tamingControl1.SetTamingMultipliers(Values.V.currentServerMultipliers.TamingSpeedMultiplier,
Values.V.currentServerMultipliers.DinoCharacterFoodDrainMultiplier);
breedingPlan1.UpdateBreedingData();
raisingControl1.UpdateRaisingData();
Expand All @@ -2722,7 +2693,7 @@ private void toolStripButtonDeleteExpiredIncubationTimers_Click(object sender, E
if (tabControlMain.SelectedTab == tabPageRaising)
raisingControl1.DeleteAllExpiredIncubationTimers();
else if (tabControlMain.SelectedTab == tabPageTimer)
timerList1.deleteAllExpiredTimers();
timerList1.DeleteAllExpiredTimers();
}

private void OcrupdateWhiteThreshold(int value)
Expand Down
51 changes: 39 additions & 12 deletions ARKBreedingStats/Form1.extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,22 @@ private void ClearAll(bool clearExtraCreatureData = true)
statIOs[s].Clear();
}
ExtractionFailed(); // set background of controls to neutral
labelFootnote.Text = "";
labelFootnote.Text = string.Empty;
labelFootnote.BackColor = Color.Transparent;
labelTE.Text = "";
labelTE.Text = string.Empty;
activeStatIndex = -1;
lbSumDom.Text = "";
lbSumWild.Text = "";
lbSumDomSB.Text = "";
lbSumDom.Text = string.Empty;
lbSumWild.Text = string.Empty;
lbSumDomSB.Text = string.Empty;
updateTorporInTester = true;
creatureInfoInputExtractor.ButtonEnabled = false;
groupBoxPossibilities.Visible = false;
groupBoxRadarChartExtractor.Visible = false;
lbInfoYellowStats.Visible = false;
button2TamingCalc.Visible = cbQuickWildCheck.Checked;
groupBoxTamingInfo.Visible = false;
groupBoxTamingInfo.Visible = cbQuickWildCheck.Checked;
UpdateQuickTamingInfo();
labelTamingInfo.Text = string.Empty;
SetMessageLabelText();
if (clearExtraCreatureData)
{
Expand Down Expand Up @@ -342,18 +344,43 @@ private bool ExtractLevels(bool autoExtraction = false, bool statInputsHighPreci
button2TamingCalc.Visible = true;

// display taming info
if (cbQuickWildCheck.Checked)
tamingControl1.setLevel(statIOs[(int)StatNames.Torpidity].LevelWild + 1);
else
tamingControl1.setLevel((int)numericUpDownLevel.Value);
labelTamingInfo.Text = tamingControl1.quickTamingInfos;
groupBoxTamingInfo.Visible = true;
SetQuickTamingInfo(cbQuickWildCheck.Checked
? statIOs[(int)StatNames.Torpidity].LevelWild + 1
: (int)numericUpDownLevel.Value);
}

ResumeLayout();
return true;
}

private void UpdateQuickTamingInfo()
{
bool showQuickTamingInfo = cbQuickWildCheck.Checked;
if (showQuickTamingInfo)
{
for (int s = 0; s < Values.STATS_COUNT; s++)
{
int lvlWild = (int)Math.Round((statIOs[s].Input - speciesSelector1.SelectedSpecies.stats[s].BaseValue) / (speciesSelector1.SelectedSpecies.stats[s].BaseValue * speciesSelector1.SelectedSpecies.stats[s].IncPerWildLevel));
statIOs[s].LevelWild = lvlWild < 0 ? 0 : lvlWild;
statIOs[s].LevelDom = 0;
}
SetQuickTamingInfo(statIOs[(int)StatNames.Torpidity].LevelWild + 1);
}
panelWildTamedBred.Enabled = !showQuickTamingInfo;
groupBoxDetailsExtractor.Enabled = !showQuickTamingInfo;
numericUpDownLevel.Enabled = !showQuickTamingInfo;
button2TamingCalc.Visible = showQuickTamingInfo;
groupBoxTamingInfo.Visible = showQuickTamingInfo;
}

private void SetQuickTamingInfo(int level)
{
tamingControl1.SetSpecies(speciesSelector1.SelectedSpecies);
tamingControl1.SetLevel(level);
labelTamingInfo.Text = tamingControl1.quickTamingInfos;
groupBoxTamingInfo.Visible = true;
}

/// <summary>
/// Call this method if an extraction failed. Possible causes of the failure are displayed for the user.
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions ARKBreedingStats/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ private static void unhandledExceptionHandler(object sender, UnhandledExceptionE
{
if (System.Diagnostics.Debugger.IsAttached) throw e;
string message = e.Message
+ "\n\nException in " + e.Source
+ "\n\nMethod throwing the error: " + e.TargetSite.DeclaringType.FullName + "." + e.TargetSite.Name
+ "\n\nStackTrace:\n" + e.StackTrace
+ (e.InnerException != null ? "\n\nInner Exception:\n" + e.InnerException.Message : string.Empty);
MessageBox.Show("Unhandled Exception:\n\n" + message, "Error in " + e.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ (e.InnerException != null ? "\n\nInner Exception:\n" + e.InnerException.Message : string.Empty)
;
MessageBox.Show(message, "Unhandled Exception in ARK Smart Breeding " + Application.ProductVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
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.34.2.0")]
[assembly: AssemblyFileVersion("0.34.4.0")]
[assembly: NeutralResourcesLanguage("en")]

2 changes: 1 addition & 1 deletion ARKBreedingStats/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static double CalculateValue(Species species, int stat, int levelWild, in
// adding an epsilon to handle rounding-errors
double result = (species.stats[stat].BaseValue * tamedBaseHP *
(1 + species.stats[stat].IncPerWildLevel * levelWild) * imprintingM + add) *
domMult + ROUND_UP_DELTA;
domMult + (Utils.precision(stat) == 3 ? ROUND_UP_DELTA * 0.01 : ROUND_UP_DELTA);

if (result <= 0) return 0;

Expand Down
Loading

0 comments on commit 0d7e92e

Please sign in to comment.