-- Registering Slash Commands (begin -->) SLASH_ORC_ADMININTERFACE1 = "/orca"; SLASH_ORC_ADMININTERFACE2 = "/odjursraidcounciladmin"; SlashCmdList["ORC_ADMININTERFACE"] = function() ORC_FrameAdmin:SetFrameStrata("HIGH"); ORC_FrameAdmin:Show(); ORC_FrameAdminLoot:Show(); end -- Registering Slash Commands (<-- end) -- Global variables (begin -->) ORCA_settings = ""; ORCA_loot = {}; ORCA_allItems = false; ORCA_lastposition = -30; -- Global variables (<-- end) -- local variables (begin -->) local ORCA_VERSIONNUMBER = "1.0(a)"; -- local variables (<-- end) -- Registering SendAddonMessage-Prefix (--> begin) RegisterAddonMessagePrefix("ORC_USER"); -- Registering SendAddonMessage-Prefix (<-- end) -- Creating EventHandler for CHAT_MSG_ADDON (--> begin) local function eventHandlerAddonMsg(self, event, arg1, prefix, message, channel, sender) if (event == "CHAT_MSG_ADDON") then if (prefix == "ORC_USER") then -- do stuff end end end -- Creating EventHandler for CHAT_MSG_ADDON (<-- end) ---- CORE FUNCTIONS (begin -->) -- Sending Items to the raid users (begin -->) local function SendItems() -- send all items at once for i = 1, GetNumLootItems() do local lootIcon, lootName, _, quality, _ = GetLootSlotInfo(i); local lootLink = GetLootSlotLink(i); ORCA_loot[i] = string.join("*", lootIcon, lootName, quality, lootLink); end SendAddonMessage("ORC_LOOT", "loot", "WHISPER", UnitName("player")); end -- Sending Items to the raid users (<-- end) -- Creating loot frames (begin -->) local function CreateLootFrames(buttonNumber) -- Creating border frame (begin -->) newFrame = CreateFrame("Frame", nil, ORC_content); newFrame:SetSize(160, 70); newFrame:SetPoint("TOPLEFT", "ORC_FrameAdminLoot", "TOPLEFT", 20, ORCA_lastposition); newFrame:SetBackdrop( { bgFile = ORC_backdropfile, edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 } }); -- Creating border frame (<-- end) -- Create Loot Button (begin ->) local newButton = CreateFrame("Button", nil, newFrame, "ItemButtonTemplate"); newButton:SetSize(32, 32); newButton:SetPoint("TOPLEFT", newFrame, "TOPLEFT", 20, -20); -- Create Loot Button (<-- end) -- Create Call Vote Button (begin ->) local newButton = CreateFrame("Button", nil, newFrame, "UIPanelButtonTemplate"); newButton:SetSize(70, 20); newButton:SetPoint("TOPLEFT", newFrame, "TOPLEFT", 70, -18); newButton:SetText("Call Vote"); -- Create Call Vote Button (<-- end) -- Create LootRoll Button (begin ->) local newButton2 = CreateFrame("Button", nil, newFrame, "UIPanelButtonTemplate"); newButton2:SetSize(70, 20); newButton2:SetPoint("TOPLEFT", newFrame, "TOPLEFT", 70, -38); newButton2:SetText("Loot Roll"); -- Create LootRoll Button (<-- end) ORCA_lastposition = ORCA_lastposition - 70; end -- Creating loot Frames (<-- end) ---- CORE FUNCTIONS (<-- end) -- Creating General EventHandler (begin -->) local function eventHandler(self, event, arg1, ...) if (event == "LOOT_OPENED") then if (ORCA_allItems == true) then SendItems() end ORC_FrameAdmin:Show(); end if (event == "ADDON_LOADED" and arg1 == "ORC_Admin") then print("Odjurs Raid Council (Admin) v. " .. ORCA_VERSIONNUMBER .. " wurde geladen!"); end end -- Creating General EventHandler (<-- end) ------ Creating the necessary objects (begin -->) ---- Creating the event whisperer frames (begin -->) ---- Creating event handler (begin -->) -- Creating the event whisprer for CHAT_MSG_ADDON (begin -->) newFrame = CreateFrame("Frame"); newFrame:RegisterEvent("CHAT_MSG_ADDON"); newFrame:SetScript("OnEvent", eventHandlerAddonMsg); -- Creating the event whisperer for CHAT_MSG_ADDON (<-- end) -- Creating general event handler (begin -->) local function ORC_FrameAdmin_OnDragStop() ORC_FrameAdmin:StopMovingOrSizing(); ORC_FrameAdminLoot:SetPoint("TOPLEFT", "ORC_FrameAdmin", "TOPLEFT", -210,0); end -- Creating general event handler (<-- end) ---- Creating event handler (<-- end) -- Creating the general event whisperer frame (begin -->) newFrame = CreateFrame("Frame"); newFrame:RegisterEvent("LOOT_OPENED"); newFrame:RegisterEvent("ADDON_LOADED"); newFrame:SetScript("OnEvent", eventHandler); -- Creating the general event whisprer frame (<-- end) ---- Creating the event whisperer frames (<-- end) -- Creating the core frame (begin -->) local newFrame = CreateFrame("Frame", "ORC_FrameAdmin"); newFrame:SetSize(640, 480); newFrame:SetPoint("CENTER"); newFrame:SetBackdrop(ORC_backdropfile); newFrame:SetClampedToScreen(true); newFrame:SetMovable(true); newFrame:EnableMouse(true); newFrame:RegisterForDrag("LeftButton"); newFrame:SetScript("OnDragStart", newFrame.StartMoving); newFrame:SetScript("OnDragStop", function() ORC_FrameAdmin_OnDragStop(); end); newButton = CreateFrame("Button", nil, newFrame, "UIPanelButtonTemplate"); newButton:SetSize(65,20); newButton:SetPoint("CENTER"); newButton:SetScript("OnClick", function() for i = 1, 6 do CreateLootFrames(); end end); newFrame:Hide(); -- Creating the core frame (<-- end) -- Creating the left side frame (begin -->) local newFrame = CreateFrame("Frame", "ORC_FrameAdminLoot"); newFrame:SetSize(200, 480); newFrame:SetBackdrop(ORC_backdropfile); newFrame:SetPoint("TOPLEFT", "ORC_FrameAdmin", "TOPLEFT", -210,0); newFrame:Hide(); -- Creating the left side frame (<-- end) -- Creating the ORC_scrollbar-stuff (begin -->) --scrollframe local scrollframe = CreateFrame("ScrollFrame", nil, ORC_FrameAdminLoot); scrollframe:SetPoint("TOPLEFT", 0, 0); scrollframe:SetPoint("BOTTOMRIGHT", 0, 0); scrollframe:SetBackdrop(ORC_backdropfile); scrollframe:SetScript("OnMouseWheel", function(self, delta) local cur_val = ORC_scrollbar:GetValue() local min_val, max_val = ORC_scrollbar:GetMinMaxValues() if delta < 0 and cur_val < max_val then cur_val = math.min(max_val, cur_val + 1) ORC_scrollbar:SetValue(cur_val + 5) elseif delta > 0 and cur_val > min_val then cur_val = math.max(min_val, cur_val - 1) ORC_scrollbar:SetValue(cur_val - 5) end end); ORC_FrameAdminLoot.scrollframe = scrollframe; --ORC_scrollbar ORC_scrollbar = CreateFrame("Slider", nil, scrollframe, "UIPanelScrollbarTemplate") ORC_scrollbar:SetPoint("TOPLEFT", ORC_FrameAdminLoot, "TOPRIGHT", -4, -16) ORC_scrollbar:SetPoint("BOTTOMLEFT", ORC_FrameAdminLoot, "BOTTOMRIGHT", -4, 16) ORC_scrollbar:SetMinMaxValues(1, 200) ORC_scrollbar:SetValueStep(1) ORC_scrollbar.scrollStep = 1 ORC_scrollbar:SetValue(0) ORC_scrollbar:SetWidth(16) ORC_scrollbar:SetScript("OnValueChanged", function (self, value) self:GetParent():SetVerticalScroll(value) end) local scrollbg = ORC_scrollbar:CreateTexture(nil, "BACKGROUND") scrollbg:SetAllPoints(ORC_scrollbar) scrollbg:SetTexture(0, 0, 0, 0.4) ORC_FrameAdminLoot.scrollbar = ORC_scrollbar --content frame local content = CreateFrame("Frame", "ORC_content", scrollframe) content:SetSize(128, 128); --local ORC_dummyvar = -10; --[[for i = 1, 10 do newButton = CreateFrame("Button", nil, content, "UIPanelButtonTemplate"); newButton:SetSize(65,20); newButton:SetPoint("TOPLEFT", 10, ORC_dummyvar); ORC_dummyvar = ORC_dummyvar - 50; end--]] for i = 1, 10 do newFrame = CreateFrame("Frame", nil, content); newFrame:SetSize(160, 70); newFrame:SetPoint("TOPLEFT", "ORC_FrameAdminLoot", "TOPLEFT", 20, ORCA_lastposition); newFrame:SetBackdrop( { bgFile = ORC_backdropfile, edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 } }); --[[ local newButton = CreateFrame("Button", nil, newFrame, "ItemButtonTemplate"); newButton:SetSize(32, 32); newButton:SetPoint("TOPLEFT", newFrame, "TOPLEFT", 20, -20); local newButton = CreateFrame("Button", nil, newFrame, "UIPanelButtonTemplate"); newButton:SetSize(70, 20); newButton:SetPoint("TOPLEFT", newFrame, "TOPLEFT", 70, -18); newButton:SetText("Call Vote"); local newButton2 = CreateFrame("Button", nil, newFrame, "UIPanelButtonTemplate"); newButton2:SetSize(70, 20); newButton2:SetPoint("TOPLEFT", newFrame, "TOPLEFT", 70, -38); newButton2:SetText("Loot Roll");--]] ORCA_lastposition = ORCA_lastposition - 70; end scrollframe.content = content; scrollframe:SetScrollChild(content); ------ Creating the necessary objects (<-- end)