PDA

View Full Version : MobileFrames addition: BuffFrame (code included)


kalethis
05-10-2005, 07:37 PM
Hello. I am a big fan customization, cutting and hacking what I need to suit my needs. Recently I tried out a new mod by Telo by the name of InfoBar. I love the mod and gives some great information. I have my InfoBar placed across the top of the screen, which requires me to move several frames (such as the minimapcluster, playerframe, and buffframe) in order to clearly see the full bar. I like a basic buff display and use the default buff icon (with Telo's BuffTimers mod to show seconds). I was unable to move the buff frame though in order to see the bar clearly, so I made my own customization to MobileFrames (currently tested on 1.82, with 2.1 being tested later today).

Included below is the code I currently use to make this frame mobile. Not being an XML guru, I simply copied and modified the MinimapCluster code in existance. Note that the frame reset coordinates are accurately set to match that of Blizzard's BuffFrame.xml. I hope this can be included in an upcoming version of MobileFrames! I really don't like having .nopatch files for Cosmos directories. :) Thanks!

PS- While I did modify my localization.fr.lua and localization.de.lua files to reflect my best guess on their proper additions, I did not include that code here as I do not know how to properly translate it. Hopefully someone on your end can do this.

KNOWN BUGS: Currently there appears to be a bug with it that only allows the frame to be moved vertically. While this is perfect for my use (I just want to slide it down a few pixels), I'm sure it will limit usability for others.

EDIT:
Currently testing with MobileFrames v2.1. It appears the code was streamlined and instead of having a seperate function to call AnchorToggleEnableGeneral, it was added to the definition of the frame. Anyways, see the appropriate version of code to use, depending on which version (cosmos release uses 1.82, current alpha uses 2.1 for anyone wishing to add this in themselves). The only file that requires different changes by version is the MobileFrames.lua file.


*** BEGIN CODE ***

File: MobileFrames.lua
Version: 1.82 (Used in current Cosmos Release)
Location:
function MobileFrames_DefineSpecialFrames()
MobileFrames_SpecialFrames = {

Code to insert:
BuffFrame = { cosmos = "COS_MOBILE_FRAMES_BUFFFRAME", reset = MobileFrames_ResetMobileBuffFrame, default = MobileFrames_EnabledByDefault, func = MobileFrames_EnableMobileBuffFrame },


File: MobileFrames.lua
Version: v1.82 (Used in current Cosmos Release)
Location:
-- <= == == == == == == == == == == == == =>
-- => Mobile Anchor Frames Reset
-- <= == == == == == == == == == == == == =>

Code to insert:
function MobileFrames_ResetMobileBuffFrame()
if ( BuffFrame.isMoving ) then
BuffFrame:StopMovingOrSizing();
BuffFrame.isMoving = false;
else
BuffFrame:ClearAllPoints();
BuffFrame:SetPoint("TOPRIGHT", "UIParent", "TOPRIGHT", -205, -13);
end
end

function MobileFrames_EnableMobileBuffFrame(checked)
MobileFrames_EnableAnchorToggleEnableGeneral("BuffFrame", checked);
end

---

File: MobileFrames.lua
Version: 2.1 (Used in current Alpha)
Location:
function MobileFrames_DefineSpecialFrames()
MobileFrames_SpecialFrames = {

Code to insert:
BuffFrame = { cosmos = "COS_MOBILE_FRAMES_BUFFFRAME", reset = MobileFrames_ResetMobileBuffFrame, default = MobileFrames_EnabledByDefault, func = function(checked) MobileFrames_AnchorToggleEnableGeneral("BuffFrame", checked) end },

File: MobileFrames.lua
Version: v2.1 (Used in current Cosmos Alpha)
Location:
-- <= == == == == == == == == == == == == =>
-- => Mobile Anchor Frames Reset
-- <= == == == == == == == == == == == == =>

Code to insert:
function MobileFrames_ResetMobileBuffFrame()
if ( BuffFrame.isMoving ) then
BuffFrame:StopMovingOrSizing();
BuffFrame.isMoving = false;
else
BuffFrame:ClearAllPoints();
BuffFrame:SetPoint("TOPRIGHT", "UIParent", "TOPRIGHT", -205, -13);
end
end

---

File: MobileFrames.xml
Version: v1.82 and v2.1 (Used in Cosmos Release and Cosmos Alpha)
Location:
Between

<Frame name="$parentMobileButton" inherits="MobileFrameAnchorSmall" parent="MinimapCluster" />

and


<Frame name="$parentMobileButton" inherits="MobileFrameAnchorSmall" parent="TicketStatusFrame" />

Code to insert:

<Frame name="$parentMobileButton" inherits="MobileFrameAnchorSmall" parent="BuffFrame" />

File: localization.lua
Version: v1.82 and v2.1 (Used in Cosmos Release and Cosmos Alpha)
Location:
MOBILE_FRAMES_FRAMEDESCRIPTIONS = {

Code to insert:
BuffFrame = "Buff Frame",

*** END CODE ***

KarlKFI
05-10-2005, 09:27 PM
I was thinking of adding that... and that's exactly how I woulda done it.... uh oh. My fame and reputation is in jeapory! NOOOOOOOoooooo.

j/k.

I'll add it right in.

KarlKFI
05-11-2005, 12:29 AM
Well I'm somewhat of a perfectionist (the reason it wasn't in there already) so I made it work to move in any direction and takes along the temporary item enchants too.

kalethis
05-11-2005, 07:47 AM
Great to hear, Karl. I look forward to comparing your code to see what exactly you did to make it mobile in any direction. Thanks a bunch for the exceptionally fast response. I've really begun to play with full-on customization of the UI in the past few days, so you can be sure if I come up with anything else, it'll be here right away. Thanks again!

KarlKFI
05-11-2005, 04:50 PM
I seemed to have missed something. There's still an issue with it moveing to the right when you zone. I'll look into it.