Skip to content

Instantly share code, notes, and snippets.

@farism
Created July 30, 2017 21:45
Show Gist options
  • Save farism/9661aa291353743aeb1bf25c921b6f9c to your computer and use it in GitHub Desktop.
Save farism/9661aa291353743aeb1bf25c921b6f9c to your computer and use it in GitHub Desktop.
IsDaoc() {
return WinActive("ahk_exe game.dll")
}
_Sleep(duration) {
Sleep, %duration%
return
}
Sleep(duration:=0, throttle:=0) {
return Throttle(Func("_Sleep"), throttle, duration)
}
_Assist() {
global assist
global assist_wait
Send, %assist%
Sleep, %assist_wait%
}
Assist(throttle:=1000) {
return Throttle(Func("_Assist"), throttle)
}
_Face() {
global face
global jump
Send, %face%
}
Face(throttle:=1000) {
return Throttle(Func("_Face"), throttle)
}
Stick(throttle:=1000) {
global stick
return Throttle(stick, throttle)
}
IsInCombat(){
global combat_color
global combat_frame_x
global combat_frame_y
PixelGetColor, color, combat_frame_x, combat_frame_y
return color = combat_color
}
EquipCurrentWeapon() {
return
}
EquipOneHanded() {
global one_handed
Send, %one_handed%
return
}
EquipTwoHanded() {
global two_handed
Send, %two_handed%
return
}
EquipRanged() {
global ranged
Send, %ranged%
return
}
TargetPet() {
global targe_pet
Send, %target_pet%
return
}
TargetGroup(position) {
global target_group1
global target_group2
global target_group3
global target_group4
global target_group5
global target_group6
global target_group7
global target_group8
key := %target_group%%position%
; Send, %target_pet%
return
}
Chain(keys, delay:=0) {
keyCount := keys.MaxIndex()
Loop, %keyCount%
{
key := keys[A_Index]
%key%()
Send, %key%
Sleep, %delay%
}
return
}
StyleChain(styles, reactionary_style_chain:=false) {
if(IsInCombat()) {
Chain(styles, 10)
} else {
keyCount := styles.MaxIndex()
; we aren't in combat
if (reactionary_style_chain) {
; it's a reactionary style, use the anytime style
default_style := styles[keyCount]
} else {
; not a reactionary style chain (so probably a positional), use the style before the anytime
index := max(1, keyCount - 1)
default_style := styles[index]
}
Send, %default_style%
}
return
}
SpellChain(spells) {
Chain(spells)
return
}
HotkeyHandler(send_key, styles, spells, equip_fn, reactionary_style_chain:=false) {
if(IsDaoc()) {
equipFn := Func(equip_fn)
%equipFn%()
Send, %send_key%
spellChain := Func("SpellChain").Bind(spells, false)
%spellChain%()
styleChain := Func("StyleChain").Bind(styles, reactionary_style_chain)
%styleChain%()
} else {
Send, %send_key%
}
return
}
Hotkey(hot_key, send_key, equip_fn, styles, spells, reactionary_style_chain:=false) {
handler := Func("HotkeyHandler").Bind(send_key, styles, spells, equip_fn, reactionary_style_chain)
Hotkey, %hot_key%, %handler%
return
}
CurrentWeapon(hotkey, send_key, styles, spells, reactionary_style_chain:=false) {
Hotkey(hotkey, send_key, "EquipCurrentWeapon", styles, spells, reactionary_style_chain)
return
}
OneHanded(hotkey, send_key, styles, spells, reactionary_style_chain:=false) {
Hotkey(hotkey, send_key, "EquipOneHanded", styles, spells, reactionary_style_chain)
return
}
TwoHanded(hotkey, send_key, styles, spells, reactionary_style_chain:=false) {
Hotkey(hotkey, send_key, "EquipTwoHanded", styles, spells, reactionary_style_chain)
return
}
Ranged(hotkey, send_key, spells) {
Hotkey(hotkey, send_key, "EquipRanged", [], spells)
return
}
Pet(hotkey, send_key, spells) {
Hotkey(hotkey, send_key, "TargetPet", [], spells)
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment