WoWInterface SVN fernir_UI

[/] [helpers.lua] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 Wildbreath-135052
--[[     Options start here     ]]
2 Wildbreath-135052
-- "true" means enabled, "false" means disabled
3 Wildbreath-135052
local AutoGreedOnGreen = false       -- Should all be green items automatically rolled "greed" in groups and raids?
4 Wildbreath-135052
local AutoRepair = true             -- Auto repair all equipment upon visiting vendor + print repair cost info.
5 Wildbreath-135052
local SellGreyCrap = true           -- Sell all grey items to vendor automatically.
6 Wildbreath-135052
local AcceptInvites = true          -- Accept party invites from frieds and guild members
7 Wildbreath-135052
local NoErrors = false               -- Hide all erros from UIErrorsFrame
8 Wildbreath-135052
 
9 Wildbreath-135052
local raidaddons = {    -- Addons you use only in raids or groups
10 Wildbreath-135052
    "BigWigs",
11 Wildbreath-135052
    "oRA2",
12 Wildbreath-135052
    "SimpleRaidTargetIcons",
13 Wildbreath-135052
    "Scada",
14 Wildbreath-135052
}
15 Wildbreath-135052
 
16 Wildbreath-135052
local pvpaddons = {     -- Addons you use only in arenas or BGs. Nothing here since i rarely do PvP =)
17 Wildbreath-135052
    "Gladius",
18 Wildbreath-135052
    "Capping",
19 Wildbreath-135052
}
20 Wildbreath-135052
 
21 Wildbreath-135052
--[[ Clear UIErrors frame ]]
22 Wildbreath-135052
UIErrorsFrame:SetScale(0.8)
23 Wildbreath-135052
--CalendarFrame:SetScale(0.8)
24 Wildbreath-135052
if(NoErrors==true) then UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE") end
25 Wildbreath-135052
 
26 Wildbreath-135052
 
27 Wildbreath-135052
WatchFrameTitle:SetAlpha(0)
28 Wildbreath-135052
 
29 Wildbreath-135052
local p1, p2, p3, p4, p5 = WatchFrameCollapseExpandButton:GetPoint()
30 Wildbreath-135052
WatchFrameCollapseExpandButton:ClearAllPoints()
31 Wildbreath-135052
WatchFrameCollapseExpandButton:SetPoint(p1, p2, p3, p4 - 15, p5)
32 Wildbreath-135052
 
33 Wildbreath-135052
local a, b, c, d, e = RaidFrameNotInRaidRaidBrowserButton:GetPoint()
34 Wildbreath-135052
RaidFrameNotInRaidRaidBrowserButton:SetPoint(a, b, c, d, e - 25)
35 Wildbreath-135052
 
36 Wildbreath-135052
 
37 Wildbreath-135052
-- Disabled WoW's combat log at startup
38 Wildbreath-135052
-- local f = CreateFrame("Frame")
39 Wildbreath-135052
-- f:SetScript("OnEvent", function()
40 Wildbreath-135052
    -- f:UnregisterEvent("COMBAT_LOG_EVENT")
41 Wildbreath-135052
    -- COMBATLOG:UnregisterEvent("COMBAT_LOG_EVENT")
42 Wildbreath-135052
-- end)
43 Wildbreath-135052
-- f:RegisterEvent("COMBAT_LOG_EVENT")
44 Wildbreath-135052
 
45 Wildbreath-135052
 
46 Wildbreath-135052
--[[ Changing some variables ]]
47 Wildbreath-135052
SetCVar("screenshotQuality", 10)
48 Wildbreath-135052
SetCVar("cameraDistanceMax", 50)
49 Wildbreath-135052
SetCVar("cameraDistanceMaxFactor", 3.4)
50 Wildbreath-135052
 
51 Wildbreath-135052
 
52 Wildbreath-135052
--[[ Autogreed on green items ]]
53 Wildbreath-135052
if(AutoGreedOnGreen==true) then
54 Wildbreath-135052
    local f = CreateFrame("Frame")
55 Wildbreath-135052
    f:RegisterEvent("START_LOOT_ROLL")
56 Wildbreath-135052
    f:SetScript("OnEvent", function(_, _, id)
57 Wildbreath-135052
        if(id and select(4, GetLootRollItemInfo(id))==2) then
58 Wildbreath-135052
            RollOnLoot(id, 2)
59 Wildbreath-135052
        end
60 Wildbreath-135052
    end)
61 Wildbreath-135052
end
62 Wildbreath-135052
 
63 Wildbreath-135052
--[[ Accept invites ]]
64 Wildbreath-135052
if(AcceptInvites==true) then
65 Wildbreath-135052
    local IsFriend = function(name)
66 Wildbreath-135052
        for i=1, GetNumFriends() do if(GetFriendInfo(i)==name) then return true end end
67 Wildbreath-135052
        if(IsInGuild()) then for i=1, GetNumGuildMembers() do if(GetGuildRosterInfo(i)==name) then return true end end end
