Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This will run in Rift but it has no real function yet
- -- I would like to make it known where I learned and some of the code I used for this add-on.
- -- A large part of the code was created useing RuneCraft Helper as a guide.
- -- I learned several of the function from Marru, the creater of RiftCount many thanks to you for given me idea's and helping me learn.
- -- Create context for UIFrames
- local context = UI.CreateContext("RiftLoot")
- local riftlootwindow = UI.CreateFrame("RiftWindow", "RiftLoot", context)
- local rlclosebutton = UI.CreateFrame("RiftButton", "RLClosebutton", riftlootwindow)
- local clickOffset = {x = 0, y = 0}
- -- used for the button to close riftlootwindow.
- local function rlHideWindow()
- riftlootwindow:SetVisible(false)
- rlwindowState = 'hide'
- end
- -- used for the button to open riftlootwindow
- local function rlShowWindow()
- riftlootwindow:SetVisible(true)
- rlwindowState = 'show'
- end
- -- this creates the window for riftloot, this will be where you make loot information selections.
- function rlcreatewindow()
- riftlootwindow:SetVisible(false)
- riftlootwindow:SetWidth(800)
- riftlootwindow:SetHeight(800)
- riftlootwindow:SetPoint("CENTER", UIParent, "CENTER")
- riftlootwindow:SetTitle("RiftLoot")
- riftlootwindow:SetLayer(1)
- local rldropdown = UI.CreateFrame("Text", "rldropdown", riftlootwindow)
- rldropdown:SetText("Select Instance")
- rldropdown:SetPoint("CENTER", riftlootwindow, "TOPLEFT", 50, 100)
- rldropdown:SetBackgroundColor(0,0,0,0)
- rlclosebutton:SetText("Close")
- rlclosebutton:SetPoint("BOTTOMCENTER", riftlootwindow, "BOTTOMCENTER", 0, -24)
- function rlclosebutton.Event:LeftPress()
- riftlootwindow:SetVisible(false)
- end
- end
- -- Create riftloot visual button with image riftbutton3.PNG
- function rlcreateButton()
- riftlootbutton = UI.CreateFrame("Texture", "RiftLoot", context)
- riftlootbutton:SetVisible(true)
- riftlootbutton:SetWidth(34)
- riftlootbutton:SetHeight(34)
- riftlootbutton:SetTexture("RiftLoot", "image/riftbutton1.PNG")
- riftlootbutton:SetPoint("TOPLEFT", UIParent, "TOPLEFT", locbutton["x"], locbutton["y"])
- riftlootbutton:SetMouseMasking("limited")
- riftlootbutton:SetLayer(2)
- -- Create riftloot button that you click, this button will not be seen.
- riftlootRealButton = UI.CreateFrame("Texture", "riftloot Real Button", riftlootbutton)
- riftlootRealButton:SetWidth(34)
- riftlootRealButton:SetHeight(34)
- riftlootRealButton:SetPoint("CENTER", riftlootbutton, "CENTER", 0, 0)
- riftlootRealButton.pressed = false
- riftlootRealButton.dragActive = false
- -- Create frame for the tooltip, this will hold the tooltip.
- local rlbuttonTooltip = UI.CreateFrame("Frame", "Tooltip", context)
- rlbuttonTooltip:SetWidth(220)
- rlbuttonTooltip:SetHeight(100)
- rlbuttonTooltip:SetPoint("BOTTOMLEFT", riftlootRealButton, "BOTTOMLEFT", -130, 70)
- rlbuttonTooltip:SetVisible(false)
- -- Create text for the tooltip frame, This is text that will go in the frame.
- local rlbuttonTooltipText = UI.CreateFrame("Text", "window", rlbuttonTooltip)
- rlbuttonTooltipText:SetLayer(4)
- rlbuttonTooltipText:SetText("Rift Loot")
- rlbuttonTooltipText:SetPoint("TOPLEFT", rlbuttonTooltip, "TOPLEFT", 10, 8)
- rlbuttonTooltipText:SetFontColor(0.5, 0.78, 0.19)
- rlbuttonTooltipText:SetFontSize(15)
- rlbuttonTooltipText:ResizeToText()
- local rlseparator = UI.CreateFrame("Mask", "RiftLootSeperator", context)
- rlseparator:SetParent(rlbuttonTooltip)
- rlseparator:SetPoint("CENTERX", rlbuttonTooltip, "CENTERX")
- rlseparator:SetPoint("TOP", rlbuttonTooltipText, "BOTTOM")
- rlseparator:SetWidth(200)
- rlseparator:SetHeight(3)
- rlseparator:SetLayer(4)
- local rlbuttonTooltipBody = UI.CreateFrame("Text", "Rift Loot", rlbuttonTooltip)
- rlbuttonTooltipBody:SetLayer(4)
- rlbuttonTooltipBody:SetText("Left click to open Rift Loot. Right click to drag button")
- rlbuttonTooltipBody:SetPoint("TOPLEFT", rlseparator, "BOTTOMLEFT")
- rlbuttonTooltipBody:SetPoint("BOTTOMRIGHT", rlbuttonTooltip, "TOPLEFT", 200, 70)
- rlbuttonTooltipBody:SetFontColor(1, 1, 1)
- rlbuttonTooltipBody:SetFontSize(13)
- rlbuttonTooltipBody:SetWordwrap(true)
- function riftlootRealButton.Event:MouseIn()
- rlbuttonTooltip:SetVisible(true)
- end
- function riftlootRealButton.Event:MouseOut()
- rlbuttonTooltip:SetVisible(false)
- end
- function riftlootRealButton.Event:LeftDown()
- riftlootRealButton.pressed = true
- end
- function riftlootRealButton.Event:LeftUp()
- if riftlootRealButton.pressed == true then
- if rlwindowState then
- if rlwindowState == 'hide' then
- rlShowWindow()
- else
- rlwindowState = 'show'
- print ("Rift Loot has been closed")
- rlHideWindow()
- end
- end
- riftlootRealButton.pressed = false
- end
- end
- function riftlootRealButton.Event:LeftUpoutside()
- riftlootRealButton.pressed = false
- riftlootbutton:SetTexture("RiftLoot", "riftbutton.PNG")
- end
- -- right click and drag button on screen
- function riftlootRealButton.Event:RightDown()
- riftlootRealButton.dragActive = true
- local mouseStatus = Inspect.Mouse()
- clickOffset["x"] = mouseStatus.x - locbutton["x"]
- clickOffset["y"] = mouseStatus.y - locbutton["y"]
- end
- function riftlootRealButton.Event:RightUp()
- riftlootRealButton.dragActive = false
- end
- function riftlootRealButton.Event:RightUpoutside()
- riftlootRealButton.dragActive = false
- end
- function riftlootRealButton.Event:MouseMove(x,y)
- if riftlootRealButton.dragActive == true then
- locbutton["x"] = x - clickOffset["x"]
- locbutton["y"] = y - clickOffset["y"]
- riftlootbutton:SetPoint("TOPLEFT", context, "TOPLEFT", locbutton["x"], locbutton["y"])
- end
- end
- end
- -- this loads the Addon setting
- local function loadSettings()
- print ("RiftLoot is loaded")
- if rlwindowState then
- if rlwindowState == 'hide' then
- print ("Welcome to RiftLoot vers 1.2")
- end
- else
- rlwindowState = 'show'
- end
- if locbutton == nil then
- locbutton = {x = ((UIParent:GetRight() / 2) - 32), y = ((UIParent:GetBottom() / 2) - 32)}
- end
- rlcreateButton()
- rlcreatewindow()
- end
- function LoadVariables()
- end
- local function rlSlashCommand(params)
- if rlwindowState then
- if rlwindowState == 'hide' then
- rlShowWindow()
- else
- rlwindowState = 'show'
- print ("L")
- rlHideWindow()
- end
- end
- end
- table.insert (Event.Addon.Startup.End, {loadSettings, "RiftLoot", "loadSettings"})
- table.insert (Command.Slash.Register("rlb"), {riftlootbutton1, "RiftLoot", "Slash command"})
- table.insert (Command.Slash.Register("rlc"), {riftlootwindow2, "RiftLoot", "Slash command"})
- table.insert (Command.Slash.Register("rl"), {riftlootwindow1, "RiftLoot", "Slash command"})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement