diff --git a/api/api.lua b/api/api.lua index b8851bc5..3f96c45b 100644 --- a/api/api.lua +++ b/api/api.lua @@ -1,7 +1,6 @@ -local _G = getfenv(0) - pfUI.api = { } - +pfUI.api._G = getfenv(0) +local _G = getfenv(0) -- [ strsplit ] -- Splits a string using a delimiter. -- 'delimiter' [string] characters that will be interpreted as delimiter @@ -115,7 +114,7 @@ end -- Loads and update the configured position of the specified frame. -- It also creates an entry in the movables table. -- 'frame' [frame] the frame that should be updated. -function pfUI.api:UpdateMovable(frame) +function pfUI.api.UpdateMovable(frame) local name = frame:GetName() if pfUI_config.global.offscreen == "0" then @@ -146,7 +145,7 @@ end -- 'parent' [frame] the frame's anchor point -- 'spacing' [number] the padding that should be used between the -- frame and its parent frame -function pfUI.api:SetAutoPoint(frame, parent, spacing) +function pfUI.api.SetAutoPoint(frame, parent, spacing) --[[ a b max @@ -215,7 +214,7 @@ end -- 'inset' [int] backdrop inset, defaults to border size. -- 'legacy' [bool] use legacy backdrop instead of creating frames. -- 'transp' [bool] force default transparency of 0.8. -function pfUI.api:CreateBackdrop(f, inset, legacy, transp) +function pfUI.api.CreateBackdrop(f, inset, legacy, transp) -- use default inset if nothing is given local border = inset if not border then @@ -281,7 +280,7 @@ end -- 'cr' [int] mouseover color (red), defaults to classcolor. -- 'cg' [int] mouseover color (green), defaults to classcolor. -- 'cb' [int] mouseover color (blue), defaults to classcolor. -function pfUI.api:SkinButton(button, cr, cg, cb) +function pfUI.api.SkinButton(button, cr, cg, cb) local b = getglobal(button) if not b then b = button end if not cr or not cg or not cb then @@ -289,7 +288,7 @@ function pfUI.api:SkinButton(button, cr, cg, cb) local color = RAID_CLASS_COLORS[class] cr, cg, cb = color.r , color.g, color.b end - pfUI.api:CreateBackdrop(b, nil, true) + pfUI.api.CreateBackdrop(b, nil, true) b:SetNormalTexture(nil) b:SetHighlightTexture(nil) b:SetPushedTexture(nil) @@ -298,12 +297,12 @@ function pfUI.api:SkinButton(button, cr, cg, cb) local funcl = b:GetScript("OnLeave") b:SetScript("OnEnter", function() if funce then funce() end - pfUI.api:CreateBackdrop(b, nil, true) + pfUI.api.CreateBackdrop(b, nil, true) b:SetBackdropBorderColor(cr,cg,cb,1) end) b:SetScript("OnLeave", function() if funcl then funcl() end - pfUI.api:CreateBackdrop(b, nil, true) + pfUI.api.CreateBackdrop(b, nil, true) end) b:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE") end @@ -315,7 +314,7 @@ end -- 'no' [function] function that is triggered on 'Cancel' button. -- 'editbox' [bool] if set, a inputfield will be shown. it can be. -- accessed with "GetParent().input". -function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) +function pfUI.api.CreateQuestionDialog(text, yes, no, editbox) -- do not allow multiple instances of question dialogs if pfQuestionDialog and pfQuestionDialog:IsShown() then pfQuestionDialog:Hide() @@ -342,7 +341,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) question:SetScript("OnMouseUp",function() this:StopMovingOrSizing() end) - pfUI.api:CreateBackdrop(question) + pfUI.api.CreateBackdrop(question) -- text question.text = question:CreateFontString("Status", "LOW", "GameFontNormal") @@ -354,7 +353,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) -- editbox if editbox then question.input = CreateFrame("EditBox", "pfQuestionDialogEdit", question) - pfUI.api:CreateBackdrop(question.input) + pfUI.api.CreateBackdrop(question.input) question.input:SetTextColor(.2,1,.8,1) question.input:SetJustifyH("CENTER") question.input:SetAutoFocus(false) @@ -368,7 +367,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) -- buttons question.yes = CreateFrame("Button", "pfQuestionDialogYes", question, "UIPanelButtonTemplate") - pfUI.api:SkinButton(question.yes) + pfUI.api.SkinButton(question.yes) question.yes:SetWidth(100) question.yes:SetHeight(20) question.yes:SetText("Yes") @@ -384,7 +383,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) end question.no = CreateFrame("Button", "pfQuestionDialogNo", question, "UIPanelButtonTemplate") - pfUI.api:SkinButton(question.no) + pfUI.api.SkinButton(question.no) question.no:SetWidth(85) question.no:SetHeight(20) question.no:SetText("No") @@ -401,7 +400,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) question.close = CreateFrame("Button", "pfQuestionDialogClose", question) question.close:SetPoint("TOPRIGHT", -border, -border) - pfUI.api:CreateBackdrop(question.close) + pfUI.api.CreateBackdrop(question.close) question.close:SetHeight(10) question.close:SetWidth(10) question.close.texture = question.close:CreateTexture("pfQuestionDialogCloseTex") @@ -414,7 +413,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox) end) question.close:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(this) + pfUI.api.CreateBackdrop(this) end) question.close:SetScript("OnClick", function() @@ -436,7 +435,7 @@ end -- [ Bar Layout Options ] -- -- 'barsize' size of bar in number of buttons -- returns: array of options as strings for pfUI.gui.bar -function pfUI.api:BarLayoutOptions(barsize) +function pfUI.api.BarLayoutOptions(barsize) assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutOptions: barsize "..tostring(barsize).." is invalid") local options = {} for i,layout in ipairs(pfGridmath[barsize]) do @@ -450,12 +449,12 @@ end -- returns: integer formfactor local formfactors = {} -- we'll use memoization so we only compute once, then lookup. setmetatable(formfactors, {__mode = "v"}) -- weak table so values not referenced are collected on next gc -function pfUI.api:BarLayoutFormfactor(option) +function pfUI.api.BarLayoutFormfactor(option) if formfactors[option] then return formfactors[option] else for barsize,_ in ipairs(pfGridmath) do - local options = pfUI.api:BarLayoutOptions(barsize) + local options = pfUI.api.BarLayoutOptions(barsize) for i,opt in ipairs(options) do if opt == option then formfactors[option] = i @@ -470,9 +469,9 @@ end -- 'bar' frame reference, -- 'barsize' integer number of buttons, -- 'formfactor' string formfactor in cols x rows -function pfUI.api:BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize) +function pfUI.api.BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize) assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid") - local formfactor = pfUI.api:BarLayoutFormfactor(formfactor) + local formfactor = pfUI.api.BarLayoutFormfactor(formfactor) local cols, rows = unpack(pfGridmath[barsize][formfactor]) local width = (iconsize + bordersize*3) * cols - bordersize local height = (iconsize + bordersize*3) * rows - bordersize @@ -485,9 +484,9 @@ end -- 'basename' name of button frame without index -- 'buttonindex' index number of button on bar -- 'formfactor' string formfactor in cols x rows -function pfUI.api:BarButtonAnchor(button,basename,buttonindex,barsize,formfactor,iconsize,bordersize) +function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor,iconsize,bordersize) assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarButtonAnchor: barsize "..tostring(barsize).." is invalid") - local formfactor = pfUI.api:BarLayoutFormfactor(formfactor) + local formfactor = pfUI.api.BarLayoutFormfactor(formfactor) local parent = button:GetParent() local cols, rows = unpack(pfGridmath[barsize][formfactor]) if buttonindex == 1 then @@ -501,7 +500,7 @@ end -- [ Create Autohide ] -- -- 'frame' the frame that should be hidden -function pfUI.api:CreateAutohide(frame) +function pfUI.api.CreateAutohide(frame) if not frame then return end frame.hover = CreateFrame("Frame", frame:GetName() .. "Autohide", frame) frame.hover:SetParent(frame) diff --git a/modules/actionbar.lua b/modules/actionbar.lua index c1355e75..e7d94fff 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -34,25 +34,25 @@ pfUI:RegisterModule("actionbar", function () end end - pfUI.api.Hook("ShowBonusActionBar", function() + Hook("ShowBonusActionBar", function() if pfActionBar then pfActionBar:Hide() end if pfBonusBar then pfBonusBar:Show() end end) - pfUI.api.Hook("HideBonusActionBar", function() + Hook("HideBonusActionBar", function() if pfActionBar then pfActionBar:Show() end if pfBonusBar then pfBonusBar:Hide() end end) if C.bars.glowrange == "1" then - pfUI.api.Hook("ActionButton_OnUpdate", function(elapsed) + Hook("ActionButton_OnUpdate", function(elapsed) -- Handle range indicator if ( this.rangeTimer ) then this.rangeTimer = this.rangeTimer - elapsed if ( this.rangeTimer <= 0.1 ) then if ( IsActionInRange( ActionButton_GetPagedID(this)) == 0 ) then if not this.a then - this.r,this.g,this.b,this.a = pfUI.api.strsplit(",", C.bars.rangecolor) + this.r,this.g,this.b,this.a = strsplit(",", C.bars.rangecolor) end _G[this:GetName() .. 'Icon']:SetVertexColor(this.r, this.g, this.b, this.a) elseif IsUsableAction(ActionButton_GetPagedID(this)) then @@ -115,25 +115,25 @@ pfUI:RegisterModule("actionbar", function () pfUI.bars.autohide:RegisterEvent("PLAYER_ENTERING_WORLD") pfUI.bars.autohide:SetScript("OnEvent", function() if C.bars.hide_actionmain == "1" then - pfUI.api:CreateAutohide(pfUI.bars.actionmain) + CreateAutohide(pfUI.bars.actionmain) end if C.bars.hide_bottomleft == "1" then - pfUI.api:CreateAutohide(pfUI.bars.bottomleft) + CreateAutohide(pfUI.bars.bottomleft) end if C.bars.hide_bottomright == "1" then - pfUI.api:CreateAutohide(pfUI.bars.bottomright) + CreateAutohide(pfUI.bars.bottomright) end if C.bars.hide_right == "1" then - pfUI.api:CreateAutohide(pfUI.bars.right) + CreateAutohide(pfUI.bars.right) end if C.bars.hide_tworight == "1" then - pfUI.api:CreateAutohide(pfUI.bars.tworight) + CreateAutohide(pfUI.bars.tworight) end if C.bars.hide_shapeshift == "1" then - pfUI.api:CreateAutohide(pfUI.bars.shapeshift) + CreateAutohide(pfUI.bars.shapeshift) end if C.bars.hide_pet == "1" then - pfUI.api:CreateAutohide(pfUI.bars.pet) + CreateAutohide(pfUI.bars.pet) end end) @@ -148,7 +148,7 @@ pfUI:RegisterModule("actionbar", function () PetActionBarFrame:SetParent(pfUI.bars.pet) pfUI.bars:SetScript("OnEvent", function() - pfUI.api:BarLayoutSize(pfUI.bars.actionmain, NUM_ACTIONBAR_BUTTONS, C.bars.actionmain.formfactor, C.bars.icon_size, default_border) + BarLayoutSize(pfUI.bars.actionmain, NUM_ACTIONBAR_BUTTONS, C.bars.actionmain.formfactor, C.bars.icon_size, default_border) pfUI.bars.actionmain:SetWidth(pfUI.bars.actionmain._size[1]) pfUI.bars.actionmain:SetHeight(pfUI.bars.actionmain._size[2]) @@ -160,11 +160,11 @@ pfUI:RegisterModule("actionbar", function () anchor = pfUI.bars.bottomleft end pfUI.bars.pet:SetPoint("BOTTOM", anchor, "TOP", 0, default_border * 3) - pfUI.api:UpdateMovable(pfUI.bars.pet) - pfUI.api:BarLayoutSize(pfUI.bars.pet, NUM_PET_ACTION_SLOTS, C.bars.pet.formfactor, C.bars.icon_size, default_border) + UpdateMovable(pfUI.bars.pet) + BarLayoutSize(pfUI.bars.pet, NUM_PET_ACTION_SLOTS, C.bars.pet.formfactor, C.bars.icon_size, default_border) pfUI.bars.pet:SetWidth(pfUI.bars.pet._size[1]) pfUI.bars.pet:SetHeight(pfUI.bars.pet._size[2]) - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.pet, default_border) end + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.pet, default_border) end PetActionBarFrame:ClearAllPoints() PetActionBarFrame:Hide() @@ -174,8 +174,8 @@ pfUI:RegisterModule("actionbar", function () b:ClearAllPoints() b:SetFrameLevel(pfUI.bars.pet:GetFrameLevel() + 1) b:SetParent(pfUI.bars.pet) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "PetActionButton", i, NUM_PET_ACTION_SLOTS, C.bars.pet.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "PetActionButton", i, NUM_PET_ACTION_SLOTS, C.bars.pet.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end else @@ -192,8 +192,8 @@ pfUI:RegisterModule("actionbar", function () local b = _G["ShapeshiftButton"..i] b:ClearAllPoints() b:SetParent(pfUI.bars.shapeshift) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "ShapeshiftButton", i, NUM_SHAPESHIFT_SLOTS, C.bars.shapeshift.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "ShapeshiftButton", i, NUM_SHAPESHIFT_SLOTS, C.bars.shapeshift.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) if b:IsShown() then shapeshiftbuttons = shapeshiftbuttons + 1 end end @@ -203,9 +203,9 @@ pfUI:RegisterModule("actionbar", function () anchor = pfUI.bars.bottomleft end pfUI.bars.shapeshift:SetPoint("BOTTOM", anchor, "TOP", 0, default_border * 3) - pfUI.api:UpdateMovable(pfUI.bars.shapeshift) - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.shapeshift, default_border) end - pfUI.api:BarLayoutSize(pfUI.bars.shapeshift, shapeshiftbuttons, C.bars.shapeshift.formfactor, C.bars.icon_size, default_border) + UpdateMovable(pfUI.bars.shapeshift) + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.shapeshift, default_border) end + BarLayoutSize(pfUI.bars.shapeshift, shapeshiftbuttons, C.bars.shapeshift.formfactor, C.bars.icon_size, default_border) pfUI.bars.shapeshift:SetWidth(pfUI.bars.shapeshift._size[1]) pfUI.bars.shapeshift:SetHeight(pfUI.bars.shapeshift._size[2]) else @@ -217,9 +217,9 @@ pfUI:RegisterModule("actionbar", function () pfUI.bars.bottomleft:SetFrameStrata("LOW") pfUI.bars.bottomleft:ClearAllPoints() pfUI.bars.bottomleft:SetPoint("BOTTOM", pfUI.bars.actionmain, "TOP", 0, default_border) - pfUI.api:UpdateMovable(pfUI.bars.bottomleft) + UpdateMovable(pfUI.bars.bottomleft) - pfUI.api:BarLayoutSize(pfUI.bars.bottomleft, NUM_ACTIONBAR_BUTTONS, C.bars.bottomleft.formfactor, C.bars.icon_size, default_border) + BarLayoutSize(pfUI.bars.bottomleft, NUM_ACTIONBAR_BUTTONS, C.bars.bottomleft.formfactor, C.bars.icon_size, default_border) pfUI.bars.bottomleft:SetWidth(pfUI.bars.bottomleft._size[1]) pfUI.bars.bottomleft:SetHeight(pfUI.bars.bottomleft._size[2]) @@ -238,8 +238,8 @@ pfUI:RegisterModule("actionbar", function () local b = _G["MultiBarBottomLeftButton"..i] b:ClearAllPoints() b:SetParent(tf) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "MultiBarBottomLeftButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.bottomleft.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "MultiBarBottomLeftButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.bottomleft.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end end @@ -254,10 +254,10 @@ pfUI:RegisterModule("actionbar", function () pfUI.bars.bottomright:Show() pfUI.bars.bottomright:SetFrameStrata("LOW") pfUI.bars.bottomright:SetPoint("BOTTOMRIGHT", pfUI.bars.actionmain, "BOTTOMLEFT", -default_border*3, 0) - pfUI.api:UpdateMovable(pfUI.bars.bottomright) - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.bottomright, default_border) end + UpdateMovable(pfUI.bars.bottomright) + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.bottomright, default_border) end - pfUI.api:BarLayoutSize(pfUI.bars.bottomright, NUM_ACTIONBAR_BUTTONS, C.bars.bottomright.formfactor, C.bars.icon_size, default_border) + BarLayoutSize(pfUI.bars.bottomright, NUM_ACTIONBAR_BUTTONS, C.bars.bottomright.formfactor, C.bars.icon_size, default_border) pfUI.bars.bottomright:SetWidth(pfUI.bars.bottomright._size[1]) pfUI.bars.bottomright:SetHeight(pfUI.bars.bottomright._size[2]) @@ -276,8 +276,8 @@ pfUI:RegisterModule("actionbar", function () local b = _G["MultiBarBottomRightButton"..i] b:ClearAllPoints() b:SetParent(tf) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "MultiBarBottomRightButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.bottomright.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "MultiBarBottomRightButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.bottomright.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end end @@ -289,10 +289,10 @@ pfUI:RegisterModule("actionbar", function () pfUI.bars.right:Show() pfUI.bars.right:SetFrameStrata("LOW") pfUI.bars.right:SetPoint("BOTTOMLEFT", pfUI.bars.actionmain, "BOTTOMRIGHT", default_border*3, 0) - pfUI.api:UpdateMovable(pfUI.bars.right) - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.right, default_border) end + UpdateMovable(pfUI.bars.right) + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.right, default_border) end - pfUI.api:BarLayoutSize(pfUI.bars.right, NUM_ACTIONBAR_BUTTONS, C.bars.right.formfactor, C.bars.icon_size, default_border) + BarLayoutSize(pfUI.bars.right, NUM_ACTIONBAR_BUTTONS, C.bars.right.formfactor, C.bars.icon_size, default_border) pfUI.bars.right:SetWidth(pfUI.bars.right._size[1]) pfUI.bars.right:SetHeight(pfUI.bars.right._size[2]) @@ -311,8 +311,8 @@ pfUI:RegisterModule("actionbar", function () local b = _G["MultiBarRightButton"..i] b:ClearAllPoints() b:SetParent(tf) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "MultiBarRightButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.right.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "MultiBarRightButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.right.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end end @@ -325,9 +325,9 @@ pfUI:RegisterModule("actionbar", function () pfUI.bars.tworight:SetFrameStrata("LOW") pfUI.bars.tworight:ClearAllPoints() pfUI.bars.tworight:SetPoint("RIGHT", UIParent, "RIGHT", -5, 0) - pfUI.api:UpdateMovable(pfUI.bars.tworight) - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.tworight, default_border) end - pfUI.api:BarLayoutSize(pfUI.bars.tworight, NUM_ACTIONBAR_BUTTONS, C.bars.tworight.formfactor, C.bars.icon_size, default_border) + UpdateMovable(pfUI.bars.tworight) + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.tworight, default_border) end + BarLayoutSize(pfUI.bars.tworight, NUM_ACTIONBAR_BUTTONS, C.bars.tworight.formfactor, C.bars.icon_size, default_border) pfUI.bars.tworight:SetWidth(pfUI.bars.tworight._size[1]) pfUI.bars.tworight:SetHeight(pfUI.bars.tworight._size[2]) @@ -346,15 +346,15 @@ pfUI:RegisterModule("actionbar", function () local b = _G["MultiBarLeftButton"..i] b:ClearAllPoints() b:SetParent(tf) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "MultiBarLeftButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.tworight.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "MultiBarLeftButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.tworight.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end end else pfUI.bars.tworight:Hide() end - pfUI.api:UpdateMovable(pfUI.bars.actionmain) + UpdateMovable(pfUI.bars.actionmain) local _, a, _ = pfUI.bars.bottomleft:GetPoint() if a and a == pfUI.bars.actionmain and pfUI.bars.bottomleft:IsShown() and pfUI.bars.bottomleft:GetWidth() == a:GetWidth() and pfUI.bars.bottomleft:GetScale() == a:GetScale() then @@ -366,25 +366,25 @@ pfUI:RegisterModule("actionbar", function () pfUI.bars.actionmain.share:SetPoint("BOTTOMLEFT", pfUI.bars.actionmain, "BOTTOMLEFT", 0, 0) pfUI.bars.actionmain.share:SetPoint("TOPRIGHT", pfUI.bars.bottomleft, "TOPRIGHT", 0, 0) pfUI.bars.actionmain.share:SetPoint("BOTTOMRIGHT", pfUI.bars.actionmain, "BOTTOMRIGHT", 0, 0) - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.actionmain.share, default_border) end + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.actionmain.share, default_border) end end else -- give both their own backdrop if pfUI.bars.actionmain.share then pfUI.bars.actionmain.share:Hide() end - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.actionmain, default_border) end - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.bottomleft, default_border) end + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.actionmain, default_border) end + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.bottomleft, default_border) end end end) -- create main action bar frame pfUI.bars.actionmain:SetFrameStrata("LOW") - pfUI.api:UpdateMovable(pfUI.bars.actionmain) + UpdateMovable(pfUI.bars.actionmain) function pfUI.bars.bottomleft:OnMove() local _, a, _ = pfUI.bars.bottomleft:GetPoint() if a ~= pfUI.bars.actionmain or not pfUI.bars.bottomleft:IsShown() or pfUI.bars.bottomleft:GetWidth() ~= a:GetWidth() or pfUI.bars.bottomleft:GetScale() ~= a:GetScale() then - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.actionmain, default_border) end - if C.bars.background == "1" then pfUI.api:CreateBackdrop(pfUI.bars.bottomleft, default_border) end + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.actionmain, default_border) end + if C.bars.background == "1" then CreateBackdrop(pfUI.bars.bottomleft, default_border) end if pfUI.bars.actionmain.share then pfUI.bars.actionmain.share:Hide() end end end @@ -400,8 +400,8 @@ pfUI:RegisterModule("actionbar", function () local b = _G["ActionButton"..i] b:ClearAllPoints() b:SetParent(tf) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "ActionButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.actionmain.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "ActionButton", i, NUM_ACTIONBAR_BUTTONS, C.bars.actionmain.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end end @@ -419,8 +419,8 @@ pfUI:RegisterModule("actionbar", function () local b = _G["BonusActionButton"..i] b:ClearAllPoints() b:SetParent(tf) - pfUI.api:CreateBackdrop(b, default_border) - pfUI.api:BarButtonAnchor(b, "BonusActionButton", i, NUM_BONUS_ACTION_SLOTS, C.bars.actionmain.formfactor, C.bars.icon_size, default_border) + CreateBackdrop(b, default_border) + BarButtonAnchor(b, "BonusActionButton", i, NUM_BONUS_ACTION_SLOTS, C.bars.actionmain.formfactor, C.bars.icon_size, default_border) b:SetPoint(unpack(b._anchor)) end diff --git a/modules/addons.lua b/modules/addons.lua index 338cc402..4c4312cf 100644 --- a/modules/addons.lua +++ b/modules/addons.lua @@ -5,7 +5,7 @@ pfUI:RegisterModule("addons", function () pfUI.addons:SetWidth(400) pfUI.addons:SetPoint("CENTER", 0,0) pfUI.addons:EnableMouseWheel(1) - pfUI.api:CreateBackdrop(pfUI.addons, nil, nil, .8) + CreateBackdrop(pfUI.addons, nil, nil, .8) pfUI.addons:SetMovable(true) pfUI.addons:EnableMouse(true) pfUI.addons:SetScript("OnMouseDown",function() @@ -34,7 +34,7 @@ pfUI:RegisterModule("addons", function () pfUI.addons.close = CreateFrame("Button", "pfBagClose", pfUI.addons) pfUI.addons.close:SetPoint("TOPRIGHT", -C.appearance.border.default*2,-C.appearance.border.default*2 ) - pfUI.api:CreateBackdrop(pfUI.addons.close) + CreateBackdrop(pfUI.addons.close) pfUI.addons.close:SetHeight(15) pfUI.addons.close:SetWidth(15) pfUI.addons.close.texture = pfUI.addons.close:CreateTexture("pfBagClose") @@ -44,12 +44,12 @@ pfUI:RegisterModule("addons", function () pfUI.addons.close.texture:SetPoint("BOTTOMRIGHT", pfUI.addons.close, "BOTTOMRIGHT", -4, 4) pfUI.addons.close.texture:SetVertexColor(1,.25,.25,1) pfUI.addons.close:SetScript("OnEnter", function () - pfUI.api:CreateBackdrop(pfUI.addons.close) + CreateBackdrop(pfUI.addons.close) pfUI.addons.close.backdrop:SetBackdropBorderColor(1,.25,.25,1) end) pfUI.addons.close:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(pfUI.addons.close) + CreateBackdrop(pfUI.addons.close) end) pfUI.addons.close:SetScript("OnClick", function() @@ -92,7 +92,7 @@ pfUI:RegisterModule("addons", function () frame.input:SetNormalTexture("") frame.input:SetPushedTexture("") frame.input:SetHighlightTexture("") - pfUI.api:CreateBackdrop(frame.input, nil, true) + CreateBackdrop(frame.input, nil, true) --frame.input:SetBackdrop(pfUI.backdrop) frame.input:SetBackdropBorderColor(.3,.3,.3,1) frame.input:SetWidth(14) @@ -173,7 +173,7 @@ pfUI:RegisterModule("addons", function () pfUI.addons.deco:ClearAllPoints() pfUI.addons.deco:SetPoint("TOPLEFT", pfUI.addons.scroll, "TOPLEFT", -5, 5) pfUI.addons.deco:SetPoint("BOTTOMRIGHT", pfUI.addons.scroll, "BOTTOMRIGHT", 5, -5) - pfUI.api:CreateBackdrop(pfUI.addons.deco, nil, nil, .8) + CreateBackdrop(pfUI.addons.deco, nil, nil, .8) pfUI.addons.deco.up = CreateFrame("Frame", nil, pfUI.addons.deco) pfUI.addons.deco.up:SetPoint("TOPRIGHT", 0,0) diff --git a/modules/autoshift.lua b/modules/autoshift.lua index 6e55df4a..e6d479e1 100644 --- a/modules/autoshift.lua +++ b/modules/autoshift.lua @@ -5,7 +5,7 @@ pfUI:RegisterModule("autoshift", function () pfUI.autoshift.lastError = "" pfUI.autoshift.CastSpellByName = _G["CastSpellByName"] - pfUI.api.Hook("CastSpell", function(spellId, spellbookTabNum) + Hook("CastSpell", function(spellId, spellbookTabNum) if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance']) elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then @@ -20,7 +20,7 @@ pfUI:RegisterModule("autoshift", function () pfUI.autoshift.lastError = "" end) - pfUI.api.Hook("CastSpellByName", function(spellName, onSelf) + Hook("CastSpellByName", function(spellName, onSelf) if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance']) elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then @@ -35,7 +35,7 @@ pfUI:RegisterModule("autoshift", function () pfUI.autoshift.lastError = "" end) - pfUI.api.Hook("UseAction", function(slot, checkCursor, onSelf) + Hook("UseAction", function(slot, checkCursor, onSelf) if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance']) elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then diff --git a/modules/bags.lua b/modules/bags.lua index e98e056a..a3523680 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -196,7 +196,7 @@ pfUI:RegisterModule("bags", function () pfUI.bag:CreateAdditions(frame) frame:SetFrameStrata("HIGH") - pfUI.api:CreateBackdrop(frame, default_border) + CreateBackdrop(frame, default_border) pfUI.bag.button_size = (frame:GetWidth() - 2*default_border - 9*default_border*3)/ 10 local topspace = pfUI.bag.right.close:GetHeight() + default_border * 2 @@ -253,7 +253,7 @@ pfUI:RegisterModule("bags", function () if bag == -1 then tpl = "BankItemButtonGenericTemplate" end pfUI.bags[bag].slots[slot] = {} pfUI.bags[bag].slots[slot].frame = CreateFrame("Button", "pfBag" .. bag .. "item" .. slot, pfUI.bags[bag], tpl) - pfUI.api:CreateBackdrop(pfUI.bags[bag].slots[slot].frame, default_border) + CreateBackdrop(pfUI.bags[bag].slots[slot].frame, default_border) pfUI.bags[bag].slots[slot].frame:SetNormalTexture("") pfUI.bags[bag].slots[slot].bag = bag @@ -359,7 +359,7 @@ pfUI:RegisterModule("bags", function () end frame.bagslots:SetPoint("BOTTOM"..position, frame, "TOP"..position, 0, default_border*3) - pfUI.api:CreateBackdrop(frame.bagslots, default_border) + CreateBackdrop(frame.bagslots, default_border) local extra = 0 if frame == pfUI.bag.left and GetNumBankSlots() < 6 then extra = 1 end @@ -393,7 +393,7 @@ pfUI:RegisterModule("bags", function () local SlotEnter = frame.bagslots.slots[slot].frame:GetScript("OnEnter") frame.bagslots.slots[slot].frame:SetScript("OnEnter", function() for slot, f in ipairs(pfUI.bags[this.slot + 1].slots) do - pfUI.api:CreateBackdrop(f.frame, default_border) + CreateBackdrop(f.frame, default_border) f.frame.backdrop:SetBackdropBorderColor(.2,1,.8,1) end SlotEnter() @@ -415,7 +415,7 @@ pfUI:RegisterModule("bags", function () frame.bagslots.slots[slot].frame:SetWidth(pfUI.bag.button_size/5*4) local id, texture = GetInventorySlotInfo("Bag" .. slot .. append) - pfUI.api:CreateBackdrop(frame.bagslots.slots[slot].frame, default_border) + CreateBackdrop(frame.bagslots.slots[slot].frame, default_border) frame.bagslots.slots[slot].frame:Show() local numSlots, full = GetNumBankSlots() @@ -432,7 +432,7 @@ pfUI:RegisterModule("bags", function () frame.bagslots.buy = CreateFrame("Button", "pfBagSlotBuy", frame.bagslots) end frame.bagslots.buy:SetPoint("RIGHT", frame.bagslots, "RIGHT", -default_border, 0) - pfUI.api:CreateBackdrop(frame.bagslots.buy, default_border) + CreateBackdrop(frame.bagslots.buy, default_border) frame.bagslots.buy:SetHeight(pfUI.bag.button_size/5*4) frame.bagslots.buy:SetWidth(pfUI.bag.button_size/5*4) frame.bagslots.buy:SetText("+") @@ -460,7 +460,7 @@ pfUI:RegisterModule("bags", function () if not frame.close then frame.close = CreateFrame("Button", "pfBagClose", frame) frame.close:SetPoint("TOPRIGHT", -default_border*1,-default_border ) - pfUI.api:CreateBackdrop(frame.close, default_border) + CreateBackdrop(frame.close, default_border) frame.close:SetHeight(12) frame.close:SetWidth(12) frame.close.texture = frame.close:CreateTexture("pfBagClose") @@ -474,7 +474,7 @@ pfUI:RegisterModule("bags", function () end) frame.close:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(frame.close, default_border) + CreateBackdrop(frame.close, default_border) end) frame.close:SetScript("OnClick", function() @@ -486,7 +486,7 @@ pfUI:RegisterModule("bags", function () if not frame.bags then frame.bags = CreateFrame("Button", "pfBagSlotShow", frame) frame.bags:SetPoint("TOPRIGHT", frame.close, "TOPLEFT", -default_border*3, 0) - pfUI.api:CreateBackdrop(frame.bags, default_border) + CreateBackdrop(frame.bags, default_border) frame.bags:SetHeight(12) frame.bags:SetWidth(12) frame.bags:SetTextColor(1,1,.25,1) @@ -504,7 +504,7 @@ pfUI:RegisterModule("bags", function () end) frame.bags:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(frame.bags, default_border) + CreateBackdrop(frame.bags, default_border) frame.bags.texture:SetVertexColor(.25,.25,.25,1) end) @@ -521,7 +521,7 @@ pfUI:RegisterModule("bags", function () if not frame.keys then frame.keys = CreateFrame("Button", "pfBagSlotShow", frame) frame.keys:SetPoint("TOPRIGHT", frame.bags, "TOPLEFT", -default_border*3, 0) - pfUI.api:CreateBackdrop(frame.keys, default_border) + CreateBackdrop(frame.keys, default_border) frame.keys:SetHeight(12) frame.keys:SetWidth(12) frame.keys:SetTextColor(1,1,.25,1) @@ -539,7 +539,7 @@ pfUI:RegisterModule("bags", function () end) frame.keys:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(frame.keys, default_border) + CreateBackdrop(frame.keys, default_border) frame.keys.texture:SetVertexColor(.25,.25,.25,1) end) @@ -559,7 +559,7 @@ pfUI:RegisterModule("bags", function () frame.search:SetHeight(12) frame.search:SetPoint("TOPLEFT", frame, "TOPLEFT", default_border, -default_border) frame.search:SetPoint("TOPRIGHT", frame.keys, "TOPLEFT", -default_border*3, -default_border) - pfUI.api:CreateBackdrop(frame.search, default_border) + CreateBackdrop(frame.search, default_border) frame.search.edit = CreateFrame("EditBox", "pfUIBagSearch", frame.search, "InputBoxTemplate") pfUIBagSearchLeft:SetTexture(nil) @@ -619,7 +619,7 @@ pfUI:RegisterModule("bags", function () if not frame.close then frame.close = CreateFrame("Button", "pfBagClose", frame) frame.close:SetPoint("TOPRIGHT", -default_border*1,-default_border ) - pfUI.api:CreateBackdrop(frame.close, default_border) + CreateBackdrop(frame.close, default_border) frame.close:SetHeight(12) frame.close:SetWidth(12) frame.close.texture = frame.close:CreateTexture("pfBagClose") @@ -633,7 +633,7 @@ pfUI:RegisterModule("bags", function () end) frame.close:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(frame.close, default_border) + CreateBackdrop(frame.close, default_border) end) frame.close:SetScript("OnClick", function() @@ -645,7 +645,7 @@ pfUI:RegisterModule("bags", function () if not frame.bags then frame.bags = CreateFrame("Button", "pfBagSlotShow", frame) frame.bags:SetPoint("TOPRIGHT", frame.close, "TOPLEFT", -default_border*3, 0) - pfUI.api:CreateBackdrop(frame.bags, default_border) + CreateBackdrop(frame.bags, default_border) frame.bags:SetHeight(12) frame.bags:SetWidth(12) frame.bags:SetTextColor(1,1,.25,1) @@ -663,7 +663,7 @@ pfUI:RegisterModule("bags", function () end) frame.bags:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(frame.bags, default_border) + CreateBackdrop(frame.bags, default_border) frame.bags.texture:SetVertexColor(.25,.25,.25,1) end) diff --git a/modules/buff.lua b/modules/buff.lua index 3e963e95..d009b0b9 100644 --- a/modules/buff.lua +++ b/modules/buff.lua @@ -59,7 +59,7 @@ pfUI:RegisterModule("buff", function () local _, _, mainhand, _, _, offhand = GetWeaponEnchantInfo() if buff then - pfUI.api:CreateBackdrop(buff) + CreateBackdrop(buff) icon:SetTexCoord(.08, .92, .08, .92) border:Hide() end @@ -111,7 +111,7 @@ pfUI:RegisterModule("buff", function () elseif i > 16 then buff:SetPoint("TOPRIGHT", _G["BuffButton" .. i-1], "TOPLEFT", -7, 0) end - pfUI.api:CreateBackdrop(buff) + CreateBackdrop(buff) text:SetPoint("TOP", buff, "BOTTOM", 0 , -C.appearance.border.default*2) icon:SetTexCoord(.08, .92, .08, .92) if border then diff --git a/modules/castbar.lua b/modules/castbar.lua index eea47687..82f90edb 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -16,7 +16,7 @@ pfUI:RegisterModule("castbar", function () -- [[ pfPlayerCastbar ]] -- pfUI.castbar.player = CreateFrame("Frame", "pfPlayerCastbar", UIParent) pfUI.castbar.player:SetFrameStrata("HIGH") - pfUI.api:CreateBackdrop(pfUI.castbar.player, default_border) + CreateBackdrop(pfUI.castbar.player, default_border) pfUI.castbar.player:SetHeight(C.global.font_size + default_border) if pfUI.uf.player then @@ -27,7 +27,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.player:SetWidth(200) end - pfUI.api:UpdateMovable(pfUI.castbar.player) + UpdateMovable(pfUI.castbar.player) pfUI.castbar.player:Hide() pfUI.castbar.player.delay = 0 @@ -38,7 +38,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.player.bar:SetAllPoints(pfUI.castbar.player) pfUI.castbar.player.bar:SetMinMaxValues(0, 100) pfUI.castbar.player.bar:SetValue(20) - local r,g,b,a = pfUI.api.strsplit(",", C.appearance.castbar.castbarcolor) + local r,g,b,a = strsplit(",", C.appearance.castbar.castbarcolor) pfUI.castbar.player.bar:SetStatusBarColor(r,g,b,a) -- text left @@ -118,20 +118,20 @@ pfUI:RegisterModule("castbar", function () end end - pfUI.api.Hook("CastSpell", function(id, bookType) + Hook("CastSpell", function(id, bookType) local spellName = GetSpellName(id, bookType) if pfUI.castbar.player[spellName] then pfUI.castbar.player[spellName](true) end end, true) - pfUI.api.Hook("CastSpellByName", function(spellName, target) + Hook("CastSpellByName", function(spellName, target) if pfUI.castbar.player[spellName] then pfUI.castbar.player[spellName](true) end end, true) - pfUI.api.Hook("UseAction", function(slot, target, button) + Hook("UseAction", function(slot, target, button) if GetActionText(slot) or not IsCurrentAction(slot) then return end scanner:ClearLines() scanner:SetAction(slot) @@ -145,7 +145,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.player.delay = 0 pfUI.castbar.player.spell = spell pfUI.castbar.player.bar.left:SetText(spell) - local r,g,b,a = pfUI.api.strsplit(",", C.appearance.castbar.castbarcolor) + local r,g,b,a = strsplit(",", C.appearance.castbar.castbarcolor) pfUI.castbar.player.bar:SetStatusBarColor(r,g,b,a) pfUI.castbar.player.startTime = GetTime() pfUI.castbar.player.maxValue = duration / 1000 @@ -173,7 +173,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.player.delay = 0 pfUI.castbar.player.spell = spell pfUI.castbar.player.bar.left:SetText(spell) - local r,g,b,a = pfUI.api.strsplit(",", C.appearance.castbar.channelcolor) + local r,g,b,a = strsplit(",", C.appearance.castbar.channelcolor) pfUI.castbar.player.bar:SetStatusBarColor(r,g,b,a) pfUI.castbar.player.maxValue = nil pfUI.castbar.player.startTime = GetTime() @@ -255,10 +255,10 @@ pfUI:RegisterModule("castbar", function () if cur > max then cur = max end if delay > 0 then - delay = "|cffffaaaa+" .. pfUI.api.round(delay,1) .. " |r " - pfUI.castbar.player.bar.right:SetText(delay .. pfUI.api.round(cur,1) .. " / " .. pfUI.api.round(max,1)) + delay = "|cffffaaaa+" .. round(delay,1) .. " |r " + pfUI.castbar.player.bar.right:SetText(delay .. round(cur,1) .. " / " .. round(max,1)) else - pfUI.castbar.player.bar.right:SetText(pfUI.api.round(cur,1) .. " / " .. pfUI.api.round(max,1)) + pfUI.castbar.player.bar.right:SetText(round(cur,1) .. " / " .. round(max,1)) end return @@ -283,10 +283,10 @@ pfUI:RegisterModule("castbar", function () return end if delay > 0 then - delay = "|cffffaaaa-" .. pfUI.api.round(delay,1) .. " |r " - pfUI.castbar.player.bar.right:SetText(delay .. pfUI.api.round(cur,1)) + delay = "|cffffaaaa-" .. round(delay,1) .. " |r " + pfUI.castbar.player.bar.right:SetText(delay .. round(cur,1)) else - pfUI.castbar.player.bar.right:SetText(pfUI.api.round(cur,1)) + pfUI.castbar.player.bar.right:SetText(round(cur,1)) end return @@ -304,7 +304,7 @@ pfUI:RegisterModule("castbar", function () -- [[ pfTargetCastbar ]] -- pfUI.castbar.target = CreateFrame("Frame", "pfTargetCastbar", UIParent) pfUI.castbar.target:SetFrameStrata("HIGH") - pfUI.api:CreateBackdrop(pfUI.castbar.target, default_border) + CreateBackdrop(pfUI.castbar.target, default_border) pfUI.castbar.target:SetHeight(C.global.font_size + default_border) if pfUI.uf.target then @@ -315,7 +315,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.target:SetWidth(200) end - pfUI.api:UpdateMovable(pfUI.castbar.target) + UpdateMovable(pfUI.castbar.target) pfUI.castbar.target:Hide() @@ -326,7 +326,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.target.bar:SetAllPoints(pfUI.castbar.target) pfUI.castbar.target.bar:SetMinMaxValues(0, 100) pfUI.castbar.target.bar:SetValue(20) - local r,g,b,a = pfUI.api.strsplit(",", C.appearance.castbar.castbarcolor) + local r,g,b,a = strsplit(",", C.appearance.castbar.castbarcolor) pfUI.castbar.target.bar:SetStatusBarColor(r,g,b,a) -- text left @@ -365,7 +365,7 @@ pfUI:RegisterModule("castbar", function () pfUI.castbar.target.bar:SetMinMaxValues(0, casttime) pfUI.castbar.target.bar:SetValue(GetTime() - starttime) pfUI.castbar.target.bar.left:SetText(spellname) - pfUI.castbar.target.bar.right:SetText(pfUI.api.round(GetTime() - starttime,1) .. " / " .. casttime) + pfUI.castbar.target.bar.right:SetText(round(GetTime() - starttime,1) .. " / " .. casttime) end else pfUI.castbar.target.casterDB[UnitName("target")] = nil diff --git a/modules/chat.lua b/modules/chat.lua index faa0a9cb..0dd887ef 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -26,13 +26,13 @@ pfUI:RegisterModule("chat", function () pfUI.chat.left:SetHeight(C.chat.left.height) pfUI.chat.left:SetPoint("BOTTOMLEFT", 5,5) pfUI.chat.left:SetScript("OnShow", function() pfUI.chat:RefreshChat() end) - pfUI.api:UpdateMovable(pfUI.chat.left) - pfUI.api:CreateBackdrop(pfUI.chat.left, default_border, nil, .8) + UpdateMovable(pfUI.chat.left) + CreateBackdrop(pfUI.chat.left, default_border, nil, .8) if C.chat.global.custombg == "1" then - local r, g, b, a = pfUI.api.strsplit(",", C.chat.global.background) + local r, g, b, a = strsplit(",", C.chat.global.background) pfUI.chat.left.backdrop:SetBackdropColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a)) - local r, g, b, a = pfUI.api.strsplit(",", C.chat.global.border) + local r, g, b, a = strsplit(",", C.chat.global.border) pfUI.chat.left.backdrop:SetBackdropBorderColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a)) end @@ -42,7 +42,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.left.panelTop:SetPoint("TOPLEFT", pfUI.chat.left, "TOPLEFT", default_border, -default_border) pfUI.chat.left.panelTop:SetPoint("TOPRIGHT", pfUI.chat.left, "TOPRIGHT", -default_border, -default_border) if C.chat.global.tabdock == "1" then - pfUI.api:CreateBackdrop(pfUI.chat.left.panelTop, default_border, nil, .8) + CreateBackdrop(pfUI.chat.left.panelTop, default_border, nil, .8) end -- whisper forwarding @@ -114,7 +114,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.left.panelTop.proxyName:SetPoint("CENTER", 0, 0) pfUI.chat.left.panelTop.proxyName:SetHeight(100) pfUI.chat.left.panelTop.proxyName:SetWidth(200) - pfUI.api:CreateBackdrop(pfUI.chat.left.panelTop.proxyName, default_border) + CreateBackdrop(pfUI.chat.left.panelTop.proxyName, default_border) pfUI.chat.left.panelTop.proxyName:SetScript("OnShow", function() pfUI.chat.left.panelTop.proxyName.input:SetText(pfUI.chat.left.panelTop.proxy.forwardto) end) @@ -129,7 +129,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.left.panelTop.proxyName.input = CreateFrame("EditBox", nil, pfUI.chat.left.panelTop.proxyName) pfUI.chat.left.panelTop.proxyName.input:SetTextColor(.2,1.1,1) pfUI.chat.left.panelTop.proxyName.input:SetJustifyH("CENTER") - pfUI.api:CreateBackdrop(pfUI.chat.left.panelTop.proxyName.input, default_border) + CreateBackdrop(pfUI.chat.left.panelTop.proxyName.input, default_border) pfUI.chat.left.panelTop.proxyName.input:SetPoint("TOPLEFT" , pfUI.chat.left.panelTop.proxyName, "TOPLEFT", 20, -40) pfUI.chat.left.panelTop.proxyName.input:SetPoint("BOTTOMRIGHT" , pfUI.chat.left.panelTop.proxyName, "BOTTOMRIGHT", -20, 40) pfUI.chat.left.panelTop.proxyName.input:SetFontObject(GameFontWhite) @@ -143,7 +143,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.left.panelTop.proxyName.okay:SetWidth(80) pfUI.chat.left.panelTop.proxyName.okay:SetHeight(20) pfUI.chat.left.panelTop.proxyName.okay:SetPoint("BOTTOMRIGHT", -10, 10) - pfUI.api:CreateBackdrop(pfUI.chat.left.panelTop.proxyName.okay, default_border) + CreateBackdrop(pfUI.chat.left.panelTop.proxyName.okay, default_border) pfUI.chat.left.panelTop.proxyName.okay.text = pfUI.chat.left.panelTop.proxyName.okay:CreateFontString("Status", "LOW", "GameFontNormal") pfUI.chat.left.panelTop.proxyName.okay.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") pfUI.chat.left.panelTop.proxyName.okay.text:ClearAllPoints() @@ -163,7 +163,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.left.panelTop.proxyName.abort:SetWidth(80) pfUI.chat.left.panelTop.proxyName.abort:SetHeight(20) pfUI.chat.left.panelTop.proxyName.abort:SetPoint("BOTTOMLEFT", 10, 10) - pfUI.api:CreateBackdrop(pfUI.chat.left.panelTop.proxyName.abort, default_border) + CreateBackdrop(pfUI.chat.left.panelTop.proxyName.abort, default_border) pfUI.chat.left.panelTop.proxyName.abort.text = pfUI.chat.left.panelTop.proxyName.abort:CreateFontString("Status", "LOW", "GameFontNormal") pfUI.chat.left.panelTop.proxyName.abort.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") pfUI.chat.left.panelTop.proxyName.abort.text:ClearAllPoints() @@ -184,13 +184,13 @@ pfUI:RegisterModule("chat", function () pfUI.chat.right:SetHeight(C.chat.right.height) pfUI.chat.right:SetPoint("BOTTOMRIGHT", -5,5) pfUI.chat.right:SetScript("OnShow", function() pfUI.chat:RefreshChat() end) - pfUI.api:UpdateMovable(pfUI.chat.right) - pfUI.api:CreateBackdrop(pfUI.chat.right, default_border, nil, .8) + UpdateMovable(pfUI.chat.right) + CreateBackdrop(pfUI.chat.right, default_border, nil, .8) if C.chat.global.custombg == "1" then - local r, g, b, a = pfUI.api.strsplit(",", C.chat.global.background) + local r, g, b, a = strsplit(",", C.chat.global.background) pfUI.chat.right.backdrop:SetBackdropColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a)) - local r, g, b, a = pfUI.api.strsplit(",", C.chat.global.border) + local r, g, b, a = strsplit(",", C.chat.global.border) pfUI.chat.right.backdrop:SetBackdropBorderColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a)) end @@ -200,7 +200,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.right.panelTop:SetPoint("TOPLEFT", pfUI.chat.right, "TOPLEFT", default_border, -default_border) pfUI.chat.right.panelTop:SetPoint("TOPRIGHT", pfUI.chat.right, "TOPRIGHT", -default_border, -default_border) if C.chat.global.tabdock == "1" then - pfUI.api:CreateBackdrop(pfUI.chat.right.panelTop, default_border, nil, .8) + CreateBackdrop(pfUI.chat.right.panelTop, default_border, nil, .8) end pfUI.chat:RegisterEvent("PLAYER_ENTERING_WORLD") @@ -544,7 +544,7 @@ pfUI:RegisterModule("chat", function () pfUI.chat.editbox:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, default_border*3) pfUI.chat.editbox:SetPoint("BOTTOMRIGHT", anchor, "TOPRIGHT", 0, default_border*3) - pfUI.api:UpdateMovable(pfUI.chat.editbox) + UpdateMovable(pfUI.chat.editbox) end) if C.chat.text.input_width == "0" then @@ -555,7 +555,7 @@ pfUI:RegisterModule("chat", function () ChatFrameEditBox:SetParent(pfUI.chat.editbox) ChatFrameEditBox:SetAllPoints(pfUI.chat.editbox) - pfUI.api:CreateBackdrop(ChatFrameEditBox, default_border) + CreateBackdrop(ChatFrameEditBox, default_border) for i,v in ipairs({ChatFrameEditBox:GetRegions()}) do if i==6 or i==7 or i==8 then v:Hide() end @@ -577,7 +577,7 @@ pfUI:RegisterModule("chat", function () CHAT_BATTLEGROUND_LEADER_GET = '[BL]' .. default CHAT_SAY_GET = '[S]' .. default - local cr, cg, cb, ca = pfUI.api.strsplit(",", C.chat.global.whisper) + local cr, cg, cb, ca = strsplit(",", C.chat.global.whisper) cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb) local wcol = string.format("%02x%02x%02x",cr * 255,cg * 255, cb * 255) @@ -631,7 +631,7 @@ pfUI:RegisterModule("chat", function () local left = string.sub(C.chat.text.timebracket, 1, 1) local right = string.sub(C.chat.text.timebracket, 2, 2) - local r,g,b,a = pfUI.api.strsplit(",", C.chat.text.timecolor) + local r,g,b,a = strsplit(",", C.chat.text.timecolor) local chex = string.format("%02x%02x%02x%02x", a*255, r*255, g*255, b*255) text = "|c" .. chex .. left .. date(C.chat.text.timeformat) .. right .. "|r " .. text end diff --git a/modules/cooldown.lua b/modules/cooldown.lua index a138291b..63e88df5 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -34,19 +34,19 @@ pfUI:RegisterModule("cooldown", function () if remaining > 99 then remaining = remaining / 60 unit = "m" - r,g,b,a = pfUI.api.strsplit(",", C.appearance.cd.mincolor) + r,g,b,a = strsplit(",", C.appearance.cd.mincolor) end if remaining > 99 then remaining = remaining / 60 unit = "h" - r,g,b,a = pfUI.api.strsplit(",", C.appearance.cd.hourcolor) + r,g,b,a = strsplit(",", C.appearance.cd.hourcolor) end if remaining > 99 then remaining = remaining / 24 unit = "d" - r,g,b,a = pfUI.api.strsplit(",", C.appearance.cd.daycolor) + r,g,b,a = strsplit(",", C.appearance.cd.daycolor) end - this.text:SetText(pfUI.api.round(remaining) .. unit) + this.text:SetText(round(remaining) .. unit) this.text:SetTextColor(r,g,b,a) else this:Hide() @@ -55,7 +55,7 @@ pfUI:RegisterModule("cooldown", function () end -- hook - pfUI.api.Hook("CooldownFrame_SetTimer", function(this, start, duration, enable) + Hook("CooldownFrame_SetTimer", function(this, start, duration, enable) -- break here if no this-reference is set if not this then return end diff --git a/modules/firstrun.lua b/modules/firstrun.lua index d2abd53f..590d42f3 100644 --- a/modules/firstrun.lua +++ b/modules/firstrun.lua @@ -36,7 +36,7 @@ pfUI:RegisterModule("firstrun", function () this:GetParent():Hide() end - pfUI.api:CreateQuestionDialog("Welcome to |cff33ffccpf|cffffffffUI|r!\n\n".. + CreateQuestionDialog("Welcome to |cff33ffccpf|cffffffffUI|r!\n\n".. "I'm the first run wizzard that will guide you through some basic configuration.\n".. "You'll now be prompted for several questions. To get a default installation,\n".. "you might want to click \"Yes\" everywhere. A few settings are client settings\n".. @@ -65,9 +65,9 @@ pfUI:RegisterModule("firstrun", function () end if step.cmpnt and step.cmpnt == "edit" then - pfUI.api:CreateQuestionDialog(step.descr, yes, no, true) + CreateQuestionDialog(step.descr, yes, no, true) else - pfUI.api:CreateQuestionDialog(step.descr, yes, no, false) + CreateQuestionDialog(step.descr, yes, no, false) end return diff --git a/modules/group.lua b/modules/group.lua index 4b563ada..ebc61ff9 100644 --- a/modules/group.lua +++ b/modules/group.lua @@ -87,7 +87,7 @@ pfUI:RegisterModule("group", function () pfUI.uf.group[i]:SetWidth(175) pfUI.uf.group[i]:SetHeight(40 + 2*default_border + spacing) pfUI.uf.group[i]:SetPoint("TOPLEFT", 5, -5 - ((i-1)*55)) - pfUI.api:UpdateMovable(pfUI.uf.group[i]) + UpdateMovable(pfUI.uf.group[i]) pfUI.uf.group[i]:Hide() pfUI.uf.group[i].id = i pfUI.uf.group[i].label = "party" @@ -97,7 +97,7 @@ pfUI:RegisterModule("group", function () pfUI.uf.group[i].hp:SetWidth(175) pfUI.uf.group[i].hp:SetHeight(30) pfUI.uf.group[i].hp:SetPoint("TOP", 0, 0) - pfUI.api:CreateBackdrop(pfUI.uf.group[i].hp, default_border) + CreateBackdrop(pfUI.uf.group[i].hp, default_border) pfUI.uf.group[i].hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.group[i].hp) pfUI.uf.group[i].hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -108,7 +108,7 @@ pfUI:RegisterModule("group", function () pfUI.uf.group[i].power:SetWidth(175) pfUI.uf.group[i].power:SetHeight(10) pfUI.uf.group[i].power:SetPoint("BOTTOM", 0, 0) - pfUI.api:CreateBackdrop(pfUI.uf.group[i].power, default_border) + CreateBackdrop(pfUI.uf.group[i].power, default_border) pfUI.uf.group[i].power.bar = CreateFrame("StatusBar", nil, pfUI.uf.group[i].power) pfUI.uf.group[i].power.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") diff --git a/modules/gui.lua b/modules/gui.lua index 19230e5d..660edb8f 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -10,7 +10,7 @@ pfUI:RegisterModule("gui", function () pfUI.gui:SetHeight(500) pfUI.gui:Hide() - pfUI.api:CreateBackdrop(pfUI.gui, nil, nil, .8) + CreateBackdrop(pfUI.gui, nil, nil, .8) pfUI.gui:SetPoint("CENTER",0,0) pfUI.gui:SetMovable(true) pfUI.gui:EnableMouse(true) @@ -29,7 +29,7 @@ pfUI:RegisterModule("gui", function () end) function pfUI.gui:Reload() - pfUI.api:CreateQuestionDialog("Some settings need to reload the UI to take effect.\nDo you want to reloadUI now?", + CreateQuestionDialog("Some settings need to reload the UI to take effect.\nDo you want to reloadUI now?", function() pfUI.gui.settingChanged = nil ReloadUI() @@ -143,7 +143,7 @@ pfUI:RegisterModule("gui", function () frame.drag = CreateFrame("Frame", nil, frame) frame.drag:SetAllPoints(frame) frame.drag:SetFrameStrata("DIALOG") - pfUI.api:CreateBackdrop(frame.drag, nil, nil, .8) + CreateBackdrop(frame.drag, nil, nil, .8) frame.drag.backdrop:SetBackdropBorderColor(.2, 1, .8) frame.drag:EnableMouseWheel(1) frame.drag.text = frame.drag:CreateFontString("Status", "LOW", "GameFontNormal") @@ -154,13 +154,13 @@ pfUI:RegisterModule("gui", function () frame.drag.text:SetFontObject(GameFontWhite) local label = (strsub(frame:GetName(),3)) if frame.drag:GetHeight() > (2 * frame.drag:GetWidth()) then - label = pfUI.api.strvertical(label) + label = strvertical(label) end frame.drag.text:SetText(label) frame.drag:SetAlpha(1) frame.drag:SetScript("OnMouseWheel", function() - local scale = pfUI.api.round(frame:GetScale() + arg1/10, 1) + local scale = round(frame:GetScale() + arg1/10, 1) if IsShiftKeyDown() and strsub(frame:GetName(),0,6) == "pfRaid" then for i=1,40 do @@ -328,12 +328,12 @@ pfUI:RegisterModule("gui", function () for _, hide in pairs(elements) do hide:Hide() - pfUI.api:CreateBackdrop(hide.switch, nil, true) + CreateBackdrop(hide.switch, nil, true) end pfUI.gui.scroll:SetScrollChild(frame) pfUI.gui.scroll:UpdateScrollState() pfUI.gui.scroll:SetVerticalScroll(0) - pfUI.api:CreateBackdrop(frame.switch, nil, true) + CreateBackdrop(frame.switch, nil, true) frame.switch:SetBackdropBorderColor(.2,1,.8) frame:Show() end @@ -368,7 +368,7 @@ pfUI:RegisterModule("gui", function () else frame.switch:SetPoint("TOPLEFT", default_border, -pfUI.gui.tabTop* (22 + default_border) -default_border) end - pfUI.api:CreateBackdrop(frame.switch, nil, true) + CreateBackdrop(frame.switch, nil, true) frame.switch.text = frame.switch:CreateFontString("Status", "LOW", "GameFontNormal") frame.switch.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.switch.text:SetAllPoints(frame.switch) @@ -445,19 +445,19 @@ pfUI:RegisterModule("gui", function () frame.color = CreateFrame("Button", nil, frame) frame.color:SetWidth(12) frame.color:SetHeight(12) - pfUI.api:CreateBackdrop(frame.color) + CreateBackdrop(frame.color) frame.color:SetPoint("TOPRIGHT" , 0, -4) frame.color.prev = frame.color.backdrop:CreateTexture("OVERLAY") frame.color.prev:SetAllPoints(frame.color) - local cr, cg, cb, ca = pfUI.api.strsplit(",", category[config]) + local cr, cg, cb, ca = strsplit(",", category[config]) if not cr or not cg or not cb or not ca then cr, cg, cb, ca = 1, 1, 1, 1 end frame.color.prev:SetTexture(cr,cg,cb,ca) frame.color:SetScript("OnClick", function() - local cr, cg, cb, ca = pfUI.api.strsplit(",", category[config]) + local cr, cg, cb, ca = strsplit(",", category[config]) if not cr or not cg or not cb or not ca then cr, cg, cb, ca = 1, 1, 1, 1 end @@ -467,10 +467,10 @@ pfUI:RegisterModule("gui", function () local r,g,b = ColorPickerFrame:GetColorRGB() local a = 1 - OpacitySliderFrame:GetValue() - r = pfUI.api.round(r, 1) - g = pfUI.api.round(g, 1) - b = pfUI.api.round(b, 1) - a = pfUI.api.round(a, 1) + r = round(r, 1) + g = round(g, 1) + b = round(b, 1) + a = round(a, 1) preview:SetTexture(r,g,b,a) @@ -495,7 +495,7 @@ pfUI:RegisterModule("gui", function () end if widget == "warning" then - pfUI.api:CreateBackdrop(frame, nil, true) + CreateBackdrop(frame, nil, true) frame:SetBackdropBorderColor(1,.5,.5) frame:SetHeight(50) frame:SetPoint("TOPLEFT", 25, parent.objectCount * -35) @@ -543,8 +543,8 @@ pfUI:RegisterModule("gui", function () -- use button widget if widget == "button" then frame.button = CreateFrame("Button", "pfButton", frame, "UIPanelButtonTemplate") - pfUI.api:CreateBackdrop(frame.button, nil, true) - pfUI.api:SkinButton(frame.button) + CreateBackdrop(frame.button, nil, true) + SkinButton(frame.button) frame.button:SetWidth(85) frame.button:SetHeight(20) frame.button:SetPoint("TOPRIGHT", -(parent.lineCount-1) * 90, -5) @@ -560,7 +560,7 @@ pfUI:RegisterModule("gui", function () frame.input:SetNormalTexture("") frame.input:SetPushedTexture("") frame.input:SetHighlightTexture("") - pfUI.api:CreateBackdrop(frame.input, nil, true) + CreateBackdrop(frame.input, nil, true) frame.input:SetWidth(14) frame.input:SetHeight(14) frame.input:SetPoint("TOPRIGHT" , 0, -4) @@ -623,7 +623,7 @@ pfUI:RegisterModule("gui", function () for i,v in ipairs({frame.input:GetRegions()}) do if v.SetTexture then v:Hide() end if v.SetTextColor then v:SetTextColor(.2,1,.8) end - if v.SetBackdrop then pfUI.api:CreateBackdrop(v) end + if v.SetBackdrop then CreateBackdrop(v) end end end @@ -635,7 +635,7 @@ pfUI:RegisterModule("gui", function () pfUI.gui.deco:ClearAllPoints() pfUI.gui.deco:SetPoint("TOPLEFT", pfUI.gui, "TOPLEFT", 4*default_border + 100,-2*default_border) pfUI.gui.deco:SetPoint("BOTTOMRIGHT", pfUI.gui, "BOTTOMRIGHT", -2*default_border,2*default_border) - pfUI.api:CreateBackdrop(pfUI.gui.deco, nil, nil, .8) + CreateBackdrop(pfUI.gui.deco, nil, nil, .8) pfUI.gui.deco.up = CreateFrame("Frame", nil, pfUI.gui.deco) pfUI.gui.deco.up:SetPoint("TOPLEFT", pfUI.gui.deco, "TOPLEFT", 0,0) @@ -758,9 +758,9 @@ pfUI:RegisterModule("gui", function () -- load profile pfUI.gui:CreateConfig(pfUI.gui.global, "Load profile", C.global, "profile", "button", function() if C.global.profile and pfUI_profiles[C.global.profile] then - pfUI.api:CreateQuestionDialog("Load profile '|cff33ffcc" .. C.global.profile .. "|r'?", function() + CreateQuestionDialog("Load profile '|cff33ffcc" .. C.global.profile .. "|r'?", function() local selp = C.global.profile - C = pfUI.api.CopyTable(pfUI_profiles[C.global.profile]) + C = CopyTable(pfUI_profiles[C.global.profile]) C.global.profile = selp ReloadUI() end) @@ -770,7 +770,7 @@ pfUI:RegisterModule("gui", function () -- delete profile pfUI.gui:CreateConfig(pfUI.gui.global, "Delete profile", C.global, "profile", "button", function() if C.global.profile and pfUI_profiles[C.global.profile] then - pfUI.api:CreateQuestionDialog("Delete profile '|cff33ffcc" .. C.global.profile .. "|r'?", function() + CreateQuestionDialog("Delete profile '|cff33ffcc" .. C.global.profile .. "|r'?", function() pfUI_profiles[C.global.profile] = nil pfUpdateProfiles() this:GetParent():Hide() @@ -781,9 +781,9 @@ pfUI:RegisterModule("gui", function () -- save profile pfUI.gui:CreateConfig(pfUI.gui.global, "Save profile", C.global, "profile", "button", function() if C.global.profile and pfUI_profiles[C.global.profile] then - pfUI.api:CreateQuestionDialog("Save current settings to profile '|cff33ffcc" .. C.global.profile .. "|r'?", function() + CreateQuestionDialog("Save current settings to profile '|cff33ffcc" .. C.global.profile .. "|r'?", function() if pfUI_profiles[C.global.profile] then - pfUI_profiles[C.global.profile] = pfUI.api.CopyTable(C) + pfUI_profiles[C.global.profile] = CopyTable(C) end this:GetParent():Hide() end) @@ -792,7 +792,7 @@ pfUI:RegisterModule("gui", function () -- create profile pfUI.gui:CreateConfig(pfUI.gui.global, "Create Profile", C.global, "profile", "button", function() - pfUI.api:CreateQuestionDialog("Please enter a name for the new profile.\nExisting profiles sharing the same name will be overwritten.", + CreateQuestionDialog("Please enter a name for the new profile.\nExisting profiles sharing the same name will be overwritten.", function() local profile = this:GetParent().input:GetText() local bad = string.gsub(profile,"([%w%s]+)","") @@ -801,7 +801,7 @@ pfUI:RegisterModule("gui", function () else profile = (string.gsub(profile,"^%s*(.-)%s*$", "%1")) if profile and profile ~= "" then - pfUI_profiles[profile] = pfUI.api.CopyTable(C) + pfUI_profiles[profile] = CopyTable(C) pfUpdateProfiles() this:GetParent():Hide() end @@ -928,15 +928,15 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.bar, "Enable Autohide For BarPet", C.bars, "hide_pet", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.bar, "Action Bar Layouts", nil, nil, "header") - local values = pfUI.api:BarLayoutOptions(NUM_ACTIONBAR_BUTTONS) + local values = BarLayoutOptions(NUM_ACTIONBAR_BUTTONS) pfUI.gui:CreateConfig(pfUI.gui.bar, "Main Actionbar (ActionMain)", C.bars.actionmain, "formfactor", "dropdown", values) pfUI.gui:CreateConfig(pfUI.gui.bar, "Second Actionbar (BottomLeft)", C.bars.bottomleft, "formfactor", "dropdown", values) pfUI.gui:CreateConfig(pfUI.gui.bar, "Left Actionbar (BottomRight)", C.bars.bottomright, "formfactor", "dropdown", values) pfUI.gui:CreateConfig(pfUI.gui.bar, "Right Actionbar (Right)", C.bars.right, "formfactor", "dropdown", values) pfUI.gui:CreateConfig(pfUI.gui.bar, "Vertical Actionbar (TwoRight)", C.bars.tworight, "formfactor", "dropdown", values) - local values = pfUI.api:BarLayoutOptions(NUM_SHAPESHIFT_SLOTS) + local values = BarLayoutOptions(NUM_SHAPESHIFT_SLOTS) pfUI.gui:CreateConfig(pfUI.gui.bar, "Shapeshift Bar (BarShapeShift)", C.bars.shapeshift, "formfactor", "dropdown", values) - local values = pfUI.api:BarLayoutOptions(NUM_PET_ACTION_SLOTS) + local values = BarLayoutOptions(NUM_PET_ACTION_SLOTS) pfUI.gui:CreateConfig(pfUI.gui.bar, "Pet Bar (BarPet)", C.bars.pet, "formfactor", "dropdown", values) -- panels @@ -1049,7 +1049,7 @@ pfUI:RegisterModule("gui", function () -- Reset Cache pfUI.gui.resetCache = pfUI.gui:CreateConfigTab("Reset Cache", "bottom", function() - pfUI.api:CreateQuestionDialog("Do you really want to reset the Cache?", + CreateQuestionDialog("Do you really want to reset the Cache?", function() _G["pfUI_playerDB"] = {} this:GetParent():Hide() @@ -1059,7 +1059,7 @@ pfUI:RegisterModule("gui", function () -- Reset Frames pfUI.gui.resetFrames = pfUI.gui:CreateConfigTab("Reset Positions", "bottom", function() - pfUI.api:CreateQuestionDialog("Do you really want to reset the Frame Positions?", + CreateQuestionDialog("Do you really want to reset the Frame Positions?", function() _G["C"]["position"] = {} this:GetParent():Hide() @@ -1069,7 +1069,7 @@ pfUI:RegisterModule("gui", function () -- Reset Chat pfUI.gui.resetChat = pfUI.gui:CreateConfigTab("Reset Firstrun", "bottom", function() - pfUI.api:CreateQuestionDialog("Do you really want to reset the Firstrun Wizard Settings?", + CreateQuestionDialog("Do you really want to reset the Firstrun Wizard Settings?", function() _G["pfUI_init"] = {} this:GetParent():Hide() @@ -1079,7 +1079,7 @@ pfUI:RegisterModule("gui", function () -- Reset Config pfUI.gui.resetConfig = pfUI.gui:CreateConfigTab("Reset Config", "bottom", function() - pfUI.api:CreateQuestionDialog("Do you really want to reset your configuration?\nThis also includes frame positions", + CreateQuestionDialog("Do you really want to reset your configuration?\nThis also includes frame positions", function() _G["C"] = {} pfUI:LoadConfig() @@ -1090,7 +1090,7 @@ pfUI:RegisterModule("gui", function () -- Reset All pfUI.gui.resetAll = pfUI.gui:CreateConfigTab("Reset All", "bottom", function() - pfUI.api:CreateQuestionDialog("Do you really want to reset |cffffaaaaEVERYTHING|r?\nThis includes configuration, frame positions, firstrun settings,\n player cache, profiles and just EVERYTHING!", + CreateQuestionDialog("Do you really want to reset |cffffaaaaEVERYTHING|r?\nThis includes configuration, frame positions, firstrun settings,\n player cache, profiles and just EVERYTHING!", function() _G["pfUI_init"] = {} _G["C"] = {} diff --git a/modules/loot.lua b/modules/loot.lua index d74065c5..91294bbb 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -73,9 +73,9 @@ pfUI:RegisterModule("loot", function () local color = ITEM_QUALITY_COLORS[maxrarity] if maxrarity <= 1 then - pfUI.api:CreateBackdrop(pfUI.loot) + CreateBackdrop(pfUI.loot) else - pfUI.api:CreateBackdrop(pfUI.loot) + CreateBackdrop(pfUI.loot) pfUI.loot.backdrop:SetBackdropBorderColor(color.r, color.g, color.b, 1) end pfUI.loot:SetHeight(math.max((real*22)+4*C.appearance.border.default), 20) @@ -137,7 +137,7 @@ pfUI:RegisterModule("loot", function () frame.ficon:SetWidth(frame:GetHeight() - 2*C.appearance.border.default) frame.ficon:ClearAllPoints() frame.ficon:SetPoint("RIGHT", frame) - pfUI.api:CreateBackdrop(frame.ficon) + CreateBackdrop(frame.ficon) frame.icon = frame.ficon:CreateTexture(nil, "ARTWORK") frame.icon:SetTexCoord(.07, .93, .07, .93) diff --git a/modules/map.lua b/modules/map.lua index dabfa7f3..44aaac94 100644 --- a/modules/map.lua +++ b/modules/map.lua @@ -45,7 +45,7 @@ pfUI:RegisterModule("map", function () WorldMapFrame:SetHeight(WorldMapButton:GetHeight() + 55) WorldMapFrameCloseButton:SetPoint("TOPRIGHT", WorldMapFrame, "TOPRIGHT", 0, 0) - pfUI.api:CreateBackdrop(WorldMapFrame) + CreateBackdrop(WorldMapFrame) WorldMapFrame:SetScale(.7) BlackoutWorld:Hide() diff --git a/modules/minimap.lua b/modules/minimap.lua index 4cdbac45..ec79bf4c 100644 --- a/modules/minimap.lua +++ b/modules/minimap.lua @@ -15,9 +15,9 @@ pfUI:RegisterModule("minimap", function () end) pfUI.minimap = CreateFrame("Frame","pfMinimap",UIParent) - pfUI.api:CreateBackdrop(pfUI.minimap) + CreateBackdrop(pfUI.minimap) pfUI.minimap:SetPoint("TOPRIGHT", UIParent, -5, -5) - pfUI.api:UpdateMovable(pfUI.minimap) + UpdateMovable(pfUI.minimap) pfUI.minimap:SetWidth(140) pfUI.minimap:SetHeight(140) pfUI.minimap:SetFrameStrata("BACKGROUND") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 301ad483..cc9c109f 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -313,7 +313,7 @@ pfUI:RegisterModule("nameplates", function () else healthbar.castbar:SetMinMaxValues(0, pfUI.castbar.target.casterDB[name:GetText()]["casttime"]) healthbar.castbar:SetValue(GetTime() - pfUI.castbar.target.casterDB[name:GetText()]["starttime"]) - healthbar.castbar.text:SetText(pfUI.api.round( pfUI.castbar.target.casterDB[name:GetText()]["starttime"] + pfUI.castbar.target.casterDB[name:GetText()]["casttime"] - GetTime(),1)) + healthbar.castbar.text:SetText(round( pfUI.castbar.target.casterDB[name:GetText()]["starttime"] + pfUI.castbar.target.casterDB[name:GetText()]["casttime"] - GetTime(),1)) if C.nameplates.spellname == "1" and healthbar.castbar.spell then healthbar.castbar.spell:SetText(pfUI.castbar.target.casterDB[name:GetText()]["cast"]) else diff --git a/modules/panel.lua b/modules/panel.lua index 9bfa27d2..c81250d9 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -54,7 +54,7 @@ pfUI:RegisterModule("panel", function () pfUI.panel.clock.timerFrame:SetWidth(120) pfUI.panel.clock.timerFrame:SetHeight(35) pfUI.panel.clock.timerFrame:SetPoint("TOP", 0, -100) - pfUI.api:UpdateMovable(pfUI.panel.clock.timerFrame) + UpdateMovable(pfUI.panel.clock.timerFrame) pfUI.panel.clock.timerFrame.text = pfUI.panel.clock.timerFrame:CreateFontString("Status", "LOW", "GameFontNormal") pfUI.panel.clock.timerFrame.text:SetFontObject(GameFontWhite) @@ -136,13 +136,13 @@ pfUI:RegisterModule("panel", function () GameTooltip:AddDoubleLine("Active Addons", "|cffffffff" .. active .. "|cff555555 / |cffffffff" .. GetNumAddOns()) GameTooltip:AddLine(" ") local nin, nout, nping = GetNetStats() - GameTooltip:AddDoubleLine("Network Down", "|cffffffff" .. pfUI.api.round(nin,1) .. "KB/s") - GameTooltip:AddDoubleLine("Network Up", "|cffffffff" .. pfUI.api.round(nout,1) .. "KB/s") + GameTooltip:AddDoubleLine("Network Down", "|cffffffff" .. round(nin,1) .. "KB/s") + GameTooltip:AddDoubleLine("Network Up", "|cffffffff" .. round(nout,1) .. "KB/s") GameTooltip:AddDoubleLine("Network Latency", "|cffffffff" .. nping .. "ms") GameTooltip:AddLine(" ") GameTooltip:AddDoubleLine("Graphic Renderer", "|cffffffff" .. GetCVar("gxApi")) GameTooltip:AddDoubleLine("Screen Resolution", "|cffffffff" .. GetCVar("gxResolution")) - GameTooltip:AddDoubleLine("UI-Scale", "|cffffffff" .. pfUI.api.round(UIParent:GetEffectiveScale(),2)) + GameTooltip:AddDoubleLine("UI-Scale", "|cffffffff" .. round(UIParent:GetEffectiveScale(),2)) GameTooltip:Show() end @@ -238,10 +238,10 @@ pfUI:RegisterModule("panel", function () GameTooltip:ClearLines() GameTooltip:AddLine("|cff555555Money") - GameTooltip:AddDoubleLine("Login:", pfUI.api.CreateGoldString(pfUI.panel.initMoney)) - GameTooltip:AddDoubleLine("Now:", pfUI.api.CreateGoldString(GetMoney())) + GameTooltip:AddDoubleLine("Login:", CreateGoldString(pfUI.panel.initMoney)) + GameTooltip:AddDoubleLine("Now:", CreateGoldString(GetMoney())) GameTooltip:AddDoubleLine("|cffffffff","") - GameTooltip:AddDoubleLine("This Session:", dmod .. pfUI.api.CreateGoldString(math.abs(pfUI.panel.diffMoney))) + GameTooltip:AddDoubleLine("This Session:", dmod .. CreateGoldString(math.abs(pfUI.panel.diffMoney))) GameTooltip:Show() end @@ -351,7 +351,7 @@ pfUI:RegisterModule("panel", function () GameTooltip_SetDefaultAnchor(GameTooltip, this) GameTooltip:AddLine("|cffffffff" .. real) GameTooltip:AddLine(sub) - GameTooltip:AddLine("|cffaaaaaa" .. pfUI.api.round(posX*100,1) .. " / " .. pfUI.api.round(posY*100,1)) + GameTooltip:AddLine("|cffaaaaaa" .. round(posX*100,1) .. " / " .. round(posY*100,1)) GameTooltip:Show() end @@ -416,14 +416,14 @@ pfUI:RegisterModule("panel", function () end pfUI.panel.left:SetHeight(C.global.font_size+default_border*2) - pfUI.api:CreateBackdrop(pfUI.panel.left, default_border, nil) + CreateBackdrop(pfUI.panel.left, default_border, nil) pfUI.panel.left.hide = CreateFrame("Button", nil, pfUI.panel.left) pfUI.panel.left.hide:ClearAllPoints() pfUI.panel.left.hide:SetWidth(12) pfUI.panel.left.hide:SetHeight(pfUI.panel.left:GetHeight()) pfUI.panel.left.hide:SetPoint("LEFT", 0, 0) - pfUI.api:CreateBackdrop(pfUI.panel.left.hide, default_border) + CreateBackdrop(pfUI.panel.left.hide, default_border) pfUI.panel.left.hide.texture = pfUI.panel.left.hide:CreateTexture("pfPanelLeftHide") pfUI.panel.left.hide.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\left") pfUI.panel.left.hide.texture:ClearAllPoints() @@ -482,14 +482,14 @@ pfUI:RegisterModule("panel", function () pfUI.panel.right:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -5, 5) end pfUI.panel.right:SetHeight(C.global.font_size+default_border*2) - pfUI.api:CreateBackdrop(pfUI.panel.right, default_border, nil) + CreateBackdrop(pfUI.panel.right, default_border, nil) pfUI.panel.right.hide = CreateFrame("Button", nil, pfUI.panel.right) pfUI.panel.right.hide:ClearAllPoints() pfUI.panel.right.hide:SetWidth(12) pfUI.panel.right.hide:SetHeight(pfUI.panel.right:GetHeight()) pfUI.panel.right.hide:SetPoint("RIGHT", 0, 0) - pfUI.api:CreateBackdrop(pfUI.panel.right.hide, default_border) + CreateBackdrop(pfUI.panel.right.hide, default_border) pfUI.panel.right.hide.texture = pfUI.panel.right.hide:CreateTexture("pfPanelRightHide") pfUI.panel.right.hide.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\right") pfUI.panel.right.hide.texture:ClearAllPoints() @@ -537,8 +537,8 @@ pfUI:RegisterModule("panel", function () pfUI.panel.right.right.text:SetFontObject(GameFontWhite) pfUI.panel.minimap = CreateFrame("Button", "pfPanelMinimap", UIParent) - pfUI.api:CreateBackdrop(pfUI.panel.minimap, default_border) - pfUI.api:UpdateMovable(pfUI.panel.minimap) + CreateBackdrop(pfUI.panel.minimap, default_border) + UpdateMovable(pfUI.panel.minimap) pfUI.panel.minimap:SetHeight(C.global.font_size+default_border*2) if pfUI.minimap then pfUI.panel.minimap:SetPoint("TOP", pfUI.minimap, "BOTTOM", 0 , -default_border*3) @@ -557,7 +557,7 @@ pfUI:RegisterModule("panel", function () if C.panel.micro.enable == "1" then pfUI.panel.microbutton = CreateFrame("Frame", "pfPanelMicroButton", UIParent) pfUI.panel.microbutton:SetPoint("TOP", pfUI.panel.minimap, "BOTTOM", 0, -2*default_border) - pfUI.api:UpdateMovable(pfUI.panel.microbutton) + UpdateMovable(pfUI.panel.microbutton) pfUI.panel.microbutton:SetHeight(23) pfUI.panel.microbutton:SetWidth(145) pfUI.panel.microbutton:SetFrameStrata("BACKGROUND") @@ -584,7 +584,7 @@ pfUI:RegisterModule("panel", function () button.frame:SetScale(1.4) button.frame:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -16) button.frame:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1) - pfUI.api:CreateBackdrop(button.frame, default_border) + CreateBackdrop(button.frame, default_border) button:Show() end end diff --git a/modules/pet.lua b/modules/pet.lua index 22f557eb..c3d4cfce 100644 --- a/modules/pet.lua +++ b/modules/pet.lua @@ -17,7 +17,7 @@ pfUI:RegisterModule("pet", function () pfUI.uf.pet:SetHeight(20 + 2*default_border + spacing) pfUI.uf.pet:ClearAllPoints() pfUI.uf.pet:SetPoint("BOTTOM", UIParent , "BOTTOM", 0, 163) - pfUI.api:UpdateMovable(pfUI.uf.pet) + UpdateMovable(pfUI.uf.pet) pfUI.uf.pet:RegisterForClicks('LeftButtonUp', 'RightButtonUp', 'MiddleButtonUp', 'Button4Up', 'Button5Up') pfUI.uf.pet:SetScript("OnEnter", function() @@ -93,7 +93,7 @@ pfUI:RegisterModule("pet", function () end if C.unitframes.custom == "1" then - local cr, cg, cb, ca = pfUI.api.strsplit(",", C.unitframes.customcolor) + local cr, cg, cb, ca = strsplit(",", C.unitframes.customcolor) pfUI.uf.pet.hp.bar:SetStatusBarColor(tonumber(cr), tonumber(cg), tonumber(cb), hp / hpmax / 4 + .75) else pfUI.uf.pet.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75) @@ -143,7 +143,7 @@ pfUI:RegisterModule("pet", function () pfUI.uf.pet.hp:SetWidth(100) pfUI.uf.pet.hp:SetHeight(16) pfUI.uf.pet.hp:SetPoint("TOP", 0, 0) - pfUI.api:CreateBackdrop(pfUI.uf.pet.hp, default_border) + CreateBackdrop(pfUI.uf.pet.hp, default_border) pfUI.uf.pet.hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.pet.hp) pfUI.uf.pet.hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -165,7 +165,7 @@ pfUI:RegisterModule("pet", function () pfUI.uf.pet.power:SetPoint("BOTTOM", 0, 0) pfUI.uf.pet.power:SetWidth(100) pfUI.uf.pet.power:SetHeight(4) - pfUI.api:CreateBackdrop(pfUI.uf.pet.power, default_border) + CreateBackdrop(pfUI.uf.pet.power, default_border) pfUI.uf.pet.power.bar = CreateFrame("StatusBar", nil, pfUI.uf.pet.power) pfUI.uf.pet.power.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -230,7 +230,7 @@ pfUI:RegisterModule("pet", function () local buffsize = pfUI.uf.pet.hp:GetWidth()/8 - 1 for i=1, 16 do local texture, stacks = UnitBuff("pet",i) - pfUI.api:CreateBackdrop(pfUI.uf.pet.buff.buffs[i], default_border) + CreateBackdrop(pfUI.uf.pet.buff.buffs[i], default_border) pfUI.uf.pet.buff.buffs[i]:SetNormalTexture(texture) for i,v in ipairs({pfUI.uf.pet.buff.buffs[i]:GetRegions()}) do if v.SetTexCoord then v:SetTexCoord(.08, .92, .08, .92) end @@ -304,7 +304,7 @@ pfUI:RegisterModule("pet", function () (row)*((2*default_border) + buffsize + 1) + (2*default_border + 1)) local texture, stacks = UnitDebuff("pet",i) - pfUI.api:CreateBackdrop(pfUI.uf.pet.debuff.debuffs[i], default_border) + CreateBackdrop(pfUI.uf.pet.debuff.debuffs[i], default_border) pfUI.uf.pet.debuff.debuffs[i]:SetNormalTexture(texture) for i,v in ipairs({pfUI.uf.pet.debuff.debuffs[i]:GetRegions()}) do if v.SetTexCoord then v:SetTexCoord(.08, .92, .08, .92) end diff --git a/modules/player.lua b/modules/player.lua index 2e735ffc..58c287a1 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -19,7 +19,7 @@ pfUI:RegisterModule("player", function () pfUI.uf.player:SetWidth(C.unitframes.player.width) pfUI.uf.player:SetHeight(C.unitframes.player.height + C.unitframes.player.pheight + 2*default_border + spacing) pfUI.uf.player:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", -75, 125) - pfUI.api:UpdateMovable(pfUI.uf.player) + UpdateMovable(pfUI.uf.player) pfUI.uf.player:RegisterForClicks('LeftButtonUp', 'RightButtonUp', 'MiddleButtonUp', 'Button4Up', 'Button5Up') pfUI.uf.player:SetScript("OnEnter", function() GameTooltip_SetDefaultAnchor(GameTooltip, this) @@ -135,7 +135,7 @@ pfUI:RegisterModule("player", function () local cr, cg, cb if C.unitframes.custom == "1" then - local r, g, b, a = pfUI.api.strsplit(",", C.unitframes.customcolor) + local r, g, b, a = strsplit(",", C.unitframes.customcolor) cr, cg, cb = tonumber(r), tonumber(g), tonumber(b) elseif C.unitframes.pastel == "1" then cr, cg, cb = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5 @@ -206,7 +206,7 @@ pfUI:RegisterModule("player", function () pfUI.uf.player.hp:SetPoint("TOP", 0, 0) pfUI.uf.player.hp:SetWidth(C.unitframes.player.width) pfUI.uf.player.hp:SetHeight(C.unitframes.player.height) - pfUI.api:CreateBackdrop(pfUI.uf.player.hp, default_border) + CreateBackdrop(pfUI.uf.player.hp, default_border) pfUI.uf.player.hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.player.hp) pfUI.uf.player.hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -244,7 +244,7 @@ pfUI:RegisterModule("player", function () pfUI.uf.player.power:SetPoint("BOTTOM", 0, 0) pfUI.uf.player.power:SetWidth(C.unitframes.player.width) pfUI.uf.player.power:SetHeight(C.unitframes.player.pheight) - pfUI.api:CreateBackdrop(pfUI.uf.player.power, default_border) + CreateBackdrop(pfUI.uf.player.power, default_border) pfUI.uf.player.power.bar = CreateFrame("StatusBar", nil, pfUI.uf.player.power) pfUI.uf.player.power.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -284,7 +284,7 @@ pfUI:RegisterModule("player", function () this.energy = UnitMana("player") - local value = pfUI.api.round((GetTime() - this.lastTick) * 100) + local value = round((GetTime() - this.lastTick) * 100) local pos = C.unitframes.player.width / 200 * value if not C.unitframes.player.pheight then return end this.spark:SetPoint("LEFT", pos-((C.unitframes.player.pheight+5)/2), 0) @@ -405,7 +405,7 @@ pfUI:RegisterModule("player", function () function pfUI.uf.player.buff.RefreshBuffs() for i=1, 16 do local stacks = GetPlayerBuffApplications(GetPlayerBuff(i-1,"HELPFUL")) - pfUI.api:CreateBackdrop(pfUI.uf.player.buff.buffs[i], default_border) + CreateBackdrop(pfUI.uf.player.buff.buffs[i], default_border) pfUI.uf.player.buff.buffs[i]:SetNormalTexture(GetPlayerBuffTexture(GetPlayerBuff(i-1,"HELPFUL"))) for i,v in ipairs({pfUI.uf.player.buff.buffs[i]:GetRegions()}) do if v.SetTexCoord then v:SetTexCoord(.08, .92, .08, .92) end @@ -529,7 +529,7 @@ pfUI:RegisterModule("player", function () local bid = GetPlayerBuff(i-1, "HARMFUL"); local stacks = GetPlayerBuffApplications(bid) - pfUI.api:CreateBackdrop(pfUI.uf.player.debuff.debuffs[i], default_border) + CreateBackdrop(pfUI.uf.player.debuff.debuffs[i], default_border) pfUI.uf.player.debuff.debuffs[i]:SetNormalTexture(GetPlayerBuffTexture(bid)) for i,v in ipairs({pfUI.uf.player.debuff.debuffs[i]:GetRegions()}) do if v.SetTexCoord then v:SetTexCoord(.08, .92, .08, .92) end diff --git a/modules/raid.lua b/modules/raid.lua index 36a0df0c..b019c986 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -44,7 +44,7 @@ pfUI:RegisterModule("raid", function () pfUI.uf.raid[i]:SetWidth(50) pfUI.uf.raid[i]:SetHeight(30 + 2*default_border + C.unitframes.raid.pspace) pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1) * (54+default_border) + 5, C.chat.left.height + 10 + ((g-1)*(37+default_border))+default_border) - pfUI.api:UpdateMovable(pfUI.uf.raid[i]) + UpdateMovable(pfUI.uf.raid[i]) pfUI.uf.raid[i]:Hide() pfUI.uf.raid[i].id = 0 @@ -52,7 +52,7 @@ pfUI:RegisterModule("raid", function () pfUI.uf.raid[i].hp:SetPoint("TOP", 0, 0) pfUI.uf.raid[i].hp:SetWidth(50) pfUI.uf.raid[i].hp:SetHeight(27) - pfUI.api:CreateBackdrop(pfUI.uf.raid[i].hp, default_border) + CreateBackdrop(pfUI.uf.raid[i].hp, default_border) pfUI.uf.raid[i].hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.raid[i].hp) pfUI.uf.raid[i].hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -63,7 +63,7 @@ pfUI:RegisterModule("raid", function () pfUI.uf.raid[i].power:SetPoint("BOTTOM", 0, 0) pfUI.uf.raid[i].power:SetWidth(50) pfUI.uf.raid[i].power:SetHeight(3) - pfUI.api:CreateBackdrop(pfUI.uf.raid[i].power, default_border) + CreateBackdrop(pfUI.uf.raid[i].power, default_border) pfUI.uf.raid[i].power.bar = CreateFrame("StatusBar", nil, pfUI.uf.raid[i].power) pfUI.uf.raid[i].power.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") diff --git a/modules/roll.lua b/modules/roll.lua index 140c470b..d9729ece 100644 --- a/modules/roll.lua +++ b/modules/roll.lua @@ -7,7 +7,7 @@ pfUI:RegisterModule("roll", function () local border = tonumber(C.appearance.border.default) local esize = size - border*2 local f = CreateFrame("Frame", "pfLootRollFrame" .. id, UIParent) - pfUI.api:CreateBackdrop(f, nil, nil, .8) + CreateBackdrop(f, nil, nil, .8) f.backdrop:SetFrameStrata("BACKGROUND") f.hasItem = 1 @@ -15,7 +15,7 @@ pfUI:RegisterModule("roll", function () f:SetHeight(size) f.icon = CreateFrame("Button", "pfLootRollFrame" .. id .. "Icon", f) - pfUI.api:CreateBackdrop(f.icon, nil, true) + CreateBackdrop(f.icon, nil, true) f.icon:SetPoint("LEFT", border, 0) f.icon:SetWidth(esize) f.icon:SetHeight(esize) @@ -120,7 +120,7 @@ pfUI:RegisterModule("roll", function () f.time.bar:SetAllPoints(f.time) f.time.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") f.time.bar:SetMinMaxValues(0, 100) - local r, g, b, a = pfUI.api.strsplit(",", C.appearance.border.color) + local r, g, b, a = strsplit(",", C.appearance.border.color) f.time.bar:SetStatusBarColor(r, g, b) f.time.bar:SetValue(20) f.time.bar:SetScript("OnUpdate", function() @@ -179,7 +179,7 @@ pfUI:RegisterModule("roll", function () if not pfUI.roll.frames[i] then pfUI.roll.frames[i] = pfUI.roll:CreateLootRoll(i) pfUI.roll.frames[i]:SetPoint("CENTER", 0, -i*35) - pfUI.api:UpdateMovable(pfUI.roll.frames[i]) + UpdateMovable(pfUI.roll.frames[i]) pfUI.roll.frames[i]:Hide() end end diff --git a/modules/sellvalue.lua b/modules/sellvalue.lua index 2e2d02c7..b5f018fe 100644 --- a/modules/sellvalue.lua +++ b/modules/sellvalue.lua @@ -26,15 +26,15 @@ pfUI:RegisterModule("sellvalue", function () GameTooltip:AddLine(" ") if count > 1 then - GameTooltip:AddDoubleLine("Sell:", pfUI.api.CreateGoldString(sell) .. "|cff555555 // " .. pfUI.api.CreateGoldString(sell*count), 1, 1, 1); + GameTooltip:AddDoubleLine("Sell:", CreateGoldString(sell) .. "|cff555555 // " .. CreateGoldString(sell*count), 1, 1, 1); else - GameTooltip:AddDoubleLine("Sell:", pfUI.api.CreateGoldString(sell * count), 1, 1, 1); + GameTooltip:AddDoubleLine("Sell:", CreateGoldString(sell * count), 1, 1, 1); end if count > 1 then - GameTooltip:AddDoubleLine("Buy:", pfUI.api.CreateGoldString(buy) .. "|cff555555 // " .. pfUI.api.CreateGoldString(buy*count), 1, 1, 1); + GameTooltip:AddDoubleLine("Buy:", CreateGoldString(buy) .. "|cff555555 // " .. CreateGoldString(buy*count), 1, 1, 1); else - GameTooltip:AddDoubleLine("Buy:", pfUI.api.CreateGoldString(buy), 1, 1, 1); + GameTooltip:AddDoubleLine("Buy:", CreateGoldString(buy), 1, 1, 1); end end GameTooltip:Show() diff --git a/modules/skin.lua b/modules/skin.lua index 58d3ab80..b80f064e 100644 --- a/modules/skin.lua +++ b/modules/skin.lua @@ -44,12 +44,12 @@ pfUI:RegisterModule("skin", function () GameMenuButtonContinue:SetPoint("BOTTOM", 0, 10) for _, button in pairs(buttons) do - pfUI.api:SkinButton(button, cr, cg, cb) + SkinButton(button, cr, cg, cb) end for _, box in pairs(boxes) do local b = getglobal(box) - pfUI.api:CreateBackdrop(b, nil, true, .8) + CreateBackdrop(b, nil, true, .8) end for i,v in ipairs({GameMenuFrame:GetRegions()}) do @@ -61,9 +61,9 @@ pfUI:RegisterModule("skin", function () end local alpha = tonumber(C.tooltip.alpha) - pfUI.api:CreateBackdrop(ShoppingTooltip1, nil, nil, alpha) - pfUI.api:CreateBackdrop(ShoppingTooltip2, nil, nil, alpha) - pfUI.api:CreateBackdrop(ItemRefTooltip, nil, nil, alpha) + CreateBackdrop(ShoppingTooltip1, nil, nil, alpha) + CreateBackdrop(ShoppingTooltip2, nil, nil, alpha) + CreateBackdrop(ItemRefTooltip, nil, nil, alpha) ShoppingTooltip1:SetScript("OnShow", function() local a, b, c, d, e = this:GetPoint() @@ -79,7 +79,7 @@ pfUI:RegisterModule("skin", function () this:SetPoint(a, b, c, d, e) end) - pfUI.api:CreateBackdrop(TicketStatusFrame) + CreateBackdrop(TicketStatusFrame) TicketStatusFrame:ClearAllPoints() TicketStatusFrame:SetPoint("TOP", 0, -5) function TicketStatusFrame_OnEvent() diff --git a/modules/target.lua b/modules/target.lua index 4949645c..e448ba1e 100644 --- a/modules/target.lua +++ b/modules/target.lua @@ -25,7 +25,7 @@ pfUI:RegisterModule("target", function () pfUI.uf.target:SetWidth(C.unitframes.target.width) pfUI.uf.target:SetHeight(C.unitframes.target.height + C.unitframes.target.pheight + 2*default_border + spacing) pfUI.uf.target:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 75, 125) - pfUI.api:UpdateMovable(pfUI.uf.target) + UpdateMovable(pfUI.uf.target) pfUI.uf.target:RegisterForClicks('LeftButtonUp', 'RightButtonUp', 'MiddleButtonUp', 'Button4Up', 'Button5Up') pfUI.uf.target:SetScript("OnEnter", function() GameTooltip_SetDefaultAnchor(GameTooltip, this) @@ -132,7 +132,7 @@ pfUI:RegisterModule("target", function () local r, g, b = .2, .2, .2 if C.unitframes.custom == "1" then - local cr, cg, cb, ca = pfUI.api.strsplit(",", C.unitframes.customcolor) + local cr, cg, cb, ca = strsplit(",", C.unitframes.customcolor) cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb) pfUI.uf.target.hp.bar:SetStatusBarColor(cr, cg, cb, hp / hpmax / 4 + .75) if C.unitframes.pastel == "1" then @@ -246,7 +246,7 @@ pfUI:RegisterModule("target", function () pfUI.uf.target.hp:SetWidth(C.unitframes.target.width) pfUI.uf.target.hp:SetHeight(C.unitframes.target.height) pfUI.uf.target.hp:SetPoint("TOP", 0, 0) - pfUI.api:CreateBackdrop(pfUI.uf.target.hp, default_border) + CreateBackdrop(pfUI.uf.target.hp, default_border) pfUI.uf.target.hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.target.hp) pfUI.uf.target.hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -284,7 +284,7 @@ pfUI:RegisterModule("target", function () pfUI.uf.target.power:SetPoint("BOTTOM", 0, 0) pfUI.uf.target.power:SetWidth(C.unitframes.target.width) pfUI.uf.target.power:SetHeight(C.unitframes.target.pheight) - pfUI.api:CreateBackdrop(pfUI.uf.target.power, default_border) + CreateBackdrop(pfUI.uf.target.power, default_border) pfUI.uf.target.power.bar = CreateFrame("StatusBar", nil, pfUI.uf.target.power) pfUI.uf.target.power.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -334,7 +334,7 @@ pfUI:RegisterModule("target", function () pfUI.uf.target["combopoint" .. point]:SetFrameStrata("HIGH") pfUI.uf.target["combopoint" .. point]:SetWidth(5) pfUI.uf.target["combopoint" .. point]:SetHeight(5) - pfUI.api:CreateBackdrop(pfUI.uf.target["combopoint" .. point]) + CreateBackdrop(pfUI.uf.target["combopoint" .. point]) pfUI.uf.target["combopoint" .. point]:SetPoint("TOPLEFT", pfUI.uf.target, "TOPRIGHT", C.appearance.border.default*3, -(point - 1) * (5 + C.appearance.border.default*3)) if point < 3 then local tex = pfUI.uf.target["combopoint" .. point]:CreateTexture("OVERLAY") @@ -428,7 +428,7 @@ pfUI:RegisterModule("target", function () function pfUI.uf.target.buff.RefreshBuffs() for i=1, 16 do local texture, stacks = UnitBuff("target",i) - pfUI.api:CreateBackdrop(pfUI.uf.target.buff.buffs[i], default_border) + CreateBackdrop(pfUI.uf.target.buff.buffs[i], default_border) pfUI.uf.target.buff.buffs[i]:SetNormalTexture(texture) for i,v in ipairs({pfUI.uf.target.buff.buffs[i]:GetRegions()}) do if v.SetTexCoord then v:SetTexCoord(.08, .92, .08, .92) end @@ -518,7 +518,7 @@ pfUI:RegisterModule("target", function () invert * (row)*((2*default_border) + C.unitframes.debuff_size + 1) + invert * (2*default_border + 1)) local texture, stacks = UnitDebuff("target",i) - pfUI.api:CreateBackdrop(pfUI.uf.target.debuff.debuffs[i], default_border) + CreateBackdrop(pfUI.uf.target.debuff.debuffs[i], default_border) pfUI.uf.target.debuff.debuffs[i]:SetNormalTexture(texture) for i,v in ipairs({pfUI.uf.target.debuff.debuffs[i]:GetRegions()}) do if v.SetTexCoord then v:SetTexCoord(.08, .92, .08, .92) end diff --git a/modules/targettarget.lua b/modules/targettarget.lua index 41209d72..49bef362 100644 --- a/modules/targettarget.lua +++ b/modules/targettarget.lua @@ -25,7 +25,7 @@ pfUI:RegisterModule("targettarget", function () pfUI.uf.targettarget:SetWidth(100) pfUI.uf.targettarget:SetHeight(20 + 2*default_border + spacing) pfUI.uf.targettarget:SetPoint("BOTTOM", UIParent , "BOTTOM", 0, 125) - pfUI.api:UpdateMovable(pfUI.uf.targettarget) + UpdateMovable(pfUI.uf.targettarget) pfUI.uf.targettarget:RegisterForClicks('LeftButtonUp', 'RightButtonUp', 'MiddleButtonUp', 'Button4Up', 'Button5Up') pfUI.uf.targettarget:SetScript("OnEnter", function() @@ -73,7 +73,7 @@ pfUI:RegisterModule("targettarget", function () local r, g, b = .2, .2, .2 if color then if C.unitframes.custom == "1" then - local cr, cg, cb, ca = pfUI.api.strsplit(",", C.unitframes.customcolor) + local cr, cg, cb, ca = strsplit(",", C.unitframes.customcolor) cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb) pfUI.uf.targettarget.hp.bar:SetStatusBarColor(cr, cg, cb, UnitHealth("targettarget") / UnitHealthMax("targettarget") / 4 + .75) if C.unitframes.pastel == "1" then @@ -127,7 +127,7 @@ pfUI:RegisterModule("targettarget", function () pfUI.uf.targettarget.hp:SetPoint("TOP", 0, 0) pfUI.uf.targettarget.hp:SetWidth(100) pfUI.uf.targettarget.hp:SetHeight(16) - pfUI.api:CreateBackdrop(pfUI.uf.targettarget.hp, default_border) + CreateBackdrop(pfUI.uf.targettarget.hp, default_border) pfUI.uf.targettarget.hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.targettarget.hp) pfUI.uf.targettarget.hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -146,7 +146,7 @@ pfUI:RegisterModule("targettarget", function () pfUI.uf.targettarget.hp.raidIcon:Hide() pfUI.uf.targettarget.power = CreateFrame("Frame",nil, pfUI.uf.targettarget) - pfUI.api:CreateBackdrop(pfUI.uf.targettarget.power, default_border) + CreateBackdrop(pfUI.uf.targettarget.power, default_border) pfUI.uf.targettarget.power:SetPoint("BOTTOM", 0, 0) pfUI.uf.targettarget.power:SetWidth(100) pfUI.uf.targettarget.power:SetHeight(4) diff --git a/modules/thirdparty.lua b/modules/thirdparty.lua index d7591c55..edad3478 100644 --- a/modules/thirdparty.lua +++ b/modules/thirdparty.lua @@ -97,7 +97,7 @@ pfUI:RegisterModule("thirdparty", function () pfUIhookWIM_PostMessage = _G.WIM_PostMessage _G.WIM_PostMessage = function(user, msg, ttype, from, raw_msg) pfUIhookWIM_PostMessage(user, msg, ttype, from, raw_msg) - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user], nil, nil, .8) + CreateBackdrop(_G["WIM_msgFrame" .. user], nil, nil, .8) _G["WIM_msgFrame" .. user .. "From"]:ClearAllPoints() _G["WIM_msgFrame" .. user .. "From"]:SetPoint("TOP", 0, -10) @@ -115,7 +115,7 @@ pfUI:RegisterModule("thirdparty", function () _G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"]:SetPoint("BOTTOMRIGHT", _G["WIM_msgFrame" .. user], "BOTTOMRIGHT", -32, 32) _G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"]:SetFont(STANDARD_TEXT_FONT, 12) - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "MsgBox"]) + CreateBackdrop(_G["WIM_msgFrame" .. user .. "MsgBox"]) _G["WIM_msgFrame" .. user .. "MsgBox"]:ClearAllPoints() _G["WIM_msgFrame" .. user .. "MsgBox"]:SetPoint("TOPLEFT", _G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"], "BOTTOMLEFT", 0, -5) _G["WIM_msgFrame" .. user .. "MsgBox"]:SetPoint("TOPRIGHT", _G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"], "BOTTOMRIGHT", 0, -5) @@ -125,27 +125,27 @@ pfUI:RegisterModule("thirdparty", function () if i==6 then v:SetTexture(.1,.1,.1,.5) end end - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton1"]) + CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton1"]) for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton1"]:GetRegions()}) do if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end end - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton2"]) + CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton2"]) for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton2"]:GetRegions()}) do if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end end - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton3"]) + CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton3"]) for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton3"]:GetRegions()}) do if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end end - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton4"]) + CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton4"]) for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton4"]:GetRegions()}) do if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end end - pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton5"]) + CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton5"]) for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton5"]:GetRegions()}) do if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end end @@ -329,7 +329,7 @@ pfUI:RegisterModule("thirdparty", function () pfUI.bag.right.sort:SetPoint("TOPRIGHT", -C.appearance.border.default*14 - 45, -C.appearance.border.default) pfUI.bag.right.sort:SetPoint("TOPRIGHT", pfUI.bag.right.keys, "TOPLEFT", -C.appearance.border.default*3, 0) - pfUI.api:CreateBackdrop(pfUI.bag.right.sort) + CreateBackdrop(pfUI.bag.right.sort) pfUI.bag.right.sort:SetHeight(12) pfUI.bag.right.sort:SetWidth(12) pfUI.bag.right.sort:SetTextColor(1,1,.25,1) @@ -347,7 +347,7 @@ pfUI:RegisterModule("thirdparty", function () end) pfUI.bag.right.sort:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(pfUI.bag.right.sort) + CreateBackdrop(pfUI.bag.right.sort) pfUI.bag.right.sort.texture:SetVertexColor(.25,.25,.25,1) end) @@ -367,7 +367,7 @@ pfUI:RegisterModule("thirdparty", function () pfUI.bag.left.sort:SetPoint("TOPRIGHT", -C.appearance.border.default*14 - 45, -C.appearance.border.default) pfUI.bag.left.sort:SetPoint("TOPRIGHT", pfUI.bag.left.bags, "TOPLEFT", -C.appearance.border.default*3, 0) - pfUI.api:CreateBackdrop(pfUI.bag.left.sort) + CreateBackdrop(pfUI.bag.left.sort) pfUI.bag.left.sort:SetHeight(12) pfUI.bag.left.sort:SetWidth(12) pfUI.bag.left.sort:SetTextColor(1,1,.25,1) @@ -385,7 +385,7 @@ pfUI:RegisterModule("thirdparty", function () end) pfUI.bag.left.sort:SetScript("OnLeave", function () - pfUI.api:CreateBackdrop(pfUI.bag.left.sort) + CreateBackdrop(pfUI.bag.left.sort) pfUI.bag.left.sort.texture:SetVertexColor(.25,.25,.25,1) end) @@ -413,7 +413,7 @@ pfUI:RegisterModule("thirdparty", function () local function pfSetupKTM() -- use pfUI border for main window - pfUI.api:CreateBackdrop(KLHTM_Frame) + CreateBackdrop(KLHTM_Frame) -- remove titlebar KLHTM_Gui.title.back:Hide() @@ -427,7 +427,7 @@ pfUI:RegisterModule("thirdparty", function () for i, button in pairs(buttons) do local b = _G[button] if not b then return end - pfUI.api:SkinButton(b) + SkinButton(b) b:SetScale(.8) -- remove red background on some buttons diff --git a/modules/tooltip.lua b/modules/tooltip.lua index 59c97c61..4f8771aa 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -1,6 +1,6 @@ pfUI:RegisterModule("tooltip", function () local alpha = tonumber(C.tooltip.alpha) -pfUI.api:CreateBackdrop(GameTooltip, nil, nil, alpha) +CreateBackdrop(GameTooltip, nil, nil, alpha) if C.tooltip.position == "cursor" then function _G.GameTooltip_SetDefaultAnchor(tooltip, parent) @@ -62,8 +62,8 @@ pfUI.api:CreateBackdrop(GameTooltip, nil, nil, alpha) _, hpm = GameTooltipStatusBar:GetMinMaxValues() if hp and hpm then - if hp >= 1000 then hp = pfUI.api.round(hp / 1000, 1) .. "k" end - if hpm >= 1000 then hpm = pfUI.api.round(hpm / 1000, 1) .. "k" end + if hp >= 1000 then hp = round(hp / 1000, 1) .. "k" end + if hpm >= 1000 then hpm = round(hpm / 1000, 1) .. "k" end pfUI.tooltipStatusBar.HP:SetText(hp .. " / " .. hpm) end end) @@ -73,7 +73,7 @@ pfUI.api:CreateBackdrop(GameTooltip, nil, nil, alpha) GameTooltipStatusBar:SetPoint("BOTTOMLEFT", GameTooltip, "TOPLEFT", 0, 0) GameTooltipStatusBar:SetPoint("BOTTOMRIGHT", GameTooltip, "TOPRIGHT", 0, 0) GameTooltipStatusBar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") - pfUI.api:CreateBackdrop(GameTooltipStatusBar) + CreateBackdrop(GameTooltipStatusBar) GameTooltipStatusBar.SetStatusBarColor_orig = GameTooltipStatusBar.SetStatusBarColor GameTooltipStatusBar.SetStatusBarColor = function() return end @@ -140,8 +140,8 @@ pfUI.api:CreateBackdrop(GameTooltip, nil, nil, alpha) end if hp and hpm then - if hp >= 1000 then hp = pfUI.api.round(hp / 1000, 1) .. "k" end - if hpm >= 1000 then hpm = pfUI.api.round(hpm / 1000, 1) .. "k" end + if hp >= 1000 then hp = round(hp / 1000, 1) .. "k" end + if hpm >= 1000 then hpm = round(hpm / 1000, 1) .. "k" end pfUI.tooltipStatusBar.HP:SetText(hp .. " / " .. hpm) end GameTooltip:Show() diff --git a/modules/uf_tukui.lua b/modules/uf_tukui.lua index 4af5d6a7..f3d0cf79 100644 --- a/modules/uf_tukui.lua +++ b/modules/uf_tukui.lua @@ -26,7 +26,7 @@ pfUI:RegisterModule("uf_tukui", function () pfUI.uf.player.powerText:SetParent(pfUI.uf.player.caption) pfUI.uf.player.powerText:SetAllPoints(pfUI.uf.player.caption) pfUI.uf.player.powerText:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") - pfUI.api:CreateBackdrop(pfUI.uf.player.caption) + CreateBackdrop(pfUI.uf.player.caption) -- Target pfUI.uf.target.caption = CreateFrame("Frame", "pfTargetCaption", pfUI.uf.target) @@ -43,6 +43,6 @@ pfUI:RegisterModule("uf_tukui", function () pfUI.uf.target.powerText:SetParent(pfUI.uf.target.caption) pfUI.uf.target.powerText:SetAllPoints(pfUI.uf.target.caption) pfUI.uf.target.powerText:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") - pfUI.api:CreateBackdrop(pfUI.uf.target.caption) + CreateBackdrop(pfUI.uf.target.caption) end end) diff --git a/modules/xpbar.lua b/modules/xpbar.lua index c2e555bb..8d360317 100644 --- a/modules/xpbar.lua +++ b/modules/xpbar.lua @@ -9,7 +9,7 @@ pfUI:RegisterModule("xpbar", function () pfUI.xp:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0) end pfUI.xp:SetFrameStrata("BACKGROUND") - pfUI.api:CreateBackdrop(pfUI.xp) + CreateBackdrop(pfUI.xp) pfUI.xp:RegisterEvent("PLAYER_LEVEL_UP") pfUI.xp:RegisterEvent("PLAYER_XP_UPDATE") pfUI.xp:RegisterEvent("PLAYER_ENTERING_WORLD") @@ -51,12 +51,12 @@ pfUI:RegisterModule("xpbar", function () pfUI.xp.mouseover = true pfUI.xp:SetAlpha(1) local xp, xpmax, exh = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion() - local xp_perc = pfUI.api.round(xp / xpmax * 100) + local xp_perc = round(xp / xpmax * 100) local remaining = xpmax - xp - local remaining_perc = pfUI.api.round(remaining / xpmax * 100) + local remaining_perc = round(remaining / xpmax * 100) local exh_perc = 0 if GetXPExhaustion() then - exh_perc = pfUI.api.round(GetXPExhaustion() / xpmax * 100) + exh_perc = round(GetXPExhaustion() / xpmax * 100) end GameTooltip:ClearLines() @@ -109,7 +109,7 @@ pfUI:RegisterModule("xpbar", function () pfUI.rep:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0) end pfUI.rep:SetFrameStrata("BACKGROUND") - pfUI.api:CreateBackdrop(pfUI.rep) + CreateBackdrop(pfUI.rep) pfUI.rep.bar = CreateFrame("StatusBar", nil, pfUI.rep) pfUI.rep.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") @@ -171,7 +171,7 @@ pfUI:RegisterModule("xpbar", function () GameTooltip:SetOwner(this, "ANCHOR_CURSOR") GameTooltip:AddLine("|cff555555Reputation") GameTooltip:AddLine(name .. " (" .. GetText("FACTION_STANDING_LABEL"..standingID, gender) .. ")", color.r + .3, color.g + .3, color.b + .3) - GameTooltip:AddLine(barValue .. " / " .. barMax .. " (" .. pfUI.api.round(barValue / barMax * 100) .. "%)",1,1,1) + GameTooltip:AddLine(barValue .. " / " .. barMax .. " (" .. round(barValue / barMax * 100) .. "%)",1,1,1) GameTooltip:Show() pfUI.rep.mouseover = true diff --git a/pfUI.lua b/pfUI.lua index 6850d306..1e356de1 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -75,13 +75,13 @@ pfUI:SetScript("OnEvent", function() local env_pfui = {} setmetatable(env_pfui, {__index = getfenv(0)}) - -- environment - env_pfui.A = pfUI.api - env_pfui.C = pfUI_config - -- env_pfui.L = pfUI_locale + -- load api into environment + for m, func in pairs(pfUI.api) do + if not env_pfui[m] then env_pfui[m] = func end + end - -- classic only - env_pfui._G = getfenv(0) + -- use C for configs + env_pfui.C = pfUI_config -- fill the cache pfUI.cache["locale"] = GetLocale()