#Event NeedInvite "#1# tells you, 'Invite me (#2#)'"
#Event LockoutTimer "#*#task because you must wait 0d:0h:#1#m before you can#*#"
#Event Death "You have been Slain#*#"
#Event FairyFireResisted "Your target resisted the Fairy Fire spell."
#Event Zoned "#*#You have entered#1#."
#Event NeedPlayers "You can not be assigned this shared task because your party does not contain the minimum required number of players."
#Event NeedMana "Insufficient Mana to cast this spell!"
#Event NoTarget "You must first select a target for this spell!"
#Event NoLoS "You cannot see your target."
#Event WitchlampForgets "For some reason the Witchlamp loses interest in you and decides to go back to its section of the woods."
#Event CannotLoot "#*#You cannot loot while a hostile creature is aware of your presence#*#"
#turbo 10
#include SpellCast.inc
Sub Main
/if (${Plugin[mq2fairy].Name.NotEqual[mq2fairy]}) {
/echo MQ2Fairy plugin is required to run this macro.
/endmacro
}
|--Configurable Variables--------------------------------------------------|
|--The Password to be auto-invited-----------------------------------------|
/declare InvitePassword string outer password
|--The location to be used as warp "Safe Spot"-----------------------------|
/declare SafeSpotY float outer -184.00
/declare SafeSpotX float outer 153.00
/declare SafeSpotZ float outer -11.00
|--The location to be used as warp "KillRemains Safe Spot"-----------------|
/declare RemainsSafeSpotY float outer -234.00
/declare RemainsSafeSpotX float outer -420.00
/declare RemainsSafeSpotZ float outer -45.00
|--The location to be used as warp "Zone Out Spot"-------------------------|
/declare ZoneOutY float outer -179.00
/declare ZoneOutX float outer -74.00
/declare ZoneOutZ float outer -14.00
|--The location in Nektulos where it should warp to, to enter the instance-|
/declare NekZoneInY float outer -366.00
/declare NekZoneInX float outer 400.00
/declare NekZoneInZ float outer -19.00
|--The location which should be walked toward, to zone out of instance-----|
/declare MvOutY float outer -120.00
/declare MvOutX float outer -174.00
|--The location which should be walked toward, to zone in to instance------|
/declare MvInY float outer 413.00
/declare MvInX float outer -372.00
|--The Zone.ID of the instance---------------------------------------------|
/declare ZID int outer 368
|--Various variables used throughout the macro-----------------------------|
/declare NeedPlayer int outer 0
/declare StartHP int outer 0
/declare LOTimer timer outer 0
/declare ZonedToInstance bool outer ${Bool[FALSE]}
/declare FFResist bool outer ${Bool[FALSE]}
/declare NeedTarget bool outer ${Bool[FALSE]}
/declare NoWitchlampAgro bool outer ${Bool[FALSE]}
/declare GotAgro bool outer ${Bool[FALSE]}
/declare CannotLoot bool outer ${Bool[FALSE]}
/declare KilledShrine[3] bool outer ${Bool[FALSE]}
/declare GSay bool outer ${Bool[FALSE]}
/declare DoDebugging bool outer ${Bool[FALSE]}
|--The Shrines-------------------------------------------------------------|
/declare Shrine[3] string outer
/varset Shrine[1] Shrine02
/varset Shrine[2] Shrine00
/varset Shrine[3] Shrine01
/declare i int local 0
/if (${Defined[Param0]}) {
/if (${Param0.Upper.Equal[DEBUG]}) {
/varset DoDebugging ${Bool[TRUE]}
} else /if (${Param0.Upper.Equal[GSAY]}) {
/varset GSay ${Bool[TRUE]}
}
}
/if (${Defined[Param1]}) {
/if (${Param1.Upper.Equal[DEBUG]}) {
/varset Loot ${Bool[TRUE]}
} else /if (${Param1.Upper.Equal[GSAY]}) {
/varset GSay ${Bool[TRUE]}
}
}
/if (${Bool[${DoDebugging}]}) {
/mqlog clear
/echo Writing debug info to logfile.
}
:loop
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@1 :: :loop begin
/if (${Zone.ID} == ${ZID}) /goto :ready
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@2 :: Zone.ID == ${Zone.ID}
/call Reset
/if (${Zone.ID} != ${ZID}) /endmacro
:ready
/varset LOTimer 40m
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@3 :: :ready begin; /call KillRemains
/call KillRemains
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@4 :: Done killing remains; /doevents; /call LootRemains
/doevents
/call LootRemains
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@5 :: Done looting remains; /warping to safespot
/squelch /warp loc ${SafeSpotY} ${SafeSpotX} ${SafeSpotZ}
/call KillShrine
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@7 :: Done killing shrines; /warping to zoneout
/squelch /warp loc ${ZoneOutY} ${ZoneOutX} ${ZoneOutZ}
/if (${Zone.ID} != ${ZID}) /goto :loop
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@8 :: Getting ready to move out.
/cleanup
:Wait
/delay 2s
/if (${Bool[${LOTimer}]}) {
/if (${Math.Distance[${SafeSpotY},${SafeSpotX}]} > 10) /call Warper TRUE
/goto :Wait
}
/if (${Zone.ID} == ${ZID}) /call Movement ${MvOutY} ${MvOutX}
/keypress BACK
/delay 4s
/if (${Bool[${DoDebugging}]}) /mqlog Sub Main@9 :: :loop end
/goto :loop
/return
Sub Movement(float MoveX, float MoveY, int Point)
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@1 :: MoveX: ${MoveX}; MoveY: ${MoveY}; Point: ${Point}
/declare StartZone int local ${Zone.ID}
/if ((${MoveX} == 9999) && (${MoveY} == 9999)) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@2 :: == 9999
/varcalc MoveX ${Target.X}+1
/varcalc MoveY ${Target.Y}-10
}
/if ((${MoveX} == 1) && (${MoveY} == 1)) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@3 :: == 1
/varset MoveX ${Ini[pointset,Nekmm,PointX${Point}]}
/varset MoveY ${Ini[pointset,Nekmm,PointY${Point}]}
}
/face nolook loc ${MoveY},${MoveX}
/if (!${Bool[${Me.Standing}]}) /stand
/keypress FORWARD hold
:loop
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@4 :: :loop begin
/if (${Zone.ID} != ${StartZone}) /return
/delay 1
/face fast nolook loc ${MoveY},${MoveX}
/if (${Math.Distance[${MoveY},${MoveX}]} > 10) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@5 :: Distance > 10: ${Math.Distance[${MoveY},${MoveX}]}
/keypress FORWARD hold
/if (${Zone.ID} != ${StartZone}) /return
} else {
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@6 :: Distance <= 10: ${Math.Distance[${MoveY},${MoveX}]}
/keypress FORWARD
/return
}
/if (${Bool[${DoDebugging}]}) /mqlog Sub Movement@6 :: :loop end
/goto :loop
/return
Sub Reset
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@1
/declare i int local 0
/declare g int local 0
/for i 0 to ${Group.Members}
/varcalc g ${Group.Members}-${i}
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@2 :: Removing Group Member ${g} from task.
/taskremove ${Group.Member[${g}]}
/next i
/delay 5s
:DustLoop
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@3 :: :DustLoop begin
/if (!${FindItem[Pinch of Dust from].InvSlot.ID}) /goto :NoDust
/cleanup
/keypress I
/delay 1s
/for i 22 to 29
/if (${InvSlot[${i}].Item.Container}) /itemnotify ${i} rightmouseup
/next i
/delay 1s
/itemnotify ${FindItem[Pinch of Dust from].InvSlot} LeftMouseUp
/delay 1
/if (${Cursor.Name.Find[Pinch of Dust from]}) /destroy
/delay 1
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@4 :: :DustLoop end
/if (${FindItem[Pinch of Dust from].InvSlot}) /goto :DustLoop
:NoDust
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@5 :: :NoDust begin
/cleanup
:GettingPlayers
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@6 :: :GettingPlayers begin; Members: ${Group.Members}
/doevents
/delay 30s (${Group.Members} > 1)
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@7 :: :GettingPlayers end; Members: ${Group.Members}
/if (${Group.Members} < 2) /goto :GettingPlayers
:GetTask
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@8 :: :GetTask begin
/varset NeedPlayer 0
/fairy
/delay 2s
/doevents
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@ 9 :: Checking if players are needed
/if (${NeedPlayer} > 0) /goto :GettingPlayers
:WaitLoop
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@10 :: :WaitLoop begin
/if (${Window[TaskTemplateSelectWnd].Open}) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@11 :: TaskTemplateSelectWnd.Open
/notify TaskTemplateSelectWnd TaskTemplateSelectAcceptButton leftmouseup
/delay 5s
/goto :GotTask
}
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@12 :: :WaitLoop end
/goto :WaitLoop
:GotTask
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@13 :: :GotTask begin
/varset ZonedToInstance ${Bool[FALSE]}
/cleanup
/delay 10s
/if (${Math.Distance[${NekZoneInY}, ${NekZoneInX}]} > 10) /squelch /warp loc ${NekZoneInY} ${NekZoneInX} ${NekZoneInZ}
/delay 1s
/call Movement ${MvInY} ${MvInX}
/delay 1m (${Bool[${ZonedToInstance}]})
/delay 10s
:LoadAAs
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@14 :: :LoadAAs begin
/if (!${Window[AAWindow].Open}) /keypress V
/notify AAWindow AAW_LoadButton Leftmouseup
/delay 15s
/if (${Bool[${DoDebugging}]}) /mqlog Sub Reset@15 :: :LoadAAs end
/if (!${Bool[${Me.AltAbility[Fairy Fire].ID}]}) /goto :LoadAAs
/cleanup
/return
Sub KillRemains
:loop
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@1 :: :loop begin
/squelch /target clear
/doevents
/varset StartHP ${Me.CurrentHPs}
/if (${SpawnCount[remains npc]} == 0) /return
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@2 :: The remains are there; /target remains; StartHP: ${StartHP}
/target remains
/delay 1s
/if (${Target.Distance} > 16) /squelch /warp loc ${Math.Calc[${Target.Y}-13]} ${Target.X} ${Target.Z}
/if (${Bool[${Target.ID}]}) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@3 :: Still got target
/face fast nolook
/attack on
}
/delay 2s
/if (${SpawnCount[remains npc]} == 0) /return
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@4 :: Still got target
/if (${StartHP} > ${Me.CurrentHPs}) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@5 :: Taking damage; StartHP: ${StartHP} > CurrentHPs: ${Me.CurrentHPs}
/call Warper FALSE "${RemainsSafeSpotY} ${RemainsSafeSpotX} ${RemainsSafeSpotZ}"
/delay 10s (${Bool[${NoWitchlampAgro}]})
/varset NoWitchlampAgro ${Bool[FALSE]}
/delay 2s
}
/if ((${Me.AltAbilityReady[Faith of the Fay]}) && (${Me.PctHPs} < 50)) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@6 :: Faith of the Fay is ready and I got < 50 PctHPs
:HealMe
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@7 :: :HealMe begin
/target myself
/call cast "Faith of the Fay" Activate
/delay 10s (!${Me.Casting.Name.Equal["Faith of the Fay"]})
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@8 :: :HealMe end
/if ((${Me.AltAbilityReady[Faith of the Fay]}) && (${Me.PctHPs} < 50)) /goto :HealMe
}
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillRemains@9 :: :loop end
/goto :loop
/return
sub Warper(bool Fade, string WarpLoc)
/if (${Bool[${DoDebugging}]}) /mqlog Sub Warper@1 :: Fade: ${Bool[${Fade}]}; WarpLoc: ${WarpLoc}
/attack off
/if (${Bool[${WarpLoc}]}) {
/squelch /warp loc ${WarpLoc}
} else {
/squelch /warp loc ${SafeSpotY} ${SafeSpotX} ${SafeSpotZ}
}
/if (${Defined[Fade]} && ${Bool[${Fade}]}) /squelch /fade
/delay 5s
/return
Sub LootRemains
/lootnodrop never
/declare ItmSlot int local 1
/declare ItmCount int local 0
:loop
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@1 :: :loop begin
/varset StartHP ${Me.CurrentHPs}
/if (${SpawnCount[remains corpse]} == 0) {
/lootnodrop always
/return
}
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@2 :: remains corpse still there
/target Remains
/squelch /warp target
/loot
/delay 5s ${Bool[${Window[LootWnd]}]}
/varset ItmCount ${Corpse.Items}
:LootLag
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@3 :: LootLag begin
/if (${ItmCount} != ${Corpse.Items}) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@4 :: ItmCount: ${ItmCount} != Corpse.Items: ${Corpse.Items}
/varset ItmCount ${Corpse.Items}
/delay 2s (${ItmCount} == ${Corpse.Items})
/goto :LootLag
}
/doevents
/if ((${StartHP} > ${Me.CurrentHPs}) || ${Bool[${CannotLoot}]}) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@5 :: StartHP: ${StartHP} > CurrentHPs: ${Me.CurrentHPs} || CannotLoot: ${Bool[${CannotLoot}]}
/call Warper TRUE
/delay 10s
/varset CannotLoot ${Bool[FALSE]}
/goto :loop
}
/delay 1s
/for ItmSlot 1 to ${ItmCount}
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@6 :: ItmSlot: ${ItmSlot}
/itemnotify loot${ItmSlot} rightmouseup
/delay 5 !${Corpse.Item[${ItmSlot}].ID}
/next ItmSlot
/notify LootWnd DoneButton leftmouseup
/delay 5s !${Bool[${Window[LootWnd]}]}
/if (${SpawnCount[remains corpse]} == 0) {
/lootnodrop always
/return
}
/if (${Bool[${DoDebugging}]}) /mqlog Sub LootRemains@7 :: :loop end
/goto :loop
/return
Sub KillShrine
/declare i int local 0
:loop
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillShrine@1 :: :loop begin; ShrineNum: ${ShrineNum}; Spawns Radius 60: ${Target.NearestSpawn[npc radius 60]}; Radius 100: ${Target.NearestSpawn[npc radius 100]}
/if (${Bool[${KilledShrine[1]}]} && ${Bool[${KilledShrine[2]}]} && ${Bool[${KilledShrine[3]}]}) /return
/delay 1s
/doevents
/for i 1 to 3
/if (${Bool[${KilledShrine[${i}]}]}) /next i
/if (${SpawnCount[${Shrine[${i}]} NPC]} == 0) {
/varset KilledShrine[${i}] ${Bool[TRUE]}
} else {
/varset KilledShrine[${i}] ${Bool[FALSE]}
}
/if (${Bool[${KilledShrine[1]}]} && ${Bool[${KilledShrine[2]}]} && ${Bool[${KilledShrine[3]}]}) /goto :end
/if (${Bool[${KilledShrine[${i}]}]}) /next i
/varset StartHP ${Me.CurrentHPs}
/target ${Shrine[${i}]}
/if (${Bool[${DoDebugging}]}) /mqlog Sub KillShrine@7 :: :Continue begin
/squelch /warp target
/keypress LEFT
/delay 6
:Casting
/varset FFResist ${Bool[FALSE]}
/call cast "Fairy Fire" Activate
/delay 1s
/delay 10s (!${Me.Casting.Name.Equal["Fairy Fire"]})
/delay 1s
/call Warper
/if (${i} != 3) /delay 7s (${Me.AltAbilityReady[Fairy Fire]})
/doevents
/if (${Bool[${NeedTarget}]}) {
/target ${Shrine[${i}]}
/varset NeedTarget ${Bool[FALSE]}
/if (${Bool[${Target.ID}]}) {
/call Warper
/goto :loop
} else {
/next i
}
}
/delay 1s´
/next i
/call Warper TRUE
/if ((${Me.AltAbilityReady[Faith of the Fay]}) && (${Me.PctHPs} < 50)) {
:HealMe
/target myself
/call cast "Faith of the Fay" Activate
/delay 10s (!${Me.Casting.Name.Equal["Faith of the Fay"]})
/if ((${Me.AltAbilityReady[Faith of the Fay]}) && (${Me.PctHPs} < 50)) /goto :HealMe
}
/if (${Me.Standing}) /sit
/if (${Bool[${FFResist}]}) {
/delay 7s (${Me.AltAbilityReady[Fairy Fire]})
/varset FFResist ${Bool[FALSE]}
/if (!${Me.Standing}) /stand
/goto :loop
}
/delay 45s
/if (!${Me.Standing}) /stand
/if (${Bool[${KilledShrine[1]}]} && ${Bool[${KilledShrine[2]}]} && ${Bool[${KilledShrine[3]}]}) /goto :end
/goto :loop
:end
/return
Sub CheckAgro
/if (${Bool[${DoDebugging}]}) /mqlog Sub CheckAgro@1
/declare i int local 0
/for i 1 to ${SpawnCount[NPC]}
/if (${NearestSpawn[${i},NPC].Speed} > 100) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub CheckAgro@2 :: Got agro (something is moving faster than 100).
/varset GotAgro ${Bool[TRUE]}
}
/next i
/return
Sub Event_LockoutTimer(string Line, int WaitTime)
/declare LockoutTime timer local 0
/declare Announcer timer local 1m
/varcalc WaitTime ${WaitTime}+1
/varset LockoutTime ${WaitTime}m
/echo Delaying ${WaitTime} minutes..
/if (${Bool[${GSay}]}) /gsay Delaying ${WaitTime} minutes..
/if (${Me.Standing}) /sit
:loop
/doevents
/delay 10s
/if (!${Bool[${Announcer}]}) {
/if (${Math.Calc[${LockoutTime}/600]} > 10) {
/echo ${Math.Calc[${LockoutTime}/600].Int}m before starting..
/if (${Bool[${GSay}]}) /gsay ${Math.Calc[${LockoutTime}/600].Int}m before requesting task..
/varset Announcer 10m
} else /if (${Math.Calc[${LockoutTime}/600]} > 1) {
/echo ${Math.Calc[${LockoutTime}/600].Int}m before starting..
/if (${Bool[${GSay}]}) /gsay ${Math.Calc[${LockoutTime}/600].Int}m before requesting task..
/varset Announcer 1m
} else {
/echo ${Math.Calc[${LockoutTime}/10].Int}s before starting..
/if (${Bool[${GSay}]}) /gsay ${Math.Calc[${LockoutTime}/10].Int}s before requesting task..
}
}
/if (${Bool[${LockoutTime}]}) /goto :loop
/if (!${Me.Standing}) /stand
/fairy
/return
Sub Event_Death
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_Death@1
/delay 1m
/return
Sub Event_FairyFireResisted
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_FairyFireResisted@1
/varset FFResist ${Bool[TRUE]}
/return
Sub Event_NeedPlayers
/varcalc NeedPlayer 3-${Group.Members}-1
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NeedPlayers@1 :: ${NeedPlayer}
/return
Sub Event_NeedMana
/declare i int local 0
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NeedMana@1
/call Warper TRUE
/if (${Me.Standing}) /sit
:medding
/for i 1 to 3
/if (${SpawnCount[${Shrine[${i}]} NPC]} == 0) {
/varset KilledShrine[${i}] ${Bool[TRUE]}
} else {
/varset KilledShrine[${i}] ${Bool[FALSE]}
}
/if (${Bool[${KilledShrine[1]}]} && ${Bool[${KilledShrine[2]}]} && ${Bool[${KilledShrine[3]}]}) /return
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NeedMana@2 :: :medding begin
/delay 6s
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NeedMana@3 :: :medding end
/if (${Me.PctMana} < 50) /goto :medding
/return
Sub Event_NoTarget
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NoTarget@1
/varset NeedTarget ${Bool[TRUE]}
/return
Sub Event_WitchlampForgets
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_WitchlampForgets@1
/varset NoWitchlampAgro ${Bool[TRUE]}
/return
Sub Event_CannotLoot
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_CannotLoot@1
/varset CannotLoot ${Bool[TRUE]}
/return
Sub Event_NoLoS
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NoLoS@1
/keypress BACK
/delay 1s
/return
Sub Event_Zoned(string Line, string ZoneName)
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_Zoned@1 :: ZoneName: ${ZoneName}
/if (${Zone.ID} == ${ZID}) {
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_Zoned@2; Entered ${ZoneName} (${Zone.ID})
/varset ZonedToInstance ${Bool[TRUE]}
/return
}
/varset ZonedToInstance ${Bool[FALSE]}
/return
Sub Event_NeedInvite(string Line, string ToonName, string Password)
/if (${Bool[${DoDebugging}]}) /mqlog Sub Event_NeedInvite@1 :: ToonName: ${ToonName}; Password: ${Password}
/if ((!${Defined[Password]}) || (${Password.NotEqual[${InvitePassword}]}) || (${Group.Members} > 4)) /return
/invite ${ToonName}
/taskadd ${ToonName}
/delay 1s
/return