Exemplo n.º 1
0
        public static RunStatus EquipOptimalRing(EquipmentContext context, ushort slot, ushort other)
        {
            var prospects = GearEvaluator.GetProspects(context, slot)
                            .Where(s => s.Slot != other);

            var current  = Equipment.GetEquipmentSlot(slot);
            var prospect = prospects.FirstOrDefault();

            if (prospect == null || prospect.Slot == slot)
            {
                context.SlotChecked[slot] = true;
                return(RunStatus.Success);
            }

            if (context.OptimizeBySpiritbind && prospect.SpiritBond >= 100f)
            {
                if (current.Item.ItemLevel < context.MinimumItemLevel)
                {
                    EquipItem(current, prospect);
                }

                context.SlotChecked[slot] = true;
                return(RunStatus.Success);
            }

            EquipItem(current, prospect);
            context.SlotChecked[slot] = true;
            return(RunStatus.Success);
        }
Exemplo n.º 2
0
        private static RunStatus EquipOptimalMainHand(EquipmentContext context)
        {
            var statWeights = Database.StatWeights.First(sw => sw.Job == Core.Me.CurrentJob);
            var mainHands   = GearEvaluator.GetProspects(context, 0);

            var primaries = mainHands
                            .Where(s => s.Item.EquipmentCatagory == statWeights.Primary)
                            .ToList();

            var alternatives = mainHands
                               .Where(s => s.Item.EquipmentCatagory == statWeights.Primary2H)
                               .ToList();

            var secondaries = GearEvaluator.GetProspects(context, 1);

            var bestOneHand = primaries.FirstOrDefault();
            var bestOffhand = secondaries.FirstOrDefault();
            var bestTwoHand = alternatives.FirstOrDefault();

            float oneHandScore = bestOneHand == null ? 0f : bestOneHand.Item.Score();
            float offhandScore = bestOffhand == null ? 0f : bestOffhand.Item.Score();
            float twoHandScore = bestTwoHand == null ? 0f : bestTwoHand.Item.Score();
            float oneHandTotal = oneHandScore + offhandScore;

            var current = Equipment.GetEquipmentSlot(0);

            if (oneHandTotal > twoHandScore && bestOneHand != null)
            {
                if (bestOneHand.Slot != 0)
                {
                    EquipItem(current, bestOneHand);
                }
            }
            else if (bestTwoHand != null && bestTwoHand.Slot != 0)
            {
                EquipItem(current, bestTwoHand);
            }

            context.SlotChecked[0] = true;
            return(RunStatus.Success);
        }