Skip to content

Commit

Permalink
added export as plain text for chats other than the ingame one. fix f…
Browse files Browse the repository at this point in the history
…or index out of range error when ocr'ing on 1680. made wild-tamed-bred input clearer.
  • Loading branch information
cadaei committed Feb 1, 2017
1 parent 57aa329 commit c7f2f4c
Show file tree
Hide file tree
Showing 11 changed files with 1,009 additions and 782 deletions.
23 changes: 17 additions & 6 deletions ARKBreedingStats/BreedingPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace ARKBreedingStats
{
public partial class BreedingPlan : UserControl
{
public delegate void EditCreatureEventHandler(Creature creature, bool virtualCreature);
public event EditCreatureEventHandler EditCreature;
public delegate void CreateTimerEventHandler(string name, DateTime time);
public event CreateTimerEventHandler CreateTimer;
public event PedigreeCreature.CreatureEditEventHandler EditCreature;
public delegate void BPRecalcEventHandler();
public event BPRecalcEventHandler BPRecalc;
public event PedigreeCreature.CreaturePartnerEventHandler BestBreedingPartners;
public event PedigreeCreature.ExportToClipboardEventHandler exportToClipboard;
private List<Creature> females = new List<Creature>();
private List<Creature> males = new List<Creature>();
private List<int>[] combinedTops = new List<int>[2];
Expand All @@ -43,10 +43,6 @@ public BreedingPlan()
statWeights[i] = 1;
combinedTops[0] = new List<int>();
combinedTops[1] = new List<int>();
pedigreeCreatureBest.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
pedigreeCreatureWorst.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
pedigreeCreatureBest.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
pedigreeCreatureWorst.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
pedigreeCreatureBest.IsVirtual = true;
pedigreeCreatureWorst.IsVirtual = true;
pedigreeCreatureBest.onlyLevels = true;
Expand All @@ -60,6 +56,17 @@ public BreedingPlan()
tt.SetToolTip(labelBreedingScore, "The Breeding-Score of a paring is not comparable to the Breeding-Score of another breeding-mode.\nThe numbers in the different modes are generated in incompatible ways.");
}

public void bindEvents()
{
// has to be done after the BreedingPlan-class got the binding
pedigreeCreatureBest.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(EditCreature);
pedigreeCreatureWorst.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(EditCreature);
pedigreeCreatureBest.exportToClipboard += new PedigreeCreature.ExportToClipboardEventHandler(exportToClipboard);
pedigreeCreatureWorst.exportToClipboard += new PedigreeCreature.ExportToClipboardEventHandler(exportToClipboard);
pedigreeCreatureBest.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
pedigreeCreatureWorst.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
}

public void drawBestParents(BreedingMode breedingMode, bool updateBreedingData = false)
{
SuspendLayout();
Expand Down Expand Up @@ -196,6 +203,7 @@ public void drawBestParents(BreedingMode breedingMode, bool updateBreedingData =
pc.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
pc.BPRecalc += new BPRecalcEventHandler(BPRecalc);
pc.BestBreedingPartners += new PedigreeCreature.CreaturePartnerEventHandler(BestBreedingPartners);
pc.exportToClipboard += new PedigreeCreature.ExportToClipboardEventHandler(exportToClipboard);
panelCombinations.Controls.Add(pc);
pcs.Add(pc);
pc = new PedigreeCreature(males[combinedTops[1][comboOrder[i]]], enabledColorRegions, comboOrder[i]);
Expand All @@ -204,6 +212,7 @@ public void drawBestParents(BreedingMode breedingMode, bool updateBreedingData =
pc.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
pc.BPRecalc += new BPRecalcEventHandler(BPRecalc);
pc.BestBreedingPartners += new PedigreeCreature.CreaturePartnerEventHandler(BestBreedingPartners);
pc.exportToClipboard += new PedigreeCreature.ExportToClipboardEventHandler(exportToClipboard);
panelCombinations.Controls.Add(pc);
pcs.Add(pc);

Expand Down Expand Up @@ -403,6 +412,8 @@ private void setParents(int comboIndex)
crW.levelsWild[7] = crW.levelsWild.Sum();
crB.name = "Best Possible";
crW.name = "Worst Possible";
crB.recalculateCreatureValues();
crW.recalculateCreatureValues();
pedigreeCreatureBest.totalLevelUnknown = totalLevelUnknown;
pedigreeCreatureWorst.totalLevelUnknown = totalLevelUnknown;
int mutationCounter = mother.mutationCounter + father.mutationCounter;
Expand Down
17 changes: 17 additions & 0 deletions ARKBreedingStats/Creature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,23 @@ public void setTopStatCount(bool[] considerStatHighlight)
topStatsCount = c;
topStatsCountBP = cBP;
}

/// <summary>
/// call this function to recalculate all stat-values of Creature c according to its levels
/// </summary>
public void recalculateCreatureValues()
{
int speciesIndex = Values.V.speciesNames.IndexOf(species);
if (speciesIndex >= 0)
{
for (int s = 0; s < 8; s++)
{
valuesBreeding[s] = Stats.calculateValue(speciesIndex, s, levelsWild[s], 0, true, 1, 0);
valuesDom[s] = Stats.calculateValue(speciesIndex, s, levelsWild[s], levelsDom[s], true, tamingEff, imprintingBonus);
}
}
calculateLevelFound();
}
}

public enum Sex
Expand Down
8 changes: 4 additions & 4 deletions ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ public int filterResultsByFixed(int dontFix = -1)
public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double lowerTEBound, double upperTEBound, bool autoDetectTamed, bool tamed, bool justTamed, bool bred, double imprintingBonusRounded, double imprintingBonusMultiplier, double cuddleIntervalMultiplier)
{
validResults = true;
if (autoDetectTamed)
if (bred)
postTamed = true;
else if (autoDetectTamed && Values.V.species[speciesI].stats[7].AddWhenTamed > 0)
{
// torpor is directly proportional to wild level. Check if creature is wild or tamed (doesn't work with creatures that have no additive bonus on torpor, e.g. the Giganotosaurus)
postTamed = (Math.Round(Values.V.species[speciesI].stats[7].BaseValue * (1 + Values.V.species[speciesI].stats[7].IncPerWildLevel * Math.Round((statIOs[7].Input - Values.V.species[speciesI].stats[7].BaseValue) / (Values.V.species[speciesI].stats[7].BaseValue * Values.V.species[speciesI].stats[7].IncPerWildLevel))), 3) != statIOs[7].Input);
}
else
{
postTamed = tamed;
}

imprintingBonus = 0;
if (bred)
Expand All @@ -182,7 +182,7 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
imprintingBonus = 1;
else if (Values.V.species[speciesI].breeding != null && Values.V.species[speciesI].breeding.maturationTimeAdjusted > 0)
{
imprintingBonus = Math.Round(Math.Round(imprintingBonusRounded * Values.V.species[speciesI].breeding.maturationTimeAdjusted / (14400 * cuddleIntervalMultiplier)) * 14400 * cuddleIntervalMultiplier / (Values.V.species[speciesI].breeding.maturationTimeAdjusted), 4);
imprintingBonus = Math.Round(Math.Round(imprintingBonusRounded * Values.V.species[speciesI].breeding.maturationTimeAdjusted / (14400 * cuddleIntervalMultiplier)) * 14400 * cuddleIntervalMultiplier / (Values.V.species[speciesI].breeding.maturationTimeAdjusted), 5);
if (imprintingBonus > 1)
imprintingBonus = 1;
}
Expand Down
Loading

0 comments on commit c7f2f4c

Please sign in to comment.