WoWInterface SVN SoopUI

[/] [trunk/] [3.0.0rc1/] [SoopUI/] [Core/] [Tweaks.lua] - Rev 7

Compare with Previous | Blame | View Log

--      ___         ___         ___         ___      ___               
--     /  /\       /  /\       /  /\       /  /\    /__/\      ___     
--    /  /:/_     /  /::\     /  /::\     /  /::\   \  \:\    /  /\    
--   /  /:/ /\   /  /:/\:\   /  /:/\:\   /  /:/\:\   \  \:\  /  /:/    
--  /  /:/ /::\ /  /:/  \:\ /  /:/  \:\ /  /:/~/:___  \  \:\/__/::\    
-- /__/:/ /:/\:/__/:/ \__\:/__/:/ \__\:/__/:/ /:/__/\  \__\:\__\/\:\__ 
-- \  \:\/:/~/:\  \:\ /  /:\  \:\ /  /:\  \:\/:/\  \:\ /  /:/  \  \:\/\
--  \  \::/ /:/ \  \:\  /:/ \  \:\  /:/ \  \::/  \  \:\  /:/    \__\::/
--   \__\/ /:/   \  \:\/:/   \  \:\/:/   \  \:\   \  \:\/:/     /__/:/ 
--     /__/:/     \  \::/     \  \::/     \  \:\   \  \::/      \__\/  
--     \__\/       \__\/       \__\/       \__\/    \__\/              
--                       v * e * r * s * i * o * n * 3
----------------------------------------------------------------------------
-- SoopUI Tweaks
----------------------------------------------------------------------------


-- Quest level(yQuestLevel by yleaf)
----------------------------------------------------------------------------
local function update()
        local buttons = QuestLogScrollFrame.buttons
        local numButtons = #buttons
        local scrollOffset = HybridScrollFrame_GetOffset(QuestLogScrollFrame)
        local numEntries, numQuests = GetNumQuestLogEntries()
        
        for i = 1, numButtons do
                local questIndex = i + scrollOffset
                local questLogTitle = buttons[i]
                if questIndex <= numEntries then
                        local title, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(questIndex)
                        if not isHeader then
                                questLogTitle:SetText("[" .. level .. "] " .. title)
                                QuestLogTitleButton_Resize(questLogTitle)
                        end
                end
        end
end
hooksecurefunc("QuestLog_Update", update)
QuestLogScrollFrameScrollBar:HookScript("OnValueChanged", update)


-- Clear UIErrors frame(ncError by Nightcracker)
----------------------------------------------------------------------------
if Soop["general"].BlizzardsErrorFrameHiding then
        local f, o, ncErrorDB = CreateFrame("Frame"), "No error ye", {
                ["Inventory is full"] = true,
        }
        f:SetScript("OnEvent", function(self, event, error)
                if ncErrorDB[error] then
                        UIErrorsFrame:AddMessage(error)
                else
                o = error
                end
        end)
        SLASH_NCERROR1 = "/error"
        function SlashCmdLisNCERROR() print(o) end
        UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
        f:RegisterEvent("UI_ERROR_MESSAGE")
end

-- Hide Blizzard raid frames
----------------------------------------------------------------------------
local irp = 0;

function HideBlizzardRaidFrameOnEvent(event)
        if event == "RAID_ROSTER_UPDATE" then
                if ((GetNumRaidMembers() > 0) and (irp == 0) and (CompactRaidFrameContainer:IsShown())) then
                        CompactRaidFrameManagerDisplayFrameHiddenModeToggle:Click();
                        irp = 1;
                elseif (GetNumRaidMembers() == 0) then
                        irp = 0;
                end
        end
        if event == "PARTY_MEMBERS_CHANGED" then        
                if ((GetNumPartyMembers() > 0) and (irp == 0) and (CompactRaidFrameContainer:IsShown())) then
                        CompactRaidFrameManagerDisplayFrameHiddenModeToggle:Click();
                        irp = 1;
                elseif (GetNumPartyMembers() == 0) then
                        irp = 0;
                end
        end
end

local HideBlizzardRaidFrameHiddenFrame = CreateFrame("FRAME", "HideBlizzardRaidFrameHiddenFrame", UIParent);
HideBlizzardRaidFrameHiddenFrame:RegisterEvent("RAID_ROSTER_UPDATE");
HideBlizzardRaidFrameHiddenFrame:RegisterEvent("PARTY_MEMBERS_CHANGED");
HideBlizzardRaidFrameHiddenFrame:SetScript("OnEvent", function(self, event, arg1, ...)                                                                          
                                                                                HideBlizzardRaidFrameOnEvent(event);
                                                                        end);
HideBlizzardRaidFrameHiddenFrame:Hide();

-- Hide boss frames
----------------------------------------------------------------------------
function hideBossFrames()
        for i = 1, 4 do
                local frame = _G["Boss"..i.."TargetFrame"]
                frame:UnregisterAllEvents()
                frame:Hide()
                frame.Show = function () end
        end
end
-- Call the hide function
hideBossFrames()


-- Repair
----------------------------------------------------------------------------
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function()
                local c = 0
                for b=0,4 do
                        for s=1,GetContainerNumSlots(b) do
                                local l = GetContainerItemLink(b, s)
                                if l then
                                        local p = select(11, GetItemInfo(l))*select(2, GetContainerItemInfo(b, s))
                                        if select(3, GetItemInfo(l))==0 then
                                                UseContainerItem(b, s)
                                                PickupMerchantItem()
                                                c = c+p
                                        end
                                end
                        end
                end
                if c>0 then
                        local g, s, c = math.floor(c/10000) or 0, math.floor((c%10000)/100) or 0, c%100
                        DEFAULT_CHAT_FRAME:AddMessage("Your vendor trash has been sold and you earned".." |cffffffff"..g.."|cffffd700g|r".." |cffffffff"..s.."|cffc7c7cfs|r".." |cffffffff"..c.."|cffeda55fc|r"..".",255,255,0)
                end
        if Soop["general"].AutoRepair then
                        cost, possible = GetRepairAllCost()
                        if cost>0 then
                                if possible then
                                        RepairAllItems()
                                        local c = cost%100
                                        local s = math.floor((cost%10000)/100)
                                        local g = math.floor(cost/10000)
                                        DEFAULT_CHAT_FRAME:AddMessage("Your items have been repaired for".." |cffffffff"..g.."|cffffd700g|r".." |cffffffff"..s.."|cffc7c7cfs|r".." |cffffffff"..c.."|cffeda55fc|r"..".",255,255,0)
                                else
                                        DEFAULT_CHAT_FRAME:AddMessage("You don't have enough money for repair!",255,0,0)
                                end
                        end
        end             
end)
f:RegisterEvent("MERCHANT_SHOW")
local savedMerchantItemButton_OnModifiedClick = MerchantItemButton_OnModifiedClick
function MerchantItemButton_OnModifiedClick(self, ...)
        if ( IsAltKeyDown() ) then
                local maxStack = select(8, GetItemInfo(GetMerchantItemLink(self:GetID())))
                local name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(self:GetID())
                if ( maxStack and maxStack > 1 ) then
                        BuyMerchantItem(self:GetID(), floor(maxStack / quantity))
                end
        end
        savedMerchantItemButton_OnModifiedClick(self, ...)
end

-- Raid Boss Emotes
----------------------------------------------------------------------------
RaidBossEmoteFrame:ClearAllPoints()
RaidBossEmoteFrame:SetPoint("TOP", UIParent, "TOP", 0, -200) 
RaidBossEmoteFrame:SetScale(.9)

RaidWarningFrame:ClearAllPoints()
RaidWarningFrame:SetPoint("TOP", UIParent, "TOP", 0, -260) 
RaidWarningFrame:SetScale(.8)

Compare with Previous | Blame