1
+ | # orig @author - FZLives
2
+ | # Creamo rework
3
+ | # Auto COH's
4
+ | The following #define specifies which channel announcements made by this macro go to. It should always
5
+ | be /gu, except when working on this macro, in which case it can be changed to /echo or /tell <charactername>
6
+ | in order to cut back on /gu spam.
7
+ #define /announce /gu
8
+ | Set the following define to the number of DeciSeconds (tenths of a second) of no activity
9
+ | to wait before automatically dropping from a group.
10
+ #define IdleTimerDS 100
11
+ | If a group member is within CoHOutsideOfRadius units of the Mage running this macro, it's assumed
12
+ | that they've already been CoH'd, and will not be CoH'd again.
13
+ #define CoHOutsideOfRadius 50
14
+ | If you want this macro to CoH only characters who are a member of the casting Mage's guild, set the
15
+ | following #define to TRUE.
16
+ #define CoHGuildiesOnly FALSE
17
+
18
+ #define cohSpellGem 8
19
+
20
+ Sub Main
21
+ | This /delay 1 should be the first line of any macro that may be launched by another macro. MQ2 bug work-around.
22
+ /delay 1
23
+ /if ( ${Me.Class.Name.NotEqual[Magician]} ) {
24
+ /echo I am not a Magician, so I cannot run a Call of the Hero macro.
25
+ /popup I am not a Magician, so I cannot run a Call of the Hero macro.
26
+ /endmacro
27
+ } else /if ( ${FindItemCount[=Pearl]} == 0 ) {
28
+ /announce I am completely out of Pearls! I need to be re-stocked before I can cast Call of the Hero.
29
+ /popup Out of Pearls!
30
+ /endmacro
31
+ } else /if ( ${FindItemCount[=Pearl]} < 5 ) {
32
+ /announce I have only ${FindItemCount[=Pearl]} Pearl${If[${FindItemCount[=Pearl]}>1,s,]} left! I will not automatically CoH until I am restocked.
33
+ /announce Contact my owner to have him/her manually CoH someone who has a supply of pearls available to re-stock me.
34
+ /endmacro
35
+ } else /if (!${Plugin[MQ2Cast].Name.Length}) {
36
+ /popup MQ2Cast which is not loaded, ending macro
37
+ /announce I require MQ2Cast which is not loaded, ending macro
38
+ /endmacro
39
+ }
40
+ /if (!${Bool[${Me.Gem[Call of the Hero]}]}) {
41
+ /announce Memorizing Call of the Hero
42
+ /memorize 1771 cohSpellGem
43
+ }
44
+ | Now announces the Mage's supply of Pearls in guild chat, so that guildies know if they need to bring Pearls
45
+ | to restock the CoH Bot.
46
+ /announce COH activated in ${Zone.Name}. ${FindItemCount[=Pearl]} Pearls
47
+
48
+ :SubMainLoop
49
+ /if (${Me.Grouped}) {
50
+ /if ( !${Defined[timerIdleAutoDisband]} ) {
51
+ /declare timerIdleAutoDisband timer outer IdleTimerDS
52
+ } else /if ( ${timerIdleAutoDisband} == 0 ) {
53
+ /call Disband
54
+ }
55
+ }
56
+ /if (${Me.CombatState.Equal[COMBAT]}) {
57
+ /popup CoH Bot is in combat, this is no bueno
58
+ /announce CoH Bot is in combat, this is no bueno
59
+ /delay 3s
60
+ }
61
+ /doevents GroupInviteFrom
62
+ /delay 1
63
+ /if (${Me.Grouped}) /call CoHGroup
64
+ /goto :SubMainLoop
65
+ /return
66
+
67
+
68
+ Sub CoHGroup
69
+ /declare iGroupMemberCOH int local
70
+ /declare iCoHsPerformed int local
71
+ /declare grouplist string local
72
+ /for iGroupMemberCOH 1 to ${Group.Members}
73
+ /varset grouplist ${grouplist}${Group.Member[${iGroupMemberCOH}].CleanName},
74
+ /next iGroupMemberCOH
75
+ /announce CoHing ${grouplist}
76
+
77
+ :COHGroupLoop
78
+ /varset iCoHsPerformed 0
79
+ /for iGroupMemberCOH 1 to ${Group.Members}
80
+ |/echo CoH ${Group.Member[${iGroupMemberCOH}].CleanName} ${iGroupMemberCOH} ${sGroupMembersAlreadyCoHd} ${Bool[${sGroupMembersAlreadyCoHd.Find[${Group.Member[${iGroupMemberCOH}].CleanName},]}]}
81
+ /if (${Select[${Group.Member[${iGroupMemberCOH}].Type},PC]} == 1 && !${Bool[${sGroupMembersAlreadyCoHd.Find[${Group.Member[${iGroupMemberCOH}].CleanName},]}]} ) {
82
+ :waitforCoHReady
83
+ /if (!${Me.SpellReady[Call of the Hero]} && !${Me.AltAbilityReady[Call of the Hero]}) {
84
+ /delay 2
85
+ /goto :waitforCoHReady
86
+ }
87
+ /if (${Me.CurrentMana} < (${Spell[Call of the Hero].Mana} + 50)) {
88
+ /if (!${Me.Sitting}) /sit
89
+ /delay 60s ${Me.CurrentMana} > (${Spell[Call of the Hero].Mana} + 50)
90
+ }
91
+ /delay 5
92
+ /call PerformCoHOnTarget "${Group.Member[${iGroupMemberCOH}].CleanName}"
93
+ /if ( ${Select[${Macro.Return},TRUE]} ) {
94
+ /varcalc iCoHsPerformed ${iCoHsPerformed} + 1
95
+ }
96
+ }
97
+ /next iGroupMemberCOH
98
+ /if ( ${iCoHsPerformed} >= 1 ) {
99
+ /goto :COHGroupLoop
100
+ }
101
+ /call Disband
102
+ /return
103
+
104
+ Sub Disband
105
+ /if (${Me.Grouped}) {
106
+ /if (${Defined[sGroupMembersAlreadyCoHd]}) {
107
+ /announce Done CoHing ${sGroupMembersAlreadyCoHd}
108
+ /g Done CoHing ${sGroupMembersAlreadyCoHd}
109
+ /deletevar sGroupMembersAlreadyCoHd
110
+ } else {
111
+ /g I had no one to CoH, disbanding
112
+ }
113
+ /squelch /target myself
114
+ /delay 15 ${Target.ID} == ${Me.ID}
115
+ /disband
116
+ /delay 1s
117
+ }
118
+ /if (${Defined[timerIdleAutoDisband]}) /deletevar timerIdleAutoDisband
119
+ /return
120
+
121
+ Sub PerformCoHOnTarget(string sTargetName)
122
+ /declare iGroupMember int local
123
+ /declare iCoHTargetID int local 0
124
+ | I am always Group.Member[0], so start with index 1.
125
+ /for iGroupMember 1 to ${Group.Members}
126
+ /if ( ${Group.Member[${iGroupMember}].CleanName.Equal[${sTargetName}]} ) {
127
+ /varset iCoHTargetID ${Group.Member[${iGroupMember}].ID}
128
+ } else {
129
+ /next iGroupMember
130
+ }
131
+ | If we get to this point and iCoHTargetID is still zero, it means that sTargetName is not in my group.
132
+ /if ( ${iCoHTargetID} == 0 ) {
133
+ /echo ${sTargetName} is not in my group. How the heck did they manage to fire this event? Possibly said "/g me" then immediately disbanded?
134
+ | Return false to indicate that sTargetName was not CoH'd.
135
+ /return FALSE
136
+ }
137
+ | Now, make sure that sTargetName is a valid CoH target...
138
+ /if ( ${Select[${Spawn[id ${iCoHTargetID}].Type},PC]} != 1 ) {
139
+ /echo Cannot find PC ${sTargetName} ${iCoHTargetID} CoH target just died and became a corpse.
140
+ /return FALSE
141
+ } else /if ( ${Spawn[id ${iCoHTargetID}].Distance} < CoHOutsideOfRadius ) {
142
+ | Seems that the target has already been CoH'd. No need to waste the time (and a Pearl) doing it again.
143
+ /return FALSE
144
+ } else /if ( CoHGuildiesOnly && ${Me.Guild.Length} && ${Spawn[id ${iCoHTargetID}].Guild.NotEqual[${Me.Guild}]} ) {
145
+ /g I'm sorry, ${Spawn[id ${iCoHTargetID}].CleanName}. I'm only authorized to CoH players who wear the <${Me.Guild}> guild tag.
146
+ /return FALSE
147
+ } else /if ( ${FindItemCount[=Pearl]} < 5 ) {
148
+ /g I'm sorry, I'm dangerously low on Pearls, and cannot CoH you.
149
+ /g If any of you have Pearls that can re-stock me, please contact the owner of this Mage and have them CoH you manually.
150
+ /if ( ${FindItemCount[=Pearl]} > 0 ) {
151
+ /announce I only have ${FindItemCount[=Pearl]} Pearl(s) in my inventory. Automatic CoHs are suspended until I get more Pearls.
152
+ /announce If you have Pearls with you that you can re-stock me with, let my owner know so that he/she can CoH you manually.
153
+ } else {
154
+ /announce I have no Pearls, so I am unable to perform any CoHs.
155
+ }
156
+ /popup Critically low on Pearls! Restock ASAP. Ending Macro.
157
+ /echo Critically low on Pearls! Restock ASAP. Ending Macro.
158
+ /endmacro
159
+ } else {
160
+ | Ok, all of the pre-conditions are met. Let's actually attempt to perform a CoH. But first, make sure we're ready and able to cast
161
+ | the CoH spell successfully...
162
+ | Alright! If we got to this point, it appears that we have a valid target, and are ready to cast CoH on him/her.
163
+ | First, get the right person on target...
164
+ /squelch /target pc id ${iCoHTargetID}
165
+ /delay 2s ${Target.ID} == ${iCoHTargetID}
166
+ /if ( ${Target.ID} != ${iCoHTargetID} ) {
167
+ /g Sorry, ${Spawn[id ${iCoHTargetID}].CleanName}. I can't target you for CoH for some reason. Lag, perhaps?
168
+ /return FALSE
169
+ }
170
+
171
+ /if (${Me.AltAbilityReady[Call of the Hero]}) {
172
+ /casting 7050 -maxtries|2
173
+ /delay 16s ${Cast.Status.Equal[I]}
174
+ } else /if (${Me.SpellReady[Call of the Hero]}) {
175
+ /casting 1771 gem8 -maxtries|2
176
+ /delay 16s ${Cast.Status.Equal[I]}
177
+ }
178
+ | Should put in a check for the "There are no heroes here" message, or whatever it is.
179
+ /if (${Target.Distance} < 30) {
180
+ /g Successfully CoH'd ${Spawn[id ${iCoHTargetID}].CleanName}.
181
+ /if ( !${Defined[sGroupMembersAlreadyCoHd]} ) {
182
+ /declare sGroupMembersAlreadyCoHd string outer ${Spawn[id ${iCoHTargetID}].CleanName},
183
+ } else {
184
+ /varset sGroupMembersAlreadyCoHd ${sGroupMembersAlreadyCoHd}${Spawn[id ${iCoHTargetID}].CleanName},
185
+ }
186
+ /delay 1
187
+ /return TRUE
188
+ /if (${Defined[timerIdleAutoDisband]}) /varset timerIdleAutoDisband IdleTimerDS
189
+ } else {
190
+ /return FALSE
191
+ }
192
+ }
193
+ /return FALSE
194
+
195
+ #event GroupInviteFrom "#1# invites you to join a group."
196
+ Sub Event_GroupInviteFrom(string sEventText, string sInvitedByName)
197
+ /delay 5
198
+ /if ( CoHGuildiesOnly && ${Me.Guild.Length} && ${Spawn[pc ${sInvitedByName}].Guild.NotEqual[${Me.Guild}]} ) {
199
+ /if ( !${Me.Grouped} ) {
200
+ /echo huh
201
+ /announce ${sInvitedByName} invited me to a group, but ${If[${Spawn[pc ${sInvitedByName}].Gender.Equal[Female]},she,he]} is not a member of <${Me.Guild}>, so I am declining the invitation without saying anything to ${If[${Spawn[pc ${sInvitedByName}].Gender.Equal[Female]},her,him]}.
202
+ /target myself
203
+ /disband
204
+ }
205
+ /return
206
+ }
207
+ /if (${Me.Grouped}) {
208
+ /tell ${sInvitedByName} Sorry, I'm working on CoHing the group with the following people in it: ${Me.GroupList}. Please invite me again in a minute or two when I'm done.
209
+ /return
210
+ }
211
+ /squelch /target clear
212
+ /delay 5
213
+ /invite
214
+ /delay 2s ${Me.Grouped}
215
+ /delay 5
216
+ /return
0 commit comments