-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMQ2Cast.inc
More file actions
80 lines (80 loc) · 2.96 KB
/
MQ2Cast.inc
File metadata and controls
80 lines (80 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
| MQ2Cast.inc - Version 0.2 (beta) - 12/24/17
|
| Format: /call Cast "SpellName" gem#|alt|item GiveUpTimerValue Attempts MySubroutineName
|
Sub Cast(string SpellName, string SpellType, int GiveUpValue, int Attempts, string MySub)
/declare DEBUG bool local FALSE
/if ( ${DEBUG} ) /echo Called: ${SpellName} - ${SpellType} - ${GiveUpValue} - ${Attempts} - ${MySub}
/if ( ( ${SpellType.Equal[item]} && !${FindItem[${SpellName}].ID} ) || ( ${SpellType.Left[3].Equal[gem]} && !${Me.Book[${Spell[${SpellName}].RankName}]} ) || ( ${SpellType.Equal[alt]} && !${Me.AltAbility[${SpellName}]} ) ) {
/beep
/echo \arUnknown: ${SpellName}\ay
/return CAST_UNKNOWNSPELL
}
/while ( ${Cursor.ID} ) {
/autoinventory
/delay 10
}
/if ( ${SpellType.Left[3].Equal[gem]} ) {
/varset SpellName ${Spell[${SpellName}].RankName}
/if ( ${Me.CurrentMana} < ${Spell[${SpellName}].Mana} ) /return CAST_OUTOFMANA
/if ( !${Me.Gem[${SpellName}]} ) {
/memspell ${SpellType.Right[-3]} "${SpellName}"
/delay 50 !${Window[SpellBookWnd].Open}
/delay 20
}
}
/if ( ${Window[SpellBookWnd].Open} ) {
/book
/delay 50 !${Window[SpellBookWnd].Open}
/delay 5
}
/if ( ${GiveUpValue} ) /declare GiveUpTimer timer local ${GiveUpValue}
/if ( ${SpellType.Left[3].Equal[gem]} ) {
/while ( ${Me.GemTimer[${Me.Gem[${SpellName}]}]} ) {
/if ( !${GiveUpTimer} || ( ${Math.Calc[${Me.GemTimer[${Me.Gem[${SpellName}]}]} / 100].Int} > ${GiveUpTimer} ) ) {
/if ( ${DEBUG} ) /echo ${SpellName} - ${Math.Calc[${Me.GemTimer[${Me.Gem[${SpellName}]}]} / 100].Int} > ${GiveUpTimer} - Not Ready
/return CAST_NOTREADY
}
/delay 5
}
/goto :CastIt
}
/if ( ${SpellType.Equal[item]} ) {
/while ( ${FindItem[${SpellName}].Timer} ) {
/if ( !${GiveUpTimer} || ( ${Math.Calc[${FindItem[${SpellName}].Timer} * 60].Int} > ${GiveUpTimer} ) ) {
/if ( ${DEBUG} ) /echo ${SpellName} - ${Math.Calc[${FindItem[${SpellName}].Timer} * 60].Int} > ${GiveUpTimer} - Not Ready
/return CAST_NOTREADY
}
/delay 5
}
/goto :CastIt
}
/if ( ${SpellType.Equal[alt]} ) {
/while ( ${Me.AltAbilityTimer[${SpellName}]} ) {
/if ( !${GiveUpTimer} || ( ${Math.Calc[${Me.AltAbilityTimer[${SpellName}]} / 100].Int} > ${GiveUpTimer} ) ) {
/if ( ${DEBUG} ) /echo ${SpellName} - ${Math.Calc[${Me.AltAbilityTimer[${SpellName}]} / 100].Int} > ${GiveUpTimer} - Not Ready
/return CAST_NOTREADY
}
/delay 5
}
}
:CastIt
/if ( ${Me.Ducking} ) {
/keypress duck
/delay 5
}
/while ( ${Me.Casting.ID} || ${Me.Moving} ) {
| /if ( ${Bool[${MySub}]} ) /call ${MySub}
/delay 5
}
/casting "${SpellName}" ${SpellType}
/delay 5
/while (${Cast.Status.Find[C]}) {
/delay 5
}
/if ( ${Select[${Cast.Result},CAST_RESIST],CAST_FIZZLE,CAST_STUNNED,CAST_INTERRUPTED]} ) {
/varcalc Attempts ${Attempts} - 1
/if ( !${Attempts} ) /return ${Cast.Result}
/goto :CastIt
}
/return ${Cast.Result}