68 Wildbreath-135052
    end
69 Wildbreath-135052
 
70 Wildbreath-135052
    local ai = CreateFrame("Frame")
71 Wildbreath-135052
    ai:RegisterEvent("PARTY_INVITE_REQUEST")
72 Wildbreath-135052
    ai:SetScript("OnEvent", function(frame, event, name)
73 Wildbreath-135052
        if(IsFriend(name)) then
74 Wildbreath-135052
            AcceptGroup()
75 Wildbreath-135052
            for i = 1, 4 do
76 Wildbreath-135052
                local frame = _G["StaticPopup"..i]
77 Wildbreath-135052
                if(frame:IsVisible() and frame.which=="PARTY_INVITE") then
78 Wildbreath-135052
                    frame.inviteAccepted = 1
79 Wildbreath-135052
                    StaticPopup_Hide("PARTY_INVITE")
80 Wildbreath-135052
                    return
81 Wildbreath-135052
                end
82 Wildbreath-135052
            end
83 Wildbreath-135052
        else
84 Wildbreath-135052
            SendWho(name)
85 Wildbreath-135052
        end
86 Wildbreath-135052
    end)
87 Wildbreath-135052
end
88 Wildbreath-135052
 
89 Wildbreath-135052
local module = CreateFrame("Frame",nil,UIParent)
90 Wildbreath-135052
 
91 Wildbreath-135052
local sells,tmp_money = 0,0
92 Wildbreath-135052
 
93 Wildbreath-135052
-- íîðìàëüíûé ôîðìàò âûâîäà äåíåã
94 Wildbreath-135052
 
95 Wildbreath-135052
local money_format = function(val)
96 Wildbreath-135052
   return format("|cffffd700%dg|r |cffc7c7cf%ds|r |cffeda55f%dc|r",mod(val/10000,10000),mod(val/100,100),mod(val,100))
97 Wildbreath-135052
end
98 Wildbreath-135052
 
99 Wildbreath-135052
module.MERCHANT_SHOW = function(self)
100 Wildbreath-135052
    if (AutoRepair==true) then
101 Wildbreath-135052
    -- ÷èíèìñÿ
102 Wildbreath-135052
 
103 Wildbreath-135052
       if (CanMerchantRepair()) then
104 Wildbreath-135052
          local cost,money = GetRepairAllCost(),GetMoney()
105 Wildbreath-135052
          if cost > 0 then
106 Wildbreath-135052
             RepairAllItems()
107 Wildbreath-135052
             print(string.format("repairing cost : %s",money_format(math.min(cost, money))))
108 Wildbreath-135052
          end
109 Wildbreath-135052
       end
110 Wildbreath-135052
    end
111 Wildbreath-135052
 
112 Wildbreath-135052
    if (SellGreyCrap==true) then
113 Wildbreath-135052
    -- ïðîäàåì ìóñîð
114 Wildbreath-135052
 
115 Wildbreath-135052
       local bag,slot
116 Wildbreath-135052
       tmp_money = GetMoney()
117 Wildbreath-135052
       for bag = 0,4 do
118 Wildbreath-135052
          if GetContainerNumSlots(bag) > 0 then
119 Wildbreath-135052
             for slot = 0, GetContainerNumSlots(bag) do
120 Wildbreath-135052
                local link = GetContainerItemLink(bag,slot)
121 Wildbreath-135052
                if(link) then
122 Wildbreath-135052
                   local _,_,i_rar=GetItemInfo(link)
123 Wildbreath-135052
                   if i_rar == 0 then
124 Wildbreath-135052
                      UseContainerItem(bag,slot)
125 Wildbreath-135052
                      sells = sells+GetItemCount(link)
126 Wildbreath-135052
                   end
127 Wildbreath-135052
                end
128 Wildbreath-135052
             end
129 Wildbreath-135052
          end
130 Wildbreath-135052
       end
131 Wildbreath-135052
    end
132 Wildbreath-135052
end
133 Wildbreath-135052
 
134 Wildbreath-135052
module.PLAYER_MONEY = function(self)
135 Wildbreath-135052
   if(sells>0) then
136 Wildbreath-135052
      print(string.format("sold %d items for %s",sells,money_format(GetMoney()-tmp_money)))
137 Wildbreath-135052
      sells = 0
138 Wildbreath-135052
   end
139 Wildbreath-135052
end
140 Wildbreath-135052
 
141 Wildbreath-135052
-------------------------------------------------------------------------------------------------------------
142 Wildbreath-135052
 
143 Wildbreath-135052
module:SetScript("OnEvent",function(self,event,...) self[event](self,event,...) end)
144 Wildbreath-135052
 
145 Wildbreath-135052
module:RegisterEvent("MERCHANT_SHOW")
146 Wildbreath-135052
module:RegisterEvent("PLAYER_MONEY")