local kills = 0;
local frameButtons = {}
local scriptsTable = {}
----chat cluster
local chatCluster = {ChatFrame1, GeneralDockManager, ChatFrame1EditBox, ChatFrameMenuButton,
QuickJoinToastButton}
--main frame of the script
local UIConfig = CreateFrame("Frame", "Minimize Frame", UIParent, nil);
UIConfig:SetSize(128, 512);
UIConfig:SetScale(.75);
UIConfig.skeleton = UIConfig:CreateTexture("testFrame_skele", "BACKGROUND");
UIConfig.skeleton:SetPoint("TOPLEFT");
UIConfig.skeleton:SetTexture("Interface/AddOns/Minimize/Media/minimizeBlack.tga");
--point, relativeFrame, relativePoint, xOffset, yoffset
UIConfig:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT");
UIConfig:SetMovable(true);
UIConfig:EnableMouse(true);
UIConfig:SetClampedToScreen(true);
UIConfig:RegisterForDrag("LeftButton");
UIConfig:SetScript("OnDragStart", UIConfig.StartMoving)
UIConfig:SetScript("OnDragStop", UIConfig.StopMovingOrSizing)
UIConfig.title = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
UIConfig.title:SetPoint("TOP", 0, -20);
UIConfig.title:SetText("Minimize");
--kill label tracking
UIConfig.textLabel = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge");
UIConfig.textLabel:SetPoint("TOP", 0, -35);
UIConfig.textLabel:SetText("Kills: ");
UIConfig.textLabel2 = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontRedLarge");
UIConfig.textLabel2:SetPoint("TOP", 25, -35);
UIConfig.textLabel2:SetText(kills);
--create scripts for each button
scriptsTable.hideConfig = function() frameButtons[11]:Show() UIConfig:Hide() checkBagStatus() end
scriptsTable.checkPlayer = function() if(PlayerFrame:IsShown()) then PlayerFrame:Hide() else PlayerFrame:Show() end end
scriptsTable.checkChat = function() if(ChatFrame1:IsShown()) then for i = 1, #chatCluster do chatCluster[i]:Hide(); end
else for i = 1, #chatCluster do chatCluster[i]:Show(); end end end
scriptsTable.checkMap = function() if(MinimapCluster:IsShown()) then MinimapCluster:Hide() else MinimapCluster:Show(); end end
scriptsTable.checkQuests = function() if(ObjectiveTrackerFrame:IsShown()) then ObjectiveTrackerFrame:Hide() else ObjectiveTrackerFrame:Show() end end
scriptsTable.checkBag = function() if(ContainerFrame1:IsShown()) then CloseAllBags() else OpenAllBags() scriptsTable.hideConfig() end end
scriptsTable.checkBagStatus = function() if(ContainerFrame1:IsShown()) then frameButtons[5]:SetText("Close Bag") else frameButtons[5]:SetText("Bag") end end
scriptsTable.hideHelperButton = function() UIConfig:Show() frameButtons[11]:Hide() checkBagStatus() end
local function setScriptsAndText()
for i = 1, #frameButtons do
if(i == 1) then
frameButtons[i]:SetText("Player")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) scriptsTable.checkPlayer() end)
elseif(i == 2) then
frameButtons[i]:SetText("Chat")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) scriptsTable.checkChat() end)
elseif(i == 3) then
frameButtons[i]:SetText("Map")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) scriptsTable.checkMap() end)
elseif(i == 4) then
frameButtons[i]:SetText("Quests")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) scriptsTable.checkQuests() end)
elseif(i == 5) then
frameButtons[i]:SetText("Bag")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) scriptsTable.checkBag() end)
elseif(i == 6) then
frameButtons[i]:SetText("Friends")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) ToggleFriendsFrame(1) end)
elseif(i == 7) then
frameButtons[i]:SetText("Character")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) ToggleCharacter("PaperDollFrame") end)
elseif(i == 8) then
frameButtons[i]:SetText("Spell")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) ToggleSpellBook("spell") end)
elseif(i == 9) then
frameButtons[i]:SetText("World")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) ToggleWorldMap() end)
elseif(i == 10) then
frameButtons[i]:SetText("Hide")
frameButtons[i]:SetScript("OnClick", function(self, button ,down) scriptsTable.hideConfig() end)
else
frameButtons[i]:SetText('Minimize')
frameButtons[i]:SetScript("OnEnter", function(self) self:SetAlpha(.8) end)
frameButtons[i]:SetScript("OnClick", function() scriptsTable.hideHelperButton() end)
end
end
UIConfig:SetScript("OnEnter", function(self) scriptsTable.checkBagStatus() end)
end
--child frames and regions:
local function createButtons()
local x = 0;
for i = 1, 11 do
if(i <= 4) then
frameButtons[i] = CreateFrame("Button", nil, UIConfig, "SecureHandlerClickTemplate");
frameButtons[i]:SetNormalTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetHighlightTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetAlpha(.9);
frameButtons[i]:RegisterForClicks("LeftButtonUp");
frameButtons[i]:SetNormalFontObject("GameFontHighlightLarge");
frameButtons[i]:SetSize(100, 40)
frameButtons[i]:SetPoint("top", UIConfig, "top", 0, -52.5 + x);
elseif(i > 4) and (i < 10) then
frameButtons[i] = CreateFrame("Button", nil, UIConfig, "SecureHandlerClickTemplate");
frameButtons[i]:SetNormalTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetHighlightTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetAlpha(.9);
frameButtons[i]:RegisterForClicks("LeftButtonUp");
frameButtons[i]:SetNormalFontObject("GameFontHighlightLarge");
frameButtons[i]:SetSize(80,40)
frameButtons[i]:SetPoint("top", UIConfig, "top", 9, -52.5 + x);
elseif(i < 11) then
frameButtons[i] = CreateFrame("Button", nil, UIConfig, "SecureHandlerClickTemplate");
frameButtons[i]:SetNormalTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetHighlightTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetAlpha(.9);
frameButtons[i]:RegisterForClicks("LeftButtonUp");
frameButtons[i]:SetNormalFontObject("GameFontHighlightLarge");
frameButtons[i]:SetSize(100, 40)
frameButtons[i]:SetPoint("top", UIConfig, "top", 0, -52.5 + x);
else
frameButtons[i] = CreateFrame("Button", nil, UIParent, "SecureHandlerClickTemplate");
frameButtons[i]:SetNormalTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetHighlightTexture("Interface/AddOns/Minimize/Media/sb.tga");
frameButtons[i]:SetAlpha(.9);
frameButtons[i]:RegisterForClicks("LeftButtonUp");
frameButtons[i]:SetNormalFontObject("GameFontHighlightLarge");
frameButtons[i]:SetSize(100, 40)
frameButtons[i]:SetPoint("BOTTOMRIGHT",0,0)
frameButtons[i]:Hide();
end
x = -45 * i;
end
return setScriptsAndText()
end
createButtons();
function killFrame_OnEvent(...)
local self, wowEvent, timestamp, combatlogEvent, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = ...
if (combatlogEvent == "PARTY_KILL") then
print(sourceName .. " killed " .. destName);
kills = kills + 1;
UIConfig.textLabel2:SetText(kills);
end
end
function killFrame_OnLoad()
UIConfig:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
UIConfig:SetScript("OnEvent", killFrame_OnEvent)
end
killFrame_OnLoad();