/trunk
} |
local itemList = { |
"52306","52307","52308","52309","43248","52492", -- cata |
"83793","83794" -- mop |
"83793","83794", -- mop |
"115990", -- wod |
} |
local function itemCount() |
end |
return |
end |
local garrisonMaps = { |
[1152] = true, -- FW Horde Garrison Level 1 |
[1330] = true, -- FW Horde Garrison Level 2 |
[1153] = true, -- FW Horde Garrison Level 3 |
[1154] = true, -- FW Horde Garrison Level 4 |
[1158] = true, -- SMV Alliance Garrison Level 1 |
[1331] = true, -- SMV Alliance Garrison Level 2 |
[1159] = true, -- SMV Alliance Garrison Level 3 |
[1160] = true, -- SMV Alliance Garrison Level 4 |
} |
local function InGarrison() |
local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() |
if(garrisonMaps[instanceMapID]) then |
return true |
end |
return false |
end |
local function apply(eb) |
local d = 'PARTY' |
local i, t = IsInInstance() |
if (t=='raid') then |
d = 'RAID' |
elseif (t=='party' or t=='pvp') then |
elseif ((t=='party' and not InGarrison()) or t=='pvp') then |
d = 'INSTANCE_CHAT' |
elseif (not i and GetNumGroupMembers()>0) then |
d = 'PARTY' |
elseif IsInGuild() then |
d = 'GUILD' |
end |
print() |
eb:SetAttribute("chatType", d) |
-- eb:SetAttribute("stickyType", d) |
end |
if(typ == "item" or typ == "enchant" or typ == "spell" or typ == "quest") then |
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR") |
GameTooltip:SetHyperlink(link) |
-- GameTooltip:Show() |
ShowUIPanel(GameTooltip) |
elseif(typ == "player") then |
local typ, name = string.match(link, "^(.-):(.*):(.*):") |
if(name) then |
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR") |
GameTooltip:SetUnit(name) |
-- GameTooltip:Show() |
ShowUIPanel(GameTooltip) |
end |
end |
end |
end |
end |
local sf_show = SendMailFrame:GetScript("OnShow") |
local sf_new = function(self) |
if(type(sf_show == 'function')) then |
sf_show(self) |
end |
print("check") |
local a,b = 0,0 |
local tab = {} |
while(a<=NUM_BAG_SLOTS) do |
b = 1 |
while(b<=GetContainerNumSlots(a)) do |
local texture, itemCount, locked, quality, readable, lootable, itemLink, isFiltered = GetContainerItemInfo(a, b) |
if(itemLink) then |
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, |
itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(itemLink) |
tab[itemType] = tab[itemType] or {} |
tab[itemType][itemSubType] = tab[itemType][itemSubType] or {} |
tab[itemType][itemSubType][#tab[itemType][itemSubType] + 1] = { |
['bag'] = a, |
['slot'] = b, |
} |
end |
b = b + 1 |
end |
a = a + 1 |
end |
for k,v in pairs(tab) do |
for c,d in pairs(v) do |
print(k,c,#d) |
end |
end |
end |
local function checkBags(on) |
if(on) then |
SendMailFrame:SetScript("OnShow", sf_new) |
else |
SendMailFrame:SetScript("OnShow", sf_show) |
end |
end |
local function getPref(pref) |
return db[pref[#pref]] |
end |
local function setPref(pref,value) |
db[pref[#pref]] = value |
end |
local function OnEvent(self, event, arg1, ...) |
if(arg1 == childName and event=="ADDON_LOADED") then |
-- print(name, event, tostring(PlayerFrame:IsUserPlaced())) |
if(PlayerFrame:IsUserPlaced()) then |
PlayerFrame:SetMoveable(true) |
PlayerFrame:SetMoveable(false) |
else |
PlayerFrame:SetUserPlaced(true) |
PlayerFrame:ClearAllPoints() |
TargetFrame:ClearAllPoints() |
TargetFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPRIGHT",0,0) |
else |
TargetFrame:SetMoveable(true) |
TargetFrame:SetMoveable(false) |
end |
self:UnregisterEvent(event) |
ChatTypeInfo['WHISPER']['sticky'] = 0 |
ChatTypeInfo['BN_WHISPER']['sticky'] = 0 |
end |
-- PlayerFrame:SetUserPlaced(true) |
elseif(event == "PLAYER_TARGET_CHANGED") then |
updateClassColor("target") |
elseif(event == "PLAYER_FOCUS_CHANGED") then |
updateClassColor("focus") |
elseif(event == "MAIL_SHOW") then |
checkBags(true) |
elseif(event == "MAIL_CLOSE") then |
checkBags(false) |
elseif(event == "UNIT_INVENTORY_CHANGED") then |
if(itemCount()<12) then return end |
if(UnitName("player") == dest) then |
local eb = _G['ChatFrame'..i..'EditBox'] |
apply(eb) |
if(not hooked['NoSay']) then |
-- hooksecurefunc(ChatEdit_OnLoad, apply) |
hooked['NoSay'] = true |
end |
end |
end |
updateClassColor("player") |
elseif(event == 'MAIL_SHOW') then |
elseif(event == 'MAIL_INBOX_UPDATE') then |
for i=GetInboxNumItems(),1,-1 do |
local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply, isGM =GetInboxHeaderInfo(i) |
if(postmaster[sender]) then |
end |
end |
end |
C_Timer.After(5, function(i) DeleteInboxItem(i) end) |
C_Timer.After(5, function() DeleteInboxItem(i) end) |
end |
end |
elseif(event == 'CHAT_MSG_SYSTEM') then -- http://www.wowinterface.com/downloads/info23035-AFKQuit.html |
end |
end |
end |
--[[ |
Start Healthbar color Phanx |
http://www.wowinterface.com/forums/showthread.php?p=302918#post302918 |
--]] |
local function OnMinMaxChanged(bar, minValue, maxValue) |
bar.maxValue = maxValue |
end |
local function SetValue(bar, value) |
bar:real_SetValue(value) |
local percent = value / bar.maxValue |
if percent > 0.5 then |
bar:SetStatusBarColor(2 * (1 - percent), 1, 0) |
else |
bar:SetStatusBarColor(1, 2 * percent, 0) |
end |
end |
local function HandleBar(bar) |
local _, maxValue = bar:GetMinMaxValues() |
bar.maxValue = maxValue |
bar.lockColor = true |
bar:HookScript("OnMinMaxChanged", OnMinMaxChanged) |
bar.real_SetValue = bar.SetValue |
bar.SetValue = SetValue |
end |
--[[ |
End Healthbar color Phanx |
http://www.wowinterface.com/forums/showthread.php?p=302918#post302918 |
--]] |
local function init(self, ...) |
options = addon['InitConfig'](addon, childName, true, { |
['type'] = "launcher", |
SetCVar(k,v) |
end |
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", addNotice) |
if(Bartender4.db) then |
if(Bartender4 and Bartender4.db) then |
if(Bartender4.db:GetCurrentProfile() ~= "Default") then |
Bartender4.db:SetProfile("Default") |
end |
end |
HandleBar(PlayerFrameHealthBar) |
HandleBar(TargetFrameHealthBar) |
end |
addon['startup'](addon, name, childName, init, true, defaults) |
addon['RegisterFunc']({'PLAYER_TARGET_CHANGED','PLAYER_FOCUS_CHANGED','UPDATE_CHAT_WINDOWS','ADDON_LOADED','PLAYER_ENTERING_WORLD','CHAT_MSG_SYSTEM','MAIL_SHOW'},"OnEvent", OnEvent) |
addon['RegisterFunc']({'MAIL_INBOX_UPDATE','PLAYER_TARGET_CHANGED','PLAYER_FOCUS_CHANGED','UPDATE_CHAT_WINDOWS','ADDON_LOADED','PLAYER_ENTERING_WORLD','CHAT_MSG_SYSTEM','MAIL_SHOW','MAIL_CLOSE'},"OnEvent", OnEvent) |
addon['RegisterEventThrottle'](childName,'UNIT_INVENTORY_CHANGED', 0.07, OnEvent) |