Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------
- -- Credits
- ----------------------------------------
- -- Wowwiki
- -- Kouri
- -- Kollektiv
- -- Lyn
- -- haste
- -- evl
- -- Blizzard AND ANYONE ELSE THAT ADDED CODE TO sARENA ( :P)
- local trinkets = {}
- local wotfs = {}
- local events = CreateFrame("Frame")
- JaxFramesData = {}
- function events:ADDON_LOADED(addonName)
- if addonName ~= "Blizzard_ArenaUI" then return end
- if JaxFramesData["Frame_scale"] then
- ArenaEnemyFrames:SetScale(JaxFramesData["Frame_scale"])
- ArenaPrepFrames:SetScale(JaxFramesData["Frame_scale"])
- else
- ArenaEnemyFrames:SetScale(1.3)
- ArenaPrepFrames:SetScale(1.3)
- end
- ArenaEnemyFrame1:ClearAllPoints()
- ArenaPrepFrame1:ClearAllPoints()
- local arenaFrame, trinket
- if JaxFramesData["Frame_point"] then
- framez = CreateFrame("Frame", WorldFrame, UIParent)
- framez:SetPoint("Center", WorldFrame, "Center");
- framez:SetWidth(150); framez:SetHeight(310);
- framez:SetPoint(JaxFramesData["Frame_point"], JaxFramesData["Frame_relativeTo"], JaxFramesData["Frame_relativePoint"], JaxFramesData["Frame_xOfs"], JaxFramesData["Frame_yOfs"])
- texy = framez:CreateTexture("ARTWORK");
- texy:SetAllPoints();
- texy:SetTexture(1.0, 0, 0); texy:SetAlpha(0.5);
- texy:Hide()
- end
- for i = 1, MAX_ARENA_ENEMIES do
- arenaFrame = "ArenaEnemyFrame"..i
- faction = UnitFactionGroup("arena"..i)
- _, race = UnitRace("arena"..i)
- _G[arenaFrame]:ClearAllPoints()
- if framez then
- point, relativeTo, relativePoint, xOfs, yOfs = texy:GetPoint()
- _G[arenaFrame]:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs-(52*(i-1)))
- _G["ArenaPrepFrame"..i]:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs-(52*(i-1)))
- else
- _G[arenaFrame]:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -187, -200-(52*(i-1)))
- _G["ArenaPrepFrame"..i]:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -187, -200-(52*(i-1)))
- end
- trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", nil)
- trinket:SetPoint("TOPRIGHT", arenaFrame, 32, -6)
- trinket:SetSize(24, 24)
- trinket.icon = trinket:CreateTexture(nil, "BACKGROUND")
- trinket.icon:SetAllPoints()
- -- determine faction and assign appropriate trinket icon
- if(faction == "Alliance") then
- if(race == "HUMAN") then
- trinket.icon:SetTexture("Interface\\Icons\\spell_shadow_charm") --alliance
- else
- trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_01") --alliance
- end
- else
- trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_02") --horde
- end
- trinket:Hide()
- trinkets["arena"..i] = trinket
- trinkets["arena"..i.."usedTime"] = 0
- -- if enemy is undead, create a frame next to the trinket frame for will of the forsaken
- if(race == "UNDEAD") then
- wotf = CreateFrame("Cooldown", arenaFrame.."WOTF", nil)
- wotf:SetPoint("TOPRIGHT", trinket, 32, 0)
- wotf:SetSize(24, 24)
- wotf.icon = wotf:CreateTexture(nil, "BACKGROUND")
- wotf.icon:SetAllPoints()
- wotf.icon:SetTexture("Interface\\Icons\\spell_shadow_raisedead") --wotf(UD)
- wotf:Hide()
- wotfs["arena"..i] = wotf
- wotfs["arena"..i.."usedTime"] = 0
- end
- end
- self:UnregisterEvent("ADDON_LOADED")
- end
- function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
- if not trinkets[unitID] then return end
- if spellID == 59752 or spellID == 42292 then
- CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1)
- trinkets[unitID.."usedTime"] = GetTime()
- SendChatMessage("Trinket used by: "..GetUnitName(unitID, true), "PARTY")
- if((_, race = UnitRace(unitID)) == "UNDEAD") then
- if GetTime()-wotfs[unitID.."usedTime"] > 90 then
- CooldownFrame_SetTimer(wotfs[unitID], GetTime(), 30, 1)
- elseif wotfs[unitID.."usedTime"] == 0 then
- CooldownFrame_SetTimer(wotfs[unitID], GetTime(), 30, 1)
- end
- CooldownFrame_SetTimer(wotfs[unitID], GetTime(), 30, 1) -- wotf frame
- end
- elseif spellID == 7744 then
- if GetTime()-trinkets[unitID.."usedTime"] > 90 then
- CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 30, 1)
- elseif trinkets[unitID.."usedTime"] == 0 then
- CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 30, 1)
- end
- CooldownFrame_SetTimer(wotfs[unitID], GetTime(), 120, 1) -- wotf frame
- SendChatMessage("WotF used by: "..GetUnitName(unitID, true), "PARTY")
- end
- end
- function events:PLAYER_ENTERING_WORLD()
- local _, instanceType = IsInInstance()
- if instanceType == "arena" then
- ArenaEnemyFrame1.SetPoint = function() end
- ArenaEnemyFrame2.SetPoint = function() end
- ArenaEnemyFrame3.SetPoint = function() end
- ArenaEnemyFrame4.SetPoint = function() end
- ArenaEnemyFrame5.SetPoint = function() end
- self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
- elseif self:IsEventRegistered("UNIT_SPELLCAST_SUCCEEDED") then
- self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
- for i = 1, 5 do
- trinkets["arena"..i]:Hide()
- end
- end
- end
- SLASH_JaxFrames1 = "/testarena"
- SlashCmdList["JaxFrames"] = function(msg, editBox)
- if editBox:GetText() == "/testarena" then
- testFrames()
- end
- end
- function testFrames()
- if not IsAddOnLoaded("Blizzard_ArenaUI") then
- LoadAddOn("Blizzard_ArenaUI")
- end
- ArenaEnemyFrames:Show()
- local arenaFrame
- for i = 1, MAX_ARENA_ENEMIES do
- arenaFrame = _G["ArenaEnemyFrame"..i]
- arenaFrame.classPortrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
- arenaFrame.classPortrait:SetTexCoord(unpack(CLASS_ICON_TCOORDS["ROGUE"]))
- arenaFrame.name:SetText("Jax")
- arenaFrame:Show()
- CooldownFrame_SetTimer(trinkets["arena"..i], GetTime(), 120, 1)
- end
- end
- ----------------------------------------
- -- Options Panel Declarations
- ----------------------------------------
- local O = "JaxFramesOptionsPanel"
- panel = CreateFrame( "Frame", O, UIParent );
- panel.name = "JaxFrames";
- local TitleLabel = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
- TitleLabel:SetText("JaxFrames Configuration GUI")
- TitleLabel:SetPoint("TOPLEFT", 16, -16)
- TestMode = CreateFrame("CheckButton", O.."TestMode", panel, "OptionsCheckButtonTemplate")
- TestMode:SetPoint("TOPLEFT", TitleLabel, "BOTTOMLEFT", 0, -16)
- _G[O.."TestModeText"]:SetText("Show Arena Frames (Enable to change scale)")
- function TestMode:OnClick()
- if self:GetChecked() then
- testFrames()
- FrameScaleSlider:Enable()
- else
- if instanceType ~= "arena" then
- if ArenaEnemyFrames then ArenaEnemyFrames:Hide() end
- end
- FrameScaleSlider:Disable()
- for i = 1, MAX_ARENA_ENEMIES do
- trinkets["arena"..i]:SetCooldown(0, 0)
- trinkets["arena"..i]:Hide()
- end
- end
- end
- TestMode:SetScript("OnClick", TestMode.OnClick)
- Unlock = CreateFrame("CheckButton", O.."Unlock", panel, "OptionsCheckButtonTemplate")
- Unlock:SetPoint("TOPLEFT", TitleLabel, "BOTTOMLEFT", 0, -40)
- _G[O.."UnlockText"]:SetText("Unlock Arena Frames (Disable to change scale)")
- function Unlock:OnClick()
- if self:GetChecked() then
- TestMode:Disable()
- FrameScaleSlider:Disable()
- frame = CreateFrame("Frame", WorldFrame, UIParent)
- frame:SetMovable(true)
- frame:EnableMouse(true)
- frame:RegisterForDrag("LeftButton")
- frame:SetScript("OnMouseDown", function(self, button)
- if button == "LeftButton" and not self.isMoving then
- self:StartMoving();
- self.isMoving = true;
- end
- end)
- frame:SetScript("OnMouseUp", function(self, button)
- if button == "LeftButton" and self.isMoving then
- self:StopMovingOrSizing();
- self.isMoving = false;
- end
- end)
- frame:SetScript("OnUpdate", function(self, button)
- if self.isMoving then
- for i = 1, MAX_ARENA_ENEMIES do
- point, relativeTo, relativePoint, xOfs, yOfs = tex:GetPoint()
- arenaFrame = _G["ArenaEnemyFrame"..i]
- arenaFrame:ClearAllPoints()
- arenaFrame:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs-(52*(i-1)))
- p, rt, rp, x, y = frame:GetPoint()
- JaxFramesData["Frame_point"] = p
- JaxFramesData["Frame_relativeTo"] = rt
- JaxFramesData["Frame_relativePoint"] = rp
- JaxFramesData["Frame_xOfs"] = x
- JaxFramesData["Frame_yOfs"] = y
- end
- end
- end)
- if JaxFramesData["Frame_point"] then
- frame:SetPoint("Center", WorldFrame, "Center");
- frame:SetWidth(150);
- frame:SetHeight(310);
- frame:SetPoint(JaxFramesData["Frame_point"], JaxFramesData["Frame_relativeTo"], JaxFramesData["Frame_relativePoint"], JaxFramesData["Frame_xOfs"], JaxFramesData["Frame_yOfs"])
- else
- frame:SetPoint("Center", WorldFrame, "Center");
- frame:SetWidth(150); frame:SetHeight(310);
- end
- tex = frame:CreateTexture("ARTWORK");
- tex:SetAllPoints();
- tex:SetTexture(1.0, 0, 0); tex:SetAlpha(0.5);
- if not JaxFramesData["Frame_point"] then
- for i = 1, MAX_ARENA_ENEMIES do
- point, relativeTo, relativePoint, xOfs, yOfs = tex:GetPoint()
- arenaFrame = _G["ArenaEnemyFrame"..i]
- arenaFrame:ClearAllPoints()
- arenaFrame:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs-(52*(i-1)))
- end
- end
- else
- TestMode:Enable()
- FrameScaleSlider:Enable()
- frame:Hide()
- end
- end
- Unlock:SetScript("OnClick", Unlock.OnClick)
- ----------------------------------------
- -- Slider helper function, thanks to Kollektiv
- ----------------------------------------
- local function CreateSlider(text, parent, low, high, step)
- local name = parent:GetName() .. text
- local slider = CreateFrame("Slider", name, parent, "OptionsSliderTemplate")
- slider:SetWidth(160)
- slider:SetMinMaxValues(low, high)
- slider:SetValueStep(step)
- --_G[name .. "Text"]:SetText(text)
- _G[name .. "Low"]:SetText(low)
- _G[name .. "High"]:SetText(high)
- return slider
- end
- ----------------------------------------
- -- Frame Scale Slider
- ----------------------------------------
- FrameScaleSlider = CreateSlider("FrameScaleSlider", panel, 0.5, 3.0, 0.1)
- FrameScaleSlider:SetScript("OnValueChanged", function(self, value)
- if IsAddOnLoaded("Blizzard_ArenaUI") then
- _G[self:GetName() .. "Text"]:SetText("Scale: " .. " (" .. tonumber(string.format("%." .. 1 .. "f", value)) .. ")")
- ArenaEnemyFrames:SetScale(value)
- ArenaPrepFrames:SetScale(value)
- JaxFramesData["Frame_scale"] = value
- end
- end)
- local FramesLabel = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
- FramesLabel:SetText("Arena Frames Options")
- FramesLabel:SetPoint("TOPLEFT", TestMode, "BOTTOMLEFT", 0, -30)
- FrameScaleSlider:SetPoint("TOPLEFT", FramesLabel, "BOTTOMLEFT", 2, -24)
- FrameScaleSlider:SetScript("OnEnable", function(self, button)
- _G[self:GetName() .. "Text"]:SetTextColor(1, 1, 1, 1)
- if JaxFramesData["Frame_scale"] then
- _G[self:GetName() .. "Text"]:SetText("Scale: " .. " (" .. tonumber(string.format("%." .. 1 .. "f", JaxFramesData["Frame_scale"])) .. ")")
- else
- _G[self:GetName() .. "Text"]:SetText("Scale: " .. " (" .. tonumber(string.format("%." .. 1 .. "f", 1.3)) .. ")")
- end
- end)
- FrameScaleSlider:SetScript("OnDisable", function(self, button)
- _G[self:GetName() .. "Text"]:SetTextColor(0.50, 0.50, 0.50, 1)
- _G[self:GetName() .. "Text"]:SetText("Scale: (Disabled)")
- end)
- FrameScaleSlider:Disable()
- panel.refresh = function()
- if JaxFramesData["Frame_scale"] then
- FrameScaleSlider:SetValue(JaxFramesData["Frame_scale"])
- else
- FrameScaleSlider:SetValue(1.3)
- end
- end
- InterfaceOptions_AddCategory(panel);
- events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
- events:RegisterEvent("ADDON_LOADED")
- events:RegisterEvent("PLAYER_ENTERING_WORLD")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement