All pastes #390995 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-11 20:43 UTC
rendered paste body
/*
   _____                              __  .__     
  /  _  \ ________ ___________  _____/  |_|  |__  
 /  /_\  \\___   // __ \_  __ \/  _ \   __\  |  \ 
/    |    \/    /\  ___/|  | \(  <_> )  | |   Y  \
\____|__  /_____ \\___  >__|   \____/|__| |___|  /
        \/      \/    \/                       \/
 
Present's to you 'Paladin Routine 1.00 for bbot'
 
**** Changes ****
*** 1.00 ***
- Started the Routine
*/
objectdef oToon inherits oToonBase
{
	variable string Version = "1.00"
	variable int MinMana = 100
	variable int MaxMana = 100
	variable int MinBattleHeal = 40
	variable int MinHealth = 45
	variable int MaxHealth = 100
 
	variable int MinSealMana = 45
 
	variable int LevelBelow = 4
	variable int LevelAbove = 2
 
	variable int Interrupt = 1
	variable string InterruptSpell = "Hammer of Justice"
	variable int MountDistance = 400
	variable int RepairPct = 30
	variable int CorpseCampLimit = 3
	variable int PoisonCounter = 0
	variable string Aura = "Devotion Aura"
 
	variable int JudgeTime = ${LavishScript.RunningTime}
 
	variable string Blessing = "Blessing of Wisdom"
 
	variable int PureMelee = 40
 
	variable int BuffNum = 0
 
 
	member NeedBuff()
	{
		if !${Me.Buff[${This.Aura}](exists)} && ${Spell[${This.Aura}](exists)}
		{
			return TRUE
		}
		elseif !${Me.Buff[${This.Blessing}](exists)} && ${Spell[${This.Blessing}](exists)}
		{
			return TRUE
		}
		elseif !${Me.Buff["Righteous Fury"](exists)} && ${Spell["Righteous Fury"](exists)}
		{
			return TRUE
		}
 
	return FALSE
	}
 
	method BuffPulse()
	{
		if !${Me.Buff[${This.Aura}](exists)}  && ${Spell[${This.Aura}](exists)}
		{
			Cast "${This.Aura}"
		}
		elseif !${Me.Buff[${This.Blessing}](exists)} && ${Spell[${This.Blessing}](exists)}
		{
			Cast "${This.Blessing}"
		}
		elseif !${Me.Buff["Righteous Fury"](exists)} && ${Spell["Righteous Fury"](exists)}
		{
			Cast "Righteous Fury"
		}
 
	}
 
	member NeedRest()
	{	
		if ${Me.PctMana} == 100 && ${Me.PctHPs} == 100
		{
			return FALSE
			This:Echo["1"]
		}
		elseif ${Me.PctHPs} > ${This.MaxHealth} && ${Me.PctMana} > ${This.MaxMana}
		{
			return FALSE
 
		}
		elseif ${Me.PctHPs} < ${This.MinHealth}
		{
			return TRUE
 
		}
		elseif ${Me.PctMana} < ${This.MinMana} 
		{
			return TRUE
 
		}
 
		return FALSE
	}
 
	method RestPulse()
	{
 
		if !${Me.Buff[Food](exists)} && ${Me.PctHPs} < ${This.MinHealth} && ${Consumable.GotFood} && !${Me.Buff["Eat"](exists)} && !${Me.Casting}
		{
			This:Echo["[Rest] Trying To Eat"]
			Consumable:Eat
 
		}
 
		elseif !${Me.Buff[Water](exists)} && ${Me.PctMana} < ${This.MinMana} && ${Consumable.GotDrink} && !${Me.Buff["Drink"](exists)} && !${Me.Casting}
		{
			This:Echo["[Rest] Trying To Drink"]
			Consumable:Drink
 
		}
 
		elseif ${Me.PctHPs}<${This.MinHealth} && !${Me.Casting} && ${Me.CurrentMana}>${Spell["Holy Light"].Mana} && ${Spell[Holy Light](exists)}
		{
			if !${Me.Buff[Water](exists)} && ${Me.Sitting}
			{
				wowpress SITORSTAND
	   	   	}
			This:Echo["[Rest] Casting Holy Light"]
			Cast "Holy Light"
		}
 
	}
 
    ;Check for poisons/curses
    member NeedCure()
    {
        BuffNum:Inc
        if ${BuffNum} > 56 || !${Me.Buff[${BuffNum}](exists)}
        {
            BuffNum:Set[1]
            if ${PoisonCounter}
            {
                return TRUE
            }
        }
 
        if ${Me.Buff[${BuffNum}].Harmful}
        {
            if ${Me.Buff[${BuffNum}].DispelType.Equal[Magic]} && ${Spell[Cleanse](exists)}
            {
                return TRUE
            }
            elseif ${Me.Buff[${BuffNum}].DispelType.Equal[Disease]} && {${Spell[Cleanse](exists)} 
            {
                return TRUE
            }
            elseif ${Me.Buff[${BuffNum}].DispelType.Equal[Poison]} && ${Spell[Cleanse](exists)} 
            {
                PoisonCounter:Inc
                return TRUE
            }
 
        }
        return FALSE
    }
 
    ;Cure stuff
    method CurePulse()
    {
        if ${Me.Buff[${BuffNum}].DispelType.Equal[Magic]} && ${Me.Action[Cleanse].Usable}
        {
 
            This:CastInstantSpell[Cleanse]
        }
        elseif ${Me.Buff[${BuffNum}].DispelType.Equal[Disease]} && ${Me.Action[Disease].Usable}
        {
 
            This:CastInstantSpell[Cleanse]
        }
        elseif ${PoisonCounter}
        {
            if ${PoisonCounter} == 1 && ${Me.Action[Cleanse].Usable}
            {
                Target ${Me.GUID}
                This:CastInstantSpell[Cleanse]
            }
            PoisonCounter:Set[0]
        }
    }
 
	member NeedHealing()
	{
		if ${Me.PctHPs}<${This.MinBattleHeal}
		{
			return TRUE
		}
		return FALSE
	}
 
	method HealingPulse()
	{
 
		if ${Me.PctHPs}<${This.MinBattleHeal} && !${Me.Casting} && ${Me.PctHPs} < 100 && ${Me.CurrentMana}>${Spell[Holy Light].Mana} && ${Spell[Holy Light](exists)}
		{
 
			This:Echo["[Heal] Casting Holy Light"]
			Cast "Holy Light" 
		}
		elseif ${Spell[Flash of Light](exists)}
		{
			if ${Me.PctHPs}<${This.MinBattleHeal} && !${Me.Casting} && ${Me.PctHPs} < 100 && ${Me.CurrentMana}>${Spell[Flash of Light].Mana} && ${Me.CurrentMana}<${Spell[Holy Light].Mana} 
			{
				This:Echo["[Heal] Casting Flash of Light"]
				Cast "Flash of Light"
			}
		}
		elseif ${Me.PctHPs} > 90
		{
			This:Echo["[Heal] Interrupted Healing"]
			WoWScript SpellStopCasting()
		}
 
	}
 
	member NeedInterrupt()
	{
		if ${WoWScript[UnitCastingInfo("playertarget")].NotEqual[NULL]} && ${Spell[Arcane Torrent](exists)} && !${Spell[Arcane Torrent].Cooldown} && ${This.Interrupt} == 1
		{
			return TRUE
		}
		elseif ${WoWScript[UnitCastingInfo("playertarget")].NotEqual[NULL]} && !${Spell[${This.InterruptSpell}].Cooldown} && ${This.Interrupt} == 1
		{
			return TRUE
		}
 
		return FALSE
	}
	method InterruptPulse()
	{
		if ${WoWScript[UnitCastingInfo("playertarget")].NotEqual[NULL]} && ${Spell[Arcane Torrent](exists)} && !${Spell[Arcane Torrent].Cooldown} && ${This.Interrupt} == 1
		{
			This:Echo["[Interupt] Casting Arcane Torrent!!"]
			Cast "Arcane Torrent"
		}
		elseif ${WoWScript[UnitCastingInfo("playertarget")].NotEqual[NULL]} && !${Spell[${This.InterruptSpell}].Cooldown} && ${This.Interrupt} == 1
		{
			This:Echo["[Interupt] Casting ${This.InterruptSpell}!!"]
			Cast "${This.InterruptSpell}"
		}
 
	}
 
	member NeedSealOfCrusader() 
	{
 
		{
			if ${Spell["Seal of the Crusader"](exists)} && !${Me.Buff["Seal of the Crusader"](exists)} && !${Me.Buff["Seal of Righteousness"](exists)} && !${Target.Buff["Judgement of the Crusader"](exists)}
			{
				return TRUE
			}
		}
		return FALSE
	}
	method SealOfCrusaderPulse() 
	{
 
		This:Echo["[Seals] Casting Seal of the Crusader."]
		This:CastInstantSpell["Seal of the Crusader"]
	}
	member NeedJudgement() 
	{
 
		if ${Spell["Judgement"](exists)} && ${Me.Buff["Seal of the Crusader"](exists)} && ${JudgeTime} < ${LavishScript.RunningTime}
		{
				return TRUE
		}
		return FALSE
	}
	method JudgementPulse() 
	{
		This:Echo["[Seals] Casting Judgement."]
		Cast "Judgement"
	}
	member NeedSealofRighteousness() 
	{
 
		if ${Spell["Seal of Righteousness"](exists)} && !${Me.Buff["Seal of the Crusader"](exists)} && !${Me.Buff["Seal of Righteousness"](exists)}
		{
			return TRUE
		}
		return FALSE
 
	}
	method SealofRighteousnessPulse() 
	{
		This:Echo["[Seals] Casting Seal of Righteousness"]
		Cast "Seal of Righteousness"
	}
 
 
 
	method Routine()
	{
 
		if ${This.NeedHealing}
		{
			This:SetStatus["HEALING"]
			This:HealingPulse
 
		}
		elseif ${This.NeedCure}
		{
			This:SetStatus["CURE"]
			This:CurePulse
 
		}
		elseif ${This.NeedBuff}
		{
			This:SetStatus["BUFF"]
			This:BuffPulse
 
		}
		elseif !${Me.Attacking} && ${Target.Distance} < 6 && !${Me.Casting}
		{
			This:SetStatus["MELEE"]
			WoWScript AttackTarget()
 
		}
		if ${This.JudgeTime} < ${LavishScript.RunningTime}
		{
			if ${This.NeedSealOfCrusader}
			{
				This:SetStatus["SEAL"]
				This:SealOfCrusaderPulse
			}
			elseif ${This.NeedJudgement}
			{
				This:SetStatus["SEAL"]
				This:JudgementPulse
			}
			elseif ${This.NeedSealofRighteousness}
			{
				This:SetStatus["SEAL"]
				This:SealofRighteousnessPulse
			}
			JudgeTime:Set[${LavishScript.RunningTime} + 1000]
		}
		elseif ${This.NeedInterrupt}
		{
			This:SetStatus["INTERRUPT"]
			This:InterruptPulse
 
		}
 
 
 
	}
 
 
 
	/*----CONFIG----*/
 
	method ToonGUIChange(string Action)
	{
		switch ${Action}
		{
 
		/** Buff Settings **/
 
 
		/** Battle Settings **/
			case Interrupt
				if ${UIElement[cmbInterrupt@Battle@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.Interrupt:Set[${UIElement[cmbInterrupt@Battle@Pages@ToonGUI].SelectedItem.Value}]
				}
			break
			case minbattleheal
				if ${UIElement[cmbbattleheal@Battle@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.MinBattleHeal:Set[${UIElement[cmbbattleheal@Battle@Pages@ToonGUI].SelectedItem.Value}]
				}
			break
			case PureMelee
				if ${UIElement[cmbPureMelee@Battle@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.PureMelee:Set[${UIElement[cmbPureMelee@Battle@Pages@ToonGUI].SelectedItem.Value}]
				}
			break
		/** Generic **/
 
			case RepairPct
				if ${UIElement[cmbRepairPct@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.RepairPct:Set[${UIElement[cmbRepairPct@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
			break
			case MountDistance
				if ${UIElement[cmbMountDistance@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.MountDistance:Set[${UIElement[cmbMountDistance@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
			break
			case minmana
				if ${UIElement[cmbMinMana@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.MinMana:Set[${UIElement[cmbMinMana@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
				break
 
			case maxmana
				if ${UIElement[cmbMaxMana@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.MaxMana:Set[${UIElement[cmbMaxMana@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
				break	
			case minhealth
				if ${UIElement[cmbMinHealth@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.MinHealth:Set[${UIElement[cmbMinHealth@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
				break
			case maxhealth
				if ${UIElement[cmbMaxHealth@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.MaxHealth:Set[${UIElement[cmbMaxHealth@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
				break
			case levelbelow
				if ${UIElement[cmbLevelBelow@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.LevelBelow:Set[${UIElement[cmbLevelBelow@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
				break
			case levelabove
				if ${UIElement[cmbLevelAbove@Generic@Pages@ToonGUI].SelectedItem.Value(exists)}
				{	
							This.LevelAbove:Set[${UIElement[cmbLevelAbove@Generic@Pages@ToonGUI].SelectedItem.Value}]
				}
				break
			case defaultgeneric
			break
		}
	}
 
 
	/*
	 * Config
	*/
 
	method LoadConfig()
	{
		This.Interrupt:Set[${This.ToonConfig.FindSetting["Interrupt",0]}]
 
		This.MountDistance:Set[${This.ToonConfig.FindSetting["MountDistance",400]}]
		This.RepairPct:Set[${This.ToonConfig.FindSetting["RepairPct",30]}]
		This.CorpseCampLimit:Set[${This.ToonConfig.FindSetting["CorpseCampLimit",3]}]
 
		This.SpamSpell:Set[${This.ToonConfig.FindSetting["SpamSpell","Frost Shock"]}]
		This.MinBattleHeal:Set[${This.ToonConfig.FindSetting["MinBattleHeal",50]}]
		This.PureMelee:Set[${This.ToonConfig.FindSetting["PureMelee",60]}]
		This.MinMana:Set[${This.ToonConfig.FindSetting["MinMana",90]}]	
		This.MaxMana:Set[${This.ToonConfig.FindSetting["MaxMana",95]}]	
		This.MinHealth:Set[${This.ToonConfig.FindSetting["MinHealth",50]}]	
		This.MaxHealth:Set[${This.ToonConfig.FindSetting["MaxHealth",95]}]	
		This.LevelBelow:Set[${This.ToonConfig.FindSetting["LevelBelow",4]}]	
		This.LevelAbove:Set[${This.ToonConfig.FindSetting["LevelAbove",2]}]
 
		This:Echo["Loaded Config!"]
	}
 
	method SaveConfig()
	{
 
		This.ToonConfig.FindSetting["Interrupt"]:Set[${This.Interrupt}]
 
		This.ToonConfig.FindSetting["MountDistance"]:Set[${This.MountDistance}]
		This.ToonConfig.FindSetting["RepairPct"]:Set[${This.RepairPct}]
		This.ToonConfig.FindSetting["CorpseCampLimit"]:Set[${This.CorpseCampLimit}]
 
		This.ToonConfig.FindSetting["SpamSpell"]:Set[${This.SpamSpell}]
		This.ToonConfig.FindSetting["PureMelee"]:Set[${This.PureMelee}]
		This.ToonConfig.FindSetting["MinBattleHeal"]:Set[${This.MinBattleHeal}]
		This.ToonConfig.FindSetting["MinMana"]:Set[${This.MinMana}]
		This.ToonConfig.FindSetting["MaxMana"]:Set[${This.MaxMana}]
		This.ToonConfig.FindSetting["MinHealth"]:Set[${This.MinHealth}]		
		This.ToonConfig.FindSetting["MaxHealth"]:Set[${This.MaxHealth}]
		This.ToonConfig.FindSetting["LevelBelow"]:Set[${This.LevelBelow}]
		This.ToonConfig.FindSetting["LevelAbove"]:Set[${This.LevelAbove}]
		This:Echo["Saved Config!"]
	}
 
	/*
	 * 
	 */
	method InitPaladinGui(string tab)
	{		
		variable int i = 1
 
		/** Buffs **/
 
 
		/** Battle **/
 
		for (i:Set[1] ; ${i}<=${UIElement[cmbInterrupt@Battle@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.Interrupt} == ${UIElement[cmbInterrupt@Battle@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbInterrupt@Battle@Pages@ToonGUI]:SelectItem[${i}]
			}
		}	
 
 
		for (i:Set[1] ; ${i}<=${UIElement[cmbMinBattleHeal@Battle@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.MinBattleHeal} == ${UIElement[cmbMinBattleHeal@Battle@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbMinBattleHeal@Battle@Pages@ToonGUI]:SelectItem[${i}]
			}
		}	
 
 
		for (i:Set[1] ; ${i}<=${UIElement[cmbPureMelee@Battle@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.PureMelee} == ${UIElement[cmbPureMelee@Battle@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbPureMelee@Battle@Pages@ToonGUI]:SelectItem[${i}]
			}
		}	
 
		/** Generic **/
 
		for (i:Set[1] ; ${i}<=${UIElement[cmbRepairPct@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.RepairPct} == ${UIElement[cmbRepairPct@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbRepairPct@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}	
		for (i:Set[1] ; ${i}<=${UIElement[cmbMountDistance@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.MountDistance} == ${UIElement[cmbMountDistance@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbMountDistance@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}	
		for (i:Set[1] ; ${i}<=${UIElement[cmbMinMana@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.MinMana} == ${UIElement[cmbMinMana@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbMinMana@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}		
		for (i:Set[1] ; ${i}<=${UIElement[cmbMaxMana@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.MaxMana} == ${UIElement[cmbMaxMana@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbMaxMana@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}
		for (i:Set[1] ; ${i}<=${UIElement[cmbMinHealth@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.MinHealth} == ${UIElement[cmbMinHealth@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbMinHealth@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}
		for (i:Set[1] ; ${i}<=${UIElement[cmbMaxHealth@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.MaxHealth} == ${UIElement[cmbMaxHealth@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbMaxHealth@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}
		for (i:Set[1] ; ${i}<=${UIElement[cmbLevelBelow@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.LevelBelow} == ${UIElement[cmbLevelBelow@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbLevelBelow@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}
		for (i:Set[1] ; ${i}<=${UIElement[cmbLevelAbove@Generic@Pages@ToonGUI].Items} ; i:Inc)
		{
		  if ${This.LevelAbove} == ${UIElement[cmbLevelAbove@Generic@Pages@ToonGUI].Item[${i}].Value}
			{
				UIElement[cmbLevelAbove@Generic@Pages@ToonGUI]:SelectItem[${i}]
			}
		}
	}
 
	method InitToon()
	{		
		LavishScript:RegisterEvent[TOON_GUI_CHANGE]
		Event[TOON_GUI_CHANGE]:AttachAtom[${This.ObjectName}:ToonGUIChange]
		This:InitPaladinGui[spells]
		This:Echo["Azeroth's Paladin Routine ${Version}"]
	}
 
	method Shutdown()
	{		
		This:SaveConfig
 
		LavishSettings["Class"]:Export["etc/class.xml"]
		Event[UI_ERROR_MESSAGE]:DetachAtom[${This.ObjectName}:ErrorMessage]
		Event[TOON_GUI_VISIBLE]:Unregister
 
		/* b7731 */
		Event[TOON_GUI_CHANGE]:DetachAtom[${This.ObjectName}:ToonGUIChange]
		Event[TOON_GUI_CHANGE]:Unregister
		/* b7731 */
 
		ui -unload "class/${Me.Class}.xml"
 
	}
	method Echo(string Text)
	{
		if ${UIElement[ConsoleGUI](exists)}
		{
			UIElement[Console@Console@Pages@ToonGUI]:Echo["${Time.Time24} ${Text.Escape}"]
		}
		else
		{
			echo "${Time.Time24} ${Text}"
		}
	}
	method SetStatus(string Text)
	{
		UIElement[Status@Console@Pages@ToonGUI]:SetText[${Text.Escape}]
	}
}