示例#1
0
        public static void DoRipStats(PropertyReader reader, ArkDinoEntry entry)
        {
            /*entry.baseLevel = ReadStatsArray("MaxStatusValues", reader, entry, DEFAULT_BASE_LEVEL);
             * entry.increasePerWildLevel = ReadStatsArray("AmountMaxGainedPerLevelUpValue", reader, entry, DEFAULT_INCREASE_PER_WILD_LEVEL);
             * entry.increasePerTamedLevel = ReadStatsArray("AmountMaxGainedPerLevelUpValueTamed", reader, entry, DEFAULT_INCREASE_PER_TAMED_LEVEL);
             * entry.additiveTamingBonus = ReadStatsArray("TamingMaxStatAdditions", reader, entry, DEFAULT_TAMING_MAX_STAT_ADDITIONS);
             * entry.multiplicativeTamingBonus = ReadStatsArray("TamingMaxStatMultipliers", reader, entry, DEFAULT_TAMING_MAX_STAT_MULTIPLY);*/

            //Create dicts
            entry.baseLevel                 = new Dictionary <DinoStatTypeIndex, float>();
            entry.increasePerWildLevel      = new Dictionary <DinoStatTypeIndex, float>();
            entry.increasePerTamedLevel     = new Dictionary <DinoStatTypeIndex, float>();
            entry.additiveTamingBonus       = new Dictionary <DinoStatTypeIndex, float>();
            entry.multiplicativeTamingBonus = new Dictionary <DinoStatTypeIndex, float>();

            //Loop through ARK indexes
            for (int i = 0; i <= 11; i++)
            {
                //Convert to our standard stat
                DinoStatTypeIndex stat = (DinoStatTypeIndex)i;

                //Calculate multipliers
                bool  can_level = true;// (i == 2) || (reader.GetPropertyByte("CanLevelUpValue", CANLEVELUP_VALUES[i], i) == 1);
                int   add_one   = IS_PERCENT_STAT[i];
                float zero_mult = can_level ? 1 : 0;
                float ETHM      = reader.GetPropertyFloat("ExtraTamedHealthMultiplier", EXTRA_MULTS_VALUES[i], i);

                //Add stat data
                entry.baseLevel.Add(stat, MathF.Round(reader.GetPropertyFloat("MaxStatusValues", BASE_VALUES[i], i) + add_one, ROUND_PERCISION));
                entry.increasePerWildLevel.Add(stat, MathF.Round(reader.GetPropertyFloat("AmountMaxGainedPerLevelUpValue", IW_VALUES[i], i) * zero_mult, ROUND_PERCISION));
                entry.increasePerTamedLevel.Add(stat, MathF.Round(reader.GetPropertyFloat("AmountMaxGainedPerLevelUpValueTamed", 0, i) * ETHM * zero_mult, ROUND_PERCISION));
                entry.additiveTamingBonus.Add(stat, MathF.Round(reader.GetPropertyFloat("TamingMaxStatAdditions", 0, i), ROUND_PERCISION));
                entry.multiplicativeTamingBonus.Add(stat, MathF.Round(reader.GetPropertyFloat("TamingMaxStatMultipliers", 0, i), ROUND_PERCISION));
            }
        }
示例#2
0
        /*
         * 0: MaxStatusValues               - baseLevel
         * 1: AmountMaxGainedPerLevelUpValue		- increasePerWildLevel
         * 2: AmountMaxGainedPerLevelUpValueTamed		- increasePerTamedLevel
         * 3: TamingMaxStatAdditions			- additiveTamingBonus
         * 4: TamingMaxStatMultipliers			- multiplicativeTamingBonus
         */

        public static ArkBreedingStat Compute(ArkDinoEntry e, DinoStatTypeIndex index, ArkConfigSettings settings)
        {
            double[] statMultipliers = new double[] { 1, 1, 1, 1 };
            return(new ArkBreedingStat
            {
                BaseValue = e.baseLevel[index],
                AddWhenTamed = (float)e.additiveTamingBonus[index] * (e.additiveTamingBonus[index] > 0 ? (float)statMultipliers[0] : 1),
                MultAffinity = (float)e.multiplicativeTamingBonus[index] * (e.multiplicativeTamingBonus[index] > 0 ? (float)statMultipliers[1] : 1),
                IncPerTamedLevel = (float)e.increasePerTamedLevel[index] * (float)statMultipliers[2],
                IncPerWildLevel = (float)e.increasePerWildLevel[index] * (float)statMultipliers[3],
            });
        }
        public Dictionary <DinoStatTypeIndex, float> multiplicativeTamingBonus; //Taming effectiveness


        /// <summary>
        /// Very, very similar to the ARKBreedingStats stat. Used for interchangability https://github.com/cadon/ARKStatsExtractor/blob/dev/ARKBreedingStats/species/CreatureStat.cs
        /// </summary>
        public Dictionary <DinoStatTypeIndex, ArkBreedingStat> GetBreedingStats(ArkConfigSettings conf)
        {
            Dictionary <DinoStatTypeIndex, ArkBreedingStat> s = new Dictionary <DinoStatTypeIndex, ArkBreedingStat>();

            for (int i = 0; i < 11; i += 1)
            {
                DinoStatTypeIndex index = (DinoStatTypeIndex)i;
                ArkBreedingStat   stat  = ArkBreedingStat.Compute(this, index, conf);
                s.Add(index, stat);
            }
            return(s);
        }
