Permalink
Browse files

[caelUI] Moved characterPanel to character_panel. 4.3 brings us a new…

… element to the CharacterModelFrame that actually has a built in rotate and zoom button. I'm excluded this feature from being included in the UI when it is run on any version newer then the current live build #.
  • Loading branch information...
1 parent 230ac97 commit 73cbc97329edc866bbc25ed30ef6867459cf6b2b @memborsky committed Oct 30, 2011
View
@@ -1,7 +1,6 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="caelCore.lua"/>
- <Script file="modules\characterPanel.lua"/>
<Script file="modules\cvarData.lua"/>
<Script file="modules\gameFonts.lua"/>
<!-- Script file="modules\keyBinding.lua"/ -->
@@ -1,76 +0,0 @@
-local _, caelCore = ...
-
-local characterpanel = caelCore.createModule("CharacterPanel")
-
-local pixel_scale = caelUI.config.pixel_scale
-
-local helm = characterpanel.helm
-local cloak = characterpanel.cloak
-local undress = characterpanel.undress
-
-CharacterModelFrameRotateLeftButton:ClearAllPoints()
-CharacterModelFrameRotateLeftButton:SetScale(pixel_scale(0.85))
-CharacterModelFrameRotateLeftButton:SetPoint("RIGHT", PaperDollFrame, "RIGHT", pixel_scale(-140), 0)
-
-CharacterModelFrameRotateRightButton:ClearAllPoints()
-CharacterModelFrameRotateRightButton:SetScale(pixel_scale(0.85))
-CharacterModelFrameRotateRightButton:SetPoint("RIGHT", PaperDollFrame, "RIGHT", pixel_scale(-112.5), 0)
-
-local ShowCloak, ShowHelm = ShowCloak, ShowHelm
-_G.ShowCloak = function () end
-_G.ShowHelm = function () end
-
-for k, v in next, {InterfaceOptionsDisplayPanelShowCloak, InterfaceOptionsDisplayPanelShowHelm} do
- v:SetButtonState("DISABLED", true)
-end
-
-helm = CreateFrame("CheckButton", nil, PaperDollFrame, "OptionsCheckButtonTemplate")
-helm:SetPoint("LEFT", CharacterHeadSlot, "RIGHT", pixel_scale(7), pixel_scale(6))
-helm:SetChecked(ShowingHelm())
-helm:SetToplevel()
-helm:RegisterEvent("PLAYER_FLAGS_CHANGED")
-helm:SetScript("OnClick", function() ShowHelm(not ShowingHelm()) end)
-helm:SetScript("OnEvent", function(self, event, unit)
- if(unit == "player") then
- self:SetChecked(ShowingHelm())
- end
-end)
-helm:SetScript("OnEnter", function(self)
- GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
- GameTooltip:SetText("Toggles helmet model.")
-end)
-helm:SetScript("OnLeave", function() GameTooltip:Hide() end)
-
-cloak = CreateFrame("CheckButton", nil, PaperDollFrame, "OptionsCheckButtonTemplate")
-cloak:SetPoint("LEFT", CharacterHeadSlot, "RIGHT", pixel_scale(7), pixel_scale(-15))
-cloak:SetChecked(ShowingCloak())
-cloak:SetToplevel()
-cloak:RegisterEvent("PLAYER_FLAGS_CHANGED")
-cloak:SetScript("OnClick", function() ShowCloak(not ShowingCloak()) end)
-cloak:SetScript("OnEvent", function(self, event, unit)
- if(unit == "player") then
- self:SetChecked(ShowingCloak())
- end
-end)
-cloak:SetScript("OnEnter", function(self)
- GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
- GameTooltip:SetText("Toggles cloak model.")
-end)
-cloak:SetScript("OnLeave", function() GameTooltip:Hide() end)
-
-undress = CreateFrame("Button", nil, DressUpFrame, "UIPanelButtonTemplate")
-undress:SetPoint("RIGHT", DressUpFrameResetButton, "LEFT")
-undress:SetHeight(pixel_scale(22))
-undress:SetWidth(pixel_scale(80))
-undress:SetText("Undress")
-undress:SetScript("OnClick", function() DressUpModel:Undress() end)
-
-local old_PaperDollFrame_SetItemLevel = PaperDollFrame_SetItemLevel
-PaperDollFrame_SetItemLevel = function(statFrame, unit, ...)
- old_PaperDollFrame_SetItemLevel(statFrame, unit, ...)
-
- -- Exit when not the player unit.
- if unit ~= "player" then return end
-
- _G[statFrame:GetName().."StatText"]:SetText(math.floor(GetAverageItemLevel() * 10) / 10)
-end
@@ -7,7 +7,7 @@ Check to see if the UI is loaded on the PTR server
@return boolean True for PTR server
--]]
function private.ptr_check ()
- local version = select(2, GetBuildInfo())
+ local _, version = GetBuildInfo()
if tonumber(version) > 14732 then
return true
@@ -0,0 +1,82 @@
+local private = unpack(select(2, ...))
+
+local pixel_scale = private.database.get("config")["pixel_scale"]
+local ShowCloak = ShowCloak
+local ShowHelm = ShowHelm
+
+--- XXX: This is killed in 4.3
+--- These are removed on the PTR and are replaced with a built in UI element on the
+--- character model frame that does the same thing plus (un)zoom the character model.
+--- This will display a rotate left and right button for the character model frame.
+if not private.ptr_check() then
+ CharacterModelFrameRotateLeftButton:ClearAllPoints()
+ CharacterModelFrameRotateLeftButton:SetScale(pixel_scale(0.85))
+ CharacterModelFrameRotateLeftButton:SetPoint("BOTTOMRIGHT", CharacterModelFrame, "BOTTOM", pixel_scale(1), pixel_scale(20))
+
+ CharacterModelFrameRotateRightButton:ClearAllPoints()
+ CharacterModelFrameRotateRightButton:SetScale(pixel_scale(0.85))
+ CharacterModelFrameRotateRightButton:SetPoint("BOTTOMLEFT", CharacterModelFrame, "BOTTOM", pixel_scale(-1), pixel_scale(20))
+end
+
+---
+--- Add a checkbox to the character model frame (Default Hotkey "c") to show/hide the helm.
+---
+local helm = CreateFrame("CheckButton", nil, CharacterModelFrame, "OptionsCheckButtonTemplate")
+helm:SetPoint("LEFT", CharacterHeadSlot, "RIGHT", pixel_scale(7), pixel_scale(6))
+helm:SetChecked(ShowingHelm())
+helm:SetToplevel()
+helm:RegisterEvent("PLAYER_FLAGS_CHANGED")
+helm:SetScript("OnClick", function() ShowHelm(not ShowingHelm()) end)
+helm:SetScript("OnEvent", function(self, _, unit)
+ if(unit == "player") then
+ self:SetChecked(ShowingHelm())
+ end
+end)
+helm:SetScript("OnEnter", function(self)
+ GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+ GameTooltip:SetText("Toggles helmet model.")
+end)
+helm:SetScript("OnLeave", function() GameTooltip:Hide() end)
+
+---
+--- Add a checkbox to the character model frame (Default Hotkey "c") to show/hide the cloak.
+---
+local cloak = CreateFrame("CheckButton", nil, CharacterModelFrame, "OptionsCheckButtonTemplate")
+cloak:SetPoint("LEFT", CharacterHeadSlot, "RIGHT", pixel_scale(7), pixel_scale(-15))
+cloak:SetChecked(ShowingCloak())
+cloak:SetToplevel()
+cloak:RegisterEvent("PLAYER_FLAGS_CHANGED")
+cloak:SetScript("OnClick", function() ShowCloak(not ShowingCloak()) end)
+cloak:SetScript("OnEvent", function(self, _, unit)
+ if(unit == "player") then
+ self:SetChecked(ShowingCloak())
+ end
+end)
+cloak:SetScript("OnEnter", function(self)
+ GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+ GameTooltip:SetText("Toggles cloak model.")
+end)
+cloak:SetScript("OnLeave", function() GameTooltip:Hide() end)
+
+---
+--- Add an undress button to the dress up frame.
+---
+local undress = CreateFrame("Button", nil, DressUpFrame, "UIPanelButtonTemplate")
+undress:SetPoint("RIGHT", DressUpFrameResetButton, "LEFT")
+undress:SetHeight(pixel_scale(22))
+undress:SetWidth(pixel_scale(80))
+undress:SetText("Undress")
+undress:SetScript("OnClick", function() DressUpModel:Undress() end)
+
+---
+--- This will replace the item level value in our character panel with a more precise number at 1 decimal place.
+---
+local old_PaperDollFrame_SetItemLevel = PaperDollFrame_SetItemLevel
+PaperDollFrame_SetItemLevel = function(statFrame, unit, ...)
+ old_PaperDollFrame_SetItemLevel(statFrame, unit, ...)
+
+ -- Exit when not the player unit.
+ if unit ~= "player" then return end
+
+ _G[statFrame:GetName().."StatText"]:SetText(math.floor(GetAverageItemLevel() * 10) / 10)
+end
@@ -10,4 +10,7 @@
<!-- Moves the ticket window. Also temporarily skins the GM chat frame. -->
<script file="gm.lua" />
+
+ <!-- Character panel customization -->
+ <script file="character_panel.lua" />
</Ui>

0 comments on commit 73cbc97

Please sign in to comment.