/Tukui/modules/misc/damage.lua
Lua | 132 lines | 112 code | 13 blank | 7 comment | 39 complexity | 7a4de1cad65b634ae2010c473d62bc74 MD5 | raw file
1local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales 2 3------------------------------------------------------------- 4-- DAMAGE / HEAL DISPLAY REPLACEMENT FOR EYEFINITY 5-- BECAUSE REGULAR 3D WORLD DAMAGE ISN'T COMPATIBLE 6------------------------------------------------------------- 7 8if not T.eyefinity then return end 9 10local displaydamage = GetCVar("CombatDamage") 11local displayheal = GetCVar("CombatHealing") 12local displaydot = GetCVar("CombatLogPeriodicSpells") 13 14local gflags = bit.bor(COMBATLOG_OBJECT_AFFILIATION_MINE, COMBATLOG_OBJECT_REACTION_FRIENDLY, COMBATLOG_OBJECT_CONTROL_PLAYER, COMBATLOG_OBJECT_TYPE_GUARDIAN) 15 16local function OnEvent(self, event, ...) 17 local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags 18 19 if T.toc < 40200 then 20 timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1,...) 21 else 22 timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = select(1,...) 23 end 24 25 if sourceGUID == UnitGUID("player") or sourceGUID == UnitGUID("pet") or sourceFlags == gflags then 26 -- dmg 27 if displaydamage then 28 if eventType == "SWING_DAMAGE" then 29 local _, amount, critical 30 if T.toc < 40200 then 31 _, amount, _, _, _, _, critical = select(9, ...) 32 else 33 _, _, _, amount, _, _, _, _, critical = select(9, ...) 34 end 35 self:AddMessage(amount, 1, 1, 1) 36 elseif eventType == "SPELL_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" then 37 local _, spellId, spellSchool, amount, critical 38 if T.toc < 40200 then 39 _, spellId, _, spellSchool, amount, _, _, _, _, _, critical = select(9, ...) 40 else 41 _, _, _, spellId, _, spellSchool, amount, _, _, _, _, _, critical = select(9, ...) 42 end 43 if eventType == "SPELL_PERIODIC_DAMAGE" then 44 if displaydot then self:AddMessage(amount, 151/255, 70/255, 194/255) end 45 else 46 self:AddMessage(amount, 1, 1, 0) 47 end 48 elseif eventType == "RANGE_DAMAGE" then 49 local _, spellId, amount, critical 50 if T.toc < 40200 then 51 _, spellId, _, _, amount, _, _, _, _, _, critical = select(9, ...) 52 else 53 _, _, _, spellId, _, _, amount, _, _, _, _, _, critical = select(9, ...) 54 end 55 self:AddMessage(amount, 1, 1, 1) 56 elseif eventType == "SWING_MISSED" then 57 local _, missType 58 if T.toc < 40200 then 59 _, missType, _ = select(9, ...) 60 else 61 _, _, _, missType, _ = select(9, ...) 62 end 63 self:AddMessage(missType, 1, 1, 1) 64 elseif eventType == "SPELL_MISSED" or eventType == "RANGE_MISSED" then 65 local _, spellId, missType 66 if T.toc < 40200 then 67 _, spellId, _, _, missType, _ = select(9,...) 68 else 69 _, _, _, spellId, _, _, missType, _ = select(9,...) 70 end 71 self:AddMessage(missType, 1, 1, 1) 72 end 73 end 74 75 -- heal 76 if displayheal then 77 if eventType == "SPELL_HEAL" or eventType== "SPELL_PERIODIC_HEAL" then 78 local _, amount 79 if T.toc < 40200 then 80 _, _, _, _, amount, _, _, _ = select(9,...) 81 else 82 _, _, _, _, _, _, amount, _, _, _ = select(9,...) 83 end 84 self:AddMessage(amount, 0, 1, 0) 85 end 86 end 87 end 88end 89 90local f = CreateFrame("ScrollingMessageFrame", "TukuiEyefinityDamage", UIParent) 91f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") 92f:SetScript("OnEvent",OnEvent) 93f:SetSize(200, 200) 94f:SetPoint("TOP", 0, -50) 95f:SetFont(C.media.dmgfont,36,"OUTLINE") 96f:SetShadowColor(0,0,0,0) 97f:SetFading(true) 98f:SetFadeDuration(0.5) 99f:SetTimeVisible(1) 100f:SetMaxLines(64) 101f:SetSpacing(2) 102 103local o = CreateFrame("Frame") 104o:RegisterEvent("CVAR_UPDATE") 105o:SetScript("OnEvent", function(self, event, cvar, value) 106 if cvar == "SHOW_DAMAGE_TEXT" then 107 if value == 1 then 108 displaydamage = true 109 else 110 displaydamage = false 111 end 112 end 113 114 if cvar == "LOG_PERIODIC_EFFECTS" then 115 if value == 1 then 116 displaydot = true 117 else 118 displaydot = false 119 end 120 end 121 122 if cvar == "SHOW_COMBAT_HEALING" then 123 if value == 1 then 124 displayheal = true 125 else 126 displayheal = false 127 end 128 end 129end) 130 131-- kill 132InterfaceOptionsCombatTextPanelPetDamage:Kill()