All pastes #524350 Raw Edit

Someone

public text v1 · immutable
#524350 ·published 2007-05-31 01:43 UTC
rendered paste body
using System;
using InnerSpaceAPI;
using LavishScriptAPI;
using PRModuleInterface;
using PRCoreInterface;

namespace PRModuleLibrary
{
    // Main Code
    public partial class PRModule : IPlugin
    {
        //my delcares
        string WhichManaGem;
        bool UseFireWard;
        bool UseFrostWard;
        bool NeedBuffs;
        bool CheckedBuffs;
        string MyManaGem;
        string CombatPrepCurrentState;
        string RoutineState;
        public enum RoutineStates
        {
            CombatPrep,			//Speaks for itself
            Pulling,			//Speaks for itself
            Combat              //The actual killing
        }
        public enum CombatPrepStates		//apparently checking health is not needed
        {
            CheckingBuffs,			//I'm going to have this here anyway because of waltz's current buff implementation
            Buffing,			//May just make this part of the CheckingBuffs.
            CheckingManaGem,		//Speaks for itself
            PreCombatWards			//I'll implement it if I have to. Do any pre-combat fire/frost wards on fire/frost damage dealers
        }
        public enum PullingStates
        {
            Advancing,			//Get close if the mob wandered out of range for some reason. If it did, your pull range is probably too high
            Casting				//the actual pulling
        }
        public enum SingleTargetCombat
        {
            Nuking,				//our good 'ole spec-optimized nukes.
            PreFlee,			//Mana-shield, snares, etc, while running from mobs
            SwapToDoubleTargetCombat	//Escalate to doubletarget combat if a mob aggros, essentially just start the CC
        }
        public enum DoubleTargetCombat
        {
            Nuking,				//Will be same as singletarget nuking, because it's really the same
            CrowdControl,			//Snare mobs if possible, get away, sheep lower priority mob
            SwapToMultiTargetCobmat,	//Switch to multi target combat if needed, not sure how well it'd work mostly because there's a good chance you'll be lowhp with adds. Flee?
            PreFlee				//same as above
        }
        public enum MultiTargetCombat
        {
            AoENuking,			//Fancy blizzarding, blast waving, etc. should really be a frostie for this...
            EmergencyCrowdControl,		//snares and flares to get away if needed, probably be merged with preflee
            PreFlee				//same as above
        }
        public enum BuffStates			//kinda like sub-substates for buffing. It'll do my own downtime if I need to.
        {
            CheckMana,			//.....
            CheckBuffs,			//I repeat, .....
            CastBuffs			//Spec-optimized buffing.
        }

