| /trunk/rBottomBarStyler/core.lua r369 | /trunk/rBottomBarStyler/core.lua r370 | ||
| 1 | 1 | ||
|---|---|---|---|
| 2 | --[[---------------------------------------------------------------------------- | 2 | --[[---------------------------------------------------------------------------- |
| 3 | Copyright (c) 2009, Erik Raetz | 3 | Copyright (c) 2009, Erik Raetz |
| 4 | All rights reserved. | 4 | All rights reserved. |
| 5 | 5 | ||
| 6 | Redistribution and use in source and binary forms, with or without | 6 | Redistribution and use in source and binary forms, with or without |
| 7 | modification, are permitted provided that the following conditions are met: | 7 | modification, are permitted provided that the following conditions are met: |
| 8 | 8 | ||
| 9 | * Redistributions of source code must retain the above copyright notice, | 9 | * Redistributions of source code must retain the above copyright notice, |
| 10 | this list of conditions and the following disclaimer. | 10 | this list of conditions and the following disclaimer. |
| 11 | * Redistributions in binary form must reproduce the above copyright notice, | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
| 12 | this list of conditions and the following disclaimer in the documentation | 12 | this list of conditions and the following disclaimer in the documentation |
| 13 | and/or other materials provided with the distribution. | 13 | and/or other materials provided with the distribution. |
| 14 | * Neither the name of rBottomBarStyler nor the names of its contributors may be used | 14 | * Neither the name of rBottomBarStyler nor the names of its contributors may be used |
| 15 | to endorse or promote products derived from this software without specific | 15 | to endorse or promote products derived from this software without specific |
| 16 | prior written permission. | 16 | prior written permission. |
| 17 | 17 | ||
| 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
| 29 | ------------------------------------------------------------------------------]] | 29 | ------------------------------------------------------------------------------]] |
| 30 | 30 | ||
| 31 | ------------------------------------------------------ | 31 | ------------------------------------------------------ |
| 32 | -- / VARIABLES / -- | 32 | -- / VARIABLES / -- |
| 33 | ------------------------------------------------------ | 33 | ------------------------------------------------------ |
| 34 | 34 | ||
| 35 | local default_scale = 0.6 | 35 | local default_scale = 0.6 |
| 36 | local default_art = "d3" | 36 | local default_art = "d3" |
| 37 | local default_bar = "bar2" | 37 | local default_bar = "bar2" |
| 38 | local default_movable = 1 | 38 | local default_movable = 1 |
| 39 | local default_locked = 1 | 39 | local default_locked = 1 |
| 40 | local default_font = NAMEPLATE_FONT | ||
| 40 | rBottomBarStyler = rBottomBarStyler or {} | 41 | rBottomBarStyler = rBottomBarStyler or {} |
| 41 | local frame_to_scale | 42 | local frame_to_scale |
| 42 | local bar_to_show | 43 | local bar_to_show |
| 43 | local frame_to_drag | 44 | local frame_to_drag |
| 44 | local fog_smoother = 1.3 | 45 | local fog_smoother = 1.3 |
| 45 | local orbtab = { | 46 | local orbtab = { |
| 46 | [1] = {r = 0.3, g = 0, b = 0, scale = 0.8, z = -12, x = 0.8, y = -1.7, anim = "SPELLS\\RedRadiationFog.m2"}, -- red | 47 | [1] = {r = 0.3, g = 0, b = 0, scale = 0.8, z = -12, x = 0.8, y = -1.7, anim = "SPELLS\\RedRadiationFog.m2"}, -- red |
| 47 | [2] = {r = 0, g = 0.3, b = 0.1, scale = 0.75, z = -12, x = 0, y = -1.1, anim = "SPELLS\\GreenRadiationFog.m2"}, -- green | 48 | [2] = {r = 0, g = 0.3, b = 0.1, scale = 0.75, z = -12, x = 0, y = -1.1, anim = "SPELLS\\GreenRadiationFog.m2"}, -- green |
| 48 | [3] = {r = 0, g = 0.2, b = 0.3, scale = 0.75, z = -12, x = 1.2, y = -1, anim = "SPELLS\\BlueRadiationFog.m2"}, -- blue | 49 | [3] = {r = 0, g = 0.2, b = 0.3, scale = 0.75, z = -12, x = 1.2, y = -1, anim = "SPELLS\\BlueRadiationFog.m2"}, -- blue |
| 49 | [4] = {r = 0.4, g = 0.3, b = 0, scale = 0.75, z = -12, x = -0.3, y = -1.2, anim = "SPELLS\\OrangeRadiationFog.m2"}, -- yellow | 50 | [4] = {r = 0.4, g = 0.3, b = 0, scale = 0.75, z = -12, x = -0.3, y = -1.2, anim = "SPELLS\\OrangeRadiationFog.m2"}, -- yellow |
| 50 | [5] = {r = 0, g = 0.7, b = 0.7, scale = 0.9, z = -12, x = -0.5, y = -0.8, anim = "SPELLS\\WhiteRadiationFog.m2"}, -- runic | 51 | [5] = {r = 0, g = 0.7, b = 0.7, scale = 0.9, z = -12, x = -0.5, y = -0.8, anim = "SPELLS\\WhiteRadiationFog.m2"}, -- runic |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | ------------------------------------------------------ | 54 | ------------------------------------------------------ |
| 54 | -- / SET UP DEFAULT VALUES / -- | 55 | -- / SET UP DEFAULT VALUES / -- |
| 55 | ------------------------------------------------------ | 56 | ------------------------------------------------------ |
| 56 | 57 | ||
| 57 | local function load_default() | 58 | local function load_default() |
| 58 | if(not rBottomBarStyler.scalevalue) then | 59 | if(not rBottomBarStyler.scalevalue) then |
| 59 | rBottomBarStyler.scalevalue = default_scale | 60 | rBottomBarStyler.scalevalue = default_scale |
| 60 | end | 61 | end |
| 61 | if(not rBottomBarStyler.artvalue) then | 62 | if(not rBottomBarStyler.artvalue) then |
| 62 | rBottomBarStyler.artvalue = default_art | 63 | rBottomBarStyler.artvalue = default_art |
| 63 | end | 64 | end |
| 64 | if(not rBottomBarStyler.barvalue) then | 65 | if(not rBottomBarStyler.barvalue) then |
| 65 | rBottomBarStyler.barvalue = default_bar | 66 | rBottomBarStyler.barvalue = default_bar |
| 66 | end | 67 | end |
| 67 | if(not rBottomBarStyler.movable) then | 68 | if(not rBottomBarStyler.movable) then |
| 68 | rBottomBarStyler.movable = default_movable | 69 | rBottomBarStyler.movable = default_movable |
| 69 | end | 70 | end |
| 70 | if(not rBottomBarStyler.locked) then | 71 | if(not rBottomBarStyler.locked) then |
| 71 | rBottomBarStyler.locked = default_locked | 72 | rBottomBarStyler.locked = default_locked |
| 72 | end | 73 | end |
| 73 | end | 74 | end |
| 74 | 75 | ||
| 75 | ------------------------------------------------------ | 76 | ------------------------------------------------------ |
| 76 | -- / CHAT OUTPUT FUNC / -- | 77 | -- / CHAT OUTPUT FUNC / -- |
| 77 | ------------------------------------------------------ | 78 | ------------------------------------------------------ |
| 78 | 79 | ||
| 79 | local function am(text) | 80 | local function am(text) |
| 80 | DEFAULT_CHAT_FRAME:AddMessage(text) | 81 | DEFAULT_CHAT_FRAME:AddMessage(text) |
| 81 | end | 82 | end |
| 82 | 83 | ||
| 83 | ------------------------------------------------------ | 84 | ------------------------------------------------------ |
| 84 | -- / SAVE POSXY FUNC / -- | 85 | -- / SAVE POSXY FUNC / -- |
| 85 | ------------------------------------------------------ | 86 | ------------------------------------------------------ |
| 86 | 87 | ||
| 87 | local function save_posxy() | 88 | local function save_posxy() |
| 88 | local point, relativeTo, relativePoint, x, y = frame_to_scale:GetPoint() | 89 | local point, relativeTo, relativePoint, x, y = frame_to_scale:GetPoint() |
| 89 | rBottomBarStyler.point = point | 90 | rBottomBarStyler.point = point |
| 90 | rBottomBarStyler.posx = x | 91 | rBottomBarStyler.posx = x |
| 91 | rBottomBarStyler.posy = y | 92 | rBottomBarStyler.posy = y |
| 92 | end | 93 | end |
| 93 | 94 | ||
| 94 | ------------------------------------------------------ | 95 | ------------------------------------------------------ |
| 95 | -- / MOVE ME FUNC / -- | 96 | -- / MOVE ME FUNC / -- |
| 96 | ------------------------------------------------------ | 97 | ------------------------------------------------------ |
| 97 | 98 | ||
| 98 | local function move_my_frame() | 99 | local function move_my_frame() |
| 99 | if frame_to_drag then | 100 | if frame_to_drag then |
| 100 | frame_to_drag:Hide() | 101 | frame_to_drag:Hide() |
| 101 | end | 102 | end |
| 102 | if rBottomBarStyler.movable == 1 then | 103 | if rBottomBarStyler.movable == 1 then |
| 103 | frame_to_scale:SetMovable(true) | 104 | frame_to_scale:SetMovable(true) |
| 104 | if rBottomBarStyler.locked == 0 then | 105 | if rBottomBarStyler.locked == 0 then |
| 105 | if frame_to_drag then | 106 | if frame_to_drag then |
| 106 | frame_to_drag:Show() | 107 | frame_to_drag:Show() |
| 107 | end | 108 | end |
| 108 | frame_to_scale:EnableMouse(true) | 109 | frame_to_scale:EnableMouse(true) |
| 109 | frame_to_scale:RegisterForDrag("LeftButton","RightButton") | 110 | frame_to_scale:RegisterForDrag("LeftButton","RightButton") |
| 110 | frame_to_scale:SetScript("OnDragStart", function(self) | 111 | frame_to_scale:SetScript("OnDragStart", function(self) |
| 111 | if IsShiftKeyDown() and IsAltKeyDown() then | 112 | if IsShiftKeyDown() and IsAltKeyDown() then |
| 112 | self:StartMoving() | 113 | self:StartMoving() |
| 113 | end | 114 | end |
| 114 | end) | 115 | end) |
| 115 | frame_to_scale:SetScript("OnDragStop", function(self) | 116 | frame_to_scale:SetScript("OnDragStop", function(self) |
| 116 | if IsShiftKeyDown() and IsAltKeyDown() then | 117 | if IsShiftKeyDown() and IsAltKeyDown() then |
| 117 | self:StopMovingOrSizing() | 118 | self:StopMovingOrSizing() |
| 118 | save_posxy() | 119 | save_posxy() |
| 119 | end | 120 | end |
| 120 | end) | 121 | end) |
| 121 | end | 122 | end |
| 122 | else | 123 | else |
| 123 | rBottomBarStyler.point = nil | 124 | rBottomBarStyler.point = nil |
| 124 | rBottomBarStyler.posx = nil | 125 | rBottomBarStyler.posx = nil |
| 125 | rBottomBarStyler.posy = nil | 126 | rBottomBarStyler.posy = nil |
| 126 | frame_to_scale:ClearAllPoints() | 127 | frame_to_scale:ClearAllPoints() |
| 127 | frame_to_scale:SetPoint("BOTTOM",0,0) | 128 | frame_to_scale:SetPoint("BOTTOM",0,0) |
| 128 | end | 129 | end |
| 129 | end | 130 | end |
| 130 | 131 | ||
| 131 | ------------------------------------------------------ | 132 | ------------------------------------------------------ |
| 132 | -- / CREATE ME A ORB GLOW FUNC / -- | 133 | -- / CREATE ME A ORB GLOW FUNC / -- |
| 133 | ------------------------------------------------------ | 134 | ------------------------------------------------------ |
| 134 | 135 | ||
| 135 | local function create_me_a_orb_glow(f,useorb,pos) | 136 | local function create_me_a_orb_glow(f,useorb,pos) |
| 136 | local glow = CreateFrame("PlayerModel", nil, f) | 137 | local glow = CreateFrame("PlayerModel", nil, f) |
| 137 | glow:SetFrameStrata("BACKGROUND") | 138 | glow:SetFrameStrata("BACKGROUND") |
| 138 | glow:SetAllPoints(f) | 139 | glow:SetAllPoints(f) |
| 139 | glow:SetModel(orbtab[useorb].anim) | 140 | glow:SetModel(orbtab[useorb].anim) |
| 140 | glow:SetModelScale(orbtab[useorb].scale) | 141 | glow:SetModelScale(orbtab[useorb].scale) |
| 141 | glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos) | 142 | glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos) |
| 142 | glow:SetAlpha(1/fog_smoother) | 143 | glow:SetAlpha(1/fog_smoother) |
| 143 | glow:SetScript("OnShow",function() | 144 | glow:SetScript("OnShow",function() |
| 144 | glow:SetModel(orbtab[useorb].anim) | 145 | glow:SetModel(orbtab[useorb].anim) |
| 145 | glow:SetModelScale(orbtab[useorb].scale) | 146 | glow:SetModelScale(orbtab[useorb].scale) |
| 146 | glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos) | 147 | glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos) |
| 147 | end) | 148 | end) |
| 148 | return glow | 149 | return glow |
| 149 | end | 150 | end |
| 150 | 151 | ||
| 151 | ------------------------------------------------------ | 152 | ------------------------------------------------------ |
| 152 | -- / CREATE ME A FRAME FUNC / -- | 153 | -- / CREATE ME A FRAME FUNC / -- |
| 153 | ------------------------------------------------------ | 154 | ------------------------------------------------------ |
| 154 | 155 | ||
| 155 | local function create_me_a_frame(fart,fname,fparent,fstrata,fwidth,fheight,fanchor,fxpos,fypos,fscale,fdrag) | 156 | local function create_me_a_frame(fart,fname,fparent,fstrata,fwidth,fheight,fanchor,fxpos,fypos,fscale,fdrag,finherit) |
| 156 | -- PARENT, BACKGROUND, LOW, MEDIUM, HIGH, DIALOG, FULLSCREEN, FULLSCREEN_DIALOG, TOOLTIP | 157 | -- PARENT, BACKGROUND, LOW, MEDIUM, HIGH, DIALOG, FULLSCREEN, FULLSCREEN_DIALOG, TOOLTIP |
| 157 | local f = CreateFrame(fart,fname,fparent) | 158 | local f = CreateFrame(fart,fname,fparent,finherit) |
| 158 | f:SetFrameStrata(fstrata) | 159 | f:SetFrameStrata(fstrata) |
| 159 | f:SetWidth(fwidth) | 160 | f:SetWidth(fwidth) |
| 160 | f:SetHeight(fheight) | 161 | f:SetHeight(fheight) |
| 161 | if fname == "rBBS_Holder" then | 162 | if fname == "rBBS_Holder" then |
| 162 | if rBottomBarStyler.point and rBottomBarStyler.posx and rBottomBarStyler.posy then | 163 | if rBottomBarStyler.point and rBottomBarStyler.posx and rBottomBarStyler.posy then |
| 163 | f:SetPoint(rBottomBarStyler.point,rBottomBarStyler.posx,rBottomBarStyler.posy) | 164 | f:SetPoint(rBottomBarStyler.point,rBottomBarStyler.posx,rBottomBarStyler.posy) |
| 164 | else | 165 | else |
| 165 | f:SetPoint(fanchor,fxpos,fypos) | 166 | f:SetPoint(fanchor,fxpos,fypos) |
| 166 | end | 167 | end |
| 167 | else | 168 | else |
| 168 | f:SetPoint(fanchor,fxpos,fypos) | 169 | f:SetPoint(fanchor,fxpos,fypos) |
| 169 | end | 170 | end |
| 170 | f:SetScale(fscale) | 171 | f:SetScale(fscale) |
| 171 | if fdrag == true then | 172 | if fdrag == true then |
| 172 | f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) | 173 | f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) |
| 173 | end | 174 | end |
| 174 | return f | 175 | return f |
| 175 | end | 176 | end |
| 176 | 177 | ||
| 177 | ------------------------------------------------------ | 178 | ------------------------------------------------------ |
| 178 | -- / CREATE ME A TEXTURE FUNC / -- | 179 | -- / CREATE ME A TEXTURE FUNC / -- |
| 179 | ------------------------------------------------------ | 180 | ------------------------------------------------------ |
| 180 | 181 | ||
| 181 | local function create_me_a_texture(fhooked,tstrata,tfile,tspecial) | 182 | local function create_me_a_texture(fhooked,tstrata,tfile,tspecial) |
| 182 | -- BACKGROUND, BORDER, ARTWORK, OVERLAY, HIGHLIGHT | 183 | -- BACKGROUND, BORDER, ARTWORK, OVERLAY, HIGHLIGHT |
| 183 | local t = fhooked:CreateTexture(nil,tstrata) | 184 | local t = fhooked:CreateTexture(nil,tstrata) |
| 184 | t:SetTexture(tfile) | 185 | t:SetTexture(tfile) |
| 185 | if tspecial == "fill" then | 186 | if tspecial == "fill" then |
| 186 | t:SetPoint("BOTTOM",fhooked,"BOTTOM",0,0) | 187 | t:SetPoint("BOTTOM",fhooked,"BOTTOM",0,0) |
| 187 | t:SetWidth(fhooked:GetWidth()) | 188 | t:SetWidth(fhooked:GetWidth()) |
| 188 | t:SetHeight(fhooked:GetHeight()) | 189 | t:SetHeight(fhooked:GetHeight()) |
| 189 | else | 190 | else |
| 190 | t:SetAllPoints(fhooked) | 191 | t:SetAllPoints(fhooked) |
| 191 | end | 192 | end |
| 192 | return t | 193 | return t |
| 193 | end | 194 | end |
| 194 | 195 | ||
| 196 | ------------------------------------------------------ | ||
| 197 | -- / DO FORMAT / -- | ||
| 198 | ------------------------------------------------------ | ||
| 199 | |||
| 200 | local function do_format(v) | ||
| 201 | local string = "" | ||
| 202 | if v > 1000000 then | ||
| 203 | string = (floor((v/1000000)*10)/10).."m" | ||
| 204 | elseif v > 1000 then | ||
| 205 | string = (floor((v/1000)*10)/10).."k" | ||
| 206 | else | ||
| 207 | string = v | ||
| 208 | end | ||
| 209 | return string | ||
| 210 | end | ||
| 211 | |||
| 195 | ------------------------------------------------------ | 212 | ------------------------------------------------------ |
| 196 | -- / ORB HEALTH FUNC / -- | 213 | -- / ORB HEALTH FUNC / -- |
| 197 | ------------------------------------------------------ | 214 | ------------------------------------------------------ |
| 198 | 215 | ||
| 199 | local function orbhealth(orb1,orb1_fill,glow1,glow2) | 216 | local function orbhealth(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2) |
| 200 | orb1:SetScript("OnEvent", function(self, event, arg1, ...) | 217 | orb1:SetScript("OnEvent", function(self, event, arg1, ...) |
| 201 | if arg1 == "player" then | 218 | if arg1 == "player" or event == "PLAYER_ENTERING_WORLD" then |
| 202 | local uh, uhm = UnitHealth("player"), UnitHealthMax("player") | 219 | local uh, uhm = UnitHealth("player"), UnitHealthMax("player") |
| 220 | local perc = floor(uh/uhm*100) | ||
| 221 | local nuh = do_format(uh) | ||
| 222 | local nuhm = do_format(uhm) | ||
| 223 | orbtext1:SetText(perc) | ||
| 224 | orbtext2:SetText(nuh.."/"..nuhm) | ||
| 203 | orb1_fill:SetHeight((uh/uhm) * orb1_fill:GetWidth()) | 225 | orb1_fill:SetHeight((uh/uhm) * orb1_fill:GetWidth()) |
| 204 | orb1_fill:SetTexCoord(0,1, math.abs(uh/uhm - 1),1) | 226 | orb1_fill:SetTexCoord(0,1, math.abs(uh/uhm - 1),1) |
| 205 | glow1:SetAlpha((uh / uhm)/fog_smoother) | 227 | glow1:SetAlpha((uh / uhm)/fog_smoother) |
| 206 | glow2:SetAlpha((uh / uhm)/fog_smoother) | 228 | glow2:SetAlpha((uh / uhm)/fog_smoother) |
| 229 | orbtext1:SetText(perc) | ||
| 230 | orbtext2:SetText(nuh.."/"..nuhm) | ||
| 207 | end | 231 | end |
| 208 | end) | 232 | end) |
| 209 | orb1:RegisterEvent("UNIT_HEALTH") | 233 | orb1:RegisterEvent("UNIT_HEALTH") |
| 234 | orb1:RegisterEvent("PLAYER_ENTERING_WORLD") | ||
| 210 | end | 235 | end |
| 211 | 236 | ||
| 212 | ------------------------------------------------------ | 237 | ------------------------------------------------------ |
| 213 | -- / ORB MANA FUNC / -- | 238 | -- / ORB MANA FUNC / -- |
| 214 | ------------------------------------------------------ | 239 | ------------------------------------------------------ |
| 215 | 240 | ||
| 216 | local function orbmana(orb2,orb2_fill,glow1,glow2) | 241 | local function orbmana(orb2,orb2_fill,glow1,glow2,orbtext1,orbtext2) |
| 217 | orb2:SetScript("OnEvent", function(self, event, arg1, ...) | 242 | orb2:SetScript("OnEvent", function(self, event, arg1, ...) |
| 218 | if arg1 == "player" then | 243 | if arg1 == "player" or event == "PLAYER_ENTERING_WORLD" then |
| 219 | local um, umm = UnitMana("player"), UnitManaMax("player") | 244 | local um, umm = UnitMana("player"), UnitManaMax("player") |
| 245 | local perc = floor(um/umm*100) | ||
| 246 | local nuh = do_format(um) | ||
| 247 | local nuhm = do_format(umm) | ||
| 248 | orbtext1:SetText(perc) | ||
| 249 | orbtext2:SetText(nuh.."/"..nuhm) | ||
| 220 | orb2_fill:SetHeight((um/umm) * orb2_fill:GetWidth()) | 250 | orb2_fill:SetHeight((um/umm) * orb2_fill:GetWidth()) |
| 221 | orb2_fill:SetTexCoord(0,1, math.abs(um/umm - 1),1) | 251 | orb2_fill:SetTexCoord(0,1, math.abs(um/umm - 1),1) |
| 222 | glow1:SetAlpha((um / umm)/fog_smoother) | 252 | glow1:SetAlpha((um / umm)/fog_smoother) |
| 223 | glow2:SetAlpha((um / umm)/fog_smoother) | 253 | glow2:SetAlpha((um / umm)/fog_smoother) |
| 224 | end | 254 | end |
| 225 | end) | 255 | end) |
| 226 | orb2:RegisterEvent("UNIT_MANA") | 256 | orb2:RegisterEvent("UNIT_MANA") |
| 227 | orb2:RegisterEvent("UNIT_RAGE") | 257 | orb2:RegisterEvent("UNIT_RAGE") |
| 228 | orb2:RegisterEvent("UNIT_ENERGY") | 258 | orb2:RegisterEvent("UNIT_ENERGY") |
| 229 | orb2:RegisterEvent("UNIT_FOCUS") | 259 | orb2:RegisterEvent("UNIT_FOCUS") |
| 230 | orb2:RegisterEvent("UNIT_RUNIC_POWER") | 260 | orb2:RegisterEvent("UNIT_RUNIC_POWER") |
| 261 | orb2:RegisterEvent("PLAYER_ENTERING_WORLD") | ||
| 231 | end | 262 | end |
| 232 | 263 | ||
| 264 | ------------------------------------------------------ | ||
| 265 | -- / SET ME A FONT / -- | ||
| 266 | ------------------------------------------------------ | ||
| 267 | |||
| 268 | local function set_me_a_font(f, font, size, style) | ||
| 269 | local fs = f:CreateFontString(nil, "OVERLAY") | ||
| 270 | fs:SetFont(font, size, style) | ||
| 271 | fs:SetShadowColor(0,0,0,1) | ||
| 272 | return fs | ||
| 273 | end | ||
| 274 | |||
| 233 | ------------------------------------------------------ | 275 | ------------------------------------------------------ |
| 234 | -- / CREATE ORB FUNC / -- | 276 | -- / CREATE ORB FUNC / -- |
| 235 | ------------------------------------------------------ | 277 | ------------------------------------------------------ |
| 236 | 278 | ||
| 237 | local function create_orb(orbtype,orbsize,orbanchorframe,orbpoint,orbposx,orbposy,orbscale,orbfilltex,useorb) | 279 | local function create_orb(orbtype,orbsize,orbanchorframe,orbpoint,orbposx,orbposy,orbscale,orbfilltex,useorb) |
| 238 | --life orb | 280 | local orb1 = create_me_a_frame("Button",nil,orbanchorframe,"BACKGROUND",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale,nil,"SecureUnitButtonTemplate") |
| 239 | local orb1 = create_me_a_frame("Frame",nil,orbanchorframe,"BACKGROUND",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale) | 281 | orb1:RegisterForClicks("AnyUp") |
| 282 | orb1:SetAttribute("unit", "player") | ||
| 283 | orb1:SetAttribute("*type1", "target") | ||
| 284 | local showmenu = function() | ||
| 285 | ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor", 0, 0) | ||
| 286 | end | ||
| 287 | orb1.showmenu = showmenu | ||
| 288 | orb1.unit = "player" | ||
| 289 | orb1:SetAttribute("*type2", "showmenu") | ||
| 290 | orb1:SetScript("OnEnter", UnitFrame_OnEnter) | ||
| 291 | orb1:SetScript("OnLeave", UnitFrame_OnLeave) | ||
| 292 | |||
| 240 | local orb1_back = create_me_a_texture(orb1,"BORDER","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_back2") | 293 | local orb1_back = create_me_a_texture(orb1,"BORDER","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_back2") |
| 241 | local orb1_fill = create_me_a_texture(orb1,"ARTWORK","Interface\\AddOns\\rBottomBarStyler\\orbtex\\"..orbfilltex,"fill") | 294 | local orb1_fill = create_me_a_texture(orb1,"ARTWORK","Interface\\AddOns\\rBottomBarStyler\\orbtex\\"..orbfilltex,"fill") |
| 242 | orb1_fill:SetVertexColor(orbtab[useorb].r,orbtab[useorb].g,orbtab[useorb].b) | 295 | orb1_fill:SetVertexColor(orbtab[useorb].r,orbtab[useorb].g,orbtab[useorb].b) |
| 296 | local glow1, glow2 | ||
| 243 | if orbtype == "life" then | 297 | if orbtype == "life" then |
| 244 | local glow1 = create_me_a_orb_glow(orb1,useorb,0) | 298 | glow1 = create_me_a_orb_glow(orb1,useorb,0) |
| 245 | local glow2 = create_me_a_orb_glow(orb1,useorb,1) | 299 | glow2 = create_me_a_orb_glow(orb1,useorb,1) |
| 246 | orbhealth(orb1,orb1_fill,glow1,glow2) | ||
| 247 | else | 300 | else |
| 248 | local glow1 = create_me_a_orb_glow(orb1,useorb,0) | 301 | glow1 = create_me_a_orb_glow(orb1,useorb,0) |
| 249 | local glow2 = create_me_a_orb_glow(orb1,useorb,1) | 302 | glow2 = create_me_a_orb_glow(orb1,useorb,1) |
| 250 | orbmana(orb1,orb1_fill,glow1,glow2) | ||
| 251 | end | 303 | end |
| 252 | local orb1_glossholder = create_me_a_frame("Frame",nil,orb1,"LOW",orbsize,orbsize,"BOTTOM",0,0,1) | 304 | local orb1_glossholder = create_me_a_frame("Frame",nil,orb1,"LOW",orbsize,orbsize,"BOTTOM",0,0,1) |
| 253 | local orb1_gloss = create_me_a_texture(orb1_glossholder,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_gloss") | 305 | local orb1_gloss = create_me_a_texture(orb1_glossholder,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_gloss") |
| 306 | local orbtext1 = set_me_a_font(orb1_glossholder, default_font, orbsize/5, "THINOUTLINE") | ||
| 307 | orbtext1:SetPoint("CENTER", 0, (orbsize/12)) | ||
| 308 | orbtext1:SetTextColor(1,1,1) | ||
| 309 | local orbtext2 = set_me_a_font(orb1_glossholder, default_font, orbsize/8.5, "THINOUTLINE") | ||
| 310 | orbtext2:SetPoint("CENTER", 0, -(orbsize/12)) | ||
| 311 | orbtext2:SetTextColor(0.6,0.6,0.6) | ||
| 312 | if orbtype == "life" then | ||
| 313 | orbhealth(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2) | ||
| 314 | else | ||
| 315 | orbmana(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2) | ||
| 316 | end | ||
| 254 | end | 317 | end |
| 255 | 318 | ||
| 256 | ------------------------------------------------------ | 319 | ------------------------------------------------------ |
| 257 | -- / SET ME A SCALE / -- | 320 | -- / SET ME A SCALE / -- |
| 258 | ------------------------------------------------------ | 321 | ------------------------------------------------------ |
| 259 | 322 | ||
| 260 | local function set_me_a_scale() | 323 | local function set_me_a_scale() |
| 261 | frame_to_scale:SetScale(rBottomBarStyler.scalevalue) | 324 | frame_to_scale:SetScale(rBottomBarStyler.scalevalue) |
| 262 | end | 325 | end |
| 263 | 326 | ||
| 264 | ------------------------------------------------------ | 327 | ------------------------------------------------------ |
| 265 | -- / SET ME A BAR / -- | 328 | -- / SET ME A BAR / -- |
| 266 | ------------------------------------------------------ | 329 | ------------------------------------------------------ |
| 267 | 330 | ||
| 268 | local function set_me_a_bar() | 331 | local function set_me_a_bar() |
| 269 | if rBottomBarStyler.artvalue == "roth" then | 332 | if rBottomBarStyler.artvalue == "roth" then |
| 270 | bar_to_show:SetTexture("Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) | 333 | bar_to_show:SetTexture("Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) |
| 271 | else | 334 | else |
| 272 | am("Does only work for roth layout") | 335 | am("Does only work for roth layout") |
| 273 | end | 336 | end |
| 274 | end | 337 | end |
| 275 | 338 | ||
| 276 | ------------------------------------------------------ | 339 | ------------------------------------------------------ |
| 277 | -- / CREATE D1 STYLE / -- | 340 | -- / CREATE D1 STYLE / -- |
| 278 | ------------------------------------------------------ | 341 | ------------------------------------------------------ |
| 279 | local function create_d1_style(scale) | 342 | local function create_d1_style(scale) |
| 280 | --holder | 343 | --holder |
| 281 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) | 344 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) |
| 282 | frame_to_scale = holder | 345 | frame_to_scale = holder |
| 283 | --bar texture | 346 | --bar texture |
| 284 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,256,"BOTTOM",0,0,1) | 347 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,256,"BOTTOM",0,0,1) |
| 285 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\bar") | 348 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\bar") |
| 286 | --orbs | 349 | --orbs |
| 287 | create_orb("life",160,holder,"BOTTOM",-290,120,1,"orb_filling4",1) | 350 | create_orb("life",160,holder,"BOTTOM",-290,120,1,"orb_filling4",1) |
| 288 | create_orb("mana",160,holder,"BOTTOM",285,120,1,"orb_filling4",3) | 351 | create_orb("mana",160,holder,"BOTTOM",285,120,1,"orb_filling4",3) |
| 289 | --left figure | 352 | --left figure |
| 290 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-320,35,0.9) | 353 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-320,35,0.9) |
| 291 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_left") | 354 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_left") |
| 292 | --right figure | 355 | --right figure |
| 293 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",320,35,0.9) | 356 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",320,35,0.9) |
| 294 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_right") | 357 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_right") |
| 295 | --dragframe | 358 | --dragframe |
| 296 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) | 359 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) |
| 297 | frame_to_drag = dragframe | 360 | frame_to_drag = dragframe |
| 298 | end | 361 | end |
| 299 | 362 | ||
| 300 | ------------------------------------------------------ | 363 | ------------------------------------------------------ |
| 301 | -- / CREATE D2 STYLE / -- | 364 | -- / CREATE D2 STYLE / -- |
| 302 | ------------------------------------------------------ | 365 | ------------------------------------------------------ |
| 303 | local function create_d2_style(scale) | 366 | local function create_d2_style(scale) |
| 304 | --holder | 367 | --holder |
| 305 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) | 368 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) |
| 306 | frame_to_scale = holder | 369 | frame_to_scale = holder |
| 307 | --bar texture | 370 | --bar texture |
| 308 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,44,1) | 371 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,44,1) |
| 309 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\bar") | 372 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\bar") |
| 310 | --border | 373 | --border |
| 311 | local border_left = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMRIGHT",0,0,1) | 374 | local border_left = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMRIGHT",0,0,1) |
| 312 | local border_left_tex = create_me_a_texture(border_left,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_left") | 375 | local border_left_tex = create_me_a_texture(border_left,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_left") |
| 313 | local border_right = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMLEFT",0,0,1) | 376 | local border_right = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMLEFT",0,0,1) |
| 314 | local border_right_tex = create_me_a_texture(border_right,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_right") | 377 | local border_right_tex = create_me_a_texture(border_right,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_right") |
| 315 | --orbs | 378 | --orbs |
| 316 | create_orb("life",160,holder,"BOTTOM",-472,55,1,"orb_filling4",1) | 379 | create_orb("life",160,holder,"BOTTOM",-472,55,1,"orb_filling4",1) |
| 317 | create_orb("mana",160,holder,"BOTTOM",465,55,1,"orb_filling4",3) | 380 | create_orb("mana",160,holder,"BOTTOM",465,55,1,"orb_filling4",3) |
| 318 | --left figure | 381 | --left figure |
| 319 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-453,44,1) | 382 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-453,44,1) |
| 320 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_left") | 383 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_left") |
| 321 | --right figure | 384 | --right figure |
| 322 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",453,44,1) | 385 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",453,44,1) |
| 323 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_right") | 386 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_right") |
| 324 | --dragframe | 387 | --dragframe |
| 325 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) | 388 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) |
| 326 | frame_to_drag = dragframe | 389 | frame_to_drag = dragframe |
| 327 | end | 390 | end |
| 328 | 391 | ||
| 329 | ------------------------------------------------------ | 392 | ------------------------------------------------------ |
| 330 | -- / CREATE D3 STYLE / -- | 393 | -- / CREATE D3 STYLE / -- |
| 331 | ------------------------------------------------------ | 394 | ------------------------------------------------------ |
| 332 | local function create_d3_style(scale) | 395 | local function create_d3_style(scale) |
| 333 | --holder | 396 | --holder |
| 334 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) | 397 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) |
| 335 | frame_to_scale = holder | 398 | frame_to_scale = holder |
| 336 | --bar texture | 399 | --bar texture |
| 337 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,0,1) | 400 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,0,1) |
| 338 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\bar") | 401 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\bar") |
| 339 | --orbs | 402 | --orbs |
| 340 | create_orb("life",200,holder,"BOTTOM",-471,-3,1,"orb_filling4",1) | 403 | create_orb("life",200,holder,"BOTTOM",-471,-3,1,"orb_filling4",1) |
| 341 | create_orb("mana",200,holder,"BOTTOM",471,-3,1,"orb_filling4",3) | 404 | create_orb("mana",200,holder,"BOTTOM",471,-3,1,"orb_filling4",3) |
| 342 | --left figure | 405 | --left figure |
| 343 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",-455,0,1) | 406 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",-455,0,1) |
| 344 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_left") | 407 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_left") |
| 345 | --right figure | 408 | --right figure |
| 346 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",455,0,1) | 409 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",455,0,1) |
| 347 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_right") | 410 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_right") |
| 348 | --dragframe | 411 | --dragframe |
| 349 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) | 412 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) |
| 350 | frame_to_drag = dragframe | 413 | frame_to_drag = dragframe |
| 351 | end | 414 | end |
| 352 | 415 | ||
| 353 | ------------------------------------------------------ | 416 | ------------------------------------------------------ |
| 354 | -- / CREATE ROTH STYLE / -- | 417 | -- / CREATE ROTH STYLE / -- |
| 355 | ------------------------------------------------------ | 418 | ------------------------------------------------------ |
| 356 | local function create_roth_style(scale) | 419 | local function create_roth_style(scale) |
| 357 | --holder | 420 | --holder |
| 358 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) | 421 | local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) |
| 359 | frame_to_scale = holder | 422 | frame_to_scale = holder |
| 360 | --bar texture | 423 | --bar texture |
| 361 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",512,256,"BOTTOM",0,0,1) | 424 | local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",512,256,"BOTTOM",0,0,1) |
| 362 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) | 425 | local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) |
| 363 | bar_to_show = bar_tex | 426 | bar_to_show = bar_tex |
| 364 | --orbs | 427 | --orbs |
| 365 | create_orb("life",120,holder,"BOTTOM",-250,-8,1,"orb_filling4",1) | 428 | create_orb("life",120,holder,"BOTTOM",-250,-8,1,"orb_filling4",1) |
| 366 | create_orb("mana",120,holder,"BOTTOM",250,-8,1,"orb_filling4",3) | 429 | create_orb("mana",120,holder,"BOTTOM",250,-8,1,"orb_filling4",3) |
| 367 | --bottom | 430 | --bottom |
| 368 | local bottom = create_me_a_frame("Frame",nil,holder,"MEDIUM",500,110,"BOTTOM",0,-10,1) | 431 | local bottom = create_me_a_frame("Frame",nil,holder,"MEDIUM",500,110,"BOTTOM",0,-10,1) |
| 369 | local bottom_tex = create_me_a_texture(bottom,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\bottom") | 432 | local bottom_tex = create_me_a_texture(bottom,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\bottom") |
| 370 | --left figure | 433 | --left figure |
| 371 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-510,0,0.6) | 434 | local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-510,0,0.6) |
| 372 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_left") | 435 | local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_left") |
| 373 | --right figure | 436 | --right figure |
| 374 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",510,0,0.6) | 437 | local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",510,0,0.6) |
| 375 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_right") | 438 | local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_right") |
| 376 | --dragframe | 439 | --dragframe |
| 377 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) | 440 | local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) |
| 378 | frame_to_drag = dragframe | 441 | frame_to_drag = dragframe |
| 379 | end | 442 | end |
| 380 | 443 | ||
| 381 | ------------------------------------------------------ | 444 | ------------------------------------------------------ |
| 382 | -- / LOAD STYLE FUNC / -- | 445 | -- / LOAD STYLE FUNC / -- |
| 383 | ------------------------------------------------------ | 446 | ------------------------------------------------------ |
| 384 | 447 | ||
| 385 | local function load_style(style,scale) | 448 | local function load_style(style,scale) |
| 386 | if style == "roth" then | 449 | if style == "roth" then |
| 387 | create_roth_style(scale) | 450 | create_roth_style(scale) |
| 388 | elseif style == "d1" then | 451 | elseif style == "d1" then |
| 389 | create_d1_style(scale) | 452 | create_d1_style(scale) |
| 390 | elseif style == "d2" then | 453 | elseif style == "d2" then |
| 391 | create_d2_style(scale) | 454 | create_d2_style(scale) |
| 392 | else | 455 | else |
| 393 | create_d3_style(scale) | 456 | create_d3_style(scale) |
| 394 | end | 457 | end |
| 395 | end | 458 | end |
| 396 | 459 | ||
| 397 | ------------------------------------------------------ | 460 | ------------------------------------------------------ |
| 398 | -- / SLASH FUNC / -- | 461 | -- / SLASH FUNC / -- |
| 399 | ------------------------------------------------------ | 462 | ------------------------------------------------------ |
| 400 | 463 | ||
| 401 | local function SlashCmd(cmd) | 464 | local function SlashCmd(cmd) |
| 402 | --setscale | 465 | --setscale |
| 403 | if (cmd:match"setscale") then | 466 | if (cmd:match"setscale") then |
| 404 | local a,b = strfind(cmd, " "); | 467 | local a,b = strfind(cmd, " "); |
| 405 | if b then | 468 | if b then |
| 406 | local c = strsub(cmd, b+1) | 469 | local c = strsub(cmd, b+1) |
| 407 | if tonumber(c) then | 470 | if tonumber(c) then |
| 408 | am("Current scaling is set to: "..c) | 471 | am("Current scaling is set to: "..c) |
| 409 | rBottomBarStyler.scalevalue = tonumber(c) | 472 | rBottomBarStyler.scalevalue = tonumber(c) |
| 410 | set_me_a_scale() | 473 | set_me_a_scale() |
| 411 | else | 474 | else |
| 412 | am("No number value.") | 475 | am("No number value.") |
| 413 | end | 476 | end |
| 414 | else | 477 | else |
| 415 | am("No value found.") | 478 | am("No value found.") |
| 416 | end | 479 | end |
| 417 | --getscale | 480 | --getscale |
| 418 | elseif (cmd:match"getscale") then | 481 | elseif (cmd:match"getscale") then |
| 419 | am("Current scaling is set to: "..rBottomBarStyler.scalevalue) | 482 | am("Current scaling is set to: "..rBottomBarStyler.scalevalue) |
| 420 | --setart | 483 | --setart |
| 421 | elseif (cmd:match"setart") then | 484 | elseif (cmd:match"setart") then |
| 422 | local a,b = strfind(cmd, " "); | 485 | local a,b = strfind(cmd, " "); |
| 423 | if b then | 486 | if b then |
| 424 | local c = strsub(cmd, b+1) | 487 | local c = strsub(cmd, b+1) |
| 425 | if c == "d1" or c == "d2" or c == "d3" or c == "roth" then | 488 | if c == "d1" or c == "d2" or c == "d3" or c == "roth" then |
| 426 | am("You set the art to: "..c) | 489 | am("You set the art to: "..c) |
| 427 | rBottomBarStyler.artvalue = c | 490 | rBottomBarStyler.artvalue = c |
| 428 | am("You need to reoad the interface to see the changes.") | 491 | am("You need to reoad the interface to see the changes.") |
| 429 | am("Type in: \"/console reloadui\".") | 492 | am("Type in: \"/console reloadui\".") |
| 430 | else | 493 | else |
| 431 | am("Wrong value. (possible values: d1, d2, d3, roth)") | 494 | am("Wrong value. (possible values: d1, d2, d3, roth)") |
| 432 | end | 495 | end |
| 433 | else | 496 | else |
| 434 | am("No value found.") | 497 | am("No value found.") |
| 435 | end | 498 | end |
| 436 | --setbar | 499 | --setbar |
| 437 | elseif (cmd:match"setbar") then | 500 | elseif (cmd:match"setbar") then |
| 438 | local a,b = strfind(cmd, " "); | 501 | local a,b = strfind(cmd, " "); |
| 439 | if b then | 502 | if b then |
| 440 | local c = strsub(cmd, b+1) | 503 | local c = strsub(cmd, b+1) |
| 441 | if c == "bar1" or c == "bar2" or c == "bar3" then | 504 | if c == "bar1" or c == "bar2" or c == "bar3" then |
| 442 | am("You set the bar to: "..c) | 505 | am("You set the bar to: "..c) |
| 443 | rBottomBarStyler.barvalue = c | 506 | rBottomBarStyler.barvalue = c |
| 444 | set_me_a_bar() | 507 | set_me_a_bar() |
| 445 | else | 508 | else |
| 446 | am("Wrong value. (possible values: bar1, bar2, bar3)") | 509 | am("Wrong value. (possible values: bar1, bar2, bar3)") |
| 447 | end | 510 | end |
| 448 | else | 511 | else |
| 449 | am("No value found.") | 512 | am("No value found.") |
| 450 | end | 513 | end |
| 451 | --getart | 514 | --getart |
| 452 | elseif (cmd:match"getart") then | 515 | elseif (cmd:match"getart") then |
| 453 | am("Current art is set to: "..rBottomBarStyler.artvalue) | 516 | am("Current art is set to: "..rBottomBarStyler.artvalue) |
| 454 | --getmovable | 517 | --getmovable |
| 455 | elseif (cmd:match"getmovable") then | 518 | elseif (cmd:match"getmovable") then |
| 456 | am("Movable is set to: "..rBottomBarStyler.movable) | 519 | am("Movable is set to: "..rBottomBarStyler.movable) |
| 457 | --getlocked | 520 | --getlocked |
| 458 | elseif (cmd:match"getlocked") then | 521 | elseif (cmd:match"getlocked") then |
| 459 | am("Locked is set to: "..rBottomBarStyler.locked) | 522 | am("Locked is set to: "..rBottomBarStyler.locked) |
| 460 | --locked | 523 | --locked |
| 461 | elseif (cmd:match"locked") then | 524 | elseif (cmd:match"locked") then |
| 462 | local a,b = strfind(cmd, " "); | 525 | local a,b = strfind(cmd, " "); |
| 463 | if b then | 526 | if b then |
| 464 | local c = strsub(cmd, b+1) | 527 | local c = strsub(cmd, b+1) |
| 465 | if tonumber(c) then | 528 | if tonumber(c) then |
| 466 | am("Locked is set to: "..c) | 529 | am("Locked is set to: "..c) |
| 467 | rBottomBarStyler.locked = tonumber(c) | 530 | rBottomBarStyler.locked = tonumber(c) |
| 468 | move_my_frame() | 531 | move_my_frame() |
| 469 | else | 532 | else |
| 470 | am("No number value.") | 533 | am("No number value.") |
| 471 | end | 534 | end |
| 472 | else | 535 | else |
| 473 | am("No value found.") | 536 | am("No value found.") |
| 474 | end | 537 | end |
| 475 | --movable | 538 | --movable |
| 476 | elseif (cmd:match"movable") then | 539 | elseif (cmd:match"movable") then |
| 477 | local a,b = strfind(cmd, " "); | 540 | local a,b = strfind(cmd, " "); |
| 478 | if b then | 541 | if b then |
| 479 | local c = strsub(cmd, b+1) | 542 | local c = strsub(cmd, b+1) |
| 480 | if tonumber(c) then | 543 | if tonumber(c) then |
| 481 | am("Movable is set to: "..c) | 544 | am("Movable is set to: "..c) |
| 482 | rBottomBarStyler.movable = tonumber(c) | 545 | rBottomBarStyler.movable = tonumber(c) |
| 483 | move_my_frame() | 546 | move_my_frame() |
| 484 | else | 547 | else |
| 485 | am("No number value.") | 548 | am("No number value.") |
| 486 | end | 549 | end |
| 487 | else | 550 | else |
| 488 | am("No value found.") | 551 | am("No value found.") |
| 489 | end | 552 | end |
| 490 | else | 553 | else |
| 491 | am("rbbs commands...") | 554 | am("rbbs commands...") |
| 492 | am("\/rbbs getscale") | 555 | am("\/rbbs getscale") |
| 493 | am("\/rbbs getart") | 556 | am("\/rbbs getart") |
| 494 | am("\/rbbs getlocked") | 557 | am("\/rbbs getlocked") |
| 495 | am("\/rbbs getmovable") | 558 | am("\/rbbs getmovable") |
| 496 | am("\/rbbs setscale NUMBER") | 559 | am("\/rbbs setscale NUMBER") |
| 497 | am("\/rbbs setart STRING (possible values: d1, d2, d3, roth)") | 560 | am("\/rbbs setart STRING (possible values: d1, d2, d3, roth)") |
| 498 | am("\/rbbs setbar STRING (possible values: bar1, bar2, bar3 - only affects the roth layout)") | 561 | am("\/rbbs setbar STRING (possible values: bar1, bar2, bar3 - only affects the roth layout)") |
| 499 | am("\/rbbs locked NUMBER (value of 1 locks bars, 0 unlocks)") | 562 | am("\/rbbs locked NUMBER (value of 1 locks bars, 0 unlocks)") |
| 500 | am("\/rbbs movable NUMBER (value of 1 makes bars movable if unlocked, value of 0 will reset position)") | 563 | am("\/rbbs movable NUMBER (value of 1 makes bars movable if unlocked, value of 0 will reset position)") |
| 501 | end | 564 | end |
| 502 | end | 565 | end |
| 503 | 566 | ||
| 504 | ------------------------------------------------------ | 567 | ------------------------------------------------------ |
| 505 | -- / LOAD THE SHIT / -- | 568 | -- / LOAD THE SHIT / -- |
| 506 | ------------------------------------------------------ | 569 | ------------------------------------------------------ |
| 507 | 570 | ||
| 508 | local a = CreateFrame"Frame" | 571 | local a = CreateFrame"Frame" |
| 509 | a:RegisterEvent("VARIABLES_LOADED") | 572 | a:RegisterEvent("VARIABLES_LOADED") |
| 510 | a:SetScript("OnEvent", function(self) | 573 | a:SetScript("OnEvent", function(self) |
| 511 | self:UnregisterEvent("VARIABLES_LOADED") | 574 | self:UnregisterEvent("VARIABLES_LOADED") |
| 512 | self:SetScript("OnEvent", nil) | 575 | self:SetScript("OnEvent", nil) |
| 513 | --default values | 576 | --default values |
| 514 | load_default() | 577 | load_default() |
| 515 | --load the styles | 578 | --load the styles |
| 516 | load_style(rBottomBarStyler.artvalue,rBottomBarStyler.scalevalue) | 579 | load_style(rBottomBarStyler.artvalue,rBottomBarStyler.scalevalue) |
| 517 | move_my_frame() | 580 | move_my_frame() |
| 518 | --slash commands | 581 | --slash commands |
| 519 | SlashCmdList["whatever"] = SlashCmd; | 582 | SlashCmdList["whatever"] = SlashCmd; |
| 520 | SLASH_whatever1 = "/rbbs"; | 583 | SLASH_whatever1 = "/rbbs"; |
| 521 | --am("rbbs loaded...") | 584 | --am("rbbs loaded...") |
| 522 | end) | 585 | end) |