Quantcast
WoWInterface: SVN - fernir_UI - Rev 2 - /combattext.lua

WoWInterface SVN fernir_UI

[/] [combattext.lua] - Rev 2

Compare with Previous | Blame | View Log

local settings = oUF_Settings

local startx, endx = 285, 285
local starty, endy = 500, 250
local Scale = 0.8
local locations = {
        startX = startx / Scale,
        endX = endx / Scale,
        startY = starty / Scale,
        endY = endy / Scale,
}


local function OnEvent(self, event, addon)
        if(addon=="Blizzard_CombatText") then
                CombatTextFont:SetFont("Fonts\\FRIZQT__.TTF", 25, "THINOUTLINE")
                CombatTextFont:SetShadowColor(0.19, 0.19, 0.19, 0)

                COMBAT_TEXT_DEFLECT = "Deflect"
                COMBAT_TEXT_REFLECT = "Reflect"
                COMBAT_TEXT_IMMUNE = "Immune"
                COMBAT_TEXT_RESIST = "Resist"
                COMBAT_TEXT_ABSORB = "Absorb"
                COMBAT_TEXT_BLOCK = "Block"
                COMBAT_TEXT_DODGE = "Dodge"
                COMBAT_TEXT_PARRY = "Parry"
                COMBAT_TEXT_EVADE = "Evade"
                COMBAT_TEXT_MISS = "Miss"

                DEFLECT = "Deflect"
                REFLECT = "Reflect"
                IMMUNE = "Immune"
                RESIST = "Resist"
                ABSORB = "Absorb"
                BLOCK = "Block"
                DODGE = "Dodge"
                PARRY = "Parry"
                EVADE = "Evade"
                MISS = "Miss"

                BLOCK_TRAILER = "(Block %d)"
                ABSORB_TRAILER = "(Absorb %d)"
                RESIST_TRAILER = "(Resist %d)"

                ENTERING_COMBAT = "++COMBAT++"
                LEAVING_COMBAT = "--COMBAT--"

                COMBAT_TEXT_SCROLLSPEED = 3.2

                function CombatText_UpdateDisplayedMessages()
                        if ( UnitHasVehicleUI("player") ) then
                                CombatText.unit = "vehicle"
                        else
                                CombatText.unit = "player"
                        end
                        CombatTextSetActiveUnit(CombatText.unit)
                        
                        CombatText:SetScale(Scale)
                        CombatTextFont:SetFont(settings.font, 23, "THINOUTLINE")

                        CombatText:RegisterEvent("COMBAT_TEXT_UPDATE")
                        CombatText:RegisterEvent("UNIT_HEALTH")
                        CombatText:RegisterEvent("UNIT_MANA")
                        CombatText:RegisterEvent("PLAYER_REGEN_DISABLED")
                        CombatText:RegisterEvent("PLAYER_REGEN_ENABLED")
                        CombatText:RegisterEvent("PLAYER_COMBO_POINTS")
                        CombatText:RegisterEvent("RUNE_POWER_UPDATE")
                        CombatText:RegisterEvent("UNIT_ENTERED_VEHICLE")
                        CombatText:RegisterEvent("UNIT_EXITING_VEHICLE")

                        COMBAT_TEXT_Y_SCALE = WorldFrame:GetHeight() / 768
                        COMBAT_TEXT_X_SCALE = WorldFrame:GetWidth() / 1024
                        COMBAT_TEXT_SPACING = 10 * COMBAT_TEXT_Y_SCALE
                        COMBAT_TEXT_MAX_OFFSET = 130 * COMBAT_TEXT_Y_SCALE
                        COMBAT_TEXT_X_ADJUSTMENT = 80 * COMBAT_TEXT_X_SCALE

                        for index, value in pairs(COMBAT_TEXT_TYPE_INFO) do
                                if ( value.var ) then
                                        if ( getglobal(value.var) == "1" ) then
                                                value.show = 1;
                                        else
                                                value.show = nil;
                                        end
                                end
                        end

                        COMBAT_TEXT_SCROLL_FUNCTION = CombatText_StandardScroll
                        COMBAT_TEXT_LOCATIONS = locations

                        CombatText_ClearAnimationList()
                end

                self:UnregisterEvent"ADDON_LOADED"
                OnEvent = nil
        end
end

local eventframe = CreateFrame"Frame"
eventframe:RegisterEvent"ADDON_LOADED"
eventframe:SetScript("OnEvent", OnEvent)

if IsAddOnLoaded"Blizzard_CombatText" then OnEvent(eventframe, "ADDON_LOADED", "Blizzard_CombatText") end

Compare with Previous | Blame