        private void GetCombatPrepState()
        {
            if (!CheckedBuffs)
                return CombatPrepStates.CheckingBuffs;
            if (!Requiem.Character.Buff("Arcane Intellect").IsValid || (!Requiem.Character.Buff("Molten Armor").IsValid && !Requiem.Character.Buff("Ice Armor").IsValid && !Requiem.Character.Buff("Frost Armor").IsValid))
                return CombatPrepStates.Buffing; //currently lacking Dampen Magic
            if (MyManaGem == null || !Requiem.Inventory.GetItem(MyManaGem))
                return CombatPrepStates.CheckingManaGem;
            if ((UseFireWard && !Requiem.Character.Buff("Fire Ward").IsValid) || (UseFrostWard && !Requiem.Character.Buff("Frost Ward").IsValid))
                return CombatPrepStates.PreCombatWards;
        }
        private void CheckBuffs()
        {
            if (!Requiem.Character.Buff("Arcane Intellect"))
            {
                NeedArcInt = true;
            }
            if (!Requiem.Character.Buff("Ice Armor") && !Requiem.Character.Buff("Frost Armor") && !Requiem.Character.Buff("Molten Armor"))
            {
                NeedArmorSpell = true;
            }
            if (Requiem.Character.TargetList.Unit(0).Mana > 0 || UseFireWard || UseFrostWard)
            {
                NeedDampen = true;
            }
        }
        private void Buffs()
        {
            if (NeedArcInt)
            {
                Requiem.Character.Cast("Arcane Intellect", Requiem.Character.GUID);
            }
            if (NeedArmorSpell)
            {
                if (!Requiem.Character.Cast("Molten Armor"))
                {
                    if (!Requiem.Character.Cast("Ice Armor"))
                    {
                        if (!Requiem.Character.Cast("Frost Armor"))
                        {
                        }
                    }
                }
            }
            if (NeedDampen)
            {
                Requiem.Character.Cast("Dampen Magaic", Requiem.Character.GUID);
            }
        }
        private void CheckManaGem()
        {
            if (!Requiem.Inventory.GetItem("Mana Agate") && !Requiem.Inventory.GetItem("Mana Jade") && !Requiem.Inventory.GetItem("Mana Citrine") && !Requiem.Inventory.GetItem("Mana Ruby") && !Requiem.Inventory.GetItem("Mana Emerald"))
            {
                if (!Requiem.Character.Cast("Conjure Mana Emerald"))
                {
                    if (!Requiem.Character.Cast("Conjure Mana Ruby"))
                    {
                        if (!Requiem.Character.Cast("Conjure Mana Citrine"))
                        {
                            if (!Requiem.Character.Cast("Conjure Mana Jade"))
                            {
                                if (!Requiem.Character.Cast("Conjure Mana Agate"))
                                {
                                }
                            }
                        }
                    }
                }
            }
        }
        private void PreCombatWards()
        {
            if (UseFireWard)
            {
                Requiem.Character.Cast("Fire Ward", Requiem.Character.GUID);
            }
            if (UseFrostWard)
            {
                Requiem.Character.Cast("Frost Ward", Requiem.Character.GUID);
            }
        }
        private void Pull()
        {
            
        }
        private RoutineStates Combat()
        {

        }
        private void ManaUp()
        {
            if (!Requiem.Inventory.ItemCount(Requiem.Inventory.BestDrink) < 6)
            {
                ConjureMyWater();
            }
            Requiem.Inventory.Use(Requiem.Inventory.BestDrink);
            if (Requiem.Character.ManaPercent < 95)
            {
                do
                {
                }
                while (Requiem.Character.Buff("Drink").IsValid);
            }
        }
        private void ConjureMyWater()
        {
            if (Requiem.Character.ManaPercent >= 7.5)
            {
                Requiem.Character.Cast("Conjure Water");
            }
            else
            {
                Requiem.Character.Sit();
                if (Requiem.Character.ManaPercent >= 7.5)
                    break;
            }
        }
        private bool GetPullState()
        {
            if (Requiem.Character.Location.Distance(Requiem.Character.CurrentTarget.Location.X, Requiem.Character.CurrentTarget.Location.Y, Requiem.Character.CurrentTarget.Location.Z))
            {
                Requiem.Navigation.Face(Requiem.Character.CurrentTarget.Location.X, Requiem.Character.CurrentTarget.Location.Y);
                do
                {
                    Requiem.Navigation.MoveForward();
                }
                while (Requiem.Character.Location.Distance(Requiem.Character.CurrentTarget.Location.X, Requiem.Character.CurrentTarget.Location.Y, Requiem.Character.CurrentTarget.Location.Z) > (PullingRange - 3));
            }
            return true;
        }
        int PullingRange;
        string CombatState;
        // This function is called every frame.
        public void Pulse()
        {
            RoutineState = GetRoutineState();
            switch (RoutineState)
            {
                case RoutineStates.CombatPrep:
                    CombatPrepCurrentState = GetCombatPrepState();
                    switch (CombatPrepCurrentState)
                    {
                        case CombatPrepStates.CheckingBuffs:
                            CheckBuffs();
                            break;
                        case CombatPrepStates.Buffing:
                            Buffs();
                            break;
                        case CombatPrepStates.CheckingManaGem:
                            CheckManaGem();
                            break;
                        case CombatPrepStates.PreCombatWards:
                            PreCombatWards();
                            break;
                    }
                    break;
                case RoutineStates.Pulling:
                    if (GetPullState)
                        Pull();
                    break;
                case RoutineStates.Combat:
                    //Will come back to this.
                    break;
            }
        }

        // This function is executed when the plugin is loaded.
        public void OnLoad()
        {

        }

        // This function is executed when the plugin is unloaded.
        public void OnUnload()
        {

        }
    }
}