Repository navigation
Expand file tree
/
Copy pathWCS_BrainIntegrations.lua
More file actions
840 lines (722 loc) · 29.1 KB
/
Copy pathWCS_BrainIntegrations.lua
File metadata and controls
840 lines (722 loc) · 29.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
--[[
WCS_BrainIntegrations.lua - Sistema de Integracion con Addons v6.4.2
Compatible con Lua 5.0 (WoW 1.12 / Turtle WoW)
Integración con addons populares:
- Damage Meters (Recount, DamageMeters, etc.)
- Threat Meters (KTM, Omen, etc.)
- Boss Mods (BigWigs, CTRaidAssist, etc.)
- Unit Frames (Discord Unit Frames, etc.)
- Casting Bars (Quartz, etc.)
]]--
if WCS_Brain and WCS_Brain.ENABLED == false then return end
WCS_BrainIntegrations = WCS_BrainIntegrations or {}
WCS_BrainIntegrations.VERSION = "9.3.0"
WCS_BrainIntegrations.enabled = true
-- ============================================================================
-- CONFIGURACION DE INTEGRACIONES
-- ============================================================================
WCS_BrainIntegrations.Config = {
enableDamageMeters = true,
enableThreatMeters = true,
enableBossMods = true,
enableUnitFrames = true,
enableCastingBars = true,
enablePredictiveAI = true, -- BigWigs AI Evasion
enableSocialFilter = true, -- WIM Auto-Reply
enableNarrativeLore = true, -- QuestVoice Lore Reaction
autoDetect = true,
updateInterval = 1.0,
debugMode = false
}
-- ============================================================================
-- DETECCION DE ADDONS
-- ============================================================================
WCS_BrainIntegrations.DetectedAddons = {
damageMeters = {},
threatMeters = {},
bossMods = {},
unitFrames = {},
castingBars = {},
bagAddons = {},
auctionHouse = {},
questHelpers = {},
actionBars = {},
buffDebuff = {},
combatText = {},
cooldownTrackers = {},
other = {
"Atlas-TW", "Atlas", "DoTimer", "EquipCompare"
}
}
-- Lista de addons conocidos
WCS_BrainIntegrations.KnownAddons = {
-- Damage Meters
damageMeters = {
"Recount", "DamageMeters", "SW_Stats", "Recap", "TinyDPS", "TerrorMeter"
},
-- Threat Meters
threatMeters = {
"KTM", "KLHThreatMeter", "Omen", "ThreatMeter", "ClassicThreatMeter"
},
-- Boss Mods
bossMods = {
"BigWigs", "CTRaidAssist", "CTRA", "BossWarnings", "RaidAlert", "TerrorSquadAI"
},
-- unitFrames
unitFrames = {
"DiscordUnitFrames", "ag_UnitFrames", "Perl", "XPerl", "PitBull", "pfUI", "HealBot"
},
-- Casting Bars
castingBars = {
"Quartz", "eCastingBar", "CastingBarMod", "ImprovedCastBar"
},
-- Bag Addons
bagAddons = {
"Bagnon", "OneBag", "ArkInventory", "Enginventory", "BagBrother"
},
-- Auction House
auctionHouse = {
"Auctioneer", "aux-addon", "BeanCounter", "AuctionMaster"
},
-- Quest Helpers
questHelpers = {
"Questie", "ShaguQuest", "QuestHelper", "MonkeyQuest", "QuestLog", "pfQuest"
},
-- Action Bars
actionBars = {
"Bartender", "Bongos", "CT_BarMod", "Discord_ActionBars", "FlexBar"
},
-- Buff/Debuff
buffDebuff = {
"Buffalo", "Buffwatch", "ClassicAuraDurations", "DebuffTimers"
},
-- Combat Text
combatText = {
"SCT", "MSBT", "Parrot", "CombatText", "xCT"
},
-- Cooldown Trackers
cooldownTrackers = {
"OmniCC", "CooldownCount", "ClassicCastbars", "CooldownTimers"
},
-- Other
other = {
"TerrorNet", "TacticalHUD", "TacticalMap"
}
}
-- Detectar addons instalados
function WCS_BrainIntegrations:DetectAddons()
self:Log("Detectando addons instalados...")
-- Limpiar detecciones previas
for category, _ in self.DetectedAddons do
self.DetectedAddons[category] = {}
end
-- Detectar por categoría
for category, addonList in self.KnownAddons do
for _, addonName in addonList do
if self:IsAddonLoaded(addonName) then
table.insert(self.DetectedAddons[category], addonName)
self:Log("Detectado " .. category .. ": " .. addonName)
end
end
end
-- Mostrar resumen
self:ShowDetectionSummary()
end
-- Verificar si un addon está cargado
function WCS_BrainIntegrations:IsAddonLoaded(addonName)
-- Método 1: Verificar variables globales conocidas
local globalVars = {
["Recount"] = "Recount",
["DamageMeters"] = "DM",
-- Damage Meters adicionales
["SW_Stats"] = "SW_Stats",
["Recap"] = "Recap",
["TinyDPS"] = "TinyDPS",
["TerrorMeter"] = "TerrorMeter",
-- Threat Meters adicionales
["KLHThreatMeter"] = "KLHThreatMeter",
["Omen"] = "Omen",
["ThreatMeter"] = "ThreatMeter",
["ClassicThreatMeter"] = "ClassicThreatMeter",
-- Boss Mods adicionales
["CTRaidAssist"] = "CT_RaidAssist",
["CTRA"] = "CT_RaidAssist",
["BossWarnings"] = "BossWarnings",
["RaidAlert"] = "RaidAlert",
-- Unit Frames adicionales
["ag_UnitFrames"] = "ag_UnitFrames",
["Perl"] = "Perl_Config",
["XPerl"] = "XPerl",
["PitBull"] = "PitBull",
-- Casting Bars adicionales
["eCastingBar"] = "eCastingBar",
["CastingBarMod"] = "CastingBarMod",
["ImprovedCastBar"] = "ImprovedCastBar",
-- Bag Addons
["Bagnon"] = "Bagnon",
["OneBag"] = "OneBag",
["ArkInventory"] = "ArkInventory",
["Enginventory"] = "Enginventory",
["BagBrother"] = "BagBrother",
-- Auction House
["Auctioneer"] = "Auctioneer",
["aux-addon"] = "aux",
["BeanCounter"] = "BeanCounter",
["AuctionMaster"] = "AuctionMaster",
-- Quest Helpers
["Questie"] = "QuestieLoader",
["ShaguQuest"] = "ShaguQuest",
["QuestHelper"] = "QuestHelper",
["MonkeyQuest"] = "MonkeyQuest",
["QuestLog"] = "QuestLog",
-- Action Bars
["Bartender"] = "Bartender",
["Bongos"] = "Bongos",
["CT_BarMod"] = "CT_BarMod",
["Discord_ActionBars"] = "DiscordActionBars",
["FlexBar"] = "FlexBar",
-- Buff/Debuff
["Buffalo"] = "Buffalo",
["Buffwatch"] = "Buffwatch",
["ClassicAuraDurations"] = "ClassicAuraDurations",
["DebuffTimers"] = "DebuffTimers",
-- Combat Text
["SCT"] = "SCT",
["MSBT"] = "MSBTMain",
["Parrot"] = "Parrot",
["CombatText"] = "CombatText",
["xCT"] = "xCT",
-- Cooldown Trackers
["OmniCC"] = "OmniCC",
["CooldownCount"] = "CooldownCount",
["ClassicCastbars"] = "ClassicCastbars",
["CooldownTimers"] = "CooldownTimers"
}
if globalVars[addonName] and _G[globalVars[addonName]] then
return true
end
-- Método 2: Verificar por nombre directo
if _G[addonName] then
return true
end
-- Método 3: Verificar funciones específicas
local specificChecks = {
["Recount"] = function() return Recount and Recount.db end,
["KTM"] = function() return KTM and KTM.GetThreat end,
["BigWigs"] = function() return BigWigs and BigWigs.RegisterModule end,
["Questie"] = function() return QuestieLoader or Questie end,
["aux-addon"] = function() return aux and aux.scan end,
["Bagnon"] = function() return Bagnon and Bagnon.GetVersion end
}
if specificChecks[addonName] and specificChecks[addonName]() then
return true
end
return false
end
-- Mostrar resumen de detección
function WCS_BrainIntegrations:ShowDetectionSummary()
local totalDetected = 0
for category, addons in self.DetectedAddons do
totalDetected = totalDetected + WCS_TableCount(addons)
end
self:Log("=== RESUMEN DE DETECCIÓN ===")
self:Log("Total de addons detectados: " .. totalDetected)
for category, addons in self.DetectedAddons do
if WCS_TableCount(addons) > 0 then
self:Log(string.upper(category) .. ": " .. table.concat(addons, ", "))
end
end
end
-- ============================================================================
-- INTEGRACIÓN CON DAMAGE METERS
-- ============================================================================
WCS_BrainIntegrations.DamageMeters = {}
-- Obtener DPS actual de Recount
function WCS_BrainIntegrations.DamageMeters:GetRecountDPS()
if not Recount or not Recount.db then return 0 end
local playerName = UnitName("player")
local combatData = Recount.db.profile.CombatTimes
if not combatData or not combatData[playerName] then return 0 end
local damage = combatData[playerName].Damage or 0
local time = combatData[playerName].ActiveTime or 1
return time > 0 and (damage / time) or 0
end
-- Obtener datos de DamageMeters
function WCS_BrainIntegrations.DamageMeters:GetDamageMetersData()
if not DM or not DM.GetDamage then return {} end
local playerName = UnitName("player")
return DM.GetDamage(playerName) or {}
end
-- Obtener DPS promedio de cualquier damage meter
function WCS_BrainIntegrations.DamageMeters:GetCurrentDPS()
-- Intentar Recount primero
if WCS_TableCount(WCS_BrainIntegrations.DetectedAddons.damageMeters) > 0 then
for _, addon in WCS_BrainIntegrations.DetectedAddons.damageMeters do
if addon == "Recount" then
return self:GetRecountDPS()
elseif addon == "DamageMeters" then
local data = self:GetDamageMetersData()
return data.dps or 0
end
end
end
return 0
end
-- ============================================================================
-- INTEGRACIÓN CON THREAT METERS
-- ============================================================================
WCS_BrainIntegrations.ThreatMeters = {}
-- Obtener threat de KTM
function WCS_BrainIntegrations.ThreatMeters:GetKTMThreat()
if not KTM or not KTM.GetThreat then return 0, 0 end
local playerThreat = KTM.GetThreat("player", "target") or 0
local maxThreat = 0
-- Obtener threat máximo del grupo/raid
if GetNumRaidMembers() > 0 then
for i = 1, GetNumRaidMembers() do
local unit = "raid" .. i
local threat = KTM.GetThreat(unit, "target") or 0
if threat > maxThreat then
maxThreat = threat
end
end
elseif GetNumPartyMembers() > 0 then
for i = 1, GetNumPartyMembers() do
local unit = "party" .. i
local threat = KTM.GetThreat(unit, "target") or 0
if threat > maxThreat then
maxThreat = threat
end
end
end
return playerThreat, maxThreat
end
-- Obtener porcentaje de threat actual
function WCS_BrainIntegrations.ThreatMeters:GetThreatPercentage()
if WCS_TableCount(WCS_BrainIntegrations.DetectedAddons.threatMeters) > 0 then
for _, addon in WCS_BrainIntegrations.DetectedAddons.threatMeters do
if addon == "KTM" then
local playerThreat, maxThreat = self:GetKTMThreat()
if maxThreat > 0 then
return (playerThreat / maxThreat) * 100
end
end
end
end
return 0
end
-- Verificar si el threat está alto
function WCS_BrainIntegrations.ThreatMeters:IsThreatHigh(threshold)
threshold = threshold or 80 -- 80% por defecto
return self:GetThreatPercentage() > threshold
end
-- ============================================================================
-- INTEGRACIÓN CON BOSS MODS
-- ============================================================================
WCS_BrainIntegrations.BossMods = {}
-- Verificar si hay alerta de boss activa
function WCS_BrainIntegrations.BossMods:HasActiveBossAlert()
-- BigWigs
if BigWigs and BigWigs.inCombat then
return BigWigs.inCombat
end
-- CTRaidAssist
if CTRA_BossWarnings and CTRA_BossWarnings.active then
return CTRA_BossWarnings.active
end
return false
end
-- Obtener información del boss actual
function WCS_BrainIntegrations.BossMods:GetCurrentBossInfo()
local info = {
name = "",
phase = 0,
abilities = {},
warnings = {}
}
-- Intentar obtener de BigWigs
if BigWigs and BigWigs.currentBoss then
info.name = BigWigs.currentBoss.name or ""
info.phase = BigWigs.currentBoss.phase or 0
end
return info
end
-- ============================================================================
-- IA PREDICTIVA: BIGWIGS (Evasión de Mascotas)
-- ============================================================================
function WCS_BrainIntegrations.BossMods:InitPredictiveAI()
if not BigWigs or not BigWigs.TriggerEvent then return end
-- Si ya fue hookeado, salir
if self.predictiveHooked then return end
self.predictiveHooked = true
WCS_BrainIntegrations:Log("Iniciando conexión neuronal con BigWigs...")
local originalTrigger = BigWigs.TriggerEvent
BigWigs.TriggerEvent = function(selfObject, eventName, ...)
-- Capturar eventos
if eventName == "BigWigs_Message" and WCS_BrainIntegrations.Config.enablePredictiveAI then
local text = arg and arg[1] or ""
local priority = arg and arg[2] or "Info"
-- Si es una alerta Urgente o Importante
if priority == "Urgent" or priority == "Important" or priority == "Alarm" then
-- Evaluar si es daño en área masivo
local lowerText = string.lower(text)
if string.find(lowerText, "void zone") or string.find(lowerText, "incoming") or string.find(lowerText, "meteor") or string.find(lowerText, "run") then
-- Activar evasión de mascota
if UnitExists("pet") and not UnitIsDeadOrGhost("pet") then
-- Forzar a la mascota a regresar
PetFollow()
if WCS_BrainPetChat then
WCS_BrainPetChat:SendChat("¡" .. text .. "! Regresando al lado del amo.")
end
end
end
end
end
return originalTrigger(selfObject, eventName, unpack(arg))
end
end
-- ============================================================================
-- INTEGRACIÓN CON UNIT FRAMES
-- ============================================================================
WCS_BrainIntegrations.UnitFrames = {}
-- Obtener información extendida del target
function WCS_BrainIntegrations.UnitFrames:GetExtendedTargetInfo()
local info = {
name = UnitName("target") or "",
level = UnitLevel("target") or 0,
classification = UnitClassification("target") or "",
creatureType = UnitCreatureType("target") or "",
health = UnitHealth("target") or 0,
maxHealth = UnitHealthMax("target") or 1,
mana = UnitMana("target") or 0,
maxMana = UnitManaMax("target") or 0,
buffs = {},
debuffs = {}
}
-- Obtener buffs y debuffs si hay unit frames avanzados
if DiscordUnitFrames then
-- Discord Unit Frames tiene funciones extendidas
info.buffs = self:GetTargetBuffs()
info.debuffs = self:GetTargetDebuffs()
end
return info
end
-- Obtener buffs del target
function WCS_BrainIntegrations.UnitFrames:GetTargetBuffs()
local buffs = {}
for i = 1, 16 do
local texture = UnitBuff("target", i)
if texture then
table.insert(buffs, {
index = i,
texture = texture,
name = "Unknown" -- WoW 1.12 no tiene UnitBuff con nombre
})
end
end
return buffs
end
-- Obtener debuffs del target
function WCS_BrainIntegrations.UnitFrames:GetTargetDebuffs()
local debuffs = {}
for i = 1, 16 do
local texture, stacks = UnitDebuff("target", i)
if texture then
table.insert(debuffs, {
index = i,
texture = texture,
stacks = stacks or 1,
name = "Unknown"
})
end
end
return debuffs
end
-- ============================================================================
-- SISTEMA DE HOOKS Y CALLBACKS
-- ============================================================================
WCS_BrainIntegrations.Hooks = {
damageCallbacks = {},
threatCallbacks = {},
bossCallbacks = {}
}
-- Registrar callback para eventos de damage
function WCS_BrainIntegrations:RegisterDamageCallback(callback)
table.insert(self.Hooks.damageCallbacks, callback)
end
-- Registrar callback para eventos de threat
function WCS_BrainIntegrations:RegisterThreatCallback(callback)
table.insert(self.Hooks.threatCallbacks, callback)
end
-- Registrar callback para eventos de boss
function WCS_BrainIntegrations:RegisterBossCallback(callback)
table.insert(self.Hooks.bossCallbacks, callback)
end
-- Ejecutar callbacks de damage
function WCS_BrainIntegrations:FireDamageCallbacks(data)
for _, callback in self.Hooks.damageCallbacks do
if type(callback) == "function" then
callback(data)
end
end
end
-- ============================================================================
-- IA PREDICTIVA: WIM & QUESTVOICE
-- ============================================================================
WCS_BrainIntegrations.WorldAIFrame = CreateFrame("Frame", "WCS_WorldAIFrame")
WCS_BrainIntegrations.WorldAIFrame:RegisterEvent("CHAT_MSG_WHISPER")
WCS_BrainIntegrations.WorldAIFrame:RegisterEvent("QUEST_DETAIL")
WCS_BrainIntegrations.WorldAIFrame:RegisterEvent("QUEST_GREETING")
WCS_BrainIntegrations.WorldAIFrame:SetScript("OnEvent", function()
-- WIM / Whispers (Secretario Social)
if event == "CHAT_MSG_WHISPER" and WCS_BrainIntegrations.Config.enableSocialFilter then
local msg = arg1
local sender = arg2
-- Si estamos en combate crítico (< 30% HP), auto-responder
if UnitAffectingCombat("player") then
local hpPct = (UnitHealth("player") / UnitHealthMax("player")) * 100
if hpPct < 30 then
-- Responder por el jugador
SendChatMessage("[WCS Neural] El amo está en combate crítico y a punto de morir. Responderá luego.", "WHISPER", nil, sender)
if WCS_BrainPetChat then
WCS_BrainPetChat:SendChat("He interceptado un susurro de " .. sender .. " para que no te distraigas, amo.")
end
end
end
end
-- QUESTVOICE / Misiones (Consciencia Narrativa)
if (event == "QUEST_DETAIL" or event == "QUEST_GREETING") and WCS_BrainIntegrations.Config.enableNarrativeLore then
local text = GetQuestText and GetQuestText() or ""
if text and text ~= "" and WCS_BrainPetChat and UnitExists("pet") then
local lText = string.lower(text)
-- Búsqueda de patrones
if string.find(lText, "kill") or string.find(lText, "matar") or string.find(lText, "slay") then
WCS_BrainPetChat:SendChat("¿Más sangre? Este npc me agrada.")
elseif string.find(lText, "bring") or string.find(lText, "fetch") or string.find(lText, "traer") then
WCS_BrainPetChat:SendChat("No somos mulas de carga... pero si tú lo dices, amo.")
elseif string.find(lText, "boar") or string.find(lText, "jabal") then
WCS_BrainPetChat:SendChat("Olor a cerdo... mis favoritos para rostizar.")
end
end
end
end)
-- ============================================================================
-- INTEGRACIÓN CON WCS_BRAIN
-- ============================================================================
-- Modificar decisiones basado en datos de addons
function WCS_BrainIntegrations:ModifyBrainDecision(spell, score, category)
local modifiedScore = score
-- Modificar basado en threat
if self.Config.enableThreatMeters and self.ThreatMeters:IsThreatHigh(75) then
-- Reducir agresividad si threat está alto
if category == "damage" then
modifiedScore = modifiedScore * 0.7
self:DebugLog("Reduciendo agresividad por threat alto: " .. spell)
elseif category == "utility" and spell == "Soulshatter" then
modifiedScore = modifiedScore * 1.5 -- Priorizar Soulshatter
end
end
-- Modificar basado en boss mods
if self.Config.enableBossMods and self.BossMods:HasActiveBossAlert() then
-- En combate de boss, priorizar supervivencia
if category == "survival" then
modifiedScore = modifiedScore * 1.2
end
end
-- Modificar basado en DPS actual
if self.Config.enableDamageMeters then
local currentDPS = self.DamageMeters:GetCurrentDPS()
if currentDPS > 0 then
-- Si el DPS está bajo, priorizar hechizos de daño
local expectedDPS = UnitLevel("player") * 10 -- DPS esperado básico
if currentDPS < expectedDPS * 0.8 then
if category == "damage" then
modifiedScore = modifiedScore * 1.1
end
end
end
end
return modifiedScore
end
-- Hook WCS_BrainAI para integrar modificaciones
function WCS_BrainIntegrations:HookBrainAI()
if not WCS_BrainAI then return end
-- Guardar función original si no existe
if not self.originalCalculateSpellScore then
self.originalCalculateSpellScore = WCS_BrainAI.CalculateSpellScore
end
-- Override con integración de addons
WCS_BrainAI.CalculateSpellScore = function(self, spell, category)
local baseScore = WCS_BrainIntegrations.originalCalculateSpellScore(self, spell, category)
return WCS_BrainIntegrations:ModifyBrainDecision(spell, baseScore, category)
end
end
-- ============================================================================
-- COMANDOS
-- ============================================================================
function WCS_BrainIntegrations:RegisterCommands()
SLASH_WCSINTEGRATION1 = "/wcsint"
SlashCmdList["WCSINTEGRATION"] = function(msg)
local args = {}
for word in string.gfind(msg, "%S+") do
table.insert(args, string.lower(word))
end
if not args[1] or args[1] == "help" then
self:ShowHelp()
elseif args[1] == "detect" then
self:DetectAddons()
elseif args[1] == "status" then
self:ShowStatus()
elseif args[1] == "dps" then
self:ShowDPSInfo()
elseif args[1] == "threat" then
self:ShowThreatInfo()
elseif args[1] == "boss" then
self:ShowBossInfo()
elseif args[1] == "toggle" and args[2] then
self:ToggleIntegration(args[2])
elseif args[1] == "debug" then
self:ToggleDebug()
else
self:Log("Comando desconocido. Usa /wcsint help")
end
end
end
function WCS_BrainIntegrations:ShowHelp()
self:Log("=== COMANDOS DE INTEGRACIÓN ===")
self:Log("/wcsint detect - Detectar addons instalados")
self:Log("/wcsint status - Ver estado de integraciones")
self:Log("/wcsint dps - Mostrar información de DPS")
self:Log("/wcsint threat - Mostrar información de threat")
self:Log("/wcsint boss - Mostrar información de boss")
self:Log("/wcsint toggle <tipo> - Activar/desactivar integración")
self:Log("/wcsint debug - Toggle modo debug")
self:Log("Tipos: damage, threat, boss, unitframes, casting")
end
function WCS_BrainIntegrations:ShowStatus()
self:Log("=== ESTADO DE INTEGRACIONES ===")
self:Log("Damage Meters: " .. (self.Config.enableDamageMeters and "ON" or "OFF"))
self:Log("Threat Meters: " .. (self.Config.enableThreatMeters and "ON" or "OFF"))
self:Log("Boss Mods: " .. (self.Config.enableBossMods and "ON" or "OFF"))
self:Log("Unit Frames: " .. (self.Config.enableUnitFrames and "ON" or "OFF"))
self:Log("Casting Bars: " .. (self.Config.enableCastingBars and "ON" or "OFF"))
self:ShowDetectionSummary()
end
function WCS_BrainIntegrations:ShowDPSInfo()
if not self.Config.enableDamageMeters then
self:Log("Integración con Damage Meters desactivada")
return
end
local dps = self.DamageMeters:GetCurrentDPS()
self:Log("=== INFORMACIÓN DE DPS ===")
self:Log("DPS Actual: " .. string.format("%.1f", dps))
if WCS_TableCount(self.DetectedAddons.damageMeters) > 0 then
self:Log("Addons detectados: " .. table.concat(self.DetectedAddons.damageMeters, ", "))
else
self:Log("No se detectaron damage meters")
end
end
function WCS_BrainIntegrations:ShowThreatInfo()
if not self.Config.enableThreatMeters then
self:Log("Integración con Threat Meters desactivada")
return
end
local threatPct = self.ThreatMeters:GetThreatPercentage()
self:Log("=== INFORMACIÓN DE THREAT ===")
self:Log("Threat Actual: " .. string.format("%.1f%%", threatPct))
self:Log("Threat Alto: " .. (self.ThreatMeters:IsThreatHigh() and "SÍ" or "NO"))
if WCS_TableCount(self.DetectedAddons.threatMeters) > 0 then
self:Log("Addons detectados: " .. table.concat(self.DetectedAddons.threatMeters, ", "))
else
self:Log("No se detectaron threat meters")
end
end
function WCS_BrainIntegrations:ToggleIntegration(type)
local configMap = {
damage = "enableDamageMeters",
threat = "enableThreatMeters",
boss = "enableBossMods",
unitframes = "enableUnitFrames",
casting = "enableCastingBars"
}
local configKey = configMap[type]
if not configKey then
self:Log("Tipo de integración inválido: " .. type)
return
end
self.Config[configKey] = not self.Config[configKey]
self:Log("Integración " .. type .. ": " .. (self.Config[configKey] and "ON" or "OFF"))
end
function WCS_BrainIntegrations:ToggleDebug()
self.Config.debugMode = not self.Config.debugMode
self:Log("Modo debug: " .. (self.Config.debugMode and "ON" or "OFF"))
end
-- ============================================================================
-- UTILIDADES
-- ============================================================================
function WCS_BrainIntegrations:Log(message)
DEFAULT_CHAT_FRAME:AddMessage("|cFF9482C9[WCS Integration]|r " .. message)
end
function WCS_BrainIntegrations:DebugLog(message)
if self.Config.debugMode then
self:Log("[DEBUG] " .. message)
end
end
-- ============================================================================
-- INICIALIZACIÓN
-- ============================================================================
function WCS_BrainIntegrations:Initialize()
self:RegisterCommands()
-- Detectar addons automáticamente
if self.Config.autoDetect then
self:DetectAddons()
end
-- Hook WCS_BrainAI si está disponible
self:HookBrainAI()
-- Iniciar IA Predictiva (BossMods)
if self.Config.enablePredictiveAI then
-- Retrasar 2 segundos para asegurar que BigWigs esté cargado
C_Timer_After = function(t, f)
local fr = CreateFrame("Frame")
fr.t = 0
fr:SetScript("OnUpdate", function()
this.t = this.t + arg1
if this.t >= t then
this:SetScript("OnUpdate", nil)
f()
end
end)
end
C_Timer_After(2, function()
self.BossMods:InitPredictiveAI()
end)
end
self:Log("Sistema de Integraciones v" .. self.VERSION .. " inicializado")
end
-- Auto-inicialización
if WCS_BrainCore and WCS_BrainCore.RegisterModule then
WCS_BrainCore:RegisterModule("Integrations", WCS_BrainIntegrations)
end
-- Inicialización manual
local function InitializeIntegrations()
if WCS_BrainIntegrations then
WCS_BrainIntegrations:Initialize()
end
end
-- Registrar eventos
if not WCS_BrainIntegrations.initialized then
local frame = CreateFrame("Frame")
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("VARIABLES_LOADED")
frame:SetScript("OnEvent", function()
if event == "ADDON_LOADED" and arg1 == "WCS_Brain" then
InitializeIntegrations()
WCS_BrainIntegrations.initialized = true
elseif event == "VARIABLES_LOADED" then
-- Re-detectar addons después de que todos estén cargados
if WCS_BrainIntegrations.initialized then
WCS_BrainIntegrations:DetectAddons()
end
end
end)
end