示例#4
0
        public static double CalculateStat(ArkDinoEntry dino_entry, DinoStatTypeIndex stat, float levelWild, float tamingEff, float levelDom, float imprintingBonus, ArkWorldSettings world, ArkConfigSettings settings, bool isTamed)
        {
            // if stat is generally available but level is set to -1 (== unknown), return -1 (== unknown)
            if (levelWild < 0 && dino_entry != null && dino_entry.increasePerWildLevel[stat] != 0)
            {
                return(-1);
            }
            if (dino_entry != null)
            {
                Dictionary <DinoStatTypeIndex, ArkBreedingStat> stats = dino_entry.GetBreedingStats(settings);
                double add = 0, domMult = 1, imprintingM = 1, tamedBaseHP = 1;
                if (isTamed)
                {
                    add = stats[stat].AddWhenTamed;
                    double domMultAffinity = stats[stat].MultAffinity;
                    // the multiplicative bonus is only multiplied with the TE if it is positive (i.e. negative boni won't get less bad if the TE is low)
                    if (domMultAffinity >= 0)
                    {
                        domMultAffinity *= tamingEff;
                    }
                    domMult = (tamingEff >= 0 ? (1 + domMultAffinity) : 1) * (1 + levelDom * stats[stat].IncPerTamedLevel);
                    if (imprintingBonus > 0 &&
                        stat != DinoStatTypeIndex.Stamina &&
                        stat != DinoStatTypeIndex.Oxygen &&
                        stat != DinoStatTypeIndex.Temperature &&
                        (stat != DinoStatTypeIndex.Speed /*|| species.NoImprintingForSpeed == false*/) &&
                        stat != DinoStatTypeIndex.TemperatureFortitude &&
                        stat != DinoStatTypeIndex.CraftingSpeed
                        )
                    {
                        imprintingM = 1 + 0.2 * imprintingBonus * settings.BabyImprintingStatScaleMultiplier; // TODO 0.2 is not always true
                    }
                    if (stat == 0)
                    {
                        tamedBaseHP = (float)dino_entry.statusComponent.tamedBaseHealthMultiplier;
                    }
                }
                //double result = Math.Round((species.stats[stat].BaseValue * tamedBaseHP * (1 + species.stats[stat].IncPerWildLevel * levelWild) * imprintingM + add) * domMult, Utils.precision(stat), MidpointRounding.AwayFromZero);
                // double is too precise and results in wrong values due to rounding. float results in better values, probably ARK uses float as well.
                // or rounding first to a precision of 7, then use the rounding of the precision
                //double resultt = Math.Round((species.stats[stat].BaseValue * tamedBaseHP * (1 + species.stats[stat].IncPerWildLevel * levelWild) * imprintingM + add) * domMult, 7);
                //resultt = Math.Round(resultt, Utils.precision(stat), MidpointRounding.AwayFromZero);

                // adding an epsilon to handle rounding-errors
                double result = Math.Round((stats[stat].BaseValue * tamedBaseHP *
                                            (1 + stats[stat].IncPerWildLevel * levelWild) * imprintingM + add) *
                                           domMult + roundupDelta, precision(stat), MidpointRounding.AwayFromZero);

                return(result >= 0 ? result : 0);
            }
            return(0);
        }
示例#5
0
 public static int precision(DinoStatTypeIndex s)
 {
     // damage and speed are percentagevalues, need more precision
     return((s == DinoStatTypeIndex.Speed || s == DinoStatTypeIndex.MeleeDamage || s == DinoStatTypeIndex.CraftingSpeed) ? 3 : 1);
 }