-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMultiBotHandler.lua
744 lines (591 loc) · 26.2 KB
/
MultiBotHandler.lua
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
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
-- TIMER --
MultiBot:SetScript("OnUpdate", function(pSelf, pElapsed)
if(MultiBot.auto.invite) then MultiBot.timer.invite.elapsed = MultiBot.timer.invite.elapsed + pElapsed end
if(MultiBot.auto.talent) then MultiBot.timer.talent.elapsed = MultiBot.timer.talent.elapsed + pElapsed end
if(MultiBot.auto.stats) then MultiBot.timer.stats.elapsed = MultiBot.timer.stats.elapsed + pElapsed end
if(MultiBot.auto.stats and MultiBot.timer.stats.elapsed >= MultiBot.timer.stats.interval) then
for i = 1, GetNumPartyMembers() do SendChatMessage("stats", "WHISPER", nil, UnitName("party" .. i)) end
MultiBot.timer.stats.elapsed = 0
end
if(MultiBot.auto.talent and MultiBot.timer.talent.elapsed >= MultiBot.timer.talent.interval) then
MultiBot.talent.setTalents()
MultiBot.timer.talent.elapsed = 0
MultiBot.auto.talent = false
end
if(MultiBot.auto.invite and MultiBot.timer.invite.elapsed >= MultiBot.timer.invite.interval) then
local tTable = MultiBot.index[MultiBot.timer.invite.roster]
if(MultiBot.isMember(tTable[MultiBot.timer.invite.index]) == false) then
SendChatMessage(MultiBot.doReplace(MultiBot.info.inviting, "NAME", tTable[MultiBot.timer.invite.index]), "SAY")
SendChatMessage(".playerbot bot add " .. tTable[MultiBot.timer.invite.index], "SAY")
MultiBot.timer.invite.needs = MultiBot.timer.invite.needs - 1
end
if(MultiBot.timer.invite.needs == 0 or tIndex == table.getn(tTable)) then
MultiBot.timer.invite.rooster = ""
MultiBot.timer.invite.index = 1
MultiBot.timer.invite.needs = 0
MultiBot.auto.invite = false
return
end
MultiBot.timer.invite.index = MultiBot.timer.invite.index + 1
MultiBot.timer.invite.elapsed = 0
end
end)
-- HANDLER --
MultiBot:SetScript("OnEvent", function()
if(event == "PLAYER_LOGOUT") then
local tX, tY = MultiBot.toPoint(MultiBot.frames["MultiBar"])
MultiBotSave["MultiBarPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.inventory)
MultiBotSave["InventoryPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.spellbook)
MultiBotSave["SpellbookPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.itemus)
MultiBotSave["ItemusPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.iconos)
MultiBotSave["IconosPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.stats)
MultiBotSave["StatsPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.reward)
MultiBotSave["RewardPoint"] = tX .. ", " .. tY
local tX, tY = MultiBot.toPoint(MultiBot.talent)
MultiBotSave["TalentPoint"] = tX .. ", " .. tY
local tPortal = MultiBot.frames["MultiBar"].frames["Masters"].frames["Portal"]
MultiBotSave["MemoryGem1"] = MultiBot.SavePortal(tPortal.buttons["Red"])
MultiBotSave["MemoryGem2"] = MultiBot.SavePortal(tPortal.buttons["Green"])
MultiBotSave["MemoryGem3"] = MultiBot.SavePortal(tPortal.buttons["Blue"])
local tValue = MultiBot.doSplit(MultiBot.frames["MultiBar"].frames["Left"].buttons["Attack"].texture, "\\")[5]
tValue = string.sub(tValue, 1, string.len(tValue) - 4)
MultiBotSave["AttackButton"] = tValue
local tValue = MultiBot.doSplit(MultiBot.frames["MultiBar"].frames["Left"].buttons["Flee"].texture, "\\")[5]
tValue = string.sub(tValue, 1, string.len(tValue) - 4)
MultiBotSave["FleeButton"] = tValue
MultiBotSave["AutoRelease"] = MultiBot.IF(MultiBot.auto.release, "true", "false")
MultiBotSave["NecroNet"] = MultiBot.IF(MultiBot.necronet.state, "true", "false")
MultiBotSave["Reward"] = MultiBot.IF(MultiBot.reward.state, "true", "false")
return
end
-- ADDON:LOADED --
if(event == "ADDON_LOADED" and arg1 == "MultiBot") then
if(MultiBotSave["MultiBarPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["MultiBarPoint"], ", ")
MultiBot.frames["MultiBar"].setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["InventoryPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["InventoryPoint"], ", ")
MultiBot.inventory.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["SpellbookPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["SpellbookPoint"], ", ")
MultiBot.spellbook.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["ItemusPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["ItemusPoint"], ", ")
MultiBot.itemus.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["IconosPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["IconosPoint"], ", ")
MultiBot.iconos.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["StatsPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["StatsPoint"], ", ")
MultiBot.stats.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["RewardPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["RewardPoint"], ", ")
MultiBot.reward.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["TalentPoint"] ~= nil) then
local tPoint = MultiBot.doSplit(MultiBotSave["TalentPoint"], ", ")
MultiBot.talent.setPoint(tonumber(tPoint[1]), tonumber(tPoint[2]))
end
if(MultiBotSave["MemoryGem1"] ~= nil) then
local tGem = MultiBot.frames["MultiBar"].frames["Masters"].frames["Portal"].buttons["Red"]
MultiBot.LoadPortal(tGem, MultiBotSave["MemoryGem1"])
end
if(MultiBotSave["MemoryGem2"] ~= nil) then
local tGem = MultiBot.frames["MultiBar"].frames["Masters"].frames["Portal"].buttons["Green"]
MultiBot.LoadPortal(tGem, MultiBotSave["MemoryGem2"])
end
if(MultiBotSave["MemoryGem3"] ~= nil) then
local tGem = MultiBot.frames["MultiBar"].frames["Masters"].frames["Portal"].buttons["Blue"]
MultiBot.LoadPortal(tGem, MultiBotSave["MemoryGem3"])
end
if(MultiBotSave["AttackButton"] ~= nil) then
if(MultiBotSave["AttackButton"] == "attack") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Attack"].buttons["Attack"]
tButton.doRight(tButton)
elseif(MultiBotSave["AttackButton"] == "attack_ranged") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Attack"].buttons["Ranged"]
tButton.doRight(tButton)
elseif(MultiBotSave["AttackButton"] == "attack_melee") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Attack"].buttons["Melee"]
tButton.doRight(tButton)
elseif(MultiBotSave["AttackButton"] == "attack_healer") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Attack"].buttons["Healer"]
tButton.doRight(tButton)
elseif(MultiBotSave["AttackButton"] == "attack_dps") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Attack"].buttons["Dps"]
tButton.doRight(tButton)
elseif(MultiBotSave["AttackButton"] == "attack_tank") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Attack"].buttons["Tank"]
tButton.doRight(tButton)
end
end
if(MultiBotSave["FleeButton"] ~= nil) then
if(MultiBotSave["FleeButton"] == "flee") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Flee"]
tButton.doRight(tButton)
elseif(MultiBotSave["FleeButton"] == "flee_ranged") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Ranged"]
tButton.doRight(tButton)
elseif(MultiBotSave["FleeButton"] == "flee_melee") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Melee"]
tButton.doRight(tButton)
elseif(MultiBotSave["FleeButton"] == "flee_healer") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Healer"]
tButton.doRight(tButton)
elseif(MultiBotSave["FleeButton"] == "flee_dps") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Dps"]
tButton.doRight(tButton)
elseif(MultiBotSave["FleeButton"] == "flee_tank") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Tank"]
tButton.doRight(tButton)
elseif(MultiBotSave["FleeButton"] == "flee_target") then
local tButton = MultiBot.frames["MultiBar"].frames["Left"].frames["Flee"].buttons["Target"]
tButton.doRight(tButton)
end
end
if(MultiBotSave["AutoRelease"] ~= nil) then
local tButton = MultiBot.frames["MultiBar"].frames["Main"].buttons["Release"]
if(MultiBotSave["AutoRelease"] == "true")
then tButton.setDisable()
else tButton.setEnable()
end
tButton.doLeft(tButton)
end
if(MultiBotSave["NecroNet"] ~= nil) then
local tButton = MultiBot.frames["MultiBar"].frames["Masters"].buttons["NecroNet"]
if(MultiBotSave["NecroNet"] == "true")
then tButton.setDisable()
else tButton.setEnable()
end
tButton.doLeft(tButton)
end
if(MultiBotSave["Reward"] ~= nil) then
local tButton = MultiBot.frames["MultiBar"].frames["Main"].buttons["Reward"]
if(MultiBotSave["Reward"] == "true")
then tButton.setDisable()
else tButton.setEnable()
end
tButton.doLeft(tButton)
end
return
end
-- PLAYER:ENTERING --
if(event == "PLAYER_ENTERING_WORLD") then
if(MultiBot.init == nil) then
SendChatMessage(".playerbot bot list", "SAY")
MultiBot.init = true
return
end
return
end
-- CHAT:SYSTEM --
if(event == "CHAT_MSG_SYSTEM") then
if(MultiBot.isInside(arg1, "Possible strategies")) then
local tStrategies = MultiBot.doSplit(arg1, ", ")
SendChatMessage("=== STRATEGIES ===", "SAY")
for i = 1, table.getn(tStrategies) do SendChatMessage(i .. " : " .. tStrategies[i], "SAY") end
end
if(MultiBot.isInside(arg1, "Whisper any of")) then
local tCommands = MultiBot.doSplit(arg1, ", ")
SendChatMessage("=== WHISPER-COMMANDS ===", "SAY")
for i = 1, table.getn(tCommands) do SendChatMessage(i .. " : " .. tCommands[i], "SAY") end
end
if(MultiBot.auto.release and MultiBot.isInside(arg1, "已经死亡")) then
SendChatMessage("release", "WHISPER", nil, MultiBot.doReplace(arg1, "已经死亡。", ""))
end
if(MultiBot.auto.release and MultiBot.isInside(arg1, "ist tot", "has dies", "has died")) then
SendChatMessage("release", "WHISPER", nil, MultiBot.doSplit(arg1, " ")[1])
end
if(string.sub(arg1, 1, 12) == "Bot roster: ") then
local tLocClass, tClass, tLocRace, tRace, tSex, tName = GetPlayerInfoByGUID(UnitGUID("player"))
tClass = MultiBot.toClass(tClass)
local tPlayer = MultiBot.addSelf(tClass, tName).setDisable()
tPlayer.class = tClass
tPlayer.name = tName
tPlayer.doLeft = function(pButton)
SendChatMessage(".playerbot bot self", "SAY")
MultiBot.OnOffSwitch(pButton)
end
-- PLAYERBOTS --
local tTable = MultiBot.doSplit(string.sub(arg1, 13), ", ")
for key, value in pairs(tTable) do
local tBot = MultiBot.doSplit(value, " ")
local tName = string.sub(tBot[1], 2)
local tClass = MultiBot.toClass(tBot[2])
local tOnline = string.sub(tBot[1], 1, 1)
local tPlayer = MultiBot.addPlayer(tClass, tName).setDisable()
tPlayer.doRight = function(pButton)
if(pButton.state == false) then return end
SendChatMessage(".playerbot bot remove " .. pButton.name, "SAY")
if(pButton.parent.frames[pButton.name] ~= nil) then pButton.parent.frames[pButton.name]:Hide() end
pButton.setDisable()
end
tPlayer.doLeft = function(pButton)
if(pButton.state) then
if(pButton.parent.frames[pButton.name] ~= nil) then MultiBot.ShowHideSwitch(pButton.parent.frames[pButton.name]) end
else
SendChatMessage(".playerbot bot add " .. pButton.name, "SAY")
pButton.setEnable()
end
end
end
-- MEMBERBOTS --
for i = 1, 50 do
local tName, tRank, tIndex, tLevel, tClass = GetGuildRosterInfo(i)
-- Ensure that the Counter is not bigger than the Amount of Members in Guildlist
if(tName ~= nil and tLevel ~= nil and tClass ~= nil and tName ~= UnitName("player")) then
local tMember = MultiBot.addMember(tClass, tLevel, tName).setDisable()
tMember.doRight = function(pButton)
if(pButton.state == false) then return end
SendChatMessage(".playerbot bot remove " .. pButton.name, "SAY")
if(pButton.parent.frames[pButton.name] ~= nil) then pButton.parent.frames[pButton.name]:Hide() end
pButton.setDisable()
end
tMember.doLeft = function(pButton)
if(pButton.state) then
if(pButton.parent.frames[pButton.name] ~= nil) then MultiBot.ShowHideSwitch(pButton.parent.frames[pButton.name]) end
else
SendChatMessage(".playerbot bot add " .. pButton.name, "SAY")
pButton.setEnable()
end
end
else
break
end
end
-- FRIENDBOTS --
for i = 1, 50 do
local tName, tLevel, tClass = GetFriendInfo(i)
-- Ensure that the Counter is not bigger than the Amount of Members in Friendlist
if(tName ~= nil and tLevel ~= nil and tClass ~= nil and tName ~= UnitName("player")) then
local tFriend = MultiBot.addFriend(tClass, tLevel, tName).setDisable()
tFriend.doRight = function(pButton)
if(pButton.state == false) then return end
SendChatMessage(".playerbot bot remove " .. pButton.name, "SAY")
if(pButton.parent.frames[pButton.name] ~= nil) then pButton.parent.frames[pButton.name]:Hide() end
pButton.setDisable()
end
tFriend.doLeft = function(pButton)
if(pButton.state) then
if(pButton.parent.frames[pButton.name] ~= nil) then MultiBot.ShowHideSwitch(pButton.parent.frames[pButton.name]) end
else
SendChatMessage(".playerbot bot add " .. pButton.name, "SAY")
pButton.setEnable()
end
end
else
break
end
end
-- REFRESH:RAID --
if(GetNumRaidMembers() > 4) then
for i = 1, GetNumRaidMembers() do
local tName = UnitName("raid" .. i)
SendChatMessage(".playerbot bot add " .. tName, "SAY")
end
return
end
-- REFRESH:GROUP --
if(GetNumPartyMembers() > 0) then
for i = 1, GetNumPartyMembers() do
local tName = UnitName("party" .. i)
SendChatMessage(".playerbot bot add " .. tName, "SAY")
end
return
end
return
end
if(MultiBot.isInside(arg1, "player already logged in")) then
local tName = string.sub(arg1, 6, string.find(arg1, " ", 6) - 1)
local tButton = MultiBot.frames["MultiBar"].frames["Units"].buttons[tName]
if(tButton == nil) then return end
if(MultiBot.isMember(tName)) then
tButton.waitFor = "CO"
SendChatMessage(MultiBot.doReplace(MultiBot.info.combat, "NAME", tName), "SAY")
SendChatMessage("co ?", "WHISPER", nil, tName)
tButton.setEnable()
--MultiBot.doRaid()
return
end
if(GetNumPartyMembers() == 4) then ConvertToRaid() end
MultiBot.doSlash("/invite", tName)
return
end
if(MultiBot.isInside(arg1, "remove: ")) then
local tName = string.sub(arg1, 9, string.find(arg1, " ", 9) - 1)
local tFrame = MultiBot.frames["MultiBar"].frames["Units"].frames[tName]
local tButton = MultiBot.frames["MultiBar"].frames["Units"].buttons[tName]
if(tButton == nil) then return end
if(MultiBot.isInside(arg1, "not your bot")) then
SendChatMessage("leave", "WHISPER", nil, tName)
end
MultiBot.doRemove(MultiBot.index.classes.actives[tButton.class], tButton.name)
MultiBot.doRemove(MultiBot.index.actives, tButton.name)
if(tFrame ~= nil) then tFrame:Hide() end
tButton.setDisable()
--MultiBot.doRaid()
return
end
if(arg1 == "Enable player botAI") then
local tName = UnitName("player")
local tButton = MultiBot.frames["MultiBar"].frames["Units"].buttons[tName]
if(tButton == nil) then return end
tButton.waitFor = "CO"
SendChatMessage(MultiBot.doReplace(MultiBot.info.combat, "NAME", tName), "SAY")
SendChatMessage("co ?", "WHISPER", nil, tName)
tButton.setEnable()
--MultiBot.doRaid()
return
end
if(arg1 == "Disable player botAI") then
local tName = UnitName("player")
local tFrame = MultiBot.frames["MultiBar"].frames["Units"].frames[tName]
local tButton = MultiBot.frames["MultiBar"].frames["Units"].buttons[tName]
if(tButton == nil) then return end
if(tFrame ~= nil) then tFrame:Hide() end
tButton.setDisable()
--MultiBot.doRaid()
return
end
if(MultiBot.isInside(arg1, "Zone:", "zone:")) then
local tPlayer = MultiBot.getBot(UnitName("player"))
if(tPlayer.waitFor ~= "COORDS") then return end
local tLocation = MultiBot.doSplit(arg1, " ")
local tZone = string.sub(tLocation[6], 2, string.len(tLocation[6]) - 1)
local tMap = string.sub(tLocation[3], 2, string.len(tLocation[3]) - 1)
local tTip = MultiBot.doReplace(MultiBot.doReplace(MultiBot.info.teleport, "MAP", tMap), "ZONE", tZone)
tPlayer.memory.goMap = tLocation[2]
tPlayer.memory.tip = MultiBot.doReplace(MultiBot.tips.game.memory, "ABOUT", tTip)
return
end
if(MultiBot.isInside(arg1, "X:") and MultiBot.isInside(arg1, "Y:")) then
local tPlayer = MultiBot.getBot(UnitName("player"))
if(tPlayer.waitFor ~= "COORDS") then return end
local tCoords = MultiBot.doSplit(arg1, " ")
tPlayer.memory.goX = tCoords[2]
tPlayer.memory.goY = tCoords[4]
tPlayer.memory.goZ = tCoords[6]
tPlayer.memory.setEnable()
tPlayer.waitFor = ""
return
end
end
-- CHAT:WHISPER --
if(event == "CHAT_MSG_WHISPER") then
-- Graveyard not ready to talk Bot in the chinese Version --
if(MultiBot.auto.release and arg1 == "在墓地见我") then
MultiBot.frames["MultiBar"].frames["Units"].buttons[arg2].waitFor = "你好"
return
end
if(MultiBot.auto.release and arg1 == "Meet me at the graveyard") then
SendChatMessage("summon", "WHISPER", nil, arg2)
return
end
if(MultiBot.isInside(arg1, "StatsOfPlayer")) then
local tUnit = MultiBot.toUnit(arg2)
MultiBot.stats.frames[tUnit].setStats(arg2, UnitLevel(tUnit), arg1, true)
end
if(arg1 == "stats" and arg2 ~= UnitName("player")) then
local tXP = math.floor(100.0 / UnitXPMax("player") * UnitXP("player"))
local tMana = math.floor(100.0 / UnitManaMax("player") * UnitMana("player"))
SendChatMessage("StatsOfPlayer " .. tXP .. " " .. tMana, "WHISPER", nil, arg2)
end
-- REQUIREMENT --
local tButton = MultiBot.frames["MultiBar"].frames["Units"].buttons[arg2]
if(MultiBot.isInside(arg1, "Hello") and tButton == nil) then
local tUnit = MultiBot.toUnit(arg2)
local tLocClass, tClass = UnitClass(tUnit)
local tLevel = UnitLevel(tUnit)
tButton = MultiBot.addActive(tClass, tLevel, arg2).setDisable()
tButton.doRight = function(pButton)
SendChatMessage(".playerbot bot remove " .. pButton.name, "SAY")
if(pButton.parent.frames[pButton.name] ~= nil) then pButton.parent.frames[pButton.name]:Hide() end
pButton.setDisable()
end
tButton.doLeft = function(pButton)
if(pButton.state) then
if(pButton.parent.frames[pButton.name] ~= nil) then MultiBot.ShowHideSwitch(pButton.parent.frames[pButton.name]) end
else
SendChatMessage(".playerbot bot add " .. pButton.name, "SAY")
pButton.setEnable()
end
end
elseif(tButton == nil) then return end
if(MultiBot.isInside(arg1, "Hello") and tButton.class == "Unknown" and tButton.roster == "friends") then
local tName = ""
local tLevel = ""
local tClass = ""
for i = 1, 50 do
tName, tLevel, tClass = GetFriendInfo(i)
if(tName == arg2) then break end
if(tName == nil) then break end
end
local tClass = MultiBot.toClass(tClass)
local tTable = MultiBot.index.classes[tButton.roster][tButton.class]
local tIndex = 0
for i = 1, table.getn(tTable) do
if(tTable[i] == arg2) then
tIndex = i
break
end
end
if(tIndex > 0) then
if(MultiBot.index.classes[tButton.roster][tClass] == nil) then MultiBot.index.classes[tButton.roster][tClass] = {} end
table.remove(MultiBot.index.classes[tButton.roster][tButton.class], tIndex)
table.insert(MultiBot.index.classes[tButton.roster][tClass], tName)
end
tButton.setTexture("Interface\\AddOns\\MultiBot\\Icons\\class_" .. string.lower(tClass) .. ".blp")
tButton.tip = MultiBot.toTip(tClass, tLevel, tName)
tButton.class = tClass
end
if(MultiBot.isInside(arg1, "Hello")) then
tButton.waitFor = "CO"
SendChatMessage(MultiBot.doReplace(MultiBot.info.combat, "NAME", arg2), "SAY")
SendChatMessage("co ?", "WHISPER", nil, arg2)
--MultiBot.doRaid()
return
end
if(arg1 == "Goodbye!") then
--MultiBot.doRaid()
return
end
-- Graveyard ready to talk Bot in the chinese Version --
if(tButton.waitFor == "你好" and arg1 == "你好") then
SendChatMessage("summon", "WHISPER", nil, arg2)
tButton.waitFor = ""
end
if(tButton.waitFor == "NC" and MultiBot.isInside(arg1, "Strategies: ")) then
tButton.waitFor = ""
tButton.normal = string.sub(arg1, 13)
tFrame = MultiBot.frames["MultiBar"].frames["Units"].addFrame(arg2, tButton.x - tButton.size - 2, tButton.y + 2)
tFrame.class = tButton.class
tFrame.name = tButton.name
MultiBot["add" .. tButton.class](tFrame, tButton.combat, tButton.normal)
MultiBot.addEvery(tFrame, tButton.combat, tButton.normal)
if(MultiBot.index.classes.actives[tButton.class] == nil) then MultiBot.index.classes.actives[tButton.class] = {} end
table.insert(MultiBot.index.classes.actives[tButton.class], tButton.name)
table.insert(MultiBot.index.actives, tButton.name)
tButton.setEnable()
return
end
if(tButton.waitFor == "CO" and MultiBot.isInside(arg1, "Strategies: ")) then
tButton.waitFor = "NC"
tButton.combat = string.sub(arg1, 13)
SendChatMessage(MultiBot.doReplace(MultiBot.info.normal, "NAME", arg2), "SAY")
SendChatMessage("nc ?", "WHISPER", nil, arg2)
return
end
if(tButton.waitFor ~= "ITEM" and tButton.waitFor ~= "SPELL" and MultiBot.auto.stats and MultiBot.isInside(arg1, "Bag")) then
local tUnit = MultiBot.toUnit(arg2)
if(MultiBot.stats.frames[tUnit] == nil) then MultiBot.addStats(MultiBot.stats, "party1", 0, 0, 32, 192, 96) end
MultiBot.stats.frames[tUnit].setStats(arg2, UnitLevel(tUnit), arg1)
return
end
-- Inventory --
if(tButton.waitFor == "INVENTORY" and MultiBot.isInside(arg1, "Inventory", "背包")) then
local tItems = MultiBot.inventory.frames["Items"]
for key, value in pairs(tItems.buttons) do value:Hide() end
table.wipe(tItems.buttons)
MultiBot.inventory.setText("Title", MultiBot.doReplace(MultiBot.info.inventory, "NAME", arg2))
MultiBot.inventory.name = arg2
tItems.index = 0
tButton.waitFor = "ITEM"
SendChatMessage("stats", "WHISPER", nil, arg2)
return
end
if(tButton.waitFor == "ITEM" and MultiBot.isInside(arg1, "Bag,", "Dur", "XP", "背包", "耐久度", "经验值")) then
MultiBot.inventory:Show()
tButton.waitFor = ""
InspectUnit(arg2)
return
end
if(tButton.waitFor == "ITEM") then
MultiBot.addItem(MultiBot.inventory.frames["Items"], arg1)
return
end
-- Spellbook --
if(tButton.waitFor == "SPELLBOOK" and MultiBot.isInside(arg1, "Spells")) then
local tOverlay = MultiBot.spellbook.frames["Overlay"]
local tSpellbook = MultiBot.spellbook
table.wipe(tSpellbook.spells)
tSpellbook.frames["Overlay"].setText("Title", MultiBot.doReplace(MultiBot.info.spellbook, "NAME", arg2))
tSpellbook.name = arg2
tSpellbook.index = 0
tSpellbook.from = 1
tSpellbook.to = 16
tButton.waitFor = "SPELL"
SendChatMessage("stats", "WHISPER", nil, arg2)
return
end
if(tButton.waitFor == "SPELL" and MultiBot.isInside(arg1, "Bag,", "Dur", "XP", "背包", "耐久度", "经验值")) then
local tOverlay = MultiBot.spellbook.frames["Overlay"]
local tSpellbook = MultiBot.spellbook
tSpellbook.now = 1
tSpellbook.max = math.ceil(tSpellbook.index / 16)
tOverlay.setText("Pages", "|cffffffff" .. tSpellbook.now .. "/" .. tSpellbook.max .. "|r")
if(tSpellbook.now == tSpellbook.max) then tOverlay.buttons[">"].doHide() end
tOverlay.buttons["<"].doHide()
tSpellbook:Show()
tButton.waitFor = ""
InspectUnit(arg2)
return
end
if(tButton.waitFor == "SPELL") then
MultiBot.addSpell(arg1)
return
end
-- EQUIPPING --
if(MultiBot.isInside(string.lower(arg1), "equipping", "using", "eating", "drinking", "feasting", "opened", "destroyed")) then
tButton.waitFor = "INVENTORY"
SendChatMessage("items", "WHISPER", nil, tButton.name)
end
return
end
-- QUEST:COMPLETE --
if(event == "QUEST_COMPLETE") then
MultiBot.setRewards()
return
end
-- WORLD:MAP --
if(event == "WORLD_MAP_UPDATE") then
if(MultiBot.necronet.state == false) then return end
local tCont = GetCurrentMapContinent()
local tArea = GetCurrentMapAreaID()
local tZone = GetCurrentMapZone()
if(MultiBot.necronet.cont ~= tCont or MultiBot.necronet.area ~= tArea or MultiBot.necronet.zone ~= tZone) then
for key, value in pairs(MultiBot.necronet.buttons) do value:Hide() end
MultiBot.necronet.cont = tCont
MultiBot.necronet.area = tArea
MultiBot.necronet.zone = tZone
local tTable = MultiBot.necronet.index[tCont]
if(tTable ~= nil) then tTable = tTable[tArea] end
if(tTable ~= nil) then tTable = tTable[tZone] end
if(tTable ~= nil) then for key, value in pairs(tTable) do value:Show() end end
end
return
end
end)
SLASH_MULTIBOT1 = "/multibot"
SLASH_MULTIBOT2 = "/mbot"
SLASH_MULTIBOT3 = "/mb"
SlashCmdList["MULTIBOT"] = function()
if(MultiBot.state) then
for key, value in pairs(MultiBot.frames) do value:Hide() end
MultiBot.state = false
else
for key, value in pairs(MultiBot.frames) do value:Show() end
MultiBot.state = true
end
end