#include ninjadvloot.inc
#event win "#*#You gain experience!!#*#"
Sub Main
/declare LootTotal int outer
/declare LootSlot int outer
/plugin mq2moveutils
/call doit
/return
Sub Doit
/doevents
/if (${Spawn[gm].ID}) /q
/if (${Me.PctHPs}<=12) /call heal
/if (${Target.ID}==FALSE) /tar NPC radius 220
/if (${Target.Distance}>220) /keypress esc
/if (${Target.PctHPs}<=98) {
/call attacked
}
/if (${Target.Level}<=3) {
/call *move*
}
/if (${Target.Level}>=4) {
/keypress back hold
/delay 2s
/keypress esc
/call doit
}
/return
Sub *move*
/doevents
/face
/if (${Target.PctHPs}>=99) {
/call kill
}
/keypress back hold
/delay .5s
/stick 7
/return
Sub kill
/doevents
/delay .5s
/if (${Target.ID}==FALSE) /call doit
/if (${Target.PctHPs}<=98) {
/delay 1s
/keypress back 1s
/delay 1s
/keypress esc
/delay .5s
/call attacked
}
/stick 7
/attack on
/doevents
:killing
/delay 1s
/if (${Target.ID}==FALSE) /call doit
/goto :killing
/if (${PC.Radius}<15) /call attacked
/return
Sub attacked
/doevents
/delay 1s
/attack off
/keypress back hold
/call doit
/return
Sub heal
/doevents
/if (${Me.PctHPs}>80) /call doit
/if (${Me.PctHPs}<=12) {
/sit on
:healing
/delay 10s
/call heal
/if (${Me.PctHPs}<=80) /goto :healing
}
/return
Sub Event_win
/doevents
/call doit
/return