A Murloc Raider
Join Date: Jan 2021
Posts: 7
|
Tab Issues
Hi all, im having issues creating tabs in LUA. Ive been working on moving my addon ( EZ Mount ) from using a mix of xml/lua to just lua.
However i am running into issues with my tab set up and have tried so many things but cannot figure out whats going wrong. My buttons are messing up by overlapping each other when i first go into the interface->addon panel. They also seem to fix themselves when I leftclick the addon name on the left hand side of the addon panel ( where you can select different addons ). There is almost no resources on the net for using wows built in tabs that are just lua, the ones Ive seen are xml/lua and are out dated. Anyone able to pinpoint what I am missing?
eztest1.jpg
Here is my addon link on curse: https://www.curseforge.com/wow/addons/ez-mount
Here is the code im using for testing lua frames
.TOC
Lua Code:
## Interface: 90100 ## Title: EZ Test ## Version: 1.2.2 ## Author: Jumpercable ## Notes: Mount addon. ## SavedVariablesPerCharacter: EZTestData EZTFrames.lua EZ Test.lua
EZ Test.lua
Lua Code:
EZTest = CreateFrame("Button","EZMount",UIPARENT,"SecureActionButtonTemplate") function EZM_ChkButton(self,button,state) end function EZM_ColorCustom(self) print(self:GetName()) end function EZM_ColorDefault(self) print(self:GetName()) end function EZM_ChkRadio(self) print(self:GetName()) end function EZT_CheckMountTxt(self) print(self:GetText()) end function EZT_ChangeTab(self,tbl) for i = 1 , #tbl do if self:GetName() == tbl[i]:GetName() then PanelTemplates_SetTab(EZTC, i) tbl[i]:Show() else tbl[i]:Hide() end end end function EZM_DropDownLoad(self) items = {"None","Random","Favorite","Passenger","Class","Covenant","Mount Off","Selection","Specific","Latest"} for i=1, #items do info = UIDropDownMenu_CreateInfo() info.text = items[i]; info.value = i; info.colorCode = "|c99FEFEFE" info.func = function() UIDropDownMenu_SetSelectedValue(self,i) --EZM_SelectionValue(txtFrame,items[i]) --EZM_TabUpdater() end UIDropDownMenu_AddButton(info) end UIDropDownMenu_SetWidth(self, 100) end function EZT_TabUpdater() --- Get Button Sizes and clear all points Frame_TabWidths = {} Frame_TotalWidth = 0 for i = 1,5 do Frame_TabWidths["EZTCTab"..i] = getglobal("EZTCTab"..i):GetWidth() - 20 getglobal("EZTCTab"..i):ClearAllPoints() end --- Tab Location Builder for i=1, 5 do getglobal("EZTCTab"..i):ClearAllPoints() Frame_TotalWidth = Frame_TotalWidth + Frame_TabWidths["EZTCTab"..i] if i == 1 then Frame_Link = "EZTC" Frame_Pos1 = "TOPLEFT" Frame_Pos2 = "BOTTOMLEFT" Frame_X = -9 Frame_Y = 3 else Frame_Link = "EZTCTab"..i-1 Frame_Pos1 = "LEFT" Frame_Pos2 = "RIGHT" Frame_X = -19 Frame_Y = 0 if i == 5 then Frame_NextLink = "EZMCTab5" end end --- SET FRAME LOCATION getglobal("EZTCTab"..i):SetPoint(Frame_Pos1, Frame_Link, Frame_Pos2, Frame_X, Frame_Y) end end Create_ConfigFrame() EZT_TabUpdater() EZT_ChangeTab(EZTC_1,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) EZTest:SetScript("OnEvent",function(self,event,...) if event=="ADDON_LOADED" then if ... == "EZ Test" then end end if event=="PLAYER_LOGIN" then end end) EZTest:RegisterEvent("ADDON_LOADED") EZTest:RegisterEvent("PLAYER_ENTERING_WORLD") EZTest:RegisterEvent("PLAYER_LOGIN")
EZTestFrames.lua
Lua Code:
-------------------------------------------------------------------- --- FUNCTIONS FOR BUILDING FRAMES, BUTTONS, CHECKBOX'S AND OTHER --- --- UI ELEMENTS. ALSO INCLUDES OTHER FUNCTIONS THAT ARE USED --- --- COMMONLY THROUGHOUT EZ Mount --- -------------------------------------------------------------------- local EZMTitle = "|cFF3d0cedE|cFF0c2eedZ |cFF0c6aedM|cFF0c88edO|cFF0cadedU|cFF0cd6edN|cFF0ceddaT" local EZMVer = "2.3.0" ----------------------------------------------------- --- BUILD FRAMES / TEXT / BUTTONS ETC --- ----------------------------------------------------- function Create_Text(Frame,Name,SizeX,SizeY,Text,Points,JustifyH,JustifyV,Colors,Font) local Let = getglobal(Frame):CreateFontString(Name, "OVERLAY", Font) --nil replace with text, need to get name if SizeX then Let:SetSize(SizeX, SizeY) end if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then Let:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else Let:SetPoint(V.Point, V.X, V.Y) end end end if JustifyH then Let:SetJustifyH(JustifyH) end if JustifyY then Let:SetJustifyV(JustifyV) end if type(Colors) == "table" then if Colors.Type == 255 then Let:SetTextColor(Colors.R*(1/255),Colors.G*(1/255),Colors.B*(1/255),Colors.A or nil) else Let:SetTextColor(Colors.R,Colors.G,Colors.B, Colors.A or nil) end end Let:SetText(Text) end function Create_Line(frame,SizeX,SizeY,Points,R,G,B,A) local Tex = getglobal(frame):CreateTexture("ARTWORK") Tex:SetTexture("Interface/Buttons/WHITE8x8") Tex:SetSize(SizeX, SizeY) if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then Tex:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else Tex:SetPoint(V.Point, V.X, V.Y) end end end Tex:SetColorTexture(R,G,B,A) end function Create_ChkButton(Frame,Name,SizeX,SizeY,Points,tooltip,Scripts) ChkBtn = CreateFrame("CheckButton", Name, getglobal(Frame), "ChatConfigCheckButtonTemplate") if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then print(V.X, V.Y) ChkBtn:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else ChkBtn:SetPoint(V.Point, V.X, V.Y) end end end ChkBtn:SetSize(SizeX or 20,SizeY or 20) if tooltip then ChkBtn.tooltip = tooltip end if type(Scripts) == "table" then for i=1, #Scripts do ChkBtn:SetScript(Scripts[i].On,Scripts[i].Func) end end end function Create_RadioButton(Frame,Name,SizeX,SizeY,Points,tooltip,Scripts) RadioBtn = CreateFrame("CheckButton", Name, getglobal(Frame), "UIRadioButtonTemplate") if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then print(V.X, V.Y) RadioBtn:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else RadioBtn:SetPoint(V.Point, V.X, V.Y) end end end RadioBtn:SetSize(SizeX or 20,SizeY or 20) if tooltip then RadioBtn.tooltip = tooltip end if type(Scripts) == "table" then for i=1, #Scripts do RadioBtn:SetScript(Scripts[i].On,Scripts[i].Func) end end end function Create_Button(Name,Parent,SizeX,SizeY,Points,Scripts,Textures,Text) local btn = CreateFrame("Button", Name, Parent, "UIPanelButtonTemplate") btn:SetSize(SizeX, SizeY) if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then btn:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else btn:SetPoint(V.Point, V.X or 0, V.Y or 0) end end end if type(Textures) == "table" then if Textures.U then btn:SetNormalTexture(Textures.U) end if Textures.D then btn:SetPushedTexture(Textures.D) end if Textures.H then btn:SetHighlightTexture(Textures.H) btn:GetHighlightTexture():SetTexCoord(0,1,0,1) end end if type(Scripts) == "table" then for i=1, #Scripts do btn:SetScript(Scripts[i].On,Scripts[i].Func) end end if Text then btn:SetText(Text) end end function Create_Tab(Name,Parent,ID,SizeX,SizeY,Points,Scripts,Textures,Text) local tab = CreateFrame("Button", Name, Parent, "CharacterFrameTabButtonTemplate") tab:SetID(ID) if SizeX then tab:SetSize(SizeX, SizeY) end if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then tab:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else tab:SetPoint(V.Point, V.X or 0, V.Y or 0) end end end if type(Textures) == "table" then if Textures.U then tab:SetNormalTexture(Textures.U) end if Textures.D then tab:SetPushedTexture(Textures.D) end if Textures.H then tab:SetHighlightTexture(Textures.H) tab:GetHighlightTexture():SetTexCoord(0,1,0,1) end end if type(Scripts) == "table" then for i=1, #Scripts do tab:SetScript(Scripts[i].On,Scripts[i].Func) end end if Text then tab:SetText(Text) end end function Create_Dropdown(Name,Parent,SizeX,SizeY,Points,Scripts) print(Parent:GetName()) local drop = CreateFrame("Frame", Name, EZTC_1, "UIDropDownMenuTemplate") UIDropDownMenu_Initialize(drop, EZM_DropDownLoad) if SizeX or SizeY then drop:SetSize(SizeX, SizeY) end if type(Points) == "table" then for _,V in pairs(Points) do print(V.X,V.Y) if V.RelF then drop:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else drop:SetPoint(V.Point, V.X or 0, V.Y or 0) end end end if type(Scripts) == "table" then for i=1, #Scripts do drop:SetScript(Scripts[i].On,Scripts[i].Func) end end end function Create_EditBox(Name,Parent,SizeX,SizeY,Points,Scripts,Other)--{Autofocus,Multiline,FontObject,MaxChars,Numeric} local Editbox = CreateFrame("EditBox", Name, Parent) Editbox:SetSize(SizeX, SizeY) if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then Editbox:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else Editbox:SetPoint(V.Point, V.X or 0, V.Y or 0) end end end if type(Scripts) == "table" then for i=1, #Scripts do Editbox:SetScript(Scripts[i].On,Scripts[i].Func) end end if type(Other) == "table" then Editbox:SetAutoFocus(Other.SetAutoFocus) if Other.Multiline then Editbox:SetMultiLine(true) end if Other.FontObject then Editbox:SetFontObject(Other.FontObject) end if Other.MaxChars then Editbox:SetMaxLetters(Other.MaxChars) end if Other.Numeric then Editbox:SetNumeric(true) end end end function Create_Frame(Type,Name,Parent,Template,SizeX,SizeY,Points,Scripts,Other)--(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0){SetMovable,EnableMouse,TopLevel,Hidden} if Template then Frm = CreateFrame(Type, Name, Parent, Template) else Frm = CreateFrame(Type, Name, Parent) end if SizeX or SizeY then Frm:SetSize(SizeX,SizeY) end if type(Points) == "table" then for _,V in pairs(Points) do if V.RelF then Frm:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else Frm:SetPoint(V.Point, V.X, V.Y) end end end if type(Scripts) == "table" then for i=1, #Scripts do print(Scripts[i].On,Scripts[i].Func) end end if type(Other) == "table" then if Other.Strata then Frm:SetFrameStrata(Other.Strata) end if Other.Scale then Frm:SetScale(Other.Scale) end if Other.SetMovable then Frm:SetMovable(true) end if Other.EnableMouse then Frm:EnableMouse(true) end if Other.TopLevel then Frm:SetToplevel(true) end if Other.Hidden then Frm:Hide() end end end function Create_Image(Frame,Name,Layer,File,SizeX,SizeY,Points,Coords,R,G,B,A) local Img = getglobal(Frame):CreateTexture(Name,Layer) Img:SetTexture(File) Img:SetSize(SizeX, SizeY) if type(Points) == "table" then for K,V in pairs(Points) do print(K,V) if V.RelF then Img:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0); else Img:SetPoint(V.Point, V.X, V.Y) end end end if type(Coords) =="table" then Img:SetTexCoord(Coords.L,Coords.R,Coords.T,Coords.B) end if R then Img:SetColorTexture(R,G,B) end if A then Img:SetAlpha(A) end end ----------------------------------------------------- --- OTHER BASE FUNCTIONS --- ----------------------------------------------------- function ConvertHex(nValue) nHexVal = string.format("%x", nValue) sHexVal = nHexVal.."" return string.format("%02s", sHexVal) end function ConvertBool(bool) if bool then return "true" else return "false" end end function Wrapper(str, limit, indent, indent1) indent = indent or "" indent1 = indent1 or indent limit = limit or 12 local here = 1-#indent1 return indent1..str:gsub("(%s+)()(%S+)()", function(sp, st, word, fi) if fi-here > limit then here = st - #indent return "\n"..indent..word end end) end function GearDur() local cur,max local TotalCur, TotalMax = 0, 0 for slot=1,18 do cur,max=GetInventoryItemDurability(slot) if cur then TotalCur = TotalCur + cur TotalMax = TotalMax + max end end return ((TotalCur / TotalMax)*100), TotalMax end ----------------------------------------------------- --- EZ MOUNT FRAME MAKERS --- ----------------------------------------------------- function Create_ConfigFrame() -- Create base frame with headers local panel = CreateFrame("FRAME","EZMF",nil,nil,nil,nil,nil) panel.name = "EZ Mount Test" InterfaceOptions_AddCategory(panel) defFrame = "EZTC_2" Create_Image("EZMF","BG","ARTWORK","Interface\\Buttons\\WHITE8x8",580,480,{{Point="TOP",X=0,Y=-22,RelF=false}},.2,.2,.2,.2,.7) -- TAB Background & Tab Container Create_Frame("Frame","EZTC",EZMF,nil,580,480,{{Point="TOP",X=0,Y=-20}}) Create_Frame("Frame","EZTC_1",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=false}) Create_Frame("Frame","EZTC_2",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true}) Create_Frame("Frame","EZTC_3",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true}) Create_Frame("Frame","EZTC_4",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true}) Create_Frame("Frame","EZTC_5",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true}) Create_Frame("ScrollFrame","EZTC_5SFrame",EZTC_5,"UIPanelScrollFrameTemplate",nil,nil,{{Point="TOPLEFT",RelP="TOPLEFT",RelF="EZTC_5",X=5,Y=-35},{Point="BOTTOMLEFT",RelP="BOTTOMLEFT",RelF="EZTC_5",X=5,Y=5},{Point="RIGHT",RelP="RIGHT",RelF="EZTC_5",X=-28,Y=0}}) Create_Frame("Frame","EZTC_5SChild",nil,nil,570,440) EZTC_5SFrame:SetScrollChild(EZTC_5SChild) Create_Text("EZTC_1","T_Mounts",180,50,"MOUNTS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge") Create_Text("EZTC_2","T_Options",180,50,"OPTIONS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge") Create_Text("EZTC_3","T_UI Messages",180,50,"UI MESSAGES",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge") Create_Text("EZTC_4","T_Class",180,50,"CLASS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge") Create_Text("EZTC_5SChild","T_SelGround",180,50,"SELECT GROUND MOUNTS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge") Create_Tab("EZTCTab1",EZTC,1,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTC,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_1,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Mounts") Create_Tab("EZTCTab2",EZTC,2,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab1,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_2,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Options") Create_Tab("EZTCTab3",EZTC,3,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab2,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_3,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"UI Message") Create_Tab("EZTCTab4",EZTC,4,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab3,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_4,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Class") Create_Tab("EZTCTab5",EZTC,5,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab4,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_5,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Select:Ground") PanelTemplates_SetNumTabs(EZTC, 5) PanelTemplates_SetTab(EZTC, 2) end function Create_CountsFrame(Table) local CMJ = C_MountJournal local EID = CMJ.GetAppliedMountEquipmentID() local Mount_IDs = { -- MOUNT EQUIPTMENT ID'S [168412] = "Light-Step Hoofplates", [168416] = "Anglers' Water Striders", [168417] = "Inflatable Mount Shoes", [168419] = "Comfortable Rider's Barding", [168427] = "Saddlechute", } local Txts = {"Ground Mount","Flying Mount","Sea Mount","Maw Mount","Class Mount","Vash'jir Mount","Heirloom Mount","Covenant Specific Mount","Passenger Ground Mount","Passenger Flying Mount"} if EZTCount then EZTCount:Show() else --- Create Frame and Title Create_Frame("Frame","EZTCount",UIPARENT,"InsetFrameTemplate",300,235,{{Point="CENTER",X=0,Y=100}},"DIALOG",nil) Create_Text("EZTCount",nil,200,20,EZMTitle,{{Point="TOP",X=0,Y=-8}},"CENTER","CENTER",{Type=1,R=.9,G=.87,B=.80},"IndexFont10") --- Build the Data BaseH = -15 StepH = 14 for i = 1, 10 do Texts = Txts[i] --- Process Druid Class Mount info here ( as druids dont have an actual mount just a new flight form ) if i == 5 and select(3,UnitClass("player")) == 11 then if C_QuestLog.IsQuestFlaggedCompleted(46319) == true then Counts = 1 else Counts = 0 end else Counts = Table[i] end --Counts = Table[i] --- Add 's if tonumber(Counts) == nil then Counts = 1 end if Counts > 1 then Text = "|c001d5add"..Texts.."s:" Count = "|c000be6e2Yes ("..Counts..")" elseif Counts == 1 then Text = "|c001d5add"..Texts..":" Count = "|c000be6e2Yes" else Text = "|c001d5add"..Texts..":" Count ="|c000be6e2No" end Y = BaseH-(i * StepH) Create_Text("EZTCount",nil,200, 20,Text, {{Point="TOPLEFT",X=30,Y=Y}} , "LEFT","CENTER" ,{Type=1,R=.9,G=.8,B=.8},"Voltage_15") Create_Text("EZTCount",nil,200, 20,Count,{{Point="TOPRIGHT",X=-30,Y=Y}}, "RIGHT","CENTER",{Type=1,R=.9,G=.8,B=.8},"Voltage_15") end --- Add Mount Equipment text if CMJ.IsMountEquipmentApplied() and EID then Mnt_Value = "|c000be6e2"..Mount_IDs[EID] else Mnt_Value = "|c000be6e2None" end Mnt_Txt = "|c001d5addMount Equipment:" Create_Text("EZTCount",nil,200, 20,Mnt_Txt, {{Point="TOPLEFT",X=30,Y=BaseH-(11*StepH)}} , "LEFT","CENTER" ,nil,"Voltage_15") Create_Text("EZTCount",nil,200, 20,Mnt_Value,{{Point="TOPRIGHT",X=-30,Y=BaseH-(11*StepH)}}, "RIGHT","CENTER",{Type=1,R=.9,G=.8,B=.8},"Voltage_15") --- Add Total and class coloured name Hex = "|c"..select(4,GetClassColor(select(2, UnitClass("player")))) TotalTxt = "|cff48687aTotal Mounts for: "..Hex..UnitName("PLAYER") Create_Text("EZTCount",nil,nil,nil,TotalTxt ,{{Point="TOP",X=0,Y=-190}},"CENTER",nil,nil,"Nineteenth_17") Create_Text("EZTCount",nil,nil,nil,Table[11] ,{{Point="TOP",X=0,Y=-210}},"CENTER",nil,{Type=255,R=245,G=244,B=230},"IndexFont10") --- Create Close Button Funct = function() if EZTCount then EZTCount:Hide() end end; Create_Button("CloseCounts",EZTCount,20,20,{{Point = "BOTTOMRIGHT", X = -4, Y= 3}} ,{{On="OnClick",Func= Funct}},{U="Interface\\AddOns\\EZMount\\Images\\Close_U",D="Interface\\AddOns\\EZMount\\Images\\Close_D",H="Interface\\AddOns\\EZMount\\Images\\Close_H"}) --- Show the frame EZTCount:Show() end end function Create_Warning(Message) if EZMWarning then EZMWarning:Show() else Create_Frame("Frame", "EZMWarning", UIPARENT, "InsetFrameTemplate",200,75,{{Point = "CENTER", X = 0, Y=75}} ,"Tooltip") Create_Text("EZMWarning",nil,190,75,Message,{{Point="CENTER",X=0,Y=0}},"CENTER","CENTER",{Type=255,R=237,G=12,B=177},"Nineteenth_17") --- Create Button Funct = function() if EZMWarning then EZMWarning:Hide() end end; Create_Button("CloseWarning",EZMWarning,15,15,{{Point = "TOPRIGHT", X = -2, Y= -2}} ,{{On="OnClick",Func= Funct}},{U="Interface\\AddOns\\EZMount\\Images\\Close_U",D="Interface\\AddOns\\EZMount\\Images\\Close_D",H="Interface\\AddOns\\EZMount\\Images\\Close_H"}) EZMWarning:Show() end end function Create_News() News = { {Date ="6/22/21", Type = "Release", Version = "2.3.0", Added={"LATEST as new mount option. ( Only works when the addon is loaded and you have added a new mount since this version"},Fixed={"Druid class mount wasnt including in counts"}}, {Date ="4/18/21", Type = "Release", Version = "2.2.1", Fixed={"Options were resettings on login.","Mount off messages showing when icon was updating","Minimap hide/show not working correctly"}}, {Date ="4/15/21", Type = "Release", Version = "2.2.0", Added={"Minimap button. Shows mount types, can quick access repair mount or mount counts/option","News feed. Showing latest updates and bug fixes", "Selections. Select mounts for each type and pick randomly from this selection","Mount Options. Each mount type is now selected from the options panel"}, Fixed={"Mighty Brutosaur Caravan missing from passenger mount"},Beta={"Icons. Icons designed to work when using multiple macros","Debug. Debug info shown on screen and in chat box when using /ezm Debug"}}, {Date="22/03/21",Type = "Release", Version = "2.1.0", Added={"Interface panel with new options","Boot vendors from mounts in instances ( for DH skip near 3rd boss in Spires of Acension for example )","Double key shortcut + EZ Mount key to use herbalism mount","Druid affinity modifier key + EZ Mount key to change to your chose affinity in combat, click EZ Mount again to change back","Mountoff as a new selection for each modifier. When used, this will put you on the same mount as your target","The ability to enable/disable each of the EZ Mount messages and change the colour and the message","Added new Maw Mount: Bound Shadehound"},Fixed={"Torghast mounts now working correctly for Shaman","Icon code updated"}}, {Date="17/02/21",Type = "Release", Version = "2.0.0", Added={"Options panel. Accessible from options>Interface>addons or from slash commands","Slash commands /EZMount or /EZM followed with config or options for panel and mounts or count for total mounts usable","New mount types: Covenant and Favorite ( mounts favourited in the Blizzard UI )"},Fixed={"Class now working correctly for Druids as druids have a skin as their class mount"}}, {Date="25/01/21",Type = "Release", Version = "1.2.3", Fixed={"Maw mounts should now work correctly"}}, {Date="11/01/21",Type = "Release", Version = "1.2.2", Added={"Added Maw Mounts","Added Covenant specific mounts"},Fixed={"Removed debug message for can_glide"}}, {Date="24/12/20",Type = "Release", Version = "1.2.1", Fixed={"Fixed error when checking for heirloom collector achievement mount","Addon was checking for any spell usable from your cloak rather than just the engineering glider enchants"}}, {Date="25/11/20",Type = "Release", Version = "1.2.0", Added={"Added Shadowlands zones","Added Maw mount"},Fixed={"Passenger mount not working","Fixed 1 profession mount that no longer requires profession"}}, {Date="12/11/20",Type = "Release", Version = "1.1.0", Fixed={"Pathfinder no longer required for Broken Isles and Draenor","Class specific mounts were showing for all class's"}}, {Date="10/11/20",Type = "Release", Version = "1.0.1", Added={"Added support for heirloom mounts","Added Ocean mounts ( after ground and flying )","Mount counter for mounts usable on current character"},Fixed={"Fixed profession mounts","Zones not working correctly i.e Black Empire Assaults","Case sensitivity removed from mounts"}}, {Date="10/10/20",Type = "Release", Version = "1.0.0"}, } if EZMNews then EZMNews:Show() else Create_Frame("Frame", "EZMNews", UIPARENT, "InsetFrameTemplate",350,250,{{Point="CENTER",X=0,Y=75}},"DIALOG",nil)--(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0) Create_Frame("ScrollFrame","EZMNewsSParent",EZMNews,"UIPanelScrollFrameTemplate",340,225,{{Point="TOPLEFT",RelF=EZMNews,RelP="TOPLEFT",X=1,Y=-35},{Point="BOTTOMLEFT",RelF=EZMNews,RelP="BOTTOMLEFT",X=1,Y=2},{Point="RIGHT",RelF=EZMNews,RelP="RIGHT",X=-27,Y=-20},}, nil,.75) Create_Frame("Frame","EZMNewsChild", nil, nil,340,225,{{Point="TOPLEFT", RelF=EZMNewsSParent,RelP="TOPLEFT",X=25,Y=15},{Point="BOTTOMLEFT", RelF=EZMNewsSParent,RelP="BOTTOMLEFT",X=-5,Y=-5}},nil,1)--(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0) EZMNewsSParent:SetScrollChild(EZMNewsChild) -- Create Close Button Funct = function() EZMVer = Version if EZMNews then EZMNews:Hide() end end; Create_Button("CloseCounts",EZMNewsSParent,25,25,{{Point = "TOPRIGHT", X = 23, Y= 29}} ,{{On="OnClick",Func= Funct}},{U="Interface\\AddOns\\EZMount\\Images\\Close_U",D="Interface\\AddOns\\EZMount\\Images\\Close_D",H="Interface\\AddOns\\EZMount\\Images\\Close_H"}) -- Show Title TitleText = EZMTitle.." |cFF0cd6edN|cFF0cadedE|cFF0c88edW|cFF0c6aedS" Create_Text("EZMNews",nil,180,30,TitleText,{{Point="TOP",X=0,Y=-2}},"CENTER","CENTER",nil,"ThinFont17") Y = -3 for V = 1,#News do Date = News[V].Date Type = News[V].Type Ver = News[V].Version Create_Text("EZMNewsChild",nil,80,20,Date,{{Point="TOPLEFT",X=5,Y=Y}},"LEFT",nil,{Type=255,R=88,G=191,B=191,A=255},"ThinFont13") Create_Text("EZMNewsChild",nil,80,20,"Ver. "..Ver,{{Point="TOPLEFT",X=65,Y=Y}},"LEFT",nil,{Type=255,R=41,G=148,B=194},"ThinFont13") Create_Text("EZMNewsChild",nil,90,20,"( "..Type.." )",{{Point="TOPLEFT",X=145,Y=Y}},"LEFT",nil,{Type=255,R=41,G=115,B=194},"ThinFont13") Y = ( Y - 15 ) Added = News[V].Added if Added then if #News[V].Added > 0 then for _,Text in pairs(Added) do Create_Text("EZMNewsChild",nil,80,30,"Added :",{{Point="TOPLEFT",X=5,Y=Y}},"LEFT","CENTER",{Type=255,R=63,G=242,B=111},"ThinFont11") Create_Text("EZMNewsChild",nil,380,30,Text,{{Point="TOPLEFT",X=55,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=229,B=202},"ThinFont11") Y = (Y - 23) end end end Fixed = News[V].Fixed if Fixed then if #News[V].Fixed > 0 then for _,Text in pairs(Fixed) do Create_Text("EZMNewsChild",nil,80,30,"Fixed :",{{Point="TOPLEFT",X=5,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=217,B=37},"ThinFont11") Create_Text("EZMNewsChild",nil,380,30,Text,{{Point="TOPLEFT",X=55,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=229,B=202},"ThinFont11") Y = Y -23 end end end Beta = News[V].Beta if Beta then if #News[V].Beta > 0 then for _,Text in pairs(Beta) do Create_Text("EZMNewsChild",nil,80,30,"Beta :",{{Point="TOPLEFT",X=5,Y=Y}},"LEFT","CENTER",{Type=255,R=224,G=13,B=56},"ThinFont11") Create_Text("EZMNewsChild",nil,380,30,Text,{{Point="TOPLEFT",X=55,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=229,B=202},"ThinFont11") Y = Y -23 end end end Y = Y - 16 end end end function Create_SelectionTable(TblName,TabNo) -- Clear Table for List = 1, #TblName do if #TblName[list] >=1 then for v = 1, #TblName[list] do TblName[list] = nil end end end -- Put checked items into table local ObjNames = { getglobal("Tab_"..TabNo.."SArea"):GetChildren() } for _,framechild in ipairs(ObjNames) do Mname = gsub(framechild:GetName(),"Tab_"..TabNo,"") Ischecked = framechild:GetChecked() if Mname and Ischecked then table.insert(TblName,Mname) end end end function Recreate_SelectionTable(TblName,TabNo) -- Clear checks first local ObjNames = { getglobal("Tab_"..TabNo.."SArea"):GetChildren() } for _,framechild in ipairs(ObjNames) do framechild:SetChecked(false) end for k,v in pairs(TblName) do if type(getglobal("Tab_"..TabNo..v)) == "table" then getglobal("Tab_"..TabNo..v):SetChecked(true) end end end function Create_SelectionTab(Header, TabNo, TableList) local Y = 10 local X = nil local Col = 0.010 --Color gradiant starting colour local CurLetter = nil --Current Letter local ActLetter = nil --Letter vs Current local Indent = nil --Spacing local MntTbl = {} -- Build Table to use and then sort it for i=1,#TableList do for k,v in pairs(TableList[i]) do table.insert(MntTbl,v) end end table.sort(MntTbl) -- Alphabetise mount list -- Set Header if type(getglobal(TabNo)) ~= "table" then Create_Text(TabNo.."SFrame",TabNo,370,20,Header.." ( "..#MntTbl.." )",{{Point="TOPLEFT",X=0,Y=30}},"LEFT","CENTER",{Type=1,R=.9,G=.87,B=.80},"Nineteenth_19") -- Build buttons and labels with dividers and side index for k,v in ipairs(MntTbl) do if not CurLetter then CurLetter = string.sub(v, 1, 1) Create_Text(TabNo.."SArea",nil,20,20,CurLetter,{{Point="TOPLEFT",X=2,Y=-(Y+2)}},"CENTER","CENTER",{Type=1,R=Col/3,G=Col/2,B=.80},"IndexFont10") end ActLetter = string.sub(v, 1, 1) if ActLetter == CurLetter then if not Indent then Indent = 1 end X = 45 + ((Indent-1) * 175) Create_Text(TabNo.."SArea",nil,150,28,v,{{Point="TOPLEFT",X=X,Y=-Y}},"LEFT","CENTER",{Type=1,R=.81,G=.85,B=.82},"ThinFont11") Create_ChkButton(TabNo.."SArea",TabNo..v,28,28,{{Point="TOPLEFT",X = (X-25),Y =(-Y)}},"") Indent = Indent + 1 --Increase Column if Indent == 4 then --Reset Column, Increase Row Indent = 1 Y = Y + 30 end else if Indent ~= 1 then --If we are at a new line, dont add Padding, and reset Column Y=Y+30 Indent = 1 end X = 45 + ((Indent-1) * 175) Col = Col + 0.045 CurLetter = string.sub(v, 1, 1) Create_Line(TabNo.."SArea",540,1,{{Point="TOPLEFT",X= 6, Y=-(Y-3)}},.9215,0.8607,.8039,.7) Create_Text(TabNo.."SArea",nil,20,20,CurLetter,{{Point="TOPLEFT",X=2,Y=-(Y+2)}},"CENTER","CENTER",{Type=1,R=Col/3,G=Col/2,B=.80},"IndexFont10") Create_Text(TabNo.."SArea",nil,150,28,v,{{Point="TOPLEFT",X=X,Y=-Y}},"LEFT","CENTER",{Type=1,R=.81,G=.85,B=.82},"ThinFont11") Create_ChkButton(TabNo.."SArea",TabNo..v,28,28,{{Point="TOPLEFT",X = (X-25),Y =(-Y)}},"") Indent = Indent + 1 end end end end
|