internal void ShowBoostProgress(ih[] boostSlots)
        {
            var needed = new BoostsNeeded();
            var cube   = new Cube
            {
                Power     = _controller.cubePower(),
                Toughness = _controller.cubeToughness()
            };

            foreach (var item in boostSlots)
            {
                needed.Add(item.equipment.GetNeededBoosts());
            }

            var current = needed.Power + needed.Toughness + needed.Special;

            if (current > 0)
            {
                if (_previousBoostsNeeded == null)
                {
                    Log($"Boosts Needed to Green: {needed.Power} Power, {needed.Toughness} Toughness, {needed.Special} Special");
                    _previousBoostsNeeded = needed;
                }
                else
                {
                    var old = _previousBoostsNeeded.Power + _previousBoostsNeeded.Toughness +
                              _previousBoostsNeeded.Special;

                    var diff = current - old;

                    //If diff is > 0, then we either added another item to boost or we levelled something. Don't add the diff to average
                    if (diff <= 0)
                    {
                        _invBoostAvg.Enqueue(diff * -1);
                    }

                    Log($"Boosts Needed to Green: {needed.Power} Power, {needed.Toughness} Toughness, {needed.Special} Special");
                    var average = _invBoostAvg.Avg();
                    if (average > 0)
                    {
                        var eta = current / average;
                        Log($"Last Minute: {diff}. Average Per Minute: {average:0}. ETA: {eta:0} minutes.");
                    }
                    else
                    {
                        Log($"Last Minute: {diff}.");
                    }

                    _previousBoostsNeeded = needed;
                }
            }

            if (_lastCube == null)
            {
                _lastCube = cube;
            }
            else
            {
                if (!_lastCube.Equals(cube))
                {
                    var output        = $"Cube Progress:";
                    var toughnessDiff = cube.Toughness - _lastCube.Toughness;
                    var powerDiff     = cube.Power - _lastCube.Power;

                    output = toughnessDiff > 0 ? $"{output} {toughnessDiff} Toughness." : output;
                    output = powerDiff > 0 ? $"{output} {powerDiff} Power." : output;

                    _cubeBoostAvg.Enqueue((decimal)(toughnessDiff + powerDiff));
                    output = $"{output} Average Per Minute: {_cubeBoostAvg.Avg():0}";
                    Log(output);
                }

                _lastCube = cube;
            }
        }
 protected bool Equals(Cube other)
 {
     return(Power.Equals(other.Power) && Toughness.Equals(other.Toughness));
 }
Beispiel #3
0
        internal void ManageBoostConversion(ih[] boostSlots)
        {
            if (_character.challenges.levelChallenge10k.curCompletions <
                _character.allChallenges.level100Challenge.maxCompletions)
            {
                return;
            }

            if (!Settings.AutoConvertBoosts)
            {
                return;
            }

            var converted = _character.inventory.GetConvertedInventory();
            //If we have a boost locked, we want to stay on that until its maxxed
            var lockedBoosts = converted.Where(x => x.id < 40 && x.locked).ToArray();

            if (lockedBoosts.Any())
            {
                foreach (var locked in lockedBoosts)
                {
                    //Unlock level 100 boosts
                    if (locked.level == 100)
                    {
                        _character.inventory.inventory[locked.slot].removable = true;
                        continue;
                    }

                    if (locked.id <= 13)
                    {
                        _controller.selectAutoPowerTransform();
                    }
                    else if (locked.id <= 26)
                    {
                        _controller.selectAutoToughTransform();
                    }
                    else if (locked.id <= 39)
                    {
                        _controller.selectAutoSpecialTransform();
                    }
                }

                return;
            }

            var needed = new BoostsNeeded();

            foreach (var item in boostSlots)
            {
                needed.Add(item.equipment.GetNeededBoosts());
            }

            if (needed.Power > 0)
            {
                _controller.selectAutoPowerTransform();
                return;
            }

            if (needed.Toughness > 0)
            {
                _controller.selectAutoToughTransform();
                return;
            }

            if (needed.Special > 0)
            {
                _controller.selectAutoSpecialTransform();
                return;
            }

            var cube = new Cube
            {
                Power     = _character.inventory.cubePower,
                Toughness = _character.inventory.cubeToughness
            };

            if (Settings.CubePriority > 0)
            {
                if (Settings.CubePriority == 1)
                {
                    if (cube.Power > cube.Toughness)
                    {
                        _controller.selectAutoToughTransform();
                    }
                    else if (cube.Toughness > cube.Power)
                    {
                        _controller.selectAutoPowerTransform();
                    }
                    else
                    {
                        _controller.selectAutoPowerTransform();
                    }
                }
                else if (Settings.CubePriority == 2)
                {
                    _controller.selectAutoPowerTransform();
                }
                else
                {
                    _controller.selectAutoToughTransform();
                }

                return;
            }

            _controller.selectAutoNoneTransform();
        }