cleric mac work in progress

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

cleric mac work in progress

Post by Ogre_Luvr » Fri Apr 23, 2004 3:15 pm

any suggestions/comments/help would be great!

put it in snippets cause its not complete and i thought help wouldn't be quite right cause i dont have any specific questions

Code: Select all

|************************************|
|* nClericGroup.mac 				*|
|* by Ogre_Luvr						*|
|* Usage: /mac clericgroup Soandso	*|
|* A work in progress             	*|
|************************************|


#include nSpellCast.inc 

Sub main
	/zapvars

	/declare mainHeal global
		/varset mainHeal "Remedy"
	/declare durationHeal global
		/varset durationHeal "Celestial Healing"
	/declare bigHeal global
		/varset bigHeal "Complete Healing"		
	/declare tankID global
		/if (${Spawn[@Param0].ID}) {
			/varset tankID ${Spawn[@Param0].ID}
		} else {
			/varset tankID 0		
		}
	:mainLoop
		/call checkHP
	/goto :mainLoop
/return

Sub checkHP
	/declare lowHP local
		|||	set the baseline for the hp check to me so i get checked (since i am not a member of the group)
		/varset lowHP ${Me.ID}
	/declare i local
	|||	iterate through the group
    /for i 1 to ${Group}
    	|||	If the group member's HP is lower than the stored member set the ner member as low
		/if (${Math.Calc[${Group[@i].PctHPs}<${Spawn[@lowHP].PctHPs}]}) {
			/varset lowHP ${Group[@i].ID}
		}
		|||	if the group member is a pet class check thier pet's HP
		|||	and they have a pet up
		|||	and the pet is lower than the stored member
    	/if (${String[@petClasses].Find[${Group[@i].Class}]} && ${Group[@i].Pet.ID} && ${Math.Calc[${Group[@i].Pet.PctHPs}<${Spawn[@lowHP].PctHPs}]}) {
				/varset lowHP ${Group[@i].Pet.ID}
    	} 
    /next i
    
    ||| if the low member is below the threshold .. heal them
    /if (${Math.Calc[${Spawn[@lowHP].PctHPs}<70]}) {
    	/call heal @lowHP
    }
/return

Sub heal(spawnID)
	/target id @spawnID
	|||	if @spawnID isn't the tank do a normal heal
	/if (${Math.Calc[@spawnID!=@tankID]}) {
		|||  if the spawn in question is less than 45% health and in range of the heal spell
    	/if (${Math.Calc[${Spawn[@spawnID].PctHPs}<45]} && ${Math.Calc[${Spawn[@spawnID].Distance}<=${Spell["@mainHeal"].Range}]}) {
    		/call cast "@mainHeal"
    	} else {
			|||	if the spawn in question is less than 70% health and in range of the duration heal spell
    		/if (${Math.Calc[${Spawn[@spawnID].PctHPs}<70]} && ${Math.Calc[${Spawn[@spawnID].Distance}<=${Spell["@durationHeal"].Range}]}) {
				|||	If the spawn in question does not have a heal timer defined for him/her make one
                /echo ${Defined[healTimer_@spawnID]}
                /if (!${Defined[healTimer_@spawnID]}) {
                	/declare healTimer_@spawnID timer
                	/varset healTimer_@spawnID 0
                } 
                
                |||	Cast the duration heal and set the timer
                /if (${Math.Calc[@healTimer_@spawnID<1]}) {
                	/call cast "@durationHeal"
                	/varset healTimer_@spawnID $calc($spell("@durationHeal",duration)*10)				
                }
    		}
    	}
    } else { |||	its the tank
    	|||  If the tank has less than 45% hp 
    	|||		and in range of the big heal spell 
    	|||		and you have enough mana ... announce and heal him
    	/if (${Math.Calc[${Spawn[@spawnID].PctHPs}<=45]} && ${Math.Calc[${Spawn[@spawnID].Distance}<=${Spell["@bigHeal"].Range}]} && ${Math.Calc[${Me.CurrentMana}>=${Spell[@bigHeal].Mana}]}) {
			/g inc @bigHeal to ${Spawn[@spawnID].Name}
			/call cast "@bigHeal"
    	}
    }
/return

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Fri Apr 23, 2004 5:07 pm

Snippets
A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.
Seriously though, might want to move this to HELP until finished then to DEPOT.

Bob_isn't_trying_to_be_the_board_nazi