You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

Kaiyan

Beginner

Posts: 4

Location: Tampa Bay, FL

  • Send private message

381

Saturday, January 21st 2012, 4:58am

Any offer any tips as to why this section would not work? I'm using the R/S version posted with this section being the only addition/change. My R/S character works fine with DIYCE but my W/K does not work with the below. I get no errors, just "IDLE" messages when I hit the macro.


Source code

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
elseif mainClass == "WARRIOR" and subClass == "KNIGHT" then
local SurpriseAttack = GetActionUsable(3)
local FeintAttack = GetActionUsable(10)
if (goat2 == "0") then
Skill = {
{ name = "Survival Instinct",                   use = combat and (phealth <= .50) },
{ name = "Enhanced Armor",                      use = (EnergyBar2 >= 120 and (not pbuffs['Enhanced Armor'])) }, --KnightSkillGeneral 12
{ name = "Blocking Stance",                     use = (EnergyBar2 >= 200 and (not pbuffs['Blocking Stance'])) }, --EliteSkill 20
}
end

if ((enemy) and (goat2 == "1")) then
Skill2 = {
{ name = "Disarmament",                         use = enemy and (not tbuffs['Disarmament IV']) },
{ name = "Aggressiveness",                      use = combat },
{ name = "Berserk",                             use = combat and (EnergyBar1 >= 25) },
{ name = "Survival Instinct",                   use = combat and (phealth <= .50) },
{ name = "Enraged",                             use = combat },
{ name = "Frenzy",                              use = combat },
{ name = "Taunt",                               use = enemy and (not tbuffs['Taunt']) },
{ name = "Surprise Attack",                     use = SurpriseAttack },
{ name = "Probing Attack",                      use = (EnergyBar1 >= 20) and (not tbuffs['Vulnerable']) },
{ name = "Open Flank",                          use = (EnergyBar1 >= 10) and (tbuffs['Vulnerable']) and (not tbuffs['Weakened']) },
{ name = "Slash",                               use = (EnergyBar1 >= 25) and (not tbuffs['Bleed']) },
{ name = "Tactical Attack",                     use = (EnergyBar1 >= 15) and (tbuffs['Bleed']) },
{ name = "Blasting Cyclone",                    use = combat and (EnergyBar1 >= 35) },
{ name = "Moon Cleave",                         use = (EnergyBar1 >= 50) },
{ name = "Whirlwind",                           use = (EnergyBar1 >= 50) },
{ name = "Punishment",                          use = enemy and (tbuffs['Light Seal III']) },
{ name = "Holy Strike",                         use = enemy },
{ name = "Attack",                              use = enemy },
}
end
This moment will never happen again. Make the most of it.

382

Sunday, January 22nd 2012, 1:53pm

could you tell me one thing: why whole macro is working only if im behind the target and I cal use blind spot? if im not behind and i cant use blind spot diyce is waiting to be behind the target and is not goind to next step
can someone tell me where is wrong? when i can use blind spot macro is working great

Source code

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
function KillSequence(arg1, healthpot, manapot, foodslot)
--arg1 = "v1" or "v2" for debugging
--arg2 = Use for multiple buttons for cooldowns and other stuff
--healthpot = # of actionbar slot for health potions
--manapot = # of actionbar slot for mana potions
--foodslot = # of actionbar slot for food (add more args for more foodslots if needed)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
    local EnergyBar1 = UnitMana("player")
    local EnergyBar2 = UnitSkill("player")
    local pctEB1 = PctM("player")
    local pctEB2 = PctS("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
    local behind = (not UnitIsUnit("player", "targettarget"))
    local melee = GetActionUsable(2) -- # is your melee range spell slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    
        
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        TargetNearestEnemy()
        return
    end
    
    --Begin Player Skill Sequences
    
        --Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, 
        --Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR
        
        -- Class: Rogue/Scout
            if mainClass == "THIEF" and subClass == "RANGER" then
            --arg2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
            
            

            if enemy then
            Skill = {
                { name = "Wound Attack",                       use =  ((EnergyBar1 >= 35) and (tbuffs[500654] and tbuffs[500704])) },
                { name = "Blind Spot",                         use =  (((EnergyBar1 >= 25)  and behind and (not tbuffs[500654]))) },
                { name = "Shadowstab",                         use = ((EnergyBar1 >= 20) and (not tbuffs[500654])) },
                { name = "Low Blow",                           use =  ((EnergyBar1 >= 25) and (tbuffs[500654]) and (not tbuffs[500704]) or (thealth < 30)) },
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Shot",                               use = ((EnergyBar1 < 20 )) },
                    }
            
            end
            
            --ADD MORE CLASS COMBOS HERE. 
            --USE AN "ELSEIF" TO CONTINUE WITH MORE CLASS COMBOS.
            --THE NEXT "END" STATEMENT IS THE END OF THE CLASS COMBOS STATEMENTS.
            --DO NOT POST BELOW THE FOLLOWING "END" STATEMENT!
            end
    if (arg1=="debugskills") then        --Used for printing the skill table, and true/false usability
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
    elseif (arg1=="debugpbuffs") then    --Used for printing your buff names, and buffID
        DIYCE_DebugBuffList(pbuffs)
    elseif (arg1=="debugtbuffs") then    --Used for printing target buff names, and buffID
        DIYCE_DebugBuffList(tbuffs)
    elseif (arg1=="debugall") then        --Used for printing all of the above at the same time
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
        DIYCE_DebugBuffList(pbuffs)
        DIYCE_DebugBuffList(tbuffs)
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    if (mainClass == "RANGER" or subClass == "RANGER")  and (not party) then        --To keep scouts from pulling mobs without meaning to.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    elseif mainClass ~= "RANGER" then                    --Let all other classes auto target.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    end   
end

383

Sunday, January 22nd 2012, 8:55pm

High folks I am hopeing someone has a Warrior/WD working Diyce 2.0 they can post
I have tried the one on page 27 from pikspk as well as the fixes posted on same page no luck
I have read this entire thread along with the old Diyce 1.0 thread many times but do not understand any of it
(I'm just a simple farmer BUDy)
Any help would be much appretiated
Cheers

384

Tuesday, January 24th 2012, 3:27pm

is there any error message you could provide ?
Post your code, so someone can have a look and try it.

385

Tuesday, January 24th 2012, 3:29pm

Quoted from "Angelusion;504075"

could you tell me one thing: why whole macro is working only if im behind the target and I cal use blind spot? if im not behind and i cant use blind spot diyce is waiting to be behind the target and is not goind to next step
can someone tell me where is wrong? when i can use blind spot macro is working great


Probably because your buff-Ids are not correct. Try it without the tbuffs and see what happens then.

386

Tuesday, January 24th 2012, 3:32pm

Quoted from "Kaiyan;503725"

Any offer any tips as to why this section would not work? I'm using the R/S version posted with this section being the only addition/change. My R/S character works fine with DIYCE but my W/K does not work with the below. I get no errors, just "IDLE" messages when I hit the macro.


please post your whole code. It might be a problem with a missing end or an end too much. Or something completly different...
Even if someone here has a W/K and tries to use your code, there is too much a chance that the error is outside your code. or that he makes a mistake putting it to his own code or...

387

Wednesday, January 25th 2012, 6:25am

One more request. I'm trying to find a DIYCE 2.2 WarriorRogue for a guildie.There was one a long time ago in this thread but it isn't searchable now and... well... it didn't really work. I'm not a warrior so I can't even write one from scratch for him. Any help? I can go ahead and offer up my RogueMage that I just finnished writing for karma...

Source code

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
--Class: Rogue/Mage
 -- DIYCE 2.2
   elseif mainClass == "THIEF" and subClass == "MAGE" then
            
-- Silence
            Skill = {
                { name = "Silence",                        use = (silenceThis) },
    
-- Potions
                { name = "Action: "..healthpot,                       use = (phealth <= .50) },
                { name = "Action: "..manapot,                        use = ((pctEB1 <= .50) and (phealth >= .50)) }, -- only mana pot if decent health
                
-- Buffs
                { name = "Poison",                        use = ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
    { name = "Intensification",               use = ((boss or elite) and not pbuffs['Intensification']) },
    { name = "Evasion",                       use = ((boss or elite) and not pbuffs['Evasion']) },
                    }
                    
--Combat
                if enemy then
                Skill2 = {
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) },
                    { name = "Informer",                     use = boss },
                    { name = "Fervent Attack",               use = boss },
                    { name = "Assassins Rage",               use = boss },
                    { name = "Shadow Step",                  use = (not combat) and (EnergyBar1 >= 50) },
     { name = "Sneak Attack",                 use = (not combat) and (boss or elite) and (EnergyBar1 >= 20) and behind },
     --{ name = "Sneak Attack",                 use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Blind Spot",                   use = (EnergyBar1 >= 20) and behind },
                    { name = "Magic Breaker",                use = (boss or elite) }, 
     { name = "Fireball",                     use = (true) },
     { name = "Lightning",                    use = (not tbuffs['Lightning']) }, 
     { name = "Poison Flame",                 use = (not tbuffs['Poison Flame']) },   
                    { name = "Paralyzing Trap",              use = (true) },
                    { name = "Wound Attack",                 use = (EnergyBar1 >= 35) },
     { name = "Shadowstab",                   use = (EnergyBar1 >= 20) and (not tbuffs[620313]) },
                    { name = "Low Blow",                     use = (EnergyBar1 >= 30) and (tbuffs[620313]) and (not tbuffs[500704]) },
                    --{ name = "Combo Throw",                  use = (true) },
                    --{ name = "Throw",                        use = (true) },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) },
                    { name = "Attack",                       use = (thealth == 1) },
                        }
                end
-- Stagger - Osha - Eyeofthetempest --

M/R/W 72/52/51
Formerly M/D/S, M/R/D (The search for decent DPS in a post GCD RoM continues)

388

Wednesday, January 25th 2012, 8:46am

@Angelusion
See what is happening here. Your combat section:

Source code

1
2
3
4
5
6
7
8
9
10
if enemy then            Skill = {
                { name = "Wound Attack",                       use =  ((EnergyBar1 >= 35) and (tbuffs[500654] and tbuffs[500704])) },
                { name = "Blind Spot",                         use =  (((EnergyBar1 >= 25)  and behind and (not tbuffs[500654]))) },
                { name = "Shadowstab",                         use = ((EnergyBar1 >= 20) and (not tbuffs[500654])) },
                { name = "Low Blow",                           use =  ((EnergyBar1 >= 25) and (tbuffs[500654]) and (not tbuffs[500704]) or (thealth < 30)) },
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Shot",                               use = ((EnergyBar1 < 20 )) },
                    }
            
            end


So, first DIYCE checks for conditions for "Wound attack" skill. Target at this point doesn't have required debuffs, so it goes to "Blind Spot" and that is what happening here:
DIYCE check for "behind" is actually different from in-game check. If you will look upper in code, it is:

Source code

1
    local behind = (not UnitIsUnit("player", "targettarget"))

So, it simply verifies that you are not target of your target, it does not checks that you are ACTUALLY behind your target. So, from point of view of DIYCE this check is TRUE, also target does not have debuff ((not tbuffs[500654]) = TRUE), and your energy is above 25 ((EnergyBar1 >= 25) ). So, condition for use of
"Blind Spot" is fulfilled and DIYCE tries to cast it.
But in-game mechanics prevents use of "Blind Spot" if you are not TECHNICALLY behind the target, so skill is not used with probably some red text on your screen, saying something like "You must be behind the target to use this skill" or whatever.
And every time you try to use this function everything will repeat, because from DIYCE point of view condition for "Blind Spot" use is fulfilled, but from in-game mechanics it is not.
What I can recommend here is to use a timer(so it fails to cast one time and then timer will trigger and you can pass to next skill) or add some more complex condition for use.

Sry for my bad English :)

389

Wednesday, January 25th 2012, 3:08pm

Honestly, I know that this isn't the greatest Rogue function... I'm just trying to blast level my R as the subclass of my Mage. As I am a M/D/R (originally M/D/S), I was just trying to find something... anything... to level R/M or D. Having a max lvl Firball and Lighning seemed the way to go for quick leveling so R/M is what I made. I haven't really played around with timers in DIYCE and, unless I have a timer based issue with Mage/Rogue when I write it, I'm not going to worry about it too much. Also, I have found that simply taking a step towards the target will either cancel or pop the skill. Basically, if Shadowstep isn't up, and it is a red mob the condition will quickly fail as it aggroes and it drops to the next skill... If it doesn't aggro, I just run at the mob and it will pop blind spot. Is this is the best solution? Nah... but Rogue isn't anything more than a level grind to me.

Now... all this said, I thank you for checking my work! I'm hoping somone can help me out with the original request; a proper and complete WarriorRogue function. We did get the one working on (I think it was page 12) but it seems very bare bones. Again, I'd make it but I've barely played Warrior and don't have one that it leveled to test the function. So, yea... A W/R function would be fantastic.

I will be working on my MageRogue function today and I'll post it when I have it up and running.
Thanks!
-- Stagger - Osha - Eyeofthetempest --

M/R/W 72/52/51
Formerly M/D/S, M/R/D (The search for decent DPS in a post GCD RoM continues)

eguner

Beginner

Posts: 15

Location: Türkiye

  • Send private message

390

Wednesday, January 25th 2012, 4:21pm

just a draft , i have tested short time seems working...

Source code

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
-- Class: Warrior/Rogue            elseif mainClass == "WARRIOR" and subClass == "THIEF" then
            
            Skill = {
                
				{ name = "Survival Instinct",            	use = (phealth <= .25) and combat },
				{ name = "Enraged",            	    	    use = (EnergyBar2 <= 20)  },
			  	{ name = "Action: 77",          			use = (phealth <= .80) }              
					              
                    }
                    
            if enemy then
            Skill2 = {
            
				{ name = "Surprise Attack",            	       use = CD("Surprise Attack") and enemy },
				{ name = "Feint",   				   		   use = ((_target == UnitName("target")) and (_type == "DODGE")) },
				{ name = "Blood Dance",               		   use = phealth >= .85 and tbuffs[501511]  },
				{ name = "Splitting Chop",                     use = (tbuffs[501503] and not tbuffs[503161]) },   						
		    --  { name = "Keen Attack",                   	   use = ((EnergyBar2 >= 20) and tbuffs[501502]) },
			    { name = "Thunder",                   		   use = ((EnergyBar1 >= 15) and tbuffs[501503]) },     				    
				{ name = "Open Flank",                   	   use = ((EnergyBar1 >= 10) and tbuffs[501502]) },							
                { name = "Probing Attack",                     use = ((EnergyBar1 >= 20) and tbuffs[500081]) },				 			
				{ name = "Slash",                     	       use = ((EnergyBar1 >= 25) and not tbuffs[500081]) },
				{ name = "Blind Stab",	                       use = not behind and ((not tbuffs[500691]) and (EnergyBar2 >= 60)) },		
				{ name = "Shadowstab",                    	   use = (EnergyBar2 >= 20 and not tbuffs[501866])  }						   
			--	{ name = "Attack",	                           use = enemy and (EnergyBar1 <= 40) }
             
					}
				end	

391

Wednesday, January 25th 2012, 5:23pm

Thank you!I have my code down for MageRogue but I haven't tested it yet. if anyone wants to check what I'm doing or mess with it themselves.... well... here are all of my custom functions :)

Edit: After some testing, I moved away from trying to limit the range on lightning, demoralize, and Kiss. Slowed everything down and wouldn't cast them with Fangs following on spam mode. May have to make Demoralize a boss or elite and figure something out for PVP but that is another matter!


Source code

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
local WHITE = "|cffffffff"
local SILVER = "|cffc0c0c0"
local GREEN = "|cff00ff00"
local LTBLUE = "|cffa0a0ff"

function DIYCE_DebugSkills(skillList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Skill List:")
    
    for i,v in ipairs(skillList) do
        DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..i..SILVER..']: "..LTBLUE.."" "..WHITE..v.name..LTBLUE..""  use = "..WHITE..(v.use and "true" or "false"))
    end

    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")
end

function DIYCE_DebugBuffList(buffList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Buff List:")
    
    for k,v in pairs(buffList) do
        -- We ignore numbered entries because both the ID and name 
        -- are stored in the list. This avoids doubling the output.
        if type(k) ~= "number" then
            DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..k..SILVER..']:  "..LTBLUE.."id: "..WHITE..v.id..LTBLUE.."  stack: "..WHITE..v.stack..LTBLUE.."  time: "..WHITE..v.time)
        end
    end
    
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")    
end

local silenceList = {
        ['Annihilation']     = true,
        ['King Bug Shock']     = true,
        ['Mana Rift']         = true,
        ['Dream of Gold']     = true,
        ['Flame']             = true,
        ['Flame Spell']     = true,
        ['Wave Bomb']         = true,
        ['Silence']         = true,
        ['Recover']         = true,
        ['Restore Life']     = true,
        ['Heal']             = true,
        ['Curing Shot']     = true,
        ['Leaves of Fire']     = true,
        ['Urgent Heal']     = true,
                    }
                    
function PriestFairySequence(arg1)
    local Skill = {}
    local Skill2 = {}
    local i = 0
    local FairyExists = UnitExists("playerpet")
    local FairyBuffs = BuffList("playerpet")
    local combat = GetPlayerCombatState()

    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Summon Fairy
    if (not FairyExists) and (not combat) then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                Skill = {
                    { name = "Shadow Fairy",            use = true },
                        }
            elseif subClass == "RANGER" then
                Skill = {
                    { name = "Water Fairy",                use = true },
                        }
            elseif subClass == "MAGE" then
                Skill = {
                    { name = "Wind Fairy",                use = true },
                        }            
            elseif subClass == "KNIGHT" then
                Skill = {
                    { name = "Light Fairy",                use = true },
                        }            
            elseif subClass == "WARRIOR" then
                Skill = {
                    { name = "Fire Fairy",                use = true },
                        }
            end
        end
    end    
    
    --Cast Halo
    if FairyExists then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                if (not FairyBuffs[503459]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Wraith Halo)",    use = true },
                            }
                end
            elseif subClass == "RANGER" then
                if (not FairyBuffs[503457]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Frost Halo)",    use = true },
                            }
                end
            elseif subClass == "MAGE" then
                if (not FairyBuffs[503461]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Windrider Halo)",    use = true },
                            }
                end
            elseif subClass == "KNIGHT" then
                if (not FairyBuffs[503507]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Devotion Halo)",    use = true },
                            }
                end
            elseif subClass == "WARRIOR" then
                if (not FairyBuffs[503455]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Accuracy Halo)",    use = true },
                            }
                end
            end
        
            --Cast Conceal
        if (not MyCombat(Skill, arg1)) then
            if (not FairyBuffs[503753]) then
                if (arg1 == "v1") then
                    Msg("- Activating Conceal", 0, 1, 1)
                end
                Skill2 = {
                    { name = "Pet Skill: 7 (Conceal)",    use = true },
                        }
            end
        end
        end
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
end
                        
function KillSequence(arg1, healthpot, manapot, foodslot)
--arg1 = "v1" or "v2" for debugging
--healthpot = # of actionbar slot for health potions
--manapot = # of actionbar slot for mana potions
--foodslot = # of actionbar slot for food (add more args for more foodslots if needed)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
    local EnergyBar1 = UnitMana("player")
    local EnergyBar2 = UnitSkill("player")
    local pctEB1 = PctM("player")
    local pctEB2 = PctS("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
    local behind = (not UnitIsUnit("player", "targettarget"))
    local melee = GetActionUsable(9) -- # is your melee range spell slot number
    local a1,a2,a3,a4,a5,ASon = GetActionInfo(14)  -- # is your Autoshot slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .04 then
            --SwapEquipmentItem()        --Note: Remove the first double dash to re-enable equipment protection.
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
        
    --Check for level 1 mobs, if it is, drop target and acquire a new one.
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        return
    end
    
     --Begin Player Skill Sequences
    
        --Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, 
        --Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR
        
        -- Class: Warrior/Mage
            if mainClass == "WARRIOR" and subClass == "MAGE" then
                local SurpriseAttack = GetActionUsable(14)
    
            --Potions and Buffs
            Skill = {
                { name = "Action: "..healthpot,            use = (phealth <= .70) },
                { name = "Survival Instinct",              use = (phealth <= .30) and combat },
                { name = "Sense of Danger",                use = (phealth <= .30) and combat },
                { name = "Action: "..manapot,              use = (pctEB2 <= .40) },
                { name = "Action: "..Healslot,             use = (phealth < .70) and (not combat) and (not party) },
                { name = "Action: "..HoTslot,              use = (phealth < .80) and (not party) },
                { name = "Intensification",                use = (pctEB2 >= .05) and (not pbuffs['Intensification']) and boss and enemy },
                { name = "Aggressiveness",                 use = boss and enemy },
                { name = "Electric Attack",                use = (pctEB2 >= .05) and ((not pbuffs['Electric Attack']) or (pbuffs['Electric Attack'].time <= 45)) },
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Silence",                    use = (silenceThis) },
                    { name = "Surprise Attack",            use = SurpriseAttack },
                    { name = "Enraged",                    use = (EnergyBar1 <= 30) and (boss or elite) },
                    { name = "Electrical Rage",            use = (EnergyBar1 >= 15) and (pctEB2 >=.05) and (not pbuffs['High Voltage III']) },
                    { name = "Thunder Sword",              use = (pctEB2 >= .05) },
                    { name = "Lightning's Touch",          use = (pctEB2 >= .05) },
                    { name = "Attack",                     use = (thealth == 1) },
                        }
                end

            --Class: Rogue/Priest
            elseif mainClass == "THIEF" and subClass == "AUGUR" then
            
            --Potions and Buffs
            Skill = {
                { name = "Regenerate",                    use = (phealth <= .90) and (pctEB2 >= .05) and (not pbuffs['Regenerate']) },
                { name = "Action: "..healthpot,           use = (phealth <= .70) },
                { name = "Action: "..manapot,             use = (pctEB2 <= .40) },
                { name = "Magic Barrier",                 use = (pctEB2 >= .05) and ((not pbuffs['Magic Barrier']) or (pbuffs['Magic Barrier'].time <= 45)) },
                { name = "Quickness Aura",                use = (pctEB2 >= .05) and ((not pbuffs['Quickness Aura']) or (pbuffs['Quickness Aura'].time <= 45)) },
                { name = "Poison",                        use = ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) },
                    { name = "Slowing Poison",               use = boss },
                    { name = "Informer",                     use = boss },
                    { name = "Fervent Attack",               use = boss },
                    { name = "Assassins Rage",               use = boss },
                    { name = "Kick",                         use = (pctEB2 >= .05) },
                    { name = "Sneak Attack",                 use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Blind Spot Attack",            use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) and (not tbuffs[620313]) },
                    { name = "Low Blow",                     use = (EnergyBar1 >= 30) and (tbuffs[620313]) and (not tbuffs[500704]) },
                    { name = "Wound Attack",                 use = (EnergyBar1 >= 35) },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) },
                    { name = "Attack",                       use = (thealth == 1) },                    
                            }
                end
                
            -- Class: Knight/Priest
-- DIYCE 2.0
            elseif mainClass == "KNIGHT" and subClass == "AUGUR" then


            --Potions and Buffs
            Skill = {
                { name = "Action: "..healthpot,                 use = (phealth <= .40) },
                { name = "Action: "..manapot,                  use = ((pctEB1 <= .50) and (phealth >= .40)) }, -- only mana pot if decent health
                { name = "Magic Barrier",                        use = (pctEB1 >= .05 and (not pbuffs['Magic Barrier'])) },
                { name = "Holy Seal",                              use = (pctEB1 >= .05 and (not pbuffs['Holy Seal'])) },
                { name = "Enhanced Armor",                    use = (pctEB1 >= .05 and (not pbuffs['Enhanced Armor'])) },
                { name = "Blessed Spring Water",             use = (pctEB1 >= .05 and (not pbuffs['Blessed Spring Water'])) },

            -- Heals
                { name = "Holy Shield",                       use = (phealth <= .20) },
                { name = "Holy Illumination",                     use = (combat and (phealth <= .75) and (not pbuffs['Holy Illumination'])) },
                { name = "Holy Aura",             use = (phealth <= .30) },
                { name = "Resolution",                             use = (combat and (phealth <= .65)) },
                { name = "Urgent Heal",                           use = (phealth <= .65) },
                { name = "Regenerate",                           use = ((phealth <= .90) and (not pbuffs['Regenerate'])) },
                    }

            -- Combat
                if enemy then
                Skill2 = {
                { name = "Shield of Valor",                   use = ((phealth <= .8) and shield) },
                { name = "Shield of Discipline",             use = (silenceThis and shield) },
                { name = "Shield of Atonement",           use = (combat and shield and (not tbuffs['Restrained'])) },
                { name = "Rising Tide",                        use = (not melee and (thealth >= .99)) }, -- To Pull with
                { name = "Mana Return",                     use = (tbuffs['Holy Seals 3']) and (pctEB1 <= .70) },
                { name = "Threaten",                          use = (tbuffs['Holy Seals 3']) and (not tbuffs['Threaten']) },
                { name = "Hatred Strike",                    use = (combat and party) },-- Agro Multiplier if in party only
                { name = "Disarmament",                    use = ((UnitLevel("target") >= (UnitLevel("player") - 10)) and (boss or elite) and ((not tbuffs['Disarmament IV']) or (tbuffs['Disarmament IV'].time <= 3))) }, -- stack to 4
                { name = "Whirlwind Shield",               use = (shield and pctEB1 >= .2 ) },
                { name = "Charge",        use = (combat and (tspell ~= nil)) or (not melee and not tbuffs['Charge']) }, -- charge spellcasters
                { name = "Holy Light's Fury",                  use = (pctEB1 >= .2 ) and not tbuffs['Holy Light's Fury'] }, -- Knight/Priest 15 Elite
                { name = "Holy Smite",        use = (pctEB1 >= .2 ) and tbuffs['Holy Light's Fury'] }, -- Knight/Priest 20 Elite
                { name = "Holy Strike",                        use = (pctEB1 >= .2 ) and not tbuffs['Light Seal III'] },
                { name = "Punishment",                        use = (tbuffs['Light Seal III']) },
                    }
            end
                
        -- Class: Druid/Mage
-- DIYCE 2.2
            elseif mainClass == "DRUID" and subClass == "MAGE" then
-- Silence
            Skill = {
                { name = "Silence",                          use = (silenceThis) },

-- Potions
                { name = "Action: "..healthpot,       use = (phealth <= .40) },
                { name = "Action: "..manapot,         use = ((pctEB1 <= .50) and (phealth >= .40)) }, -- only mana pot if decent health

-- Heals
                { name = "Mother Earth's Protection",        use = (phealth <= .30) },
                { name = "Recover",                               use = (phealth <= .40) },
                { name = "Curing Seed",                         use = (phealth <= .50) },
                { name = "Restore Life",                       use = ((phealth <= .60) and (pbuffs['Nature's Power'].stack <=2))}, -- use this ahead of Recover if low on Natures Power
                { name = "Recover",                             use = ((phealth <= .60) and (not pbuffs['Recover'])) },
                { name = "Antidote",                             use = (pbuffs['Poisoned']) },
                { name = "Purify",                                use = (pbuffs['Curse']) },
                { name = "Blossoming Life",                  use = ((phealth <= .80) and (not pbuffs['Blossoming Life'])) },
                { name = "Blossoming Life",                  use = ((phealth <= .90) and not combat) },

-- Buffs
                { name = "Savage Blessing",                 use = (not pbuffs['Savage Blessing']) },
                { name = "Concentration Prayer",          use = (not pbuffs['Concentration Prayer']) },
                { name = "Fire Ward",                          use = (not pbuffs['Fire Ward']) },
                { name = "Intensification",                     use = (enemy and not pbuffs['Intensification']) },
                    }

-- Ranged Attack
                if enemy then
                Skill2 = {
                { name = "Binding Silence",                  use = (tspell ~= nil and ttime >= 1 and (ttime - telapsed) > 0.5 and pctEB1 >= .05) },
                { name = "Mother Nature's Wrath",                         use = (true) },
                { name = "Fireball",                             use = (combat) },
                { name = "Earth Pulse",                      use = (combat) },
                { name = "Weakening Seed",              use = ((boss or elite) and (not tbuffs['Weakening Seed']) and (pbuffs['Nature's Power'].stack >= 3)) },
                { name = "Lightning",                          use = (not tbuffs['Lightning']) },
                { name = "Rockslide",                         use = (true) },
                { name = "Earth Arrow",                      use = (true) },
                { name = "Briar Entwinement",              use = (not tbuffs['Briar Entwinement'] or BuffTimeLeft("target", "Briar Entwinement") <=2) },
                    }
    end
    
--Class: Rogue/Mage
    -- DIYCE 2.2
            elseif mainClass == "THIEF" and subClass == "MAGE" then
            
-- Silence
            Skill = {
                { name = "Silence",                        use = (silenceThis) },
                
-- Potions
                { name = "Action: "..healthpot,                       use = (phealth <= .50) },
                { name = "Action: "..manapot,                        use = ((pctEB1 <= .50) and (phealth >= .50)) }, -- only mana pot if decent health
                
-- Buffs
                { name = "Poison",                        use = ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
                { name = "Intensification",               use = ((boss or elite) and not pbuffs['Intensification']) },
                { name = "Evasion",                       use = ((boss or elite) and not pbuffs['Evasion']) },
                { name = "Create Opportunity",            use = ((boss or elite) and not pbuffs['Create Opportunity']) },
                    }
                    
--Combat
                if enemy then
                Skill2 = {
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) },
                    { name = "Vanish",                       use = combat and (phealth <= .20) },
                    { name = "Informer",                     use = boss },
                    { name = "Fervent Attack",               use = boss },
                    { name = "Assassins Rage",               use = boss },
                    { name = "Shadow Step",                  use = (not combat) and (EnergyBar1 >= 50) },
                    { name = "Sneak Attack",                 use = (not combat) and (boss or elite) and (EnergyBar1 >= 20) and behind },
                    --{ name = "Sneak Attack",                 use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Blind Spot",                   use = (EnergyBar1 >= 20) and behind },
                    { name = "Magic Breaker",                use = (boss or elite) },    
                    { name = "Fireball",                     use = (true) },
                    { name = "Lightning",                    use = (not tbuffs['Lightning']) },    
                    { name = "Poison Flame",                 use = (not tbuffs['Poison Flame']) },            
                    { name = "Paralyzing Trap",              use = (true) },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) and (not tbuffs[620313]) },
                    { name = "Low Blow",                     use = (EnergyBar1 >= 30) and (tbuffs[620313]) and (not tbuffs[500704]) },
                    { name = "Wound Attack",                 use = (EnergyBar1 >= 35) },
                    --{ name = "Combo Throw",                  use = (true) },
                    --{ name = "Throw",                        use = (true) },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) },
                    { name = "Attack",                       use = (thealth == 1) },
                        }
                end

-- Class: Mage/Rogue
-- DIYCE 2.2
            elseif mainClass == "MAGE" and subClass == "THIEF" then

-- Silence
            Skill = {
                { name = "Silence",                                       use = (silenceThis) },

-- Potions
                { name = "Action: 48",                use = (phealth <= .50) },
                { name = "Action: 49",                use = ((pctEB1 <= .50) and (phealth >= .50)) }, -- only mana pot if decent health

-- Buffs
                { name = "Fang Ritual",               use = (not pbuffs['Fang Ritual']) },
                { name = "Action: 47",                use = (not pbuffs['Unbridled Enthusiasm']) and not (pbuffs['Thunder Force']) },
                { name = "Action: 54",                use = (boss and not pbuffs['Ancient Spirit Water']) }, 
                { name = "Shadow Protection",         use = ((not pbuffs['Ancient Spirit Water']) and not (pbuffs['Shadow Protection'])) },                
                --{ name = "Fire Ward",                 use = (not pbuffs['Fire Ward']) },
                { name = "Energy Influx",             use = (not pbuffs['Energy Influx']) },
                { name = "Electrostatic Charge",      use = (not pbuffs['Electrostatic Charge']) },
                { name = "Distract",                  use = ((phealth <= .35) and not pbuffs['Electrostatic Charge']) },
                { name = "Energy Well",               use = (not pbuffs['Energy Well']) }, 
                { name = "Elemental Catalysis",       use = (boss and not tbuffs['Elemental Catalysis']) },
                { name = "Intensification",           use = (boss and not tbuffs['Intensification']) },
                    }

-- Ranged Attack
                if enemy then
                Skill2 = {
                --{ name = "Electric Bolt",               use = (boss and not tbuffs['Electric Flow']) },
                { name = "Elemental Weakness",          use = (boss and not tbuffs['Elemental Weakness']) },
                { name = "Flame",                       use = ((pbuffs['Elemental Catalysis']) or (pbuffs['Ancient Spirit Water'])) },
                { name = "Fireball",                    use = (true) },
                { name = "Demoralize",                  use = (not tbuffs['Demoralize']) },
                { name = "Lightning",                   use = (not tbuffs['Lightning']) },
                { name = "Kiss of the Vampire",         use = (not tbuffs['Kiss of the Vampire']) },
                { name = "Cursed Fangs",                use = (EnergyBar2 >= 30) },
                { name = "Flame",                       use = (boss or tbuffs['Elemental Weakness']) },
                { name = "Phoenix",                     use = (combat and melee) },
                { name = "Discharge",                   use = (combat and melee) },
                { name = "Meteor Shower",                    use = (true) },
                { name = "Plasma Arrow",          use = (not pbuffs['Charged']) },
                        }
                end                
-- Class: Mage/Druid
-- DIYCE 2.2
            elseif mainClass == "MAGE" and subClass == "DRUID" then

-- Silence
            Skill = {
                { name = "Silence",                                       use = (silenceThis) },

-- Potions
                { name = "Action: "..healthpot,                       use = (phealth <= .50) },
                { name = "Action: "..manapot,                        use = ((pctEB1 <= .50) and (phealth >= .50)) }, -- only mana pot if decent health
-- Heals
                { name = "Recover",                   use = ((phealth <= .60) and not pbuffs['Recover']) },
                { name = "Recover",                   use = (phealth <= .30) },
                { name = "Recover",                   use = ((phealth <= .90) and not combat) }, -- top off before fight
-- Buffs
                { name = "Perception",                use = (not pbuffs['Perception']) }, -- Mage/Druid Elite 15
                --{ name = "Magic Target",              use = (not combat and not pbuffs['Magic Target']) }, -- Mage/Druid Elite 20
                { name = "Savage Blessing",           use = (not pbuffs['Savage Blessing']) },
                --{ name = "Fire Ward",                 use = (not pbuffs['Fire Ward']) },
                { name = "Electrostatic Charge",      use = (not pbuffs['Electrostatic Charge']) },
-- In case Electrostatic Charge is still on cooldown and you're getting hit hard
                { name = "Mother Earth's Protection", use = ((phealth <= .30) and not pbuffs['Electrostatic Charge']) },  
                { name = "Elemental Catalysis",       use = (boss and not tbuffs['Elemental Catalysis']) },
                { name = "Intensification",           use = (boss and not tbuffs['Intensification']) },
                    }

-- Ranged Attack
                if enemy then
                Skill2 = {
                --{ name = "Electric Bolt",               use = (boss and not tbuffs['Electric Flow']) },
                { name = "Elemental Weakness",        use = (boss and not tbuffs['Elemental Weakness']) },
                { name = "Magma Blade",                    use = (true) },
                { name = "Fireball",                    use = (true) },
                { name = "Lightning",                   use = (melee and not tbuffs['Lightning']) },
                { name = "Flame",                     use = (boss or tbuffs['Elemental Weakness']) },
                { name = "Phoenix",                   use = (combat and melee) },
                { name = "Discharge",              use = (combat and melee) },
                { name = "Meteor Shower",                    use = (true) },
                { name = "Earth Pulse",              use = (combat and melee) },
                { name = "Plasma Arrow",          use = (not pbuffs['Charged']) },
                        }
                end
                
            --ADD MORE CLASS COMBOS HERE. 
            --USE AN "ELSEIF" TO CONTINUE WITH MORE CLASS COMBOS.
            --THE NEXT "END" STATEMENT IS THE END OF THE CLASS COMBOS STATEMENTS.
            --DO NOT POST BELOW THE FOLLOWING "END" STATEMENT!
            end
    --End Player Skill Sequences
    
    if (arg1=="debugskills") then        --Used for printing the skill table, and true/false usability
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
    elseif (arg1=="debugpbuffs") then    --Used for printing your buff names, and buffID
        DIYCE_DebugBuffList(pbuffs)
    elseif (arg1=="debugtbuffs") then    --Used for printing target buff names, and buffID
        DIYCE_DebugBuffList(tbuffs)
    elseif (arg1=="debugall") then        --Used for printing all of the above at the same time
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
        DIYCE_DebugBuffList(pbuffs)
        DIYCE_DebugBuffList(tbuffs)
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    if mainClass == "RANGER" and (not party) then        --To keep scouts from pulling mobs without meaning to.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    elseif mainClass ~= "RANGER" then                    --Let all other classes auto target.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    end
end
-- Stagger - Osha - Eyeofthetempest --

M/R/W 72/52/51
Formerly M/D/S, M/R/D (The search for decent DPS in a post GCD RoM continues)

hangman04

Savage Warrior

Posts: 113

Location: Romania

Mood: Smile

  • Send private message

392

Thursday, January 26th 2012, 9:28pm

DIYCE.lua

Source code

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
-- DIY Combat Engine version 2.2

local g_skill  = {}
local g_lastaction = ""
local DIYCE_Timers = {}

function Msg(outstr,a1,a2,a3)
    DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr),a1,a2,a3)
end

function ReadSkills()
    g_skill = {}
    local skillname,slot

    for page = 1,4 do
        slot = 1
        skillname = GetSkillDetail(page,slot)
        repeat
            local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
            if skillusable then
                g_skill[skillname] = { ['page'] = page, ['slot'] = slot }
            end
            slot = slot + 1
            skillname = GetSkillDetail(page,slot)
        until skillname == nil
    end
end

-- Read Skills on Log-In/Class Change/Level-Up
        local DIYCE_EventFrame = CreateUIComponent("Frame","DIYCE_EventFrame","UIParent")
            DIYCE_EventFrame:SetScripts("OnEvent", [=[ 
                    if event == 'PLAYER_SKILLED_CHANGED' then
                        ReadSkills()
                        end
                    ]=] )
            DIYCE_EventFrame:RegisterEvent("PLAYER_SKILLED_CHANGED")

function PctH(tgt)
    return (UnitHealth(tgt)/UnitMaxHealth(tgt))
end

function PctM(tgt)
    return (UnitMana(tgt)/UnitMaxMana(tgt))
end

function PctS(tgt)
    return (UnitSkill(tgt)/UnitMaxSkill(tgt))
end

function CancelBuff(buffname)
    local i = 1
    local buff = UnitBuff("player",i)

    while buff ~= nil do
        if buff == buffname then
            CancelPlayerBuff(i)
            return true
        end

        i = i + 1
        buff = UnitBuff("player",i)
    end
    return false
end

function BuffList(tgt)
    local list = {}
    local buffcmd = UnitBuff
    local infocmd = UnitBuffLeftTime

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitDebuff
        infocmd = UnitDebuffLeftTime
    end

    -- There is a max of 100 buffs/debuffs per unit apparently
    for i = 1,100 do
        local buff, _, stackSize, ID = buffcmd(tgt, i)
        local timeRemaining = infocmd(tgt,i)
        if buff then
            -- Ad to list by name
            list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining, id = ID }
            -- We also list by ID in case two different buffs/debuffs have the same name.
            list[ID] = {stack = stackSize, time = timeRemaining, name = buff:gsub("(%()(.)(%))", "%2") }
        else
            break
        end
    end

    return list
end


function CD(skillname)
    local firstskill = GetSkillDetail(2,1)
    if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
        ReadSkills()
    end

    if g_skill[skillname] ~= nil then
        local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
        return cd <= 0.4
    elseif skillname == nil then
        return false
    else
        Msg("Skill not available: "..skillname)        --Comment this line out if you do not wish to recieve this error message.
        return
    end
end

function MyCombat(Skill, arg1)
    local spell_name = UnitCastingTime("player")
    local talktome = ((arg1 == "v1") or (arg1 == "v2"))
    local action,actioncd,actiondef,actioncnt
    
    if spell_name ~= nil then
        if (arg1 == "v2") then Msg("- ['..spell_name..']", 0, 1, 1) end
        return true
    end

    for x,tbl in ipairs(Skill) do
        
    local useit = type(Skill[x].use) ~= "function" and Skill[x].use or (type(Skill[x].use) == "function" and Skill[x].use() or false)
        if useit then
            if string.find(Skill[x].name, "Action:") then
                action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
                _1,actioncd = GetActionCooldown(action)
                actiondef,_1,actioncnt = GetActionInfo(action)
                if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
                    if talktome then Msg("- "..Skill[x].name) end
                    UseAction(action)
                    return true
                end
            elseif string.find(Skill[x].name, "Custom:") then
                action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
                if CustomAction(action) then
                    return true
                end
            elseif string.find(Skill[x].name, "Item:") then
                action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                UseItemByName(action)
                return true
            elseif CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                return true
            elseif string.find(Skill[x].name, "Pet Skill:") then
                action = string.gsub(Skill[x].name, "(Pet Skill:)( *)(%d+)(.*)", "%3")
                    UsePetAction(action)
                if (arg1 == "v2") then Msg(Skill[x].name.." has been fully processed") end
                return true
            end
        end
    end
    if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end
    
    return false
end

--[[ Timer Update function ]]--
-- Tick down any active timers
function DIYCE_TimerUpdate(elapsed)
    for k,v in pairs(DIYCE_Timers) do
        v.timeLeft = v.timeLeft - elapsed
        if v.timeLeft < 0 then
            v.timeLeft = 0
        end
    end
end

--[[ Create a named timer ]]--
-- if the named timer already exists, this does nothing.
function CreateDIYCETimer(timerName, waitTime)
    if not DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = { timeLeft = 0, waitTime = waitTime }
    end
end

--[[ Set/reset waitTimer of an existing timer ]]--
-- if the timer doesn't exist, this does nothing
function SetDIYCETimerDelay(timerName, waitTime)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].waitTime = waitTime
    end
end

--[[ Delete named timer ]]--
-- if the timer doesn't exist, this does nothing
-- Not really needed, but added for completeness
function DeleteDIYCETimer(timerName)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = nil
    end
end

--[[ Get a timer's current time ]]--
-- if the timer doesn't exist, this returns 0
function GetDIYCETimerValue(timerName)
    if timerName then
        return DIYCE_Timers[timerName] and DIYCE_Timers[timerName].timeLeft or 0
    end
    return 0
end

--[[ Starts a timer ticking down ]]--
-- if timer doesn't exist, this does nothing
function StartDIYCETimer(timerName)
    if timerName and DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].timeLeft = DIYCE_Timers[timerName].waitTime
    end
end


function CustomAction(action)
    if CD(action) then
        if IsShiftKeyDown() then Msg("- "..action) end
        g_lastaction = action
        CastSpellByName(action)
        return true
    else
        return false
    end
end

function BuffTimeLeft(tgt, buffname)
    local cnt = 1
    local buff = UnitBuff(tgt,cnt)

    while buff ~= nil do
        if string.find(buff,buffname) then
            return UnitBuffLeftTime(tgt,cnt)
        end
        cnt = cnt + 1
        buff = UnitBuff(tgt,cnt)
    end

    return 0
end

function BuffParty(arg1,arg2)
--    arg1 = Quickbar slot # for targetable, instant-cast buff without a cooldown (eg. Amp Attack) for range checking.
--    arg2 = buff expiration time cutoff (in seconds) for refreshing buffs, default is 45 seconds.

    local selfbuffs = { "Soul Bond", "Enhanced Armor", "Holy Seal" }
    local groupbuffs = { "Grace of Life", "Amplified Attack", "Angel's Blessing", "Essence of Magic", "Magic Barrier", "Blessed Spring Water", "Fire Ward", "Savage Blessing", "Concentration Prayer", "Shadow Fury"  }

    local buffrefresh = arg2 or 45           -- Refresh buff time (seconds)
    local spell = UnitCastingTime("player")  -- Spell being cast?
    local vocal = IsShiftKeyDown()           -- Generate feedback if Shift key held

    if (spell ~= nil) then
        return
    end

    if vocal then Msg("- Checking self buffs on "..UnitName("player")) end
    for i,buff in ipairs(selfbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    if vocal then Msg("- Checking group buffs on "..UnitName("player")) end
    for i,buff in ipairs(groupbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    for num=1,GetNumPartyMembers()-1 do
        TargetUnit("party"..num)
        if GetActionUsable(arg1) and (UnitHealth("party"..num) > 0) then
            if vocal then Msg("- Checking group buffs on "..UnitName("party"..num)) end
            for i,buff in ipairs(groupbuffs) do
                if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("target",buff) <= buffrefresh) then
                    if UnitIsUnit("target","party"..num) then
                        if vocal then Msg("- Casting "..buff.." on "..UnitName("target")) end
                        CastSpellByName(buff)
                        return
                    else
                        if vocal then Msg("- Error: "..UnitName("target").." != "..UnitName("party"..num)) end
                    end
                end
            end
        else
            if vocal then Msg("- Player "..UnitName("party"..num).." out of range or dead.") end
        end
    end

    if vocal then Msg("- Nothing to do.") end
end

-- DIY Combat Engine version 2.2

local g_skill  = {}
local g_lastaction = ""
-- Holds the created timers
local DIYCE_Timers = {}

function Msg(outstr,a1,a2,a3)
    DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr),a1,a2,a3)
end

function ReadSkills()
    g_skill = {}
    local skillname,slot

    for page = 1,4 do
        slot = 1
        skillname = GetSkillDetail(page,slot)
        repeat
            local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
            if skillusable then
                g_skill[skillname] = { ['page'] = page, ['slot'] = slot }
            end
            slot = slot + 1
            skillname = GetSkillDetail(page,slot)
        until skillname == nil
    end
end

-- Read Skills on Log-In/Class Change/Level-Up
        local DIYCE_EventFrame = CreateUIComponent("Frame","DIYCE_EventFrame","UIParent")
        DIYCE_EventFrame:SetScripts("OnUpdate", [=[ DIYCE_TimerUpdate(elapsedTime) ]=] )
            DIYCE_EventFrame:SetScripts("OnEvent", [=[ 
                    if event == 'PLAYER_SKILLED_CHANGED' then
                        ReadSkills()
                        end
                    ]=] )
            DIYCE_EventFrame:RegisterEvent("PLAYER_SKILLED_CHANGED")

function PctH(tgt)
    return (UnitHealth(tgt)/UnitMaxHealth(tgt))
end

function PctM(tgt)
    return (UnitMana(tgt)/UnitMaxMana(tgt))
end

function PctS(tgt)
    return (UnitSkill(tgt)/UnitMaxSkill(tgt))
end

function CancelBuff(buffname)
    local i = 1
    local buff = UnitBuff("player",i)

    while buff ~= nil do
        if buff == buffname then
            CancelPlayerBuff(i)
            return true
        end

        i = i + 1
        buff = UnitBuff("player",i)
    end
    return false
end

function BuffList(tgt)
    local list = {}
    local buffcmd = UnitBuff
    local infocmd = UnitBuffLeftTime

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitDebuff
        infocmd = UnitDebuffLeftTime
    end

    -- There is a max of 100 buffs/debuffs per unit apparently
    for i = 1,100 do
        local buff, _, stackSize, ID = buffcmd(tgt, i)
        local timeRemaining = infocmd(tgt,i)
        if buff then
            -- Ad to list by name
            list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining or 0, id = ID }
            -- We also list by ID in case two different buffs/debuffs have the same name.
            list[ID] = {stack = stackSize, time = timeRemaining or 0, name = buff:gsub("(%()(.)(%))", "%2") }
        else
            break
        end
    end

    return list
end

-- Custom Function that checks if one buff is casted by dif players on target (#ref: http://forum.us.runesofmagic.com/showpost.php?p=492329&postcount=278)
function ChkBuffCount(tgt,buffname,BuffID,buffcount)
    local cnt = 1
    local buffcmd = UnitBuff
    local buffcounter = 0

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitDebuff
    end
    local buff, _, _, ID = buffcmd(tgt,cnt)

    while buff ~= nil do
        if string.gsub(buff, "(%()(.)(%))", "%2") == buffname
            or ID == BuffID then
            buffcounter = buffcounter + 1        
        end
        cnt = cnt + 1
        buff = buffcmd(tgt,cnt)
        
        if buffcounter >= buffcount then
            return true
        end
    end    
end

function CD(skillname)
    local firstskill = GetSkillDetail(2,1)
    if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
        ReadSkills()
    end

    if g_skill[skillname] ~= nil then
        local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
        return cd <= 0.4
    elseif skillname == nil then
        return false
    else
        Msg("Skill not available: "..skillname)        --Comment this line out if you do not wish to recieve this error message.
        return
    end
end

function MyCombat(Skill, arg1)
    local spell_name = UnitCastingTime("player")
    local talktome = ((arg1 == "v1") or (arg1 == "v2"))
    local action,actioncd,actiondef,actioncnt
    
    if spell_name ~= nil then
        if (arg1 == "v2") then Msg("- ['..spell_name..']", 0, 1, 1) end
        return true
    end

    for x,tbl in ipairs(Skill) do
        
    local useit = type(Skill[x].use) ~= "function" and Skill[x].use or (type(Skill[x].use) == "function" and Skill[x].use() or false)
        if useit then
            if string.find(Skill[x].name, "Action:") then
                action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
                _1,actioncd = GetActionCooldown(action)
                actiondef,_1,actioncnt = GetActionInfo(action)
                if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
                    if talktome then Msg("- "..Skill[x].name) end
                    UseAction(action)
                    return true
                end
            elseif string.find(Skill[x].name, "Custom:") then
                action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
                if CustomAction(action) then
                    return true
                end
            elseif string.find(Skill[x].name, "Item:") then
                action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                UseItemByName(action)
                return true
            elseif (Skill[x].ignoretimer or GetDIYCETimerValue(Skill[x].timer) == 0) and CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                StartDIYCETimer(Skill[x].timer)
                return true
            elseif string.find(Skill[x].name, "Pet Skill:") then
                action = string.gsub(Skill[x].name, "(Pet Skill:)( *)(%d+)(.*)", "%3")
                    UsePetAction(action)
                if (arg1 == "v2") then Msg(Skill[x].name.." has been fully processed") end
                return true
            end
        end
    end
    if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end
    
    return false
end

--[[ Timer Update function ]]--
-- Tick down any active timers
function DIYCE_TimerUpdate(elapsed)
    for k,v in pairs(DIYCE_Timers) do
        v.timeLeft = v.timeLeft - elapsed
        if v.timeLeft < 0 then
            v.timeLeft = 0
        end
    end
end

--[[ Create a named timer ]]--
-- if the named timer already exists, this does nothing.
function CreateDIYCETimer(timerName, waitTime)
    if not DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = { timeLeft = 0, waitTime = waitTime }
    end
end

--[[ Set/reset waitTimer of an existing timer ]]--
-- if the timer doesn't exist, this does nothing
function SetDIYCETimerDelay(timerName, waitTime)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].waitTime = waitTime
    end
end

--[[ Delete named timer ]]--
-- if the timer doesn't exist, this does nothing
-- Not really needed, but added for completeness
function DeleteDIYCETimer(timerName)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = nil
    end
end

--[[ Get a timer's current time ]]--
-- if the timer doesn't exist, this returns 0
function GetDIYCETimerValue(timerName)
    if timerName then
        return DIYCE_Timers[timerName] and DIYCE_Timers[timerName].timeLeft or 0
    end
    return 0
end

--[[ Starts a timer ticking down ]]--
-- if timer doesn't exist, this does nothing
function StartDIYCETimer(timerName)
    if timerName and DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].timeLeft = DIYCE_Timers[timerName].waitTime
    end
end

function CustomAction(action)
    if CD(action) then
        if IsShiftKeyDown() then Msg("- "..action) end
        g_lastaction = action
        CastSpellByName(action)
        return true
    else
        return false
    end
end

function BuffTimeLeft(tgt, buffname)
    local cnt = 1
    local buff = UnitBuff(tgt,cnt)

    while buff ~= nil do
        if string.find(buff,buffname) then
            return UnitBuffLeftTime(tgt,cnt)
        end
        cnt = cnt + 1
        buff = UnitBuff(tgt,cnt)
    end

    return 0
end

function BuffParty(arg1,arg2)
--    arg1 = Quickbar slot # for targetable, instant-cast buff without a cooldown (eg. Amp Attack) for range checking.
--    arg2 = buff expiration time cutoff (in seconds) for refreshing buffs, default is 45 seconds.

    local selfbuffs = { "Soul Bond", "Enhanced Armor", "Holy Seal" }
    local groupbuffs = { "Grace of Life", "Amplified Attack", "Angel's Blessing", "Essence of Magic", "Magic Barrier", "Blessed Spring Water", "Fire Ward", "Savage Blessing", "Concentration Prayer", "Shadow Fury"  }

    local buffrefresh = arg2 or 45           -- Refresh buff time (seconds)
    local spell = UnitCastingTime("player")  -- Spell being cast?
    local vocal = IsShiftKeyDown()           -- Generate feedback if Shift key held

    if (spell ~= nil) then
        return
    end

    if vocal then Msg("- Checking self buffs on "..UnitName("player")) end
    for i,buff in ipairs(selfbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    if vocal then Msg("- Checking group buffs on "..UnitName("player")) end
    for i,buff in ipairs(groupbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    for num=1,GetNumPartyMembers()-1 do
        TargetUnit("party"..num)
        if GetActionUsable(arg1) and (UnitHealth("party"..num) > 0) then
            if vocal then Msg("- Checking group buffs on "..UnitName("party"..num)) end
            for i,buff in ipairs(groupbuffs) do
                if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("target",buff) <= buffrefresh) then
                    if UnitIsUnit("target","party"..num) then
                        if vocal then Msg("- Casting "..buff.." on "..UnitName("target")) end
                        CastSpellByName(buff)
                        return
                    else
                        if vocal then Msg("- Error: "..UnitName("target").." != "..UnitName("party"..num)) end
                    end
                end
            end
        else
            if vocal then Msg("- Player "..UnitName("party"..num).." out of range or dead.") end
        end
    end

    if vocal then Msg("- Nothing to do.") end
end


custom function.lua

Source code

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
local WHITE = "|cffffffff"
local SILVER = "|cffc0c0c0"
local GREEN = "|cff00ff00"
local LTBLUE = "|cffa0a0ff"

function DIYCE_DebugSkills(skillList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Skill List:")
    
    for i,v in ipairs(skillList) do
        DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..i..SILVER..']: "..LTBLUE.."" "..WHITE..v.name..LTBLUE..""  use = "..WHITE..(v.use and "true" or "false"))
    end

    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")
end

function DIYCE_DebugBuffList(buffList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Buff List:")
    
    for k,v in pairs(buffList) do
        -- We ignore numbered entries because both the ID and name 
        -- are stored in the list. This avoids doubling the output.
        if type(k) ~= "number" then
            DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..k..SILVER..']:  "..LTBLUE.."id: "..WHITE..v.id..LTBLUE.."  stack: "..WHITE..v.stack..LTBLUE.."  time: "..WHITE..v.time)
        end
    end
    
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")    
end

local silenceList = {
        ['Annihilation']     = true,
        ['King Bug Shock']     = true,
        ['Mana Rift']         = true,
        ['Dream of Gold']     = true,
        ['Flame']             = true,
        ['Flame Spell']     = true,
        ['Wave Bomb']         = true,
        ['Silence']         = true,
        ['Recover']         = true,
        ['Restore Life']     = true,
        ['Heal']             = true,
        ['Curing Shot']     = true,
        ['Leaves of Fire']     = true,
        ['Urgent Heal']     = true,
                    }
                    
function PriestFairySequence(arg1)
    local Skill = {}
    local Skill2 = {}
    local i = 0
    local FairyExists = UnitExists("playerpet")
    local FairyBuffs = BuffList("playerpet")
    local combat = GetPlayerCombatState()

    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Summon Fairy
    if (not FairyExists) and (not combat) then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                Skill = {
                    { name = "Shadow Fairy",            use = true },
                        }
            elseif subClass == "RANGER" then
                Skill = {
                    { name = "Water Fairy",                use = true },
                        }
            elseif subClass == "MAGE" then
                Skill = {
                    { name = "Wind Fairy",                use = true },
                        }            
            elseif subClass == "KNIGHT" then
                Skill = {
                    { name = "Light Fairy",                use = true },
                        }            
            elseif subClass == "WARRIOR" then
                Skill = {
                    { name = "Fire Fairy",                use = true },
                        }
            end
        end
    end    
    
    --Cast Halo
    if FairyExists then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                if (not FairyBuffs[503459]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Wraith Halo)",    use = true },
                            }
                end
            elseif subClass == "RANGER" then
                if (not FairyBuffs[503457]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Frost Halo)",    use = true },
                            }
                end
            elseif subClass == "MAGE" then
                if (not FairyBuffs[503461]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Windrider Halo)",    use = true },
                            }
                end
            elseif subClass == "KNIGHT" then
                if (not FairyBuffs[503507]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Devotion Halo)",    use = true },
                            }
                end
            elseif subClass == "WARRIOR" then
                if (not FairyBuffs[503455]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Accuracy Halo)",    use = true },
                            }
                end
            end
        
            --Cast Conceal
        if (not MyCombat(Skill, arg1)) then
            if (not FairyBuffs[503753]) then
                if (arg1 == "v1") then
                    Msg("- Activating Conceal", 0, 1, 1)
                end
                Skill2 = {
                    { name = "Pet Skill: 7 (Conceal)",    use = true },
                        }
            end
        end
        end
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
end
                        
function KillSequence(arg1, healthpot, manapot, foodslot)
--arg1 = "v1" or "v2" for debugging
--healthpot = # of actionbar slot for health potions
--manapot = # of actionbar slot for mana potions
--foodslot = # of actionbar slot for food (add more args for more foodslots if needed)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
    local EnergyBar1 = UnitMana("player")
    local EnergyBar2 = UnitSkill("player")
    local pctEB1 = PctM("player")
    local pctEB2 = PctS("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
    local behind = (not UnitIsUnit("player", "targettarget"))
    local melee = GetActionUsable(13) -- # is your melee range spell slot number
    local a1,a2,a3,a4,a5,ASon = GetActionInfo(14)  -- # is your Autoshot slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .04 then
            --SwapEquipmentItem()        --Note: Remove the first double dash to re-enable equipment protection.
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
        
    --Check for level 1 mobs, if it is, drop target and acquire a new one.
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        return
    end
    
    --Begin Player Skill Sequences
    
        --Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, 
        --Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR
        
        -- Class: Warrior/Mage
            if mainClass == "WARRIOR" and subClass == "MAGE" then
                local SurpriseAttack = GetActionUsable(14)
    
            --Potions and Buffs
            Skill = {
                { name = "Action: "..healthpot,            use = (phealth <= .70) },
                { name = "Survival Instinct",              use = (phealth <= .30) and combat },
                { name = "Sense of Danger",                use = (phealth <= .30) and combat },
                { name = "Action: "..manapot,              use = (pctEB2 <= .40) },
                { name = "Action: "..Healslot,             use = (phealth < .70) and (not combat) and (not party) },
                { name = "Action: "..HoTslot,              use = (phealth < .80) and (not party) },
                { name = "Intensification",                use = (pctEB2 >= .05) and (not pbuffs['Intensification']) and boss and enemy },
                { name = "Aggressiveness",                 use = boss and enemy },
                { name = "Electric Attack",                use = (pctEB2 >= .05) and ((not pbuffs['Electric Attack']) or (pbuffs['Electric Attack'].time <= 45)) },
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Silence",                    use = (silenceThis) },
                    { name = "Surprise Attack",            use = SurpriseAttack },
                    { name = "Enraged",                    use = (EnergyBar1 <= 30) and (boss or elite) },
                    { name = "Electrical Rage",            use = (EnergyBar1 >= 15) and (pctEB2 >=.05) and (not pbuffs['High Voltage III']) },
                    { name = "Thunder Sword",              use = (pctEB2 >= .05) },
                    { name = "Lightning's Touch",          use = (pctEB2 >= .05) },
                    { name = "Attack",                     use = (thealth == 1) },
                        }
                end

            --Class: Rogue/Priest
            elseif mainClass == "THIEF" and subClass == "AUGUR" then
            
            --Potions and Buffs
            Skill = {
                { name = "Regenerate",                    use = (phealth <= .90) and (pctEB2 >= .05) and (not pbuffs['Regenerate']) },
                { name = "Action: "..healthpot,           use = (phealth <= .70) },
                { name = "Action: "..manapot,             use = (pctEB2 <= .40) },
                { name = "Magic Barrier",                 use = (pctEB2 >= .05) and ((not pbuffs['Magic Barrier']) or (pbuffs['Magic Barrier'].time <= 45)) },
                { name = "Quickness Aura",                use = (pctEB2 >= .05) and ((not pbuffs['Quickness Aura']) or (pbuffs['Quickness Aura'].time <= 45)) },
                { name = "Poison",                        use = ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) },
                    { name = "Slowing Poison",               use = boss },
                    { name = "Informer",                     use = boss },
                    { name = "Fervent Attack",               use = boss },
                    { name = "Assassins Rage",               use = boss },
                    { name = "Kick",                         use = (pctEB2 >= .05) },
                    { name = "Sneak Attack",                 use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Blind Spot Attack",            use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) and (not tbuffs[620313]) },
                    { name = "Low Blow",                     use = (EnergyBar1 >= 30) and (tbuffs[620313]) and (not tbuffs[500704]) },
                    { name = "Wound Attack",                 use = (EnergyBar1 >= 35) },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) },
                    { name = "Attack",                       use = (thealth == 1) },                    
                            }
                end
                
            --Class: Warrior/Warden
            elseif mainClass == "WARRIOR" and subClass == "WARDEN" then
            
            --CreateDIYCETimer("SBleed", 7) --Change the value between 6 -> 7.5 depending on your lag.
            --CreateDIYCETimer("SWEffect", 56) --Change the value between 55 ->  57 depending on your lag.
            
            --Potions and Buffs
            Skill = {
                { name = "Briar Shield",                  use = (EnergyBar2 >= 200) and ((not pbuffs['Briar Shield']) or (pbuffs['Briar Shield'].time <= 45)) },
                { name = "Battle Creed",                  use = (EnergyBar2 >= 200) and ((not pbuffs['Battle Creed']) or (pbuffs['Battle Creed'].time <= 45)) },
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                { name = "Survival Instinct",                use = (  phealth <= .49                                                             )},
                { name = "Enraged",                          use = (  EnergyBar1 <= 20                                                          )},
                --{ name = "Savage Whirlwind",                 use = ( (EnergyBar2 >= 300) and timer = "SWEffect"                                    )},
                { name = "Tactical Attack",                  use = ( (EnergyBar1 >= 15)  and (ChkBuffCount("target",_,500081,2))                  )},
                { name = "Open Flank",                       use = ( (EnergyBar1 >= 10)  and tbuffs['Vulnerable']                                )},
                { name = "Tactical Attack",                  use = ( (EnergyBar1 >= 15)  and tbuffs[500081] and (not CD("Probing Attack"))      )},
                --{ name = "Slash",                            use = ( (EnergyBar1 >= 25)  and (timer = "SBleed")                                    )},
                { name = "Probing Attack",                   use = ( (EnergyBar1 >= 20)                                                          )},
                { name = "Slash",                            use = (  EnergyBar1 >= 25                                                            )},
                { name = "Savage Whirlwind",                 use = (  EnergyBar2 >= 300                                                            )},
                { name = "Power of the Wood Spirit",         use = (  EnergyBar2 >= 200                                                            )},
                { name = "Attack",                           use =    true                                                                           },                   
                            }
                end
                
            --Class: Warrior/Rogue
            elseif mainClass == "WARRIOR" and subClass == "THIEF" then
            
            --Potions and Buffs
            Skill = {
                { name = "Poison",                        use = ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                { name = "Survival Instinct",                use = (  phealth <= .49                                                                                        )},
                { name = "Enraged",                          use = (  EnergyBar1 <= 20                                                                                         )},
                { name = "Splitting Chop",                   use = ( (EnergyBar1 >= 15) and tbuffs['Weakened']                                                                )},
                { name = "Open Flank",                       use = ( (EnergyBar1 >= 10) and tbuffs['Vulnerable'] and not tbuffs['Shattered Armor'] and CD("Splitting Chop") )},
                { name = "Keen Attack",                      use = ( (EnergyBar2 >= 20) and tbuffs['Vulnerable']                                                             )},
                { name = "Open Flank",                       use = ( (EnergyBar1 >= 10) and tbuffs['Vulnerable'] and CD("Splitting Chop")                                     )},
                { name = "Probing Attack",                   use = ( (EnergyBar1 >= 20)                                                                                       )},
                { name = "Blood Dance",                      use = (  phealth >= .85                                                                                           )},
                { name = "Slash",                            use = (  EnergyBar1 >= 25                                                                                           )}, 
                { name = "Shadowstab",                       use = (  EnergyBar2 >= 20                                                                                           )},
                { name = "Attack",                           use =    true                                                                                                         },                 
                            }
                end
                
            --Class: Warden/Warrior
            elseif mainClass == "WARDEN" and subClass == "WARRIOR" then
            
            --Potions and Buffs
            Skill = {
                { name = "Briar Shield",                  use = (EnergyBar1 >= 200) and ((not pbuffs['Briar Shield']) or (pbuffs['Briar Shield'].time <= 45)) },
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                { name = "Damage Transfer",                  use = (  phealth <= .25                                    )},    
                { name = "Elven Amulet",                     use = (  phealth <= .35                                    )},
                { name = "Energy Absorb",                    use = (  boss                                              )},                
                { name = "Enraged",                          use = (  EnergyBar2 <= 20                                  )},
                { name = "Pulse Mastery",                    use = ( (EnergyBar2 >= 20) and tbuffs['Beast Sigil']       )},
                { name = "Beast Chop",                       use = ( (EnergyBar2 >= 20)                                 )},
                { name = "Double Chop",                      use = ( (EnergyBar1 >= 100)                                )}, 
                { name = "Will Attack",                      use = (  EnergyBar1 >= 200                                    )},
                { name = "Slash",                            use = (  EnergyBar2 >= 25                                    )},
                { name = "Power of the Wood Spirit",         use = (  EnergyBar1 >= 200                                    )},
                { name = "Attack",                           use =    true                                          }                   
                            }
                end
                
            --ADD MORE CLASS COMBOS HERE. 
            --USE AN "ELSEIF" TO CONTINUE WITH MORE CLASS COMBOS.
            --THE NEXT "END" STATEMENT IS THE END OF THE CLASS COMBOS STATEMENTS.
            --DO NOT POST BELOW THE FOLLOWING "END" STATEMENT!
            end
    --End Player Skill Sequences
    
    if (arg1=="debugskills") then        --Used for printing the skill table, and true/false usability
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
    elseif (arg1=="debugpbuffs") then    --Used for printing your buff names, and buffID
        DIYCE_DebugBuffList(pbuffs)
    elseif (arg1=="debugtbuffs") then    --Used for printing target buff names, and buffID
        DIYCE_DebugBuffList(tbuffs)
    elseif (arg1=="debugall") then        --Used for printing all of the above at the same time
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
        DIYCE_DebugBuffList(pbuffs)
        DIYCE_DebugBuffList(tbuffs)
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    if mainClass == "RANGER" and (not party) then        --To keep scouts from pulling mobs without meaning to.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    elseif mainClass ~= "RANGER" then                    --Let all other classes auto target.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    end
end


In the warrior / warden i can't make the timer work. Everytime i activate the timer the script brokes. Otherwise it works perfectly.

Tyvm for help!

393

Friday, January 27th 2012, 1:46pm

This is not how timer intended to work. It does not return true or false.
Try out this:

Source code

1
{ name = "Savage Whirlwind",   use =  (EnergyBar2 >= 300), timer = "SWEffect" },

hangman04

Savage Warrior

Posts: 113

Location: Romania

Mood: Smile

  • Send private message

394

Sunday, January 29th 2012, 1:21am

Quoted from "synops;505601"

This is not how timer intended to work. It does not return true or false.
Try out this:

Source code

1
{ name = "Savage Whirlwind",   use =  (EnergyBar2 >= 300), timer = "SWEffect" },

Unfortunately doesn't work :(. it has to be smth in the general function but i have no idea what...

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

395

Sunday, January 29th 2012, 1:53am

You must also make sure that this line is uncommented:

Source code

1
            --CreateDIYCETimer("SWEffect", 56) --Change the value between 55 ->  57 depending on your lag.

(remove the two dashes at the front)

If you don't then the timer will have no effect.
2013... The year from hell....

hangman04

Savage Warrior

Posts: 113

Location: Romania

Mood: Smile

  • Send private message

396

Sunday, January 29th 2012, 3:29pm

Quoted from "Peryl;505972"

You must also make sure that this line is uncommented:

Source code

1
            --CreateDIYCETimer("SWEffect", 56) --Change the value between 55 ->  57 depending on your lag.

(remove the two dashes at the front)

If you don't then the timer will have no effect.

Yes off course. When i activate the createtimer the kill sequence just brakes. No skill works. Usually this happens when some variables or function are nor defined correctly. Cause if would be smth in the timer it will broke just that line of the kill sequence. I copied the main lua from mrmisterwaa 's post and added a custom function that i already had (ChkBuffCount).

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

397

Sunday, January 29th 2012, 10:15pm

Quoted from "hangman04;506095"

Yes off course. When i activate the createtimer the kill sequence just brakes. No skill works. Usually this happens when some variables or function are nor defined correctly. Cause if would be smth in the timer it will broke just that line of the kill sequence. I copied the main lua from mrmisterwaa 's post and added a custom function that i already had (ChkBuffCount).


Weird ... mine works perfectly fine ... what error do you get?

398

Tuesday, January 31st 2012, 2:25am

Well, I had every intention of eventually updating the first post of this thread at some point with the most up to date version of the addon zip file, the version that included the timers and other at least two other changes. However, since they chose to ban my main account with no reason at all, that update will now never come. Thanks management team for the uncalled for ban!

399

Wednesday, February 1st 2012, 3:42am

Hey guys, so I have my r/s DIYCE working how I want it. However, I'm having trouble finding a way to make sure that i'm always normal attacking, not only for increased dps but also for energy thief. Can I get some suggestions on how to do it?
The best mind-altering drug is truth.

[LEFT]
[/LEFT]

400

Wednesday, February 1st 2012, 8:26am

you can make a timer for your attack skill to activate every 2 seconds for example, it has no CD and with the next button hit you can use a skill.

Source code

1
{ name="Attack", use=true, timer="Attacktimer" }


and define a timer named Attacktimer at 2 seconds or so.

however this already seems to me like too lazy :))
just move in closer to the boss (supposing you are at the PC when you play)
one advice, because i see too many bot-like features are asked here, please don't make this addon to be banned.
and use this addon as it should be used: a helper, not a substitute.
thank you :)