Skip to content

Instantly share code, notes, and snippets.

@Cellane
Created February 7, 2011 23:10
Show Gist options
  • Save Cellane/815484 to your computer and use it in GitHub Desktop.
Save Cellane/815484 to your computer and use it in GitHub Desktop.
-- enable or disable an addon via command
SlashCmdList.DISABLE_ADDON = function(s) DisableAddOn(s) ReloadUI() end
SLASH_DISABLE_ADDON1 = "/disable"
SlashCmdList.ENABLE_ADDON = function(s) EnableAddOn(s) LoadAddOn(s) ReloadUI() end
SLASH_ENABLE_ADDON1 = "/enable"
-- switch to heal layout via a command
local function HEAL()
DisableAddOn("Tukui_Dps_Layout")
EnableAddOn("Tukui_Heal_Layout")
ReloadUI()
end
SLASH_HEAL1 = "/heal"
SlashCmdList["HEAL"] = HEAL
-- switch to dps layout via a command
local function DPS()
DisableAddOn("Tukui_Heal_Layout");
EnableAddOn("Tukui_Dps_Layout")
ReloadUI()
end
SLASH_DPS1 = "/dps"
SlashCmdList["DPS"] = DPS
-- fix combatlog manually when it broke
local function CLFIX()
CombatLogClearEntries()
end
SLASH_CLFIX1 = "/clfix"
SlashCmdList["CLFIX"] = CLFIX
-- a command to show frame you currently have mouseovered
SLASH_FRAME1 = "/frame"
SlashCmdList["FRAME"] = function(arg)
if arg ~= "" then
arg = _G[arg]
else
arg = GetMouseFocus()
end
if arg ~= nil and arg:GetName() ~= nil then
local point, relativeTo, relativePoint, xOfs, yOfs = arg:GetPoint()
ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
ChatFrame1:AddMessage("Name: |cffFFD100"..arg:GetName())
if arg:GetParent() then
ChatFrame1:AddMessage("Parent: |cffFFD100"..arg:GetParent():GetName())
end
ChatFrame1:AddMessage("Width: |cffFFD100"..format("%.2f",arg:GetWidth()))
ChatFrame1:AddMessage("Height: |cffFFD100"..format("%.2f",arg:GetHeight()))
ChatFrame1:AddMessage("Strata: |cffFFD100"..arg:GetFrameStrata())
ChatFrame1:AddMessage("Level: |cffFFD100"..arg:GetFrameLevel())
if xOfs then
ChatFrame1:AddMessage("X: |cffFFD100"..format("%.2f",xOfs))
end
if yOfs then
ChatFrame1:AddMessage("Y: |cffFFD100"..format("%.2f",yOfs))
end
if relativeTo then
ChatFrame1:AddMessage("Point: |cffFFD100"..point.."|r anchored to "..relativeTo:GetName().."'s |cffFFD100"..relativePoint)
end
ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
elseif arg == nil then
ChatFrame1:AddMessage("Invalid frame name")
else
ChatFrame1:AddMessage("Could not find frame info")
end
end
-- enable lua error by command
function SlashCmdList.LUAERROR(msg, editbox)
if (msg == 'on') then
SetCVar("scriptErrors", 1)
-- because sometime we need to /rl to show error.
ReloadUI()
elseif (msg == 'off') then
SetCVar("scriptErrors", 0)
else
print("/luaerror on - /luaerror off")
end
end
SLASH_LUAERROR1 = '/luaerror'
function DisbandRaidGroup()
if InCombatLockdown() then return end -- Prevent user error in combat
SendChatMessage(tukuilocal.disband, "RAID" or "PARTY")
if UnitInRaid("player") then
for i = 1, GetNumRaidMembers() do
local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
if online and name ~= TukuiDB.myname then
UninviteUnit(name)
end
end
else
for i = MAX_PARTY_MEMBERS, 1, -1 do
if GetPartyMember(i) then
UninviteUnit(UnitName("party"..i))
end
end
end
LeaveParty()
end
StaticPopupDialogs["DISBAND_RAID"] = {
text = "Are you sure you want to disband the group?",
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = DisbandRaidGroup,
timeout = 0,
whileDead = 1,
}
SlashCmdList["GROUPDISBAND"] = function()
StaticPopup_Show("DISBAND_RAID")
end
SLASH_GROUPDISBAND1 = '/rd'
--Raid Utility by Elv22
local panel_height = ((TukuiDB.Scale(5)*4) + (TukuiDB.Scale(20)*4))
tukuilocal.core_raidutil = "Raid Utility"
tukuilocal.core_raidutil_disbandgroup = "Disband Group"
tukuilocal.core_raidutil_blue = "Blue"
tukuilocal.core_raidutil_green = "Green"
tukuilocal.core_raidutil_purple = "Purple"
tukuilocal.core_raidutil_red = "Red"
tukuilocal.core_raidutil_white = "Yellow"
tukuilocal.core_raidutil_clear = "Clear"
--Create main frame
local RaidUtilityPanel = CreateFrame("Frame", "RaidUtilityPanel", UIParent)
TukuiDB.CreatePanel(RaidUtilityPanel, TukuiDB.Scale(170), panel_height, "TOP", UIParent, "TOP", -300, panel_height + 2)
local r,g,b,_ = TukuiCF["media"].backdropcolor
RaidUtilityPanel:SetBackdropColor(r,g,b,0.6)
TukuiDB.CreateShadow(RaidUtilityPanel)
--Check if We are Raid Leader or Raid Officer
local function CheckRaidStatus()
local inInstance, instanceType = IsInInstance()
if (UnitIsRaidOfficer("player")) and not (inInstance and (instanceType == "pvp" or instanceType == "arena")) then
return true
else
return false
end
end
--Change border when mouse is inside the button
local function ButtonEnter(self)
local color = RAID_CLASS_COLORS[TukuiDB.myclass]
self:SetBackdropBorderColor(color.r, color.g, color.b)
end
--Change border back to normal when mouse leaves button
local function ButtonLeave(self)
self:SetBackdropBorderColor(unpack(TukuiCF["media"].bordercolor))
end
-- Function to create buttons in this module
local function CreateButton(name, parent, template, width, height, point, relativeto, point2, xOfs, yOfs, text, texture)
local b = CreateFrame("Button", name, parent, template)
b:SetWidth(width)
b:SetHeight(height)
b:SetPoint(point, relativeto, point2, xOfs, yOfs)
b:HookScript("OnEnter", ButtonEnter)
b:HookScript("OnLeave", ButtonLeave)
b:EnableMouse(true)
TukuiDB.SetTemplate(b)
if text then
local t = b:CreateFontString(nil,"OVERLAY",b)
t:SetFont(TukuiCF.media.font,12,"OUTLINE")
t:SetPoint("CENTER")
t:SetJustifyH("CENTER")
t:SetText(text)
elseif texture then
local t = b:CreateTexture(nil,"OVERLAY",nil)
t:SetTexture(texture)
t:SetPoint("TOPLEFT", b, "TOPLEFT", TukuiDB.mult, -TukuiDB.mult)
t:SetPoint("BOTTOMRIGHT", b, "BOTTOMRIGHT", -TukuiDB.mult, TukuiDB.mult)
end
end
--Create button to toggle the frame
CreateButton("ShowButton", RaidUtilityPanel, "SecureHandlerClickTemplate", RaidUtilityPanel:GetWidth() / 2.5, TukuiDB.Scale(18), "TOP", UIParent, "TOP", 0, 2, tukuilocal.core_raidutil, nil)
ShowButton:SetAttribute("_onclick", [=[
if select(5, self:GetPoint()) > 0 then
self:GetParent():ClearAllPoints()
self:GetParent():SetPoint("TOP", UIParent, "TOP", 0, 1)
self:ClearAllPoints()
self:SetPoint("TOP", UIParent, "TOP", 0, -100)
else
self:GetParent():ClearAllPoints()
self:GetParent():SetPoint("TOP", UIParent, "TOP", 0, 500)
self:ClearAllPoints()
self:SetPoint("TOP", UIParent, "TOP", 0, 1)
end
]=])
--Disband Raid button
CreateButton("DisbandRaidButton", RaidUtilityPanel, nil, RaidUtilityPanel:GetWidth() * 0.9, TukuiDB.Scale(18), "TOP", RaidUtilityPanel, "TOP", 0, TukuiDB.Scale(-5), tukuilocal.core_raidutil_disbandgroup, nil)
DisbandRaidButton:SetScript("OnMouseUp", function(self)
if CheckRaidStatus() then
StaticPopup_Show("DISBAND_RAID")
end
end)
--Role Check button
CreateButton("RoleCheckButton", RaidUtilityPanel, nil, RaidUtilityPanel:GetWidth() * 0.9, TukuiDB.Scale(18), "TOP", DisbandRaidButton, "BOTTOM", 0, TukuiDB.Scale(-5), ROLE_POLL, nil)
RoleCheckButton:SetScript("OnMouseUp", function(self)
if CheckRaidStatus() then
InitiateRolePoll()
end
end)
--MainTank Button
CreateButton("MainTankButton", RaidUtilityPanel, "SecureActionButtonTemplate", (DisbandRaidButton:GetWidth() / 2) - TukuiDB.Scale(2), TukuiDB.Scale(18), "TOPLEFT", RoleCheckButton, "BOTTOMLEFT", 0, TukuiDB.Scale(-5), MAINTANK, nil)
MainTankButton:SetAttribute("type", "maintank")
MainTankButton:SetAttribute("unit", "target")
MainTankButton:SetAttribute("action", "set")
--MainAssist Button
CreateButton("MainAssistButton", RaidUtilityPanel, "SecureActionButtonTemplate", (DisbandRaidButton:GetWidth() / 2) - TukuiDB.Scale(2), TukuiDB.Scale(18), "TOPRIGHT", RoleCheckButton, "BOTTOMRIGHT", 0, TukuiDB.Scale(-5), MAINASSIST, nil)
MainAssistButton:SetAttribute("type", "mainassist")
MainAssistButton:SetAttribute("unit", "target")
MainAssistButton:SetAttribute("action", "set")
--Ready Check button
CreateButton("ReadyCheckButton", RaidUtilityPanel, nil, RoleCheckButton:GetWidth() * 0.75, TukuiDB.Scale(18), "TOPLEFT", MainTankButton, "BOTTOMLEFT", 0, TukuiDB.Scale(-5), READY_CHECK, nil)
ReadyCheckButton:SetScript("OnMouseUp", function(self)
if CheckRaidStatus() then
DoReadyCheck()
end
end)
--World Marker button
CreateButton("WorldMarkerButton", RaidUtilityPanel, "SecureHandlerClickTemplate", RoleCheckButton:GetWidth() * 0.2, TukuiDB.Scale(18), "TOPRIGHT", MainAssistButton, "BOTTOMRIGHT", 0, TukuiDB.Scale(-5), nil, "Interface\\RaidFrame\\Raid-WorldPing")
WorldMarkerButton:SetAttribute("_onclick", [=[
if self:GetChildren():IsShown() then
self:GetChildren():Hide()
else
self:GetChildren():Show()
end
]=])
-- Marker Buttons
local function CreateMarkerButton(name, text, point, relativeto, point2)
local f = CreateFrame("Button", name, MarkerFrame, "SecureActionButtonTemplate")
f:SetPoint(point, relativeto, point2, 0, TukuiDB.Scale(-5))
f:SetWidth(MarkerFrame:GetWidth())
f:SetHeight((MarkerFrame:GetHeight() / 6) + TukuiDB.Scale(-5))
f:SetFrameLevel(MarkerFrame:GetFrameLevel() + 1)
f:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
local t = f:CreateFontString(nil,"OVERLAY",f)
t:SetFont(TukuiCF.media.font,12,"OUTLINE")
t:SetText(text)
t:SetPoint("CENTER")
t:SetJustifyH("CENTER")
f:SetAttribute("type", "macro")
end
--Marker Holder Frame
local MarkerFrame = CreateFrame("Frame", "MarkerFrame", WorldMarkerButton)
TukuiDB.SetTemplate(MarkerFrame)
MarkerFrame:SetBackdropColor(r,g,b,0.6)
TukuiDB.CreateShadow(MarkerFrame)
MarkerFrame:SetWidth(RaidUtilityPanel:GetWidth() * 0.4)
MarkerFrame:SetHeight(RaidUtilityPanel:GetHeight()* 1.2)
MarkerFrame:SetPoint("TOPLEFT", WorldMarkerButton, "BOTTOMRIGHT", TukuiDB.Scale(2), TukuiDB.Scale(-2))
MarkerFrame:Hide()
--Setup Secure Buttons
CreateMarkerButton("BlueFlare", "|cff0000FF"..tukuilocal.core_raidutil_blue.."|r", "TOPLEFT", MarkerFrame, "TOPLEFT")
BlueFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button1
]])
CreateMarkerButton("GreenFlare", "|cff00FF00"..tukuilocal.core_raidutil_green.."|r", "TOPLEFT", BlueFlare, "BOTTOMLEFT")
GreenFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button2
]])
CreateMarkerButton("PurpleFlare", "|cffFF00FF"..tukuilocal.core_raidutil_purple.."|r", "TOPLEFT", GreenFlare, "BOTTOMLEFT")
PurpleFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button3
]])
CreateMarkerButton("RedFlare", "|cffFF0000"..tukuilocal.core_raidutil_red.."|r", "TOPLEFT", PurpleFlare, "BOTTOMLEFT")
RedFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button4
]])
CreateMarkerButton("WhiteFlare", "|cffFFFF00"..tukuilocal.core_raidutil_white, "TOPLEFT", RedFlare, "BOTTOMLEFT")
WhiteFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button5
]])
CreateMarkerButton("ClearFlare", tukuilocal.core_raidutil_clear, "TOPLEFT", WhiteFlare, "BOTTOMLEFT")
ClearFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button6
]])
MarkerFrame:SetHeight(MarkerFrame:GetHeight() + TukuiDB.Scale(4))
local function ToggleRaidUtil(self, event)
if InCombatLockdown() then
self:RegisterEvent("PLAYER_REGEN_ENABLED")
return
end
if CheckRaidStatus() then
RaidUtilityPanel:Show()
else
RaidUtilityPanel:Hide()
end
if event == "PLAYER_REGEN_ENABLED" then
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
end
end
--Automatically show/hide the frame if we have RaidLeader or RaidOfficer
local LeadershipCheck = CreateFrame("Frame")
LeadershipCheck:RegisterEvent("RAID_ROSTER_UPDATE")
LeadershipCheck:RegisterEvent("PLAYER_ENTERING_WORLD")
LeadershipCheck:SetScript("OnEvent", ToggleRaidUtil)
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="modules\reloadui.lua"/>
<Script file="modules\variables.lua"/>
<Script file="local\english.lua"/>
<Script file="local\french.lua"/>
<Script file="local\russian.lua"/>
<Script file="local\german.lua"/>
<Script file="local\taiwan.lua"/>
<Script file="local\spanish.lua"/>
<Script file="local\korean.lua"/>
<Script file="config\config.lua"/>
<Script file="config\media.lua"/>
<Script file="modules\configui.lua"/>
<Include file="libs\oUF\oUF.xml"/>
<Script file="libs\oUF_AuraWatch\oUF_AuraWatch.lua"/>
<Script file="libs\oUF_CombatFeedback\oUF_CombatFeedback.lua"/>
<Script file="libs\oUF_DebuffHighlight\oUF_DebuffHighlight.lua"/>
<Script file="libs\oUF_Experience\oUF_Experience.lua"/>
<Script file="libs\oUF_MovableFrames\movable.lua"/>
<Script file="libs\oUF_Reputation\oUF_Reputation.lua"/>
<Script file="libs\oUF_Smooth\oUF_Smooth.lua"/>
<Script file="libs\oUF_ThreatBar\oUF_ThreatBar.lua"/>
<Script file="libs\oUF_TotemBar\oUF_TotemBar.lua"/>
<Script file="libs\oUF_Trinkets\oUF_Trinkets.lua"/>
<Script file="libs\oUF_RaidDebuffs\oUF_RaidDebuffs.lua"/>
<Script file="config\watch.lua"/>
<Script file="modules\colors.lua"/>
<Script file="modules\functions.lua"/>
<Script file="modules\launch.lua"/>
<Script file="modules\temp.lua"/>
<Script file="modules\autodisable.lua"/>
<Script file="modules\watchframe.lua"/>
<Script file="modules\durability.lua"/>
<Script file="modules\vehicle.lua"/>
<Script file="modules\capturebar.lua"/>
<Script file="modules\gm.lua"/>
<Script file="modules\commands.lua"/>
<Script file="modules\quests.lua"/>
<Script file="modules\invite.lua"/>
<Script file="modules\autodez.lua"/>
<Script file="modules\autorelease.lua"/>
<Script file="modules\symbol.lua"/>
<Script file="modules\merchant.lua"/>
<Script file="modules\error.lua"/>
<Script file="modules\bind.lua"/>
<Script file="modules\copyurl.lua"/>
<Script file="modules\item.lua"/>
<Script file="modules\kill.lua"/>
<Script file="modules\spam.lua"/>
<Script file="scripts\font.lua"/>
<Script file="scripts\buffs.lua"/>
<Script file="scripts\minimap.lua"/>
<Script file="scripts\panels.lua"/>
<Script file="datatext\armor.lua"/>
<Script file="datatext\avoidance.lua"/>
<Script file="datatext\bags.lua"/>
<Script file="datatext\battleground.lua"/>
<Script file="datatext\crit.lua"/>
<Script file="datatext\dps.lua"/>
<Script file="datatext\durability.lua"/>
<Script file="datatext\fps.lua"/>
<Script file="datatext\friend.lua"/>
<Script file="datatext\gold.lua"/>
<Script file="datatext\guild.lua"/>
<Script file="datatext\haste.lua"/>
<Script file="datatext\hps.lua"/>
<Script file="datatext\mem.lua"/>
<Script file="datatext\power.lua"/>
<Script file="datatext\time.lua"/>
<Script file="datatext\currency.lua"/>
<Script file="actionbars\Hide.lua"/>
<Script file="actionbars\Bar1.lua"/>
<Script file="actionbars\Bar2.lua"/>
<Script file="actionbars\Bar3.lua"/>
<Script file="actionbars\Bar4.lua"/>
<Script file="actionbars\Bar5.lua"/>
<Script file="actionbars\BarPet.lua"/>
<Script file="actionbars\BarShift.lua"/>
<Script file="actionbars\BarTotem.lua"/>
<Script file="actionbars\Style.lua"/>
<Script file="actionbars\Range.lua"/>
<Script file="actionbars\Others.lua"/>
<Script file="scripts\chat.lua"/>
<Script file="scripts\tooltip.lua"/>
<Script file="scripts\cooldown.lua"/>
<Script file="scripts\nameplates.lua"/>
<Script file="scripts\bags.lua"/>
<Script file="scripts\loot.lua"/>
<Script file="scripts\lootroll.lua"/>
<Script file="scripts\map.lua"/>
<Script file="scripts\mirror.lua"/>
<Script file="scripts\reminder.lua"/>
<Script file="scripts\skin.lua"/>
<Script file="scripts\totemskin.lua"/>
<Script file="scripts\bubbles.lua"/>
<Script file="scripts\raidutility.lua"/>
<Include file="unitframes\templates.xml"/>
<Script file="unitframes\tags.lua"/>
<Script file="unitframes\layout.lua"/>
<Script file="pvp\interrupticons.lua"/>
<Script file="class\priest.lua"/>
<Script file="class\hunter.lua"/>
</Ui>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment