WoWInterface SVN Eui

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

EuiSet/EuiSet.lua New file
0,0 → 1,642
local ALLOWED_GROUPS = {
["main"] = 1,
["filter"] = 1,
["chat"] = 1,
["bag"] = 1,
["actionbar"] = 1,
["unitframe"] = 1,
["raid"] = 1,
["tooltip"] = 1,
["threat"] = 1,
["info"] = 0,
["clickset"] = 1,
["skins"] = 1,
["other"] = 1,
}
 
local function Local(o)
local E, C = unpack(EUI)
-- 主菜单
if o == "EuiSetGuimain" then o = e_main_label end
if o == "EuiSetGuifilter" then o = e_filter_label end
if o == "EuiSetGuichat" then o = e_chat_label end
if o == "EuiSetGuibag" then o = e_bag_label end
if o == "EuiSetGuiactionbar" then o = e_actionbar_label end
if o == "EuiSetGuiunitframe" then o = e_unitframe_label end
if o == "EuiSetGuitooltip" then o = e_tooltip_label end
if o == "EuiSetGuithreat" then o = e_threat_label end
if o == "EuiSetGuiinfo" then o = e_info_label end
if o == "EuiSetGuiraid" then o = e_raid_label end
if o == "EuiSetGuiclickset" then o = e_clickset_label end
if o == "EuiSetGuiskins" then o = e_skins_label end
if o == "EuiSetGuiother" then o = e_other_label end
 
-- 一般设置(EuiSetGuimain)
if o == "EuiSetGuimainautoscale" then o = e_main_autoscale end
if o == "EuiSetGuimainuiscale" then o = e_main_uiscale end
if o == "EuiSetGuimainautoinvite" then o = e_main_autoinvite end
if o == "EuiSetGuimaininvitetext" then o = e_main_invitetext end
if o == "EuiSetGuimainnoerrors" then o = e_main_noerrors end
if o == "EuiSetGuimainnoerrorsincombat" then o = e_main_noerrorsincombat end
if o == "EuiSetGuimainmoveuierrors" then o = e_main_moveuierrors end
if o == "EuiSetGuimainignoreduel" then o = e_main_ignoreduel end
if o == "EuiSetGuimainautoroll" then o = e_main_autoroll end
if o == "EuiSetGuimaindisableconfirm" then o = e_main_disableconfirm end
if o == "EuiSetGuimainautoloot" then o = e_main_autoloot end
if o == "EuiSetGuimainautorepair" then o = e_main_autorepair end
if o == "EuiSetGuimainautorepairguild" then o = e_main_autorepairguild end
if o == "EuiSetGuimainsellgreycrap" then o = e_main_sellgreycrap end
if o == "EuiSetGuimainacceptinvites" then o = e_main_acceptinvites end
if o == "EuiSetGuimainbugstack" then o = e_main_buystack end
if o == "EuiSetGuimainalttotrade" then o = e_main_alttotrade end
if o == "EuiSetGuimaintalentspam" then o = e_main_talentspam end
if o == "EuiSetGuimainquestauto" then o = e_main_questauto end
if o == "EuiSetGuimainquesticons" then o = e_main_questicons end
if o == "EuiSetGuimainautorez" then o = e_main_autorez end
if o == "EuiSetGuimaincombatnoti" then o = e_main_combatnoti end
if o == "EuiSetGuimainlockquest" then o = e_main_lockquest end
if o == "EuiSetGuimainminimappos" then o = e_main_minimappos end
if o == "EuiSetGuimainalpha" then o = e_main_alpha end
if o == "EuiSetGuimainclasscolortheme" then o = e_main_classcolortheme end
 
--其它设置(EuiSetGuiother)
if o == "EuiSetGuiothernameplate" then o = e_other_nameplate end
if o == "EuiSetGuiothernameplateauto" then o = e_other_nameplateauto end
if o == "EuiSetGuiothernameplatevalue" then o = e_other_nameplatevalue end
if o == "EuiSetGuiothermail" then o = e_other_mail end
if o == "EuiSetGuiothercooldown" then o = e_other_cooldown end
if o == "EuiSetGuiothertab" then o = e_other_tab end
if o == "EuiSetGuiotherloot" then o = e_other_loot end
if o == "EuiSetGuiotherrecipients" then o = e_other_recipients end
if o == "EuiSetGuiothersr" then o = e_other_sr end
if o == "EuiSetGuiotherfocuser" then o = e_other_focuser end
if o == "EuiSetGuiotherratings" then o = e_other_ratings end
if o == "EuiSetGuiotherhb" then o = e_other_hb end
if o == "EuiSetGuiotherspellid" then o = e_other_spellid end
if o == "EuiSetGuiothermbb" then o = e_other_mbb end
if o == "EuiSetGuiotherminimap" then o = e_other_minimap end
if o == "EuiSetGuiotherbuff" then o = e_other_buff end
 
-- 聊天(EuiSetGuichat)
if o == "EuiSetGuichatenable" then o = e_chat_enable end
if o == "EuiSetGuichathidejunk" then o = e_chat_hidejunk end
if o == "EuiSetGuichatchatw" then o = e_chat_chatw end
if o == "EuiSetGuichatchath" then o = e_chat_chath end
if o == "EuiSetGuichatchatbar" then o = e_chat_chatbar end
if o == "EuiSetGuichatchatguard" then o = e_chat_chatguard end
if o == "EuiSetGuichatLFW" then o = e_chat_LFW end
 
-- 技能监视(EuiSetGuifilter)
if o == "EuiSetGuifilterenable" then o = e_filter_enable end
if o == "EuiSetGuifilterconfigmode" then o = e_filter_configmode end
if o == "EuiSetGuifilterclasscolor" then o = e_filter_classcolor end
if o == "EuiSetGuifilterpbuffbar" then o = e_filter_pbuffbar end
if o == "EuiSetGuifiltertdebuffbar" then o = e_filter_tdebuffbar end
if o == "EuiSetGuifilterbarheight" then o = e_filter_barheight end
if o == "EuiSetGuifiltercoolline" then o = e_filter_coolline end
if o == "EuiSetGuifiltericonsize" then o = e_filter_iconsize end
if o == "EuiSetGuifilterpbufficon" then o = e_filter_pbufficon end
if o == "EuiSetGuifiltertdebufficon" then o = e_filter_tdebufficon end
if o == "EuiSetGuifilterfloat" then o = e_filter_float end
if o == "EuiSetGuifilterraid" then o = e_filter_raid end
if o == "EuiSetGuifilterraidwidth" then o = e_filter_raidwidth end
if o == "EuiSetGuifilterraidheight" then o = e_filter_raidheight end
if o == "EuiSetGuifilterraidnumber" then o = e_filter_raidnumber end
 
-- 头像(EuiSetGuiunitframe)
if o == "EuiSetGuiunitframeaaaaunit" then o = e_unitframe_aaaaunit end
if o == "EuiSetGuiunitframetotalhpmp" then o = e_unitframe_totalhpmp end
if o == "EuiSetGuiunitframecastbar" then o = e_unitframe_castbar end
if o == "EuiSetGuiunitframeswing" then o = e_unitframe_swing end
if o == "EuiSetGuiunitframetotdebuffs" then o = e_unitframe_totdebuffs end
if o == "EuiSetGuiunitframecolorClass" then o = e_unitframe_colorClass end --新增
if o == "EuiSetGuiunitframeFbuffs" then o = e_unitframe_Fbuffs end
if o == "EuiSetGuiunitframeFdebuffs" then o = e_unitframe_Fdebuffs end
if o == "EuiSetGuiunitframeportrait" then o = e_unitframe_portrait end
if o == "EuiSetGuiunitframeshowPvP" then o = e_unitframe_showPvP end
if o == "EuiSetGuiunitframeonlyplayer" then o = e_unitframe_onlyplayer end
if o == "EuiSetGuiunitframepowerspark" then o = e_unitframe_powerspark end
if o == "EuiSetGuiunitframeplayerx" then o = e_unitframe_playerx end
if o == "EuiSetGuiunitframeplayery" then o = e_unitframe_playery end
if o == "EuiSetGuiunitframeplayerwidth" then o = e_unitframe_playerwidth end
if o == "EuiSetGuiunitframeplayerheight" then o = e_unitframe_playerheight end
if o == "EuiSetGuiunitframepetwidth" then o = e_unitframe_petwidth end
if o == "EuiSetGuiunitframepetheight" then o = e_unitframe_petheight end
if o == "EuiSetGuiunitframetotwidth" then o = e_unitframe_totwidth end
if o == "EuiSetGuiunitframetotheight" then o = e_unitframe_totheight end
if o == "EuiSetGuiunitframefocuswidth" then o = e_unitframe_focuswidth end
if o == "EuiSetGuiunitframefocusheight" then o = e_unitframe_focusheight end
if o == "EuiSetGuiunitframecolorClassName" then o = e_unitframe_colorClassName end
if o == "EuiSetGuiunitframecpoint" then o = e_unitframe_cpoint end
if o == "EuiSetGuiunitframecpointwidth" then o = e_unitframe_cpointwidth end
if o == "EuiSetGuiunitframecpointheight" then o = e_unitframe_cpointheight end
if o == "EuiSetGuiunitframeplayerdebuffnum" then o = e_unitframe_playerdebuffnum end
if o == "EuiSetGuiunitframebigcastbar" then o = e_unitframe_bigcastbar end
if o == "EuiSetGuiunitframebigcastbarscale" then o = e_unitframe_bigcastbarscale end
if o == "EuiSetGuiunitframebigcastbarpos" then o = e_unitframe_bigcastbarpos end
 
--团队(EuiSetGuiraid)
 
if o == "EuiSetGuiraidraidDirection" then o = e_raid_raidDirection end
if o == "EuiSetGuiraidraid" then o = e_raid_raid end
if o == "EuiSetGuiraidraidthreat" then o = e_raid_raidthreat end
if o == "EuiSetGuiraidraidaurawatch" then o = e_raid_raidaurawatch end
if o == "EuiSetGuiraidgrid" then o = e_raid_grid end
if o == "EuiSetGuiraidgridhealthvettical" then o = e_raid_gridhealthvettical end
if o == "EuiSetGuiraidraidColorClass" then o = e_raid_raidColorClass end
if o == "EuiSetGuiraidraidgroups" then o = e_raid_raidgroups end
if o == "EuiSetGuiraidgrouphv" then o = e_raid_grouphv end
if o == "EuiSetGuiraidgroupspace" then o = e_raid_groupspace end
if o == "EuiSetGuiraidgridheight" then o = e_raid_gridheight end
if o == "EuiSetGuiraidnogridheight" then o = e_raid_nogridheight end
if o == "EuiSetGuiraidgridh" then o = e_raid_gridh end
if o == "EuiSetGuiraidgridw" then o = e_raid_gridw end
if o == "EuiSetGuiraidnogridh" then o = e_raid_nogridh end
if o == "EuiSetGuiraidnogridw" then o = e_raid_nogridw end
if o == "EuiSetGuiraidclickset" then o = e_raid_clickset end
if o == "EuiSetGuiraidhottime" then o = e_raid_hottime end
if o == "EuiSetGuiraidhotsize" then o = e_raid_hotsize end
if o == "EuiSetGuiraidmt" then o = e_raid_mt end
if o == "EuiSetGuiraidboss" then o = e_raid_boss end
if o == "EuiSetGuiraidshowParty" then o = e_raid_showParty end
if o == "EuiSetGuiraidshowPartyTarget" then o = e_raid_showPartyTarget end
if o == "EuiSetGuiraidraidtarget" then o = e_raid_raidtarget end
if o == "EuiSetGuiraidtexture" then o = e_raid_texture end
 
 
-- 动作条(EuiSetGuiactionbar)
if o == "EuiSetGuiactionbarenable" then o = e_actionbar_enable end
if o == "EuiSetGuiactionbarhotkey" then o = e_actionbar_hotkey end
if o == "EuiSetGuiactionbarrightbarmouseover" then o = e_actionbar_rightbarmouseover end
if o == "EuiSetGuiactionbarshapeshiftmouseover" then o = e_actionbar_shapeshiftmouseover end
if o == "EuiSetGuiactionbarhideshapeshift" then o = e_actionbar_hideshapeshift end
if o == "EuiSetGuiactionbarshowgrid" then o = e_actionbar_showgrid end
if o == "EuiSetGuiactionbarbottompetbar" then o = e_actionbar_bottompetbar end
if o == "EuiSetGuiactionbarbuttonsize" then o = e_actionbar_buttonsize end
if o == "EuiSetGuiactionbarbuttonspacing" then o = e_actionbar_buttonspacing end
if o == "EuiSetGuiactionbarpetbuttonsize" then o = e_actionbar_petbuttonsize end
if o == "EuiSetGuiactionbarpetbuttonspacing" then o = e_actionbar_petbuttonspacing end
if o == "EuiSetGuiactionbarswaptopbottombar" then o = e_actionbar_swaptopbottombar end
if o == "EuiSetGuiactionbarmacrotext" then o = e_actionbar_macrotext end
if o == "EuiSetGuiactionbarverticalstance" then o = e_actionbar_verticalstance end
if o == "EuiSetGuiactionbarmicrobar" then o = e_actionbar_microbar end
if o == "EuiSetGuiactionbarmousemicro" then o = e_actionbar_mousemicro end
if o == "EuiSetGuiactionbarrankwatch" then o = e_actionbar_rankwatch end
 
-- 鼠标提示(EuiSetGuitooltip)
if o == "EuiSetGuitooltipenable" then o = e_tooltip_enable end
if o == "EuiSetGuitooltipcursor" then o = e_tooltip_cursor end
if o == "EuiSetGuitooltiphideincombat" then o = e_tooltip_hideincombat end
if o == "EuiSetGuitooltiphidebuttonscombat" then o = e_tooltip_hidebuttonscombat end
if o == "EuiSetGuitooltiphovertip" then o = e_tooltip_hovertip end
if o == "EuiSetGuitooltipScalee" then o = e_tooltip_Scale end
if o == "EuiSetGuitooltipDisplayPvPRank" then o = e_tooltip_DisplayPvPRank end
if o == "EuiSetGuitooltipShowIsPlayer" then o = e_tooltip_ShowIsPlayer end
if o == "EuiSetGuitooltipDisplayFaction" then o = e_tooltip_DisplayFaction end
if o == "EuiSetGuitooltipPlayerServer" then o = e_tooltip_PlayerServer end
if o == "EuiSetGuitooltipTargetOfMouse" then o = e_tooltip_TargetOfMouse end
if o == "EuiSetGuitooltipClassIcon" then o = e_tooltip_ClassIcon end
if o == "EuiSetGuitooltipShowTalent" then o = e_tooltip_ShowTalent end
if o == "EuiSetGuitooltipTargetedBy" then o = e_tooltip_TargetedBy end
if o == "EuiSetGuitooltipx" then o = e_tooltip_x end
if o == "EuiSetGuitooltipy" then o = e_tooltip_y end
 
-- 背包(EuiSetGuibag)
if o == "EuiSetGuibagenable" then o = e_bag_enable end
 
-- 仇恨显示(EuiSetGuithreat)
if o == "EuiSetGuithreatenable" then o = e_threat_enable end
if o == "EuiSetGuithreatwidth" then o = e_threat_width end
if o == "EuiSetGuithreatheight" then o = e_threat_height end
if o == "EuiSetGuithreatbars" then o = e_threat_bars end
if o == "EuiSetGuithreatspacing" then o = e_threat_spacing end
if o == "EuiSetGuithreatdirection" then o = e_threat_direction end
if o == "EuiSetGuithreattest" then o = e_threat_test end
 
-- 信息(EuiSetGuiinfo)
if o == "EuiSetGuiinfoenable" then o = e_info_enable end
if o == "EuiSetGuiinfobag" then o = e_info_bag end
if o == "EuiSetGuiinfolatency" then o = e_info_latency end
if o == "EuiSetGuiinfodurability" then o = e_info_durability end
if o == "EuiSetGuiinfomemory" then o = e_info_memory end
if o == "EuiSetGuiinfoxp" then o = e_info_xp end
if o == "EuiSetGuiinfosetting" then o = e_info_setting end
if o == "EuiSetGuiinfowowtime" then o = e_info_wowtime end
if o == "EuiSetGuiinfowgtimenoti" then o = e_info_wgtimenoti end
if o == "EuiSetGuiinfoguild" then o = e_info_guild end
if o == "EuiSetGuiinfofriend" then o = e_info_friend end
if o == "EuiSetGuiinfoapsp" then o = e_info_apsp end
if o == "EuiSetGuiinfodps" then o = e_info_dps end
 
-- 点击施法(EuiSetGuiclickset)
if o == "EuiSetGuiclicksetaadefault" then o = e_clickset_aadefault end
if o == "EuiSetGuiclicksetshiftztype1" then o = e_clickset_shiftztype1 end
if o == "EuiSetGuiclicksetctrlztype1" then o = e_clickset_ctrlztype1 end
if o == "EuiSetGuiclicksetaltztype1" then o = e_clickset_altztype1 end
if o == "EuiSetGuiclicksetaltzctrlztype1" then o = e_clickset_altzctrlztype1 end
if o == "EuiSetGuiclicksettype2" then o = e_clickset_type2 end
if o == "EuiSetGuiclicksetshiftztype2" then o = e_clickset_shiftztype2 end
if o == "EuiSetGuiclicksetctrlztype2" then o = e_clickset_ctrlztype2 end
if o == "EuiSetGuiclicksetaltztype2" then o = e_clickset_altztype2 end
if o == "EuiSetGuiclicksetaltzctrlztype2" then o = e_clickset_altzctrlztype2 end
if o == "EuiSetGuiclicksettype3" then o = e_clickset_type3 end
if o == "EuiSetGuiclicksettype1" then o = e_clickset_type1 end
 
if o == "EuiSetGuiclicksettype4" then o = e_clickset_type4 end
if o == "EuiSetGuiclicksetshiftztype4" then o = e_clickset_shiftztype4 end
if o == "EuiSetGuiclicksetctrlztype4" then o = e_clickset_ctrlztype4 end
if o == "EuiSetGuiclicksetaltztype4" then o = e_clickset_altztype4 end
if o == "EuiSetGuiclicksetaltzctrlztype4" then o = e_clickset_altzctrlztype4 end
 
if o == "EuiSetGuiclicksettype5" then o = e_clickset_type5 end
if o == "EuiSetGuiclicksetshiftztype5" then o = e_clickset_shiftztype5 end
if o == "EuiSetGuiclicksetctrlztype5" then o = e_clickset_ctrlztype5 end
if o == "EuiSetGuiclicksetaltztype5" then o = e_clickset_altztype5 end
if o == "EuiSetGuiclicksetaltzctrlztype5" then o = e_clickset_altzctrlztype5 end
if o == "EuiSetGuiclicksetaamouse" then o = e_clickset_aamouse end
 
-- 皮肤
if o == "EuiSetGuiskinsaskins" then o = e_skins_askins end
if o == "EuiSetGuiskinsdbm" then o = e_skins_dbm end
if o == "EuiSetGuiskinsskada" then o = e_skins_skada end
 
E.option = o
end
 
local NewButton = function(text,parent)
local E,C = unpack(EUI)
local result = CreateFrame("Button", nil, parent)
local label = result:CreateFontString(nil,"OVERLAY",nil)
label:SetFont(E.font,12,"OUTLINE")
label:SetText(text)
result:SetWidth(label:GetWidth())
result:SetHeight(label:GetHeight())
result:SetFontString(label)
 
return result
end
 
local function SetValue(group, option, value)
if not EuiSettings then
EuiSettings = {}
end
if not EuiSettings[group] then
EuiSettings[group] = {}
end
EuiSettings[group][option] = value
end
 
local VISIBLE_GROUP = nil
local lastbutton = nil
local function ShowGroup(group, button)
local E, C = unpack(EUI)
if (lastbutton) then
lastbutton:SetText(lastbutton:GetText().sub(lastbutton:GetText(), 11, -3))
end
if (VISIBLE_GROUP) then
_G["EuiSetGui"..VISIBLE_GROUP]:Hide()
end
if _G["EuiSetGui"..group] then
local o = "EuiSetGui"..group
Local(o)
_G["EuiSetGuiTitle"]:SetText(E.option)
local height = _G["EuiSetGui"..group]:GetHeight()
_G["EuiSetGui"..group]:Show()
local scrollamntmax = 305
local scrollamntmin = scrollamntmax - 10
local max = height > scrollamntmax and height-scrollamntmin or 1
 
if max == 1 then
_G["EuiSetGuiGroupSlider"]:SetValue(1)
_G["EuiSetGuiGroupSlider"]:Hide()
else
_G["EuiSetGuiGroupSlider"]:SetMinMaxValues(0, max)
_G["EuiSetGuiGroupSlider"]:Show()
_G["EuiSetGuiGroupSlider"]:SetValue(1)
end
_G["EuiSetGuiGroup"]:SetScrollChild(_G["EuiSetGui"..group])
 
local x
if EuiSetGuiGroupSlider:IsShown() then
_G["EuiSetGuiGroup"]:EnableMouseWheel(true)
_G["EuiSetGuiGroup"]:SetScript("OnMouseWheel", function(self, delta)
if EuiSetGuiGroupSlider:IsShown() then
if delta == -1 then
x = _G["EuiSetGuiGroupSlider"]:GetValue()
_G["EuiSetGuiGroupSlider"]:SetValue(x + 10)
elseif delta == 1 then
x = _G["EuiSetGuiGroupSlider"]:GetValue()
_G["EuiSetGuiGroupSlider"]:SetValue(x - 30)
end
end
end)
else
_G["EuiSetGuiGroup"]:EnableMouseWheel(false)
end
 
VISIBLE_GROUP = group
lastbutton = button
end
end
 
function CreateEuiSetGui()
local E,C = unpack(EUI)
if EuiSetGui then
ShowGroup("main")
EuiSetGui:Show()
return
end
 
-- MAIN FRAME
local EuiSetGui = CreateFrame("Frame","EuiSetGui",UIParent)
EuiSetGui:SetPoint("CENTER", UIParent, "CENTER", E.Scale(90), 0)
EuiSetGui:SetWidth(E.Scale(400))
EuiSetGui:SetHeight(E.Scale(300))
EuiSetGui:SetFrameStrata("DIALOG")
EuiSetGui:SetFrameLevel(20)
tinsert(UISpecialFrames, "EuiSetGui")
 
-- TITLE 2
local EuiSetGuiTitleBox = CreateFrame("Frame","EuiSetGui",EuiSetGui)
EuiSetGuiTitleBox:SetWidth(E.Scale(420))
EuiSetGuiTitleBox:SetHeight(E.Scale(24))
EuiSetGuiTitleBox:SetPoint("TOPLEFT", -E.Scale(10), E.Scale(42))
E.EuiSetTemplate(EuiSetGuiTitleBox)
 
local title = EuiSetGuiTitleBox:CreateFontString("EuiSetGuiTitle", "OVERLAY")
title:SetFont(E.font, 12)
title:SetPoint("CENTER")
 
local EuiSetGuiBG = CreateFrame("Frame","EuiSetGui",EuiSetGui)
EuiSetGuiBG:SetPoint("TOPLEFT", -E.Scale(10), E.Scale(10))
EuiSetGuiBG:SetPoint("BOTTOMRIGHT", E.Scale(10), -E.Scale(10))
E.EuiSetTemplate(EuiSetGuiBG)
 
-- GROUP SELECTION ( LEFT SIDE )
local groups = CreateFrame("ScrollFrame", "EuiSetGuiCategoryGroup", EuiSetGui)
groups:SetPoint("TOPLEFT",-E.Scale(180),0)
groups:SetWidth(E.Scale(150))
groups:SetHeight(E.Scale(300))
 
local groupsBG = CreateFrame("Frame","EuiSetGui",EuiSetGui)
groupsBG:SetPoint("TOPLEFT", groups, -E.Scale(10), E.Scale(10))
groupsBG:SetPoint("BOTTOMRIGHT", groups, E.Scale(10), -E.Scale(10))
E.EuiSetTemplate(groupsBG)
 
local TitleBoxVer = CreateFrame("Frame", "TitleBoxVer", EuiSetGui)
TitleBoxVer:SetWidth(E.Scale(170))
TitleBoxVer:SetHeight(E.Scale(24))
TitleBoxVer:SetPoint("BOTTOMLEFT", groupsBG, "TOPLEFT", 0, E.Scale(8))
E.EuiSetTemplate(TitleBoxVer)
 
local version = GetAddOnMetadata("Eui", "Version")
local verdata = GetAddOnMetadata("EuiSet", "Version")
local TitleBoxVerText = TitleBoxVer:CreateFontString("EuiSetGuiTitleVer", "OVERLAY", "GameFontNormal")
TitleBoxVerText:SetPoint("CENTER")
TitleBoxVerText:SetText("EUI "..version.." "..verdata)
 
local slider = CreateFrame("Slider", "EuiSetGuiCategorySlider", groups)
slider:SetPoint("TOPRIGHT", 0, 0)
slider:SetWidth(E.Scale(20))
slider:SetHeight(E.Scale(300))
slider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
slider:SetOrientation("VERTICAL")
slider:SetValueStep(20)
slider:SetScript("OnValueChanged", function(self,value) groups:SetVerticalScroll(value) end)
 
local child = CreateFrame("Frame",nil,groups)
child:SetPoint("TOPLEFT")
local offset=E.Scale(5)
for group in pairs(ALLOWED_GROUPS) do
local o = "EuiSetGui"..group
Local(o)
local button = NewButton(E.option, child)
button:SetHeight(E.Scale(16))
button:SetWidth(E.Scale(125))
button:SetPoint("TOPLEFT", E.Scale(5),-(offset))
--button:SetScript("OnClick", function(self) ShowGroup(group) end)
button:SetScript("OnClick", function(self) ShowGroup(group, button) self:SetText("|cff00ff00"..E.option.."|r") end)
offset=offset+E.Scale(20)
end
child:SetWidth(E.Scale(125))
child:SetHeight(offset)
slider:SetMinMaxValues(0, 1)
--slider:SetMinMaxValues(0, (offset == 0 and 1 or offset-13*25))
slider:SetValue(1)
groups:SetScrollChild(child)
 
local x
_G["EuiSetGuiCategoryGroup"]:EnableMouseWheel(true)
_G["EuiSetGuiCategoryGroup"]:SetScript("OnMouseWheel", function(self, delta)
if _G["EuiSetGuiCategorySlider"]:IsShown() then
if delta == -1 then
x = _G["EuiSetGuiCategorySlider"]:GetValue()
_G["EuiSetGuiCategorySlider"]:SetValue(x + 10)
elseif delta == 1 then
x = _G["EuiSetGuiCategorySlider"]:GetValue()
_G["EuiSetGuiCategorySlider"]:SetValue(x - 20)
end
end
end)
 
-- GROUP SCROLLFRAME ( RIGHT SIDE)
local group = CreateFrame("ScrollFrame", "EuiSetGuiGroup", EuiSetGui)
group:SetPoint("TOPLEFT",0,E.Scale(5))
group:SetWidth(E.Scale(400))
group:SetHeight(E.Scale(300))
local slider = CreateFrame("Slider", "EuiSetGuiGroupSlider", group)
slider:SetPoint("TOPRIGHT",0,0)
slider:SetWidth(E.Scale(20))
slider:SetHeight(E.Scale(300))
slider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
slider:SetOrientation("VERTICAL")
slider:SetValueStep(20)
slider:SetScript("OnValueChanged", function(self,value) group:SetVerticalScroll(value) end)
 
function pairsByKeys (t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end
 
--for group in pairs(ALLOWED_GROUPS) do
for group in pairsByKeys(ALLOWED_GROUPS) do
local frame = CreateFrame("Frame","EuiSetGui"..group,EuiSetGuiGroup)
frame:SetPoint("TOPLEFT")
frame:SetWidth(E.Scale(225))
 
local offset=5
for option,value in pairsByKeys(C[group]) do
 
if type(value) == "boolean" then
local button = CreateFrame("CheckButton", "EuiSetGui"..group..option, frame, "InterfaceOptionsCheckButtonTemplate")
local o = "EuiSetGui"..group..option
Local(o)
_G["EuiSetGui"..group..option.."Text"]:SetText(E.option)
_G["EuiSetGui"..group..option.."Text"]:SetFont(E.font, 12, "OUTLINE")
button:SetChecked(value)
button:SetScript("OnClick", function(self) SetValue(group,option,(self:GetChecked() and true or false)) end)
button:SetPoint("TOPLEFT", E.Scale(5), -E.Scale((offset)))
offset = offset+25
elseif type(value) == "number" or type(value) == "string" then
local label = frame:CreateFontString(nil,"OVERLAY",nil)
label:SetFont(E.font,12,"OUTLINE")
local o = "EuiSetGui"..group..option
Local(o)
label:SetText(E.option)
label:SetWidth(E.Scale(360))
label:SetHeight(E.Scale(20))
label:SetJustifyH("LEFT")
label:SetPoint("TOPLEFT", E.Scale(5), -E.Scale((offset)))
 
local editbox = CreateFrame("EditBox", nil, frame)
editbox:SetAutoFocus(false)
editbox:SetMultiLine(false)
editbox:SetWidth(E.Scale(220))
editbox:SetHeight(E.Scale(20))
editbox:SetMaxLetters(255)
editbox:SetTextInsets(3,0,0,0)
editbox:SetBackdrop({
bgFile = [=[Interface\Addons\Eui\media\normTex]=],
tiled = false,
})
editbox:SetBackdropColor(0,0,0,0.5)
editbox:SetBackdropBorderColor(0,0,0,1)
editbox:SetFontObject(GameFontHighlight)
editbox:SetPoint("TOPLEFT", E.Scale(5), -E.Scale((offset+20)))
editbox:SetText(value)
 
E.EuiSetTemplate(editbox)
 
local okbutton = CreateFrame("Button", nil, frame)
okbutton:SetHeight(editbox:GetHeight())
okbutton:SetWidth(editbox:GetHeight())
E.EuiSetTemplate(okbutton)
okbutton:SetPoint("LEFT", editbox, "RIGHT", E.Scale(2), 0)
 
local oktext = okbutton:CreateFontString(nil,"OVERLAY",nil)
oktext:SetFont(E.font,12,"OUTLINE")
oktext:SetText("OK")
oktext:SetPoint("CENTER")
oktext:SetJustifyH("CENTER")
okbutton:Hide()
 
if type(value) == "number" then
editbox:SetScript("OnEscapePressed", function(self) okbutton:Hide() self:ClearFocus() self:SetText(value) end)
editbox:SetScript("OnChar", function(self) okbutton:Show() end)
editbox:SetScript("OnEnterPressed", function(self) okbutton:Hide() self:ClearFocus() SetValue(group,option,tonumber(self:GetText())) end)
okbutton:SetScript("OnMouseDown", function(self) editbox:ClearFocus() self:Hide() SetValue(group,option,tonumber(editbox:GetText())) end)
else
editbox:SetScript("OnEscapePressed", function(self) okbutton:Hide() self:ClearFocus() self:SetText(value) end)
editbox:SetScript("OnChar", function(self) okbutton:Show() end)
editbox:SetScript("OnEnterPressed", function(self) okbutton:Hide() self:ClearFocus() SetValue(group,option,tostring(self:GetText())) end)
okbutton:SetScript("OnMouseDown", function(self) editbox:ClearFocus() self:Hide() SetValue(group,option,tostring(editbox:GetText())) end)
end
offset = offset+45
end
end
 
frame:SetHeight(E.Scale(offset))
frame:Hide()
end
 
local reset = NewButton(DEFAULT, EuiSetGui)
reset:SetWidth(E.Scale(100))
reset:SetHeight(E.Scale(20))
reset:SetPoint("BOTTOMLEFT",-E.Scale(10), -E.Scale(38))
reset:SetScript("OnClick", function(self) EuiSettings = {} ReloadUI() end)
E.EuiSetTemplate(reset)
 
local close = NewButton(CLOSE, EuiSetGui)
close:SetWidth(E.Scale(100))
close:SetHeight(E.Scale(20))
close:SetPoint("BOTTOMRIGHT", E.Scale(10), -E.Scale(38))
close:SetScript("OnClick", function(self) EuiSetGui:Hide() end)
E.EuiSetTemplate(close)
 
local load = NewButton(APPLY, EuiSetGui)
load:SetHeight(E.Scale(20))
load:SetPoint("LEFT", reset, "RIGHT", E.Scale(15), 0)
load:SetPoint("RIGHT", close, "LEFT", -E.Scale(15), 0)
load:SetScript("OnClick", function(self) ReloadUI() end)
E.EuiSetTemplate(load)
 
local totalreset = NewButton(e_gui_button_reset, groupsBG)
totalreset:SetHeight(E.Scale(20))
totalreset:SetWidth(E.Scale(170))
totalreset:SetPoint("TOPLEFT", groupsBG, "BOTTOMLEFT", 0, -E.Scale(8))
totalreset:SetScript("OnClick", function(self) ReloadUI() end)
--totalreset:SetScript("OnClick", function(self) StaticPopup_Show("RESET_UI") EuiSetGui:Hide() end)
E.EuiSetTemplate(totalreset)
 
ShowGroup("main")
end
 
do
SLASH_CONFIG1 = '/cfg'
SLASH_CONFIG2 = '/config'
function SlashCmdList.CONFIG(msg, editbox)
if not EuiSetGui or not EuiSetGui:IsShown() then
CreateEuiSetGui()
else
EuiSetGui:Hide()
end
end
end
 
do
local euihelp = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
euihelp:Hide()
 
euihelp.name = "EUI"
euihelp:SetScript("OnShow", function(self)
local E, C = unpack(EUI)
local title = self:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOPLEFT", E.Scale(16), -E.Scale(16))
title:SetText("EUI 相关命令")
 
local subtitle = self:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
subtitle:SetHeight(400)
subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -E.Scale(8))
subtitle:SetPoint("RIGHT", self, -E.Scale(32), 0)
subtitle:SetNonSpaceWrap(true)
subtitle:SetWordWrap(true)
subtitle:SetJustifyH("LEFT")
subtitle:SetText(
"常用设置:"..
"\n ROLL框移动 /teksloot"..
"\n界面重设 /eset ui"..
"\n/eset all"..
"\n插件设置界面 /cfg"..
"\n重载插件 /rl"..
"\n绑定动作快捷键 /hb"..
"\n技能监视添加 /af /addfilter"..
"\n聊天框重设 /setchat"..
"\n整合包包设置 /baudbag"..
"\n框体解锁/锁定, 点聊天框右下角UnLock键"..
"\n系统菜单栏在小地图中按鼠标中键,或右击右上角设置"..
"\n追踪菜单在小地图按鼠标右键"..
"\n时间,背包,日历等可直接点击上面的信息条对应项打开"
)
local b = CreateFrame("Button", nil, this, "UIPanelButtonTemplate")
b:SetWidth(120)
b:SetHeight(20)
b:SetText("设 置")
b:SetScript("OnClick", function()
InterfaceOptionsFrameCancel_OnClick()
HideUIPanel(GameMenuFrame)
SlashCmdList.CONFIG()
end)
b:SetPoint("TOPLEFT", title, "TOPRIGHT", 10, 0)
end)
 
InterfaceOptions_AddCategory(euihelp)
end
\ No newline at end of file
EuiSet/EuiSet.toc New file
0,0 → 1,11
## Interface: 30300
## Title: |cffC495DDEui|r Set
## Title-zhCN: 界面设置模块|cffC495DDEuiSet|r
## Author: Ljxx
## RequiredDeps: Eui
## Version: 20110510A
## SavedVariablesPerCharacter: EuiSettings
 
locales\zhCN.lua
 
EuiSet.lua
\ No newline at end of file
EuiSet/locales/zhCN.lua New file
0,0 → 1,245
if GetLocale() == "zhCN" then
e_gui_button_reset = "重载插件"
 
-- 主菜单
e_main_label = "一般设置"
e_filter_label = "技能监视"
e_chat_label = "聊天"
e_bag_label = "背包"
e_unitframe_label = "头像"
e_actionbar_label = "动作条"
e_tooltip_label = "鼠标提示"
e_threat_label = "仇恨显示"
e_info_label = "信息条"
e_raid_label = "团队/小队"
e_clickset_label = "点击施法"
e_skins_label = "界面美化"
e_other_label = "其它"
 
-- 一般设置
e_main_autoscale = "自动缩放"
e_main_uiscale = "手动缩放比例(范围0.64 - 1)"
e_main_movechat = "锁定聊天位置"
e_main_autoinvite = "自动密语邀请"
e_main_invitetext = "密语邀请暗号"
e_main_noerrors = "屏蔽红字提示"
e_main_noerrorsincombat = "战斗中屏蔽红字提示"
e_main_chatfilter = "过滤聊天框废话"
e_main_moveuierrors = "移动红字错误到顶部"
e_main_ignoreduel = "自动拒绝决斗"
e_main_autoroll = "自动贪婪绿色物品"
e_main_disableconfirm = "自动贪婪禁止弹出确认"
e_main_autoloot = "自动拾取切换"
e_main_autorepair = "自动修理"
e_main_autorepairguild = "优先公会修理"
e_main_sellgreycrap = "自动售卖灰色物品"
e_main_acceptinvites = "自动接受好友/同公会邀请"
e_main_buystack = "alt+点击购买堆叠物品"
e_main_alttotrade = "alt+点击自动与目标交易该物品"
e_main_talentspam = "天赋切换报告"
e_main_questauto = "自动完成任务"
e_main_questicons = "高亮已完成任务图标(问号)"
e_main_autorez = "战场自动释放"
e_main_combatnoti = "进入/脱离战斗提示"
e_main_lockquest = "移动任务监视/载具显示"
e_main_alpha = "启用透明背景"
e_main_classcolortheme = "启用职业色主题"
 
--其它
e_other_nameplate = "启用内置姓名板"
e_other_nameplateauto = "战斗自动打开姓名板"
e_other_nameplatevalue = "姓名板显示血量"
e_other_mail = "启用内置邮件增强"
e_other_cooldown = "启用冷却内置计时功能"
e_other_tab = "启用专业标签"
e_other_loot = "启用ROLL框增强"
e_other_recipients = "启用收(发)件人列表"
e_other_sr = "启用增强声望显示方式"
e_other_focuser = "启用shift+左键设置焦点"
e_other_ratings = "启用等级百分比转换"
e_other_hb = "启用/hb 绑定快捷键功能"
e_other_spellid = "启用鼠标提示显示技能ID"
e_other_mbb = "启用小地图图标合集"
e_other_minimap = "启用小地图"
e_other_buff = "启用BUFF/DEBUFF美化"
 
-- 聊天
e_chat_enable = "启用聊天增强"
e_chat_hidejunk = "屏蔽废话"
e_chat_chatw = "聊天框宽度"
e_chat_chath = "聊天框高度"
e_chat_chatbar = "启用频道按钮条"
e_chat_chatguard = "启用防刷屏功能"
e_chat_LFW = "启用组队频道转发LFW功能"
 
-- 技能监视
e_filter_enable = "启用技能监视"
e_filter_configmode = "调试模式"
e_filter_classcolor = "计时条职业染色"
e_filter_pbuffbar = "玩家BUFF计时条"
e_filter_tdebuffbar = "目标DEBUFF计时条"
e_filter_barheight = "计时条高度(宽度同玩家和目标血条)"
e_filter_coolline = "启用流线行冷却计时条"
e_filter_iconsize = "提示图标大小"
e_filter_pbufficon = "启用玩家BUFF图标提示"
e_filter_tdebufficon = "启用目标DEBUFF图标提示"
e_filter_float = "冷却时间显示小数"
e_filter_raid = "启用团队技能冷却计时"
e_filter_raidwidth = "团队技能冷却条宽度"
e_filter_raidheight = "团队技能冷却条高度"
e_filter_raidnumber = "团队技能冷却条最大条数"
 
-- 头像
e_unitframe_totalhpmp = "玩家血条显示详细值"
e_unitframe_castbar = "启用施法条"
e_unitframe_swing = "启用平砍计时条"
e_unitframe_totdebuffs = "显示目标的目标的Debuff数"
e_unitframe_colorClass = "启用血条职业色彩"
e_unitframe_Fbuffs = "焦点BUFF数量"
e_unitframe_Fdebuffs = "焦点DEBUFF数量"
e_unitframe_portrait = "启用3D头像"
e_unitframe_showPvP = "显示PvP图标"
e_unitframe_onlyplayer = "只显示玩家施放的DEBUFF"
e_unitframe_powerspark = "显示五秒回蓝"
e_unitframe_playerx = "玩家与目标头像间的间隔"
e_unitframe_playery = "头像距屏幕底距离"
e_unitframe_playerwidth = "玩家和目标头像宽度"
e_unitframe_playerheight = "玩家和目标头像高度"
e_unitframe_petwidth = "宠物头像宽度"
e_unitframe_petheight = "宠物头像高度"
e_unitframe_totwidth = "目标的目标的宽度"
e_unitframe_totheight = "目标的目标的高度"
e_unitframe_focuswidth = "焦点和焦点目标宽度"
e_unitframe_focusheight = "焦点和焦点目标高度"
e_unitframe_colorClassName = "名字职业色彩"
e_unitframe_cpoint = "启用连击点符文和图腾条"
e_unitframe_cpointwidth = "连击点符文条宽度"
e_unitframe_cpointheight = "连击点符文条高度"
e_unitframe_aaaaunit = "头像样式选式1 , 2 ,3 or 4; 0则禁用"
e_unitframe_playerdebuffnum = "玩家头像显示DEBUFF数量"
e_unitframe_bigcastbar = "启用大型施法条"
e_unitframe_bigcastbarscale = "大型施法条缩放比率"
e_unitframe_bigcastbarpos = "大型施法条焦点/玩家/目标距底端的位置"
 
--团队
e_raid_raidDirection = "治疗模式团队逆序排列"
e_raid_raid = "启用团队小队框架"
e_raid_raidthreat = "显示团队仇恨及Debuff高亮"
e_raid_raidaurawatch = "显示团队副本Debuff"
e_raid_grid = "治疗模式(开)/DPS模式(关)排列团队"
e_raid_gridhealthvettical = "治疗模式排列时纵向血条"
e_raid_raidColorClass = "启用职业色彩"
e_raid_raidgroups = "显示小队数量"
e_raid_grouphv = "治疗模式队伍横排/竖排"
e_raid_groupspace = "DPS模式小队间隔"
e_raid_gridheight = "治疗模式框架距屏幕底端的距离"
e_raid_nogridheight = "DPS模式框架距屏幕顶端的距离"
e_raid_gridh = "治疗模式单元高度"
e_raid_gridw = "治疗模式单元宽度"
e_raid_nogridh = "DPS模式单元高度"
e_raid_nogridw = "DPS模式单元宽度"
e_raid_clickset = "启用点击施法,预设技能详见Eui/unitframe/ClickSets.lua"
e_raid_hottime = "启用四角HOT计时数字"
e_raid_hotsize = "四角HOT尺寸"
e_raid_showPartyTarget = "显示队伍目标和宠物"
e_raid_showParty = "显示小队框体"
e_raid_boss = "显示BOSS"
e_raid_mt = "显示MT"
e_raid_raidtarget = "启用团队目标监视模块"
e_raid_texture = "团队材质样式(0,1,2)"
 
-- 动作条
e_actionbar_hideshapeshift = "隐藏姿态栏或图腾栏"
e_actionbar_showgrid = "总是显示动作条空格"
e_actionbar_enable = "启用EUI动作条"
e_actionbar_rightbarmouseover = "右侧动作条鼠标滑过显示"
e_actionbar_hotkey = "在按钮上显示快捷键"
e_actionbar_shapeshiftmouseover = "姿态栏或图腾栏鼠标滑过显示"
e_actionbar_bottompetbar = "将宠物动作条放在主动作条下边,会将主动作条上移"
e_actionbar_buttonsize = "动作条按键大小"
e_actionbar_buttonspacing = "主动作条按键间距"
e_actionbar_petbuttonsize = "宠物/姿态条按键大小"
e_actionbar_petbuttonspacing = "姿态条按键间距"
e_actionbar_swaptopbottombar = "互换顶部和底部动作条位置"
e_actionbar_macrotext = "在动作条按钮上显示宏名称"
e_actionbar_verticalstance = "垂直显示姿态栏"
e_actionbar_microbar = "显示微型系统栏"
e_actionbar_mousemicro = "鼠标滑过时显示微型系统栏"
e_actionbar_rankwatch = "启用低级法术警报"
 
-- 鼠标提示
e_tooltip_enable = "启用鼠标提示"
e_tooltip_cursor = "跟随鼠标"
e_tooltip_hideincombat = "战斗中隐藏"
e_tooltip_hidebuttonscombat = "隐藏动作条快捷键提示"
e_tooltip_hovertip = "聊天框提示"
e_tooltip_Scale = "提示框缩放比率"
e_tooltip_DisplayPvPRank = "显示军衔"
e_tooltip_ShowIsPlayer = "是否在等级行显示“(玩家)”字样"
e_tooltip_DisplayFaction = "是否显示NPC声望等级"
e_tooltip_PlayerServer = "是否显示玩家所属服务器"
e_tooltip_TargetOfMouse = "显示对象的目标"
e_tooltip_ClassIcon = "显示对象玩家的职业图标"
e_tooltip_ShowTalent = "是否显示玩家天赋"
e_tooltip_TargetedBy = "是否显示关注目标"
e_tooltip_x = "水平方向偏移值"
e_tooltip_y = "垂直方向偏移值"
 
-- 背包
e_bag_enable = "启用背包整合"
 
-- 仇恨
e_threat_enable = "启用仇恨条"
e_threat_width = "宽度"
e_threat_height = "高度"
e_threat_bars = "仇恨条数量"
e_threat_spacing = "仇恨条间隔"
e_threat_direction = "排列方向:down、left、right、up"
e_threat_test = "打开调试模式"
 
--信息条
e_info_enable = "启用信息条(下列各位置设为0则禁用)"
e_info_bag = "背包信息位置"
e_info_latency = "延时显示位置"
e_info_durability = "耐久显示位置"
e_info_memory = "插件内存显示位置"
e_info_xp = "经验(声望)显示位置"
e_info_setting = "设置显示位置"
e_info_wowtime = "时间显示位置"
e_info_wgtimenoti = "启用冬握湖时间提醒"
e_info_friend = "好友信息位置"
e_info_guild = "公会信息位置"
e_info_apsp = "1显示攻强,2显示法强"
e_info_dps = "1显示秒伤害,2显示秒治疗"
 
--点击施法
e_clickset_aadefault = "启用预设方案,关闭可自义技能ID,禁用填入数字0"
e_clickset_shiftztype1 = "shift+左键"
e_clickset_ctrlztype1 = "ctrl+左键"
e_clickset_altztype1 = "alt+左键"
e_clickset_altzctrlztype1 = "alt+ctrl+左键"
e_clickset_type2 = "右键"
e_clickset_shiftztype2 = "shift+右键"
e_clickset_ctrlztype2 = "ctrl+右键"
e_clickset_altztype2 = "alt+右键"
e_clickset_altzctrlztype2 = "alt+ctrl+右键"
e_clickset_type3 = "中键"
e_clickset_type1 = "左键"
e_clickset_type4 = "第4键"
e_clickset_shiftztype4 = "shift+4键"
e_clickset_ctrlztype4 = "ctrl+4键"
e_clickset_altztype4 = "alt+4键"
e_clickset_altzctrlztype4 = "alt+ctrl+4键"
e_clickset_type5 = "5键"
e_clickset_shiftztype5 = "shift+5键"
e_clickset_ctrlztype5 = "ctrl+5键"
e_clickset_altztype5 = "alt+5键"
e_clickset_altzctrlztype5 = "alt+ctrl+5键"
e_clickset_aamouse = "启用鼠标滚轮解DEBUFF"
 
--皮肤
e_skins_askins = "启用系统框美化"
e_skins_dbm = "启用DBM皮肤"
e_skins_skada = "启用Skada皮肤"
 
end
\ No newline at end of file
Eui/script/Localization.lua New file
0,0 → 1,35
--[[
Chinese Local : CWDG Translation Team CondyWl
CWDG site: http://cwowaddon.com
$Rev$
$Date$
]]
--2009.10.04
if (GetLocale() == "zhCN") then
------------------------------------------------------------------------------
-- Simplified Chinese localization
------------------------------------------------------------------------------
--TipTacTalents.lua
TTT_NoTalents_Main = '主天赋:|cffffffff ';
TTT_NoTalents_Sec = '副天赋:|cff808069 ';
TTT_NoTalents = "无天赋";
TTT_Talents_Loading = "读取中……";
elseif (GetLocale() == "zhTW") then
------------------------------------------------------------------------------
-- Traditional Chinese localization
------------------------------------------------------------------------------
--TipTacTalents.lua
TTT_NoTalents_Main = '主天賦:|cffffffff ';
TTT_NoTalents_Sec = '副天賦:|cff808069 ';
TTT_NoTalents = "無天賦";
TTT_Talents_Loading = "讀取中……";
else
------------------------------------------------------------------------------
-- English localization (default)
------------------------------------------------------------------------------
--TipTacTalents.lua
TTT_NoTalents_Main = 'Talents:|cffffffff ';
TTT_NoTalents_Sec = 'Sec spec:|cffffffff ';
TTT_NoTalents = "No Talents";
TTT_Talents_Loading = " Loading...";
end
\ No newline at end of file
Eui/script/JPack.lua New file
0,0 → 1,1235
local E, C = unpack(select(2, ...))
if not C["bag"].enable == true then return end
 
_G.JPackLocale = {}
if GetLocale() ~= "zhCN" then return end
local L = JPackLocale
 
L.TYPE_BAG = "容器"
L.TYPE_FISHWEAPON = "鱼竿"
L.TYPE_MISC = "其它"
L.TYPE_CONSUMABLE = "消耗品"
 
JPACK_ORDER={"炉石","##坐骑","矿工锄","剥皮小刀","鱼竿","#鱼竿","#武器","#护甲",
"#武器##其它","#护甲##其它","#配方","#任务","##元素","##金属和矿石","##草药",
"#材料","##珠宝","#消耗品","##布料","#商品","##肉类","#","鱼油","灵魂碎片","#其它"}
 
JPACK_DEPOSIT={"##元素","##金属和矿石","#材料","##草药","#珠宝","#容器"}
JPACK_DRAW={"#任务","##草药"}
 
L["HELP"] = '输入"/jpack help"获取帮助.'
L["COMPLETE"] = "整理完毕..."
L["WARN"] = "请先拿掉你鼠标上的物品. 整理时不要抓起物品、金钱、法术."
L["Unknown command"] = "未知命令"
 
-- Help info
L["Slash command"] = "命令"
L["Pack"] = "整理"
L["Set sequence to ascend"] = "正序整理"
L["Set sequence to descend"] = "逆序整理"
L["Save to the bank"] = "保存到银行"
L["Load from the bank"] = "从银行取出"
L["Packup guildbank"] = "整理公会银行"
L["Print help info"] = "显示帮助"
 
L["Sequence"] = "整理顺序"
L["asc"] = "正序"
L["desc"] = "逆序"
 
L["Click"] = "点击"
L["Pack"] = "整理"
 
L["Alt + Left-Click"] = "Alt + 左键"
L["Shift + Left-Click"] = "Shift + 左键"
L["Ctrl + Left-Click"] = "Ctrl + 左键"
L["Shift + Right-Click"] = "Shift + 右键"
L["Ctrl + Right-Click"] = "Ctrl + 右键"
 
local DEV_MOD = false
local debug
local debugf = tekDebug and tekDebug:GetFrame("JPack")--tekDebug
if debugf then
debug = function(...) debugf:AddMessage(string.join(", ", tostringall(...))) end
else
debug = function() end
end
 
--[===[@debug@
DEV_MOD = true
--@end-debug@]===]
 
 
--[[===================================
Local
=====================================]]
JPack = CreateFrame"Frame"
JPack.DEV_MOD = DEV_MOD
 
JPack.bankOpened = false
JPack.guildbankOpened = false
JPack.deposit = false
JPack.draw = false
JPack.packupguildbank = false
JPack.bagGroups = {}
JPack.packingGroupIndex = 1
JPack.packingBags={}
JPack.updatePeriod = .1
 
local version = GetAddOnMetadata("JPack", "Version") or "alpha"
JPack.version = version
local L = setmetatable(JPackLocale, {__index=function(t,i) return i end})
 
JPack:SetScript("OnEvent", function(self, event, ...) self[event](self,event,...) end)
 
 
local bagSize=0
local packingBags={}
local JPACK_MAXMOVE_ONCE=3
local current,to,lockedSlots,currentGBTab
 
-- 整理状态
local JPACK_STEP=0
local JPACK_STARTED=1
local JPACK_DEPOSITING=2
local JPACK_DRAWING=3 --
local JPACK_STACKING=4 --
local JPACK_STACK_OVER=5
local JPACK_SORTING=6 --
local JPACK_PACKING=7
local JPACK_START_PACK=8
local JPACK_GUILDBANK_STACKING=9
local JPACK_GUILDBANK_SORTING=10
local JPACK_GUILDBANK_COMPLETE=11
local JPACK_SPEC_BAG_OVER=12
local JPACK_STOPPED=0
 
 
--[[===================================
lib
=====================================]]
 
local function print(msg,r,g,b)
if (not r) or (not g) or (not b) then r, g, b = .41, .8, .94 end
msg = 'JPack: '..msg
DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b)
end
 
local function CheckCursor()
ClearCursor()
if GetCursorInfo() then
return true
end
end
 
local function IndexOfTable(t,v)
for i=1,#t do
if(v==t[i])then
return i
end
end
return 0
end
 
--[[
获得一个 JPack 格式的物品对象
isGB = true, 工会银行
]]
local function getJPackItem(bag,slot,isGB)
local link = isGB and GetGuildBankItemLink(bag,slot) or GetContainerItemLink(bag,slot)
if not link then return end
local item={}
item.slotId=c
item.name, item.link, item.rarity,
item.level, item.minLevel, item.type, item.subType, item.stackCount,
item.equipLoc, item.texture = GetItemInfo(link)
item.itemid = tonumber(link:match("item:(%d+):"))
return item
end
 
--是否能放入某背包
local function CanGoInBag(frombag,fromslot, tobag)
local item = GetContainerItemLink(frombag,fromslot)
if not item then return false end
-- Get the item's family
local itemFamily = GetItemFamily(item)
 
-- If the item is a container, then the itemFamily should be 0
--[[
local equipSlot = select(9, GetItemInfo(item))
if equipSlot == "INVTYPE_BAG" then
itemFamily = 0
end
]]--
-- Get the bag's family
local bagFamily = select(2, GetContainerNumFreeSlots(tobag))
 
return bagFamily == 0 or bit.band(itemFamily, bagFamily) > 0
end
 
--背包是否准备好了(无锁定物品)
local function isBagReady(bag)
for i=1,GetContainerNumSlots(bag) do
local _, _, locked = GetContainerItemInfo(bag,i)
if(locked)then return false end
end
return true
end
 
-- 公会银行是否准备好 (无锁定物品)
local function isGBReady(tab)
for i = 1, 98 do -- 每页98个格子
local _,_,locked = GetGuildBankItemInfo(tab or currentGBTab, i)
if locked then return end
end
return true
end
 
--是否所有背包准备好了
local function isAllBagReady()
for i=1,#JPack.bagGroups do
for j=1,#JPack.bagGroups[i] do
if(not isBagReady(JPack.bagGroups[i][j])) then return false end
end
end
return true
end
 
--[[
return 1xxx 非垃圾 ,0xxx for 垃圾,xxx为(999-JPACK_ORDER中所定的位置)
]]
local function getPerffix(item)
if not item then return end
 
--按名称获取顺序
local i=IndexOfTable(JPACK_ORDER,item.name)
if(i<=0)then
--按子类别获取顺序
i=IndexOfTable(JPACK_ORDER,"#"..item.type.."##"..item.subType)
else
--名称匹配直接返回
return '1'..string.format("%3d",999-i)
end
if(i<=0)then
--按子类别获取顺序
i=IndexOfTable(JPACK_ORDER,"##"..item.subType)
end
if(i<=0)then
--按类别获取顺序
i=IndexOfTable(JPACK_ORDER,"#"..item.type)
end
if(i<=0)then
--默认类别顺序
i=IndexOfTable(JPACK_ORDER,"#")
end
if(i<=0)then
--默认顺序
i=999
end
local s=string.format("%3d",999-i)
--灰色物品、可装备的非优秀物品
if(item.rarity==0)then
return "00"..s
elseif(IsEquippableItem(item.name) and item.type~=L.TYPE_BAG and item.subType~=L.TYPE_FISHWEAPON) and item.subType~=L.TYPE_MISC then
if(item.rarity <= 1 ) or (item.level<UnitLevel('player')*0.9)then
return '02'..s
end
elseif(item.type==L.TYPE_CONSUMABLE)then
if(item.level<UnitLevel('player')*0.9)then
return '01'..s
end
end
return "1"..s
 
end
 
--[[
bagIds = {1,3,5}
packIndex ---JPack的index
bagID --- wow 的bagId
slotId ---- wow 的slotId
]]
 
--[[
bag 背包
slot 位置
return 是否需要保存到银行
]]
local function shouldSaveToBank(bag,slot)
local item=getJPackItem(bag,slot)
return item~=nil and ((IndexOfTable(JPACK_DEPOSIT,"#"..item.type.."##"..item.subType)>0) or (IndexOfTable(JPACK_DEPOSIT,"#"..item.type)>0) or (IndexOfTable(JPACK_DEPOSIT,"##"..item.subType)>0) or (IndexOfTable(JPACK_DEPOSIT,item.name)>0))
end
 
--[[
bag 背包
slot 位置
return 是否需要从银行取出
]]
local function shouldLoadFromBank(bag,slot)
local item=getJPackItem(bag,slot)
return item~=nil and ((IndexOfTable(JPACK_DRAW,"#"..item.type.."##"..item.subType)>0) or (IndexOfTable(JPACK_DRAW,"#"..item.type)>0) or (IndexOfTable(JPACK_DRAW,"##"..item.subType)>0) or (IndexOfTable(JPACK_DRAW,item.name)>0))
end
 
--[[
bags 一组背包
bag 当前背包在bags中位置
slot 当前背包slot
return 前一个背包位置的 bag,slot
]]--
local function getPrevSlot(bags,bag,slot)
if(slot>1)then
slot=slot-1
elseif(bag>1)then
bag=bag-1
slot=GetContainerNumSlots(bags[bag])
else
bag=-1
end
return bag,slot
end
 
--[[
比较用的字符串,与排序直接相关的函数
]]
local function getCompareStr(item)
if(not item)then
return nil
elseif(not item.compareStr)then
local _,_,textureType,textureIndex=string.find(item.texture,"\\.*\\([^_]+_?[^_]*_?[^_]*)_?(%d*)")
if(not item.rarity)then item.rarity='1' end
item.compareStr= getPerffix(item).." "..item.rarity..item.type.." "..item.subType.." "..textureType.." "
..string.format("%2d",item.minLevel).." "..string.format("%2d",item.level).." "..(textureIndex or "00")..item.name
end
return item.compareStr
end
 
--[[
比较两个物品
return 1 a 在前
return -1 b 在前
]]
local function compare(a, b)
local ret=0
if(a==b)then
ret= 0
elseif(a==nil)then
ret= -1
elseif(b==nil)then
ret= 1
elseif(a.name==b.name)then
ret= 0
else
local sa = getCompareStr(a)
local sb = getCompareStr(b)
if(sa>sb)then
ret= 1
elseif(sa<sb) then
ret= -1
end
end
return ret
end
 
local function swap(items,i,j)
local y=items[i]
items[i]=items[j]
items[j]=y
end
 
local function qsort(items,from,to)
 
local i,j=from,to
local ix=items[i]
local x=i
while(i<j) do
while(j>x) do
if(compare(items[j], ix)==1)then
swap(items,j,x)
x=j
else
j=j-1
end
end
while(i<x)do
if(compare(items[i], ix)==-1)then
swap(items,i,x)
x=i
else
i=i+1
end
end
end
if(x-1 > from) then
qsort(items,from,x-1)
end
if(x+1 < to) then
qsort(items,x+1,to)
end
end
 
--[[
排序 items ,并返回一个新的排序过的 items,原 items 不变
]]
local function jsort(items)
local clone = {}--Item:new[items.length]
for i=1,bagSize do
clone[i] = items[i]
end
qsort(clone,1,bagSize)
return clone
end
 
--local moving=false
local function sortTo(_current, _to)
current=_current
to=_to
lockedSlots={}
JPACK_STEP=JPACK_PACKING
end
 
--[[===================================
Main Processing
=====================================]]
--移动到特殊背包,如箭袋,灵魂袋,草药袋,矿石袋
--flag =0 , 背包, flag = 1 bank
local function moveToSpecialBag(flag)
local bagTypes
if flag == 0 then
--bagSlotTypes[容器]=[0,1,2,4] ,bagSlotTypes[箭袋]=[3]
bagTypes = JPack.bagSlotTypes
elseif flag == 1 then
bagTypes = JPack.bankSlotTypes
if(not JPack.bankOpened)then return end
--elseif guidbank
end
 
--从容器中取出物品 ,fromBags = 容器
local fromBags = bagTypes[L.TYPE_BAG]
 
for k,v in pairs(bagTypes) do
--针对每种不同的背包,k is type,v is slots
if k ~= L.TYPE_BAG then
local toBags = v
local frombagIndex,tobagIndex=#fromBags,#toBags
local frombag,tobag = fromBags[frombagIndex],toBags[tobagIndex]
local fromslot,toslot=GetContainerNumSlots(frombag),GetContainerNumSlots(tobag)
--移动
local c = 0
while(true) do
c = c + 1
if(c>300)then
debug("force quit, count to 300")
break
end
 
while(tobagIndex>0 and GetContainerItemLink(tobag,toslot))do
--直到找到一个空格
tobagIndex,toslot=getPrevSlot(toBags,tobagIndex,toslot)
tobag = toBags[tobagIndex]
end
 
while(tobagIndex>0 and frombagIndex>0 and (not CanGoInBag(frombag,fromslot,tobag)))do
frombagIndex,fromslot=getPrevSlot(fromBags,frombagIndex,fromslot)
frombag = fromBags[frombagIndex]
end
 
if(frombagIndex<=0 or tobagIndex <=0 or fromslot<=0 or toslot<=0)then
debug("break to move sepical bag")
break
end
if CheckCursor() then
print(L["WARN"],1,0,0)
end
PickupContainerItem(frombag,fromslot)
PickupContainerItem(tobag,toslot)
--next
frombagIndex,fromslot=getPrevSlot(fromBags,frombagIndex,fromslot)
tobagIndex,toslot=getPrevSlot(toBags,tobagIndex,toslot)
end
 
end
end
 
end
 
--保存到银行
local function saveToBank()
if(not JPack.bankOpened)then return end
 
--保存
for k,v in pairs(JPack.bankSlotTypes) do
--针对每种不同的背包,k is type,v is slots
local bkTypes,bagTypes=JPack.bankSlotTypes[k],JPack.bagSlotTypes[k]
local bkBag,bag=#bkTypes,#bagTypes
local bkSlot,slot=GetContainerNumSlots(bkTypes[bkBag]),GetContainerNumSlots(bagTypes[bag])
--保存
while(true) do
while(bkBag>0 and GetContainerItemLink(bkTypes[bkBag],bkSlot))do
--直到找到一个空格
bkBag,bkSlot=getPrevSlot(bkTypes,bkBag,bkSlot)
end
 
while(bag>0 and (not shouldSaveToBank(bagTypes[bag],slot)))do
bag,slot=getPrevSlot(bagTypes,bag,slot)
end
 
if(bkBag<=0 or bag <=0 or bkSlot<=0 or slot<=0)then
debug("break to save")
break
end
if CheckCursor() then
print(L["WARN"],1,0,0)
end
PickupContainerItem(bagTypes[bag],slot)
PickupContainerItem(bkTypes[bkBag],bkSlot)
--next
bkBag,bkSlot=getPrevSlot(bkTypes,bkBag,bkSlot)
bag,slot=getPrevSlot(bagTypes,bag,slot)
end
end
end
 
--从银行取出
local function loadFromBank()
if(not JPack.bankOpened)then return end
 
--保存
for k,v in pairs(JPack.bankSlotTypes) do
--针对每种不同的背包,k is type,v is slots
local bkTypes,bagTypes=JPack.bankSlotTypes[k],JPack.bagSlotTypes[k]
local bkBag,bag=#bkTypes,#bagTypes
local bkSlot,slot=GetContainerNumSlots(bkTypes[bkBag]),GetContainerNumSlots(bagTypes[bag])
--保存
while(true) do
while(bag>0 and GetContainerItemLink(bagTypes[bag],slot))do
--直到找到一个空格
bag,slot=getPrevSlot(bagTypes,bag,slot)
end
while(bkBag>0 and (not shouldLoadFromBank(bkTypes[bkBag],bkSlot)))do
bkBag,bkSlot=getPrevSlot(bkTypes,bkBag,bkSlot)
end
 
if(bkBag<=0 or bag <=0 or bkSlot<=0 or slot<=0)then
break
end
if CheckCursor() then
print(L["WARN"],1,0,0)
end
PickupContainerItem(bkTypes[bkBag],bkSlot)
PickupContainerItem(bagTypes[bag],slot)
--next
bkBag,bkSlot=getPrevSlot(bkTypes,bkBag,bkSlot)
bag,slot=getPrevSlot(bagTypes,bag,slot)
end
end
end
 
 
--[[
将背包按类型分组
bagGroups
bankGroups
bagTypes
packingTypeIndex
packingBags
]]
local dummy_table = {}
local function groupBags()
local ignored = JPACK_IGNORE_BAGS or dummy_table
local bagTypes={}
bagTypes[L.TYPE_BAG]={}
if not ignored[0] then
bagTypes[L.TYPE_BAG][1]=0
end
for i=1,4 do
if not ignored[i] then
local name=GetBagName(i)
if(name)then
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, subType, itemStackCount,
itemEquipLoc, itemTexture = GetItemInfo(name)
debug("Bag[",i,"]Type:",subType)
if(bagTypes[subType]==nil)then
bagTypes[subType]={}
end
local t = bagTypes[subType]
t[#t+1]=i
end
end
end
 
local bankSlotTypes={}
if(JPack.bankOpened)then
bankSlotTypes[L.TYPE_BAG]={}
if not ignored[-1] then
bankSlotTypes[L.TYPE_BAG][1]=-1
end
for i=5,11 do
if not ignored[i] then
local name=GetBagName(i)
if(name)then
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, subType, itemStackCount,
itemEquipLoc, itemTexture = GetItemInfo(name)
if(bankSlotTypes[subType]==nil)then
bankSlotTypes[subType]={}
end
local t = bankSlotTypes[subType]
t[#t+1]=i
end
end
end
end
JPack.bagSlotTypes=bagTypes
JPack.bankSlotTypes=bankSlotTypes
local j=1
for k,v in pairs(bankSlotTypes) do
JPack.bagGroups[j]=v
j=j+1
end
for k,v in pairs(bagTypes) do
JPack.bagGroups[j]=v
j=j+1
end
 
end
 
--[[
获取PackingBags的 JPack格式物品table
]]
local function getPackingItems()
local c=1
local items={}
if not JPackDB then
JPackDB = {}
end
if JPackDB.asc then
for i=1,#JPack.packingBags do
local num = GetContainerNumSlots(JPack.packingBags[i])
for j = 1,num do
items[c]=getJPackItem(JPack.packingBags[i],j)
c = c+1
end
end
else
for i=#JPack.packingBags,1,-1 do
local num = GetContainerNumSlots(JPack.packingBags[i])
for j = num,1,-1 do
items[c]=getJPackItem(JPack.packingBags[i],j)
c = c+1
end
end
end
return items,c-1
end
 
--[[
开始对packingBags 进行整理
]]
local function startPack()
local items,count = getPackingItems()
bagSize=count
local sorted = jsort(items)
debug("sorted...")
--[[for i=1,#sorted do
debug(getCompareStr(sorted[i]))
end]]
sortTo(items,sorted)
end
 
--[[
将 PackIndex 转换为 BagId,SlotId
]]
local function getSlotId(packIndex)
local slot=packIndex
if JPackDB.asc then
for i=1,#JPack.packingBags do
local num=GetContainerNumSlots(JPack.packingBags[i])
if(slot<=num)then
return JPack.packingBags[i],slot
end
slot = slot - num
end
else
for i=#JPack.packingBags,1,-1 do
local num=GetContainerNumSlots(JPack.packingBags[i])
if(slot<=num)then
return JPack.packingBags[i],1+num-slot
end
slot = slot - num
end
end
return -1,-1
end
 
--[[
oldIndex 原JPack物品位置索引
newIndex 新JPack物品位置索引
把物品从oldIndex 移动到 newIndex
]]
local function moveTo(oldIndex,newIndex)
PickupContainerItem(getSlotId(oldIndex))
PickupContainerItem(getSlotId(newIndex))
end
 
--[[
某位置是否被锁定,与blizzard函数不同的是,空格也可能被锁定
]]
local function isLocked(index)
local il=IndexOfTable(lockedSlots,index)
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(getSlotId(index))
if(texture==nil)then
locked= il >0
elseif(il>0)then
table.remove(lockedSlots,il)
end
return locked
end
 
--[[
items 物品数组
key 待查找物品名字
return 最后一个可以移动的此物品位置
]]
local function GetLastItemIndex(items,key)
local i=bagSize
while(i>0)do
if(items[i] ~= nil and not isLocked(i) and items[i].name == key)then
return i
end
i= i-1
end
return -1
end
 
--[[
移动一次, 返回是否继续
]]
local function moveOnce()
local working=false
local i=1
local lockCount=0
while to[i] do
local locked=isLocked(i)
if(locked==nil)then locked=false end
if(locked)then
lockCount=lockCount+1
end
if(lockCount>JPACK_MAXMOVE_ONCE)then
return true
end
if(current[i] == nil or to[i].name ~= current[i].name)then
working = true
if(not locked)then
local slot =GetLastItemIndex(current, to[i].name)
if(slot ~= -1)then
moveTo(slot,i) -- 移动物品
local x=current[slot]
current[slot]=current[i]
current[i]=x
if(current[slot]==nil)then
--锁定空格
lockedSlots[#lockedSlots+1]=i
end
end
end
 
end
i=i+1
end
return working or lockCount>0
end
 
--堆叠一次,返回是否结束
local function stackOnce()
local bags,bag,item,slotInfo
if(JPack.bankOpened)then
bags={11,10,9,8,7,6,5,-1,4,3,2,1,0}
else
bags={4,3,2,1,0}
end
local pendingStack={}
local complet=true
for i=1,#bags do
bag = bags[i]
for slot = GetContainerNumSlots(bag),1,-1 do
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(bag, slot)
item = getJPackItem(bag,slot)
if(item)then
if (not locked) then
if (item.stackCount ~= 1) and (itemCount < item.stackCount)then
slotInfo = pendingStack[item.itemid]
if(slotInfo)then
PickupContainerItem(bag,slot)
PickupContainerItem(slotInfo[1],slotInfo[2])
pendingStack[item.itemid]=nil
complet = false
else
pendingStack[item.itemid]={bag,slot}
end
end
else
complet = false
end
end
end
end
return complet
end
 
 
 
--[[
=== GuildBank ===
 
http://wowprogramming.com/docs/api/
GetCurrentGuildBankTab Returns the currently selected guild bank tab (number)
PickupGuildBankItem
GetGuildBankItemInfo(tab, slot) 返回 材质/堆叠数量/*是否锁定
GetGuildBankItemLink
GetGuildBankTabInfo
GetGuildBankTabPermissions
GetNumGuildBankTabs
]]
 
--堆叠一次公会银行,返回是否结束
local function GBstackOnce()
local item,slotInfo
local pendingStack={}
local complet = true
for slot = 98,1,-1 do
local texture, itemCount, locked = GetGuildBankItemInfo(currentGBTab, slot)
if texture then -- if there is an item in this slot
item = getJPackItem(currentGBTab,slot,true) -- tab, slot, isGuildBank
if(item) then
if(not locked)then
if(itemCount < item.stackCount)then
slotInfo = pendingStack[item.itemid]
if(slotInfo)then
JPack:GBMoved(true)
PickupGuildBankItem(currentGBTab,slot)
PickupGuildBankItem(slotInfo[1],slotInfo[2])
pendingStack[item.itemid]=nil
complet = false
else
pendingStack[item.itemid]={currentGBTab,slot}
end
end
else
complet = false
end
end
end
end
return complet
end
 
 
 
-- TODO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--[[===================================
Events/slash..etc..
=====================================]]
 
local function stopPacking()
if JPack:GetScript"OnUpdate" then
JPack:SetScript("OnUpdate", nil)
end
 
if JPack.packupguildbank then
JPack:UnregisterEvent("GUILDBANKBAGSLOTS_CHANGED")
end
end
 
 
JPack.OnLoad = {}
JPack.OnLoad_GB = {}
 
function JPack:ADDON_LOADED(event, addon)
--if addon ~= 'JPack' then return end
debug'JPack loaded'
self:UnregisterEvent("ADDON_LOADED")
self.ADDON_LOADED = nil
 
JPackDB = JPackDB or {}
 
local oldver = JPackDB.version
if oldver ~= version then
JPackDB.version = version
end
 
print(format('%s %s', version, L["HELP"]))
 
 
JPack:RegisterEvent"BANKFRAME_OPENED"
JPack:RegisterEvent"BANKFRAME_CLOSED"
JPack:RegisterEvent"GUILDBANKFRAME_CLOSED"
JPack:RegisterEvent"GUILDBANKFRAME_OPENED"
 
end
JPack:RegisterEvent"ADDON_LOADED"
 
function JPack:BANKFRAME_OPENED()
JPack.bankOpened = true
end
 
function JPack:BANKFRAME_CLOSED()
JPack.bankOpened = false
stopPacking()
end
 
function JPack:GUILDBANKFRAME_OPENED()
JPack.guildbankOpened = true
end
 
function JPack:GUILDBANKFRAME_CLOSED()
JPack.guildbankOpened = false
if JPACK_STEP~=JPACK_STOPPED and JPack.packupguildbank then stopPacking() end
end
 
--[=[
GuildBank packup
 
 
排序可以参考 银行的整理,但由于pick银行和pick背包都是相同的api只是背包的bagId不同 ,
而公会银行则是完全使用了另外一套api,这里处理起来有些难度。
 
1. 将背包分组,分组后 类似 {{1,2,3},{4,5},{6,7,8},{9,10}} 是一个bagId数组的数组,
{1,2,3} 这3背包将视为整体在一起整理,然后是 {4,5} , { 6,7,8} 。
公会银行的bagId与背包银行的bagId不知道是否有冲突。
如果有冲突可以使用 100+公会银行bagId 来进行区分
 
2. bagId,slotId -> jpackIndex , jpackIndex -> bagId,slotId ,在jpack排序过程中,
只是对一个数组进行排序,而不区分背包,所以需要将 bagId、slotId 转换为 jpackIndex,
而在排序结束后,需要移动物品,
在移动物品时则要把 jpackIndex 转换为 bagId,slotId 以移动物品。
此处同样是bagId 的问题。
 
2. 排序。无需修改
 
3. 移动物品,pickup(bag1,slot1);pickup(bag2,slot2) ;
这两行代码将会把 bag1,slot1 与 bag2 slot2的物品互换,
bag2,slot2 可以没有物品,bag1,slot1 必须有物品。
此处要做的修改是,bag1,bag2 如果是背包或银行则使用原有的pickup函数,
如果bag1、bag2是公会银行,则使用公会银行的pickup函数。
 
]=]
 
 
--[[
GUILDBANKBAGSLOTS_CHANGED will fire THREE times when you move a item
before this event fired, NOTHING you can do with the guildbank
 
GuildBank movement check
]]
local GUILDBANKBAGSLOTS_CHANGED_TIMES = 0
function JPack:GUILDBANKBAGSLOTS_CHANGED()
GUILDBANKBAGSLOTS_CHANGED_TIMES = GUILDBANKBAGSLOTS_CHANGED_TIMES + 1
end
 
function JPack:GBCanMove()
if (GUILDBANKBAGSLOTS_CHANGED_TIMES ~= 0) and (GUILDBANKBAGSLOTS_CHANGED_TIMES%3 == 0) then
return true
end
end
 
function JPack:GBMoved(isTrue)
if isTrue then
GUILDBANKBAGSLOTS_CHANGED_TIMES = 0
end
end
 
 
--[[
bag/bank packup
onupdate script to move items
]]
local elapsed = 0
function JPack.OnUpdate(self, el)
elapsed = elapsed + el
if elapsed < self.updatePeriod then return end
elapsed = 0
debug("\nOnUpdate!\n")
if DEV_MOD and JPACK_STEP==JPACK_STARTED and JPack.guildbankOpened and JPack.packupguildbank then
debug"整理开始, 工会银行整理"
 
-- 取得当前打开页
currentGBTab = GetCurrentGuildBankTab()
debug('currentGBTab: ',currentGBTab)
 
-- 判断玩家是否打开公会银行并有相应权限 *** 需要纠正判断
if IsGuildLeader(UnitName("player")) then
JPACK_STEP=JPACK_GUILDBANK_STACKING -- 直接进入工会银行堆叠
else
local name, icon, isViewable, canDeposit, numWithdrawals, remainingWithdrawals = GetGuildBankTabInfo(currentGBTab)
debug('isViewable ', isViewable, 'canDeposit ', canDeposit, 'remainingWithdrawals', remainingWithdrawals)
if isViewable and canDeposit then -- 拥有移动权限
JPACK_STEP=JPACK_GUILDBANK_STACKING -- 进入工会银行堆叠
else
currentGBTab = nil
JPACK_STEP=JPACK_GUILDBANK_COMPLETE -- 无足够权限 结束整理
end
end
-- restack
elseif(JPACK_STEP == JPACK_GUILDBANK_STACKING)then
if JPack:GBCanMove() then
if GBstackOnce() then
JPACK_STEP = JPACK_GUILDBANK_SORTING
end
end
-- 计算排序, 移动物品
elseif(JPACK_STEP == JPACK_GUILDBANK_SORTING)then
JPACK_STEP = JPACK_GUILDBANK_COMPLETE
--_G.print'123123123'
--if isGBReady() then
 
--公会银行整理结束, 结束整理工作
elseif(JPACK_STEP == JPACK_GUILDBANK_COMPLETE) then
debug"GUILDBANK PACKUP COMPLETE"
print(L["COMPLETE"])
JPack:UnregisterEvent("GUILDBANKBAGSLOTS_CHANGED")
 
-- 普通整理
elseif JPACK_STEP==JPACK_STARTED then
debug"普通整理"
if stackOnce() then
JPACK_STEP=JPACK_STACK_OVER
end
elseif(JPACK_STEP==JPACK_STACK_OVER)then
debug("JPACK_STEP==JPACK_STACK_OVER, 开始移动到特殊背包")
if(isAllBagReady())then
debug("堆叠完毕,JPack_STEP=JPACK_STACK_OVER")
moveToSpecialBag(1)
moveToSpecialBag(0)
JPACK_STEP = JPACK_SPEC_BAG_OVER
end
elseif(JPACK_STEP==JPACK_SPEC_BAG_OVER)then
debug("JPACK_STEP==JPACK_SPEC_BAG_OVER, 开始向银行保存")
if(isAllBagReady())then
if(JPack.deposit)then
debug("saveToBank()")
saveToBank()
end
JPACK_STEP=JPACK_DEPOSITING
end
elseif(JPACK_STEP==JPACK_DEPOSITING)then
debug("JPACK_STEP==JPACK_DEPOSITING, 开始从银行提取")
if(isAllBagReady())then
debug("保存物品完毕,JPack_STEP=JPACK_DEPOSITING")
if(JPack.draw)then
debug("loadFromBank()")
loadFromBank()
end
JPACK_STEP=JPACK_START_PACK
end
elseif(JPACK_STEP==JPACK_START_PACK)then
debug("开始整理,JPACK_STEP=JPACK_START_PACK")
if(isAllBagReady())then
JPack.packingGroupIndex=1
JPack.packingBags=JPack.bagGroups[1]
--计算排序
startPack()
JPACK_STEP=JPACK_PACKING
end
elseif(JPACK_STEP==JPACK_PACKING)then
--排序结束
--移动物品
if not moveOnce() then
JPack.packingGroupIndex=JPack.packingGroupIndex + 1
debug("index", JPack.packingGroupIndex)
JPack.packingBags=JPack.bagGroups[JPack.packingGroupIndex]
debug("JPack.bagGroups . size = ",#JPack.bagGroups)
for i=1,#JPack.bagGroups do
for j=1,#JPack.bagGroups[i] do
debug("i", i, "j", j..":", JPack.bagGroups[i][j])
end
end
if(JPack.packingBags==nil)then
debug"PACKUP COMPLETE"
JPACK_STEP=JPACK_STOPPED
JPack.bagGroups={}
print(L["COMPLETE"])
JPack:SetScript("OnUpdate",nil)
current=nil
to=nil
else
debug("Packing ", JPack.packingGroupIndex)
startPack()
end
end
end
end
 
local function pack()
debug("\n\n\n\nPACK START")
if CheckCursor() then
print(L["WARN"],2,0.28,2)
else
JPACK_STEP=JPACK_STARTED
if JPack.packupguildbank then
JPack:GBMoved(true)
JPack:RegisterEvent"GUILDBANKBAGSLOTS_CHANGED"
else
groupBags()
end
 
elapsed = 1
JPack:SetScript("OnUpdate", JPack.OnUpdate)
end
end
 
SLASH_JPACK1 = "/jpack"
SLASH_JPACK2 = "/jp"
SlashCmdList.JPACK = function(msg)
local a,b,c=strfind(msg, "(%S+)")
if not c then return JPack:Pack() end
c = strlower(c)
if(c=="asc")then
JPack:Pack(nil, 1)
elseif(c=="desc")then
JPack:Pack(nil, 2)
elseif(c=="deposit" or c=="save")then
JPack:Pack(1)
elseif(c=="draw" or c=="load")then
JPack:Pack(2)
elseif(DEV_MOD and c=="gb" or c=="guildbank") then
JPack:Pack(3)
elseif(c == "stop") then
stopPacking()
elseif(c=="help")then
local text = "%s - |cffffffff%s|r"
print(L["Slash command"]..": /jpack |cffffffffor|r /jp")
print(format(text, "/jp", L["Pack"]))
print(format(text, "/jp asc", L["Set sequence to ascend"]))
print(format(text, "/jp desc", L["Set sequence to descend"]))
print(format(text, "/jp deposit |cffffffffor|r save", L["Save to the bank"]))
print(format(text, "/jp draw |cffffffffor|r load", L["Load from the bank"]))
if DEV_MOD then print(format(text, "/jp gb |cffffffffor|r guildback", L["Packup guildbank"])) end
print(format(text, "/jp help", L["Print help info"]))
else
print(format("%s: |cffff0000%s|r , %s", L["Unknown command"], c, L["HELP"]))
end
end
 
 
--[[===================================
API
=====================================]]
 
--[[
JPack:Pack(access, order)
access
1 save
2 load
3 packup guild bank
nil just pack the bag (and bank)
order
1 asc
2 desc
nil last-time-order
]]
function JPack:Pack(access, order)
JPack.deposit = false
JPack.draw = false
JPack.packupguildbank = false
if access == 1 then
JPack.deposit = true
elseif access == 2 then
JPack.draw = true
elseif access == 3 and DEV_MOD then
JPack.packupguildbank = true
end
if order == 1 then
JPackDB.asc=true
elseif order == 2 then
JPackDB.asc=false
end
 
pack()
end
 
local L = _G.JPackLocale
 
local addon = CreateFrame'frame'
addon:SetScript('OnEvent', function(self, event, ...) self[event](self, event, ...) end)
 
local function OnClick(self, button)
local access, order
if ( button == 'LeftButton' ) then
if IsShiftKeyDown() then
access = 1
elseif IsControlKeyDown() then
access = 2
elseif IsAltKeyDown() then
access = 3
end
elseif ( button == 'RightButton' ) then
if IsShiftKeyDown() then
order = 1
elseif IsControlKeyDown() then
order = 2
end
end
JPack:Pack(access, order)
end
 
 
local function OnEnter(self)
GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
GameTooltip:AddDoubleLine(L['Click'], L['Pack'], 0, 1, 0, 0, 1, 0)
if JPack.DEV_MOD then GameTooltip:AddDoubleLine(L['Alt + Left-Click'], L['Packup guildbank'], 0, 1, 0, 0, 1, 0) end
GameTooltip:AddDoubleLine(L['Shift + Left-Click'], L['Save to the bank'], 0, 1, 0, 0, 1, 0)
GameTooltip:AddDoubleLine(L['Ctrl + Left-Click'], L['Load from the bank'], 0, 1, 0, 0, 1, 0)
GameTooltip:AddDoubleLine(L['Shift + Right-Click'], L['Set sequence to ascend'], 0, 1, 0, 0, 1, 0)
GameTooltip:AddDoubleLine(L['Ctrl + Right-Click'], L['Set sequence to descend'], 0, 1, 0, 0, 1, 0)
GameTooltip:Show()
end
 
local function OnLeave()
GameTooltip:Hide()
end
 
function BuildButton(parent, width, height, point1, point2, point3)
local f = CreateFrame('Button', nil, parent, 'UIPanelButtonTemplate')
 
f:SetWidth(width)
f:SetHeight(height)
f:SetPoint(point1, point2, point3)
f:SetText(L['Pack'])
f:SetScript('OnMouseUP', OnClick)
 
f:SetScript('OnEnter', OnEnter)
f:SetScript('OnLeave', OnLeave)
 
return f
end
 
function addon:ADDON_LOADED(event,addon)
if addon ~= 'Blizzard_GuildBankUI' then return end
BuildButton(GuildBankFrame, 45, 20, 'TOPRIGHT', -25, -15)
self:UnregisterEvent('ADDON_LOADED')
self.ADDON_LOADED = nil
end
 
function addon:PLAYER_LOGIN()
addon:UnregisterEvent('PLAYER_LOGIN')
BuildButton(BBCont1_1, 45, 20, 'TOPRIGHT', -45, 22)
BuildButton(BBCont2_1, 45, 20, 'TOPRIGHT', -45, 22)
 
if JPack.DEV_MOD then addon:RegisterEvent('ADDON_LOADED') end
end
 
addon:RegisterEvent('PLAYER_LOGIN')
\ No newline at end of file
Eui/script/align.lua New file
0,0 → 1,82
local grid
local boxSize = 32
 
function Grid_Show()
if not grid then
Grid_Create()
elseif grid.boxSize ~= boxSize then
grid:Hide()
Grid_Create()
else
grid:Show()
end
end
 
function Grid_Hide()
if grid then
grid:Hide()
end
end
 
local isAligning = false
SLASH_TOGGLEGRID1 = "/align"
SlashCmdList["TOGGLEGRID"] = function(arg)
if isAligning then
Grid_Hide()
isAligning = false
else
boxSize = (math.ceil((tonumber(arg) or boxSize) / 32) * 32)
if boxSize > 256 then boxSize = 256 end
Grid_Show()
isAligning = true
end
end
 
function Grid_Create()
grid = CreateFrame('Frame', nil, UIParent)
grid.boxSize = boxSize
grid:SetAllPoints(UIParent)
 
local size = 2
local width = GetScreenWidth()
local ratio = width / GetScreenHeight()
local height = GetScreenHeight() * ratio
 
local wStep = width / boxSize
local hStep = height / boxSize
 
for i = 0, boxSize do
local tx = grid:CreateTexture(nil, 'BACKGROUND')
if i == boxSize / 2 then
tx:SetTexture(1, 0, 0, 0.5)
else
tx:SetTexture(0, 0, 0, 0.5)
end
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", i*wStep - (size/2), 0)
tx:SetPoint('BOTTOMRIGHT', grid, 'BOTTOMLEFT', i*wStep + (size/2), 0)
end
height = GetScreenHeight()
 
do
local tx = grid:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(1, 0, 0, 0.5)
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height/2) + (size/2))
tx:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -(height/2 + size/2))
end
 
for i = 1, math.floor((height/2)/hStep) do
local tx = grid:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 0, 0, 0.5)
 
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2))
tx:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -(height/2+i*hStep + size/2))
 
tx = grid:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 0, 0, 0.5)
 
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2))
tx:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -(height/2-i*hStep + size/2))
 
end
 
end
\ No newline at end of file
Eui/script/openall.lua New file
0,0 → 1,119
local E,C = unpack(select(2, ...))
if C["other"].mail ~= true then return end
local deletedelay, t = 0.5, 0
local takingOnlyCash = false
local button, button2, waitForMail, doNothing, openAll, openAllCash, openMail, lastopened, stopOpening, onEvent, needsToWait, copper_to_pretty_money, total_cash
local _G = _G
local baseInboxFrame_OnClick
function doNothing() end
 
function openAll()
if GetInboxNumItems() == 0 then return end
button:SetScript("OnClick", nil)
button2:SetScript("OnClick", nil)
baseInboxFrame_OnClick = InboxFrame_OnClick
InboxFrame_OnClick = doNothing
button:RegisterEvent("UI_ERROR_MESSAGE")
openMail(GetInboxNumItems())
end
function openAllCash()
takingOnlyCash = true
openAll()
end
function openMail(index)
if not InboxFrame:IsVisible() then return stopOpening("Need a mailbox.") end
if index == 0 then return stopOpening("Reached the end.") end
local _, _, _, _, money, COD, _, numItems = GetInboxHeaderInfo(index)
if money > 0 then
TakeInboxMoney(index)
needsToWait = true
if total_cash then total_cash = total_cash - money end
elseif (not takingOnlyCash) and numItems and (numItems > 0) and COD <= 0 then
TakeInboxItem(index)
needsToWait = true
end
local items = GetInboxNumItems()
if (numItems and numItems > 1) or (items > 1 and index <= items) then
lastopened = index
t = 0
button:SetScript("OnUpdate", waitForMail)
else
stopOpening("All done.")
end
end
function waitForMail()
t = t + arg1
if (not needsToWait) or (t > deletedelay) then
needsToWait = false
button:SetScript("OnUpdate", nil)
local _, _, _, _, money, COD, _, numItems = GetInboxHeaderInfo(lastopened)
if money > 0 or ((not takingOnlyCash) and COD <= 0 and numItems and (numItems > 0)) then
--The lastopened index inbox item still contains stuff we want
openMail(lastopened)
else
openMail(lastopened - 1)
end
end
end
function stopOpening(msg, ...)
button:SetScript("OnUpdate", nil)
button:SetScript("OnClick", openAll)
button2:SetScript("OnClick", openAllCash)
if baseInboxFrame_OnClick then
InboxFrame_OnClick = baseInboxFrame_OnClick
end
button:UnregisterEvent("UI_ERROR_MESSAGE")
takingOnlyCash = false
total_cash = nil
if msg then DEFAULT_CHAT_FRAME:AddMessage("OpenAll: "..msg, ...) end
end
function onEvent(frame, event, arg1, arg2, arg3, arg4)
if event == "UI_ERROR_MESSAGE" then
if arg1 == ERR_INV_FULL then
stopOpening("停止,背包已满")
end
end
end
local function makeButton(id, text, w, h, x, y)
local button = CreateFrame("Button", id, InboxFrame, "UIPanelButtonTemplate")
button:SetWidth(w)
button:SetHeight(h)
button:SetPoint("CENTER", InboxFrame, "TOP", x, y)
button:SetText(text)
return button
end
button = makeButton("OpenAllButton", "All", 60, 25, -50, -410)
button:SetScript("OnClick", openAll)
button:SetScript("OnEvent", onEvent)
button2 = makeButton("OpenAllButton2", "Cash", 60, 25, 20, -410)
button2:SetScript("OnClick", openAllCash)
 
button:SetScript("OnEnter", function()
GameTooltip:SetOwner(button, "ANCHOR_RIGHT")
GameTooltip:AddLine(string.format("%d messages", GetInboxNumItems()), 1, 1, 1)
GameTooltip:Show()
end)
button:SetScript("OnLeave", function() GameTooltip:Hide() end)
 
function copper_to_pretty_money(c)
if c > 10000 then
return ("%d|cffffd700g|r%d|cffc7c7cfs|r%d|cffeda55fc|r"):format(c/10000, (c/100)%100, c%100)
elseif c > 100 then
return ("%d|cffc7c7cfs|r%d|cffeda55fc|r"):format((c/100)%100, c%100)
else
return ("%d|cffeda55fc|r"):format(c%100)
end
end
button2:SetScript("OnEnter", function()
if not total_cash then
total_cash = 0
for index=0, GetInboxNumItems() do
total_cash = total_cash + select(5, GetInboxHeaderInfo(index))
end
end
GameTooltip:SetOwner(button, "ANCHOR_RIGHT")
GameTooltip:AddLine(copper_to_pretty_money(total_cash), 1, 1, 1)
GameTooltip:Show()
end)
button2:SetScript("OnLeave", function() GameTooltip:Hide() end)
 
Eui/script/SpellID.lua New file
0,0 → 1,42
local E, C = unpack(select(2, ...))
if C["other"].spellid ~= true then return end
 
hooksecurefunc(GameTooltip, "SetUnitBuff", function(self,...)
local id = select(11,UnitBuff(...))
if id then
self:AddDoubleLine("技能ID:",id)
self:Show()
end
end)
 
hooksecurefunc(GameTooltip, "SetUnitDebuff", function(self,...)
local id = select(11,UnitDebuff(...))
if id then
self:AddDoubleLine("技能ID:",id)
self:Show()
end
end)
 
hooksecurefunc(GameTooltip, "SetUnitAura", function(self,...)
local id = select(11,UnitAura(...))
if id then
self:AddDoubleLine("技能ID:",id)
self:Show()
end
end)
 
hooksecurefunc("SetItemRef", function(link, text, button, chatFrame)
if string.find(link,"^spell:") then
local id = string.sub(link,7)
ItemRefTooltip:AddDoubleLine("技能ID:",id)
ItemRefTooltip:Show()
end
end)
 
GameTooltip:HookScript("OnTooltipSetSpell", function(self)
local id = select(3,self:GetSpell())
if id then
self:AddDoubleLine("技能ID:",id)
self:Show()
end
end)
\ No newline at end of file
Eui/script/vendorbait.lua New file
0,0 → 1,24
local f = LibStub("tekShiner").new(QuestRewardScrollChildFrame)
f:Hide()
 
 
f:RegisterEvent("QUEST_COMPLETE")
f:SetScript("OnEvent", function(self)
self:Hide()
local bestp, besti = 0
for i=1,GetNumQuestChoices() do
local link, name, _, qty = GetQuestItemLink("choice", i), GetQuestItemInfo("choice", i)
local price = link and select(11, GetItemInfo(link))
if not price then return
elseif (price * (qty or 1)) > bestp then bestp, besti = (price * (qty or 1)), i end
end
 
if besti then
self:ClearAllPoints()
self:SetAllPoints("QuestInfoItem"..besti.."IconTexture")
self:Show()
end
end)
 
 
if QuestInfoItem1:IsVisible() then f:GetScript("OnEvent")(f) end
Eui/script/Cadcamzy.toc New file
0,0 → 1,63
## Interface: 30300
## Title: Cadcamzy
## Title-zhCN: 增强功能合集|cffC495DDCadcamzy|r
## Notes: 一些小的单体插件
## Notes-zhCN: EUI 的增强补丁
## Author: cadcamzy@yahoo.com.cn
## Version: r1.1
## X-oUF: oUF
## SavedVariables: RecipientsDB, friendsWhisp, guildWhisp, totallastplayers, entries, teksLootDB, Achieved_Settings
## SavedVariablesPerCharacter: RankWatchSettings, MBB_Exclude, MBB_Options, Achieved_CharVars
 
##LOOT框
teksLoot.lua
##炼金师巡逻日常助手
Jhxx.lua
##收件人列表
Recipients.lua
##改变声望显示方式
SR.lua
##快捷设焦点(shift+左键)
Focuser.lua
 
## 插件管理
ACP.lua
ACP-localization-zhCN.lua
ACP.xml
 
##等级百分比转换
Ratings_core.lua
Ratings_panel.lua
 
##谁密我的
WhoWhisperedMe.xml
WhoWhisperedMe.lua
 
##只显示自已得的牌子
OnlyMyBadges.lua
 
##快捷按键绑定
##鼠标放在动作条上,直接按键就可以绑定。按ESC键或者右击为取消当前按键的绑定
ncHoverBind.lua
 
##游戏内的物品法术查询IDQuery
Includes\InterfaceOptionPage-1.0.lua
Includes\VirtualScrollList-1.0.lua
IDQueryLocalization.lua
IDQuery.lua
 
##小地图图标集合MBB
MBB\localization-zhCN.lua
MBB\MBB.xml
 
##在鼠标提示中显示法术BUFF的ID
SpellID.lua
 
##防止刷屏
ChatGuard.lua
 
##已知配方染色
AlreadyKnown.lua
 
##频道转发
LFGForwarder.lua
\ No newline at end of file
Eui/script/ncHoverBind.lua New file
0,0 → 1,334
local bind, localmacros = CreateFrame("Frame", "ncHoverBind", UIParent), 0
-- SLASH COMMAND
SlashCmdList.MOUSEOVERBIND = function()
if InCombatLockdown() then print("你不能在战斗中绑定按键") return end
if not bind.loaded then
local find = string.find
local _G = getfenv(0)
 
bind:SetFrameStrata("DIALOG")
bind:EnableMouse(true)
bind:EnableKeyboard(true)
bind:EnableMouseWheel(true)
bind.texture = bind:CreateTexture()
bind.texture:SetAllPoints(bind)
bind.texture:SetTexture(0, 0, 0, .25)
bind:Hide()
 
local elapsed = 0
GameTooltip:HookScript("OnUpdate", function(self, e)
elapsed = elapsed + e
if elapsed < .2 then return else elapsed = 0 end
if (not self.comparing and IsModifiedClick("COMPAREITEMS")) then
GameTooltip_ShowCompareItem(self)
self.comparing = true
elseif ( self.comparing and not IsModifiedClick("COMPAREITEMS")) then
for _, frame in pairs(self.shoppingTooltips) do
frame:Hide()
end
self.comparing = false
end
end)
hooksecurefunc(GameTooltip, "Hide", function(self) for _, tt in pairs(self.shoppingTooltips) do tt:Hide() end end)
 
bind:SetScript("OnEvent", function(self) self:Deactivate(false) end)
bind:SetScript("OnLeave", function(self) self:HideFrame() end)
-- chaged the following two Script from OnKeyUp to OnKeyDown to fix can't bind a combine key such as SHFT+T, ALT+SHIFT+Q
bind:SetScript("OnKeyDown", function(self, key) self:Listener(key) end)
bind:SetScript("OnMouseDown", function(self, key) self:Listener(key) end)
bind:SetScript("OnMouseWheel", function(self, delta) if delta>0 then self:Listener("MOUSEWHEELUP") else self:Listener("MOUSEWHEELDOWN") end end)
 
function bind:Update(b, spellmacro)
if not self.enabled or InCombatLockdown() then return end
self.button = b
self.spellmacro = spellmacro
 
self:ClearAllPoints()
self:SetAllPoints(b)
self:Show()
 
ShoppingTooltip1:Hide()
 
if spellmacro=="SPELL" then
self.button.id = SpellBook_GetSpellID(self.button:GetID())
self.button.name = GetSpellName(self.button.id, SpellBookFrame.bookType)
 
GameTooltip:AddLine("Trigger")
GameTooltip:Show()
GameTooltip:SetScript("OnHide", function(self)
self:SetOwner(bind, "ANCHOR_NONE")
self:SetPoint("BOTTOM", bind, "TOP", 0, 1)
self:AddLine(bind.button.name, 1, 1, 1)
bind.button.bindings = {GetBindingKey(spellmacro.." "..bind.button.name)}
if #bind.button.bindings == 0 then
self:AddLine("未绑定按键", .6, .6, .6)
else
self:AddDoubleLine("绑定", "按键", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
self:AddDoubleLine(i, bind.button.bindings[i])
end
end
self:Show()
self:SetScript("OnHide", nil)
end)
elseif spellmacro=="MACRO" then
self.button.id = self.button:GetID()
 
if localmacros==1 then self.button.id = self.button.id + 36 end
 
self.button.name = GetMacroInfo(self.button.id)
 
GameTooltip:SetOwner(bind, "ANCHOR_NONE")
GameTooltip:SetPoint("BOTTOM", bind, "TOP", 0, 1)
GameTooltip:AddLine(bind.button.name, 1, 1, 1)
 
bind.button.bindings = {GetBindingKey(spellmacro.." "..bind.button.name)}
if #bind.button.bindings == 0 then
GameTooltip:AddLine("未绑定按键", .6, .6, .6)
else
GameTooltip:AddDoubleLine("绑定", "按键", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
GameTooltip:AddDoubleLine("Binding"..i, bind.button.bindings[i], 1, 1, 1)
end
end
GameTooltip:Show()
elseif spellmacro=="STANCE" or spellmacro=="PET" then
self.button.id = tonumber(b:GetID())
self.button.name = b:GetName()
 
if not self.button.name then return end
 
if not self.button.id or self.button.id < 1 or self.button.id > (spellmacro=="STANCE" and 10 or 12) then
self.button.bindstring = "CLICK "..self.button.name..":LeftButton"
else
self.button.bindstring = (spellmacro=="STANCE" and "SHAPESHIFTBUTTON" or "BONUSACTIONBUTTON")..self.button.id
end
 
GameTooltip:AddLine("Trigger")
GameTooltip:Show()
GameTooltip:SetScript("OnHide", function(self)
self:SetOwner(bind, "ANCHOR_NONE")
self:SetPoint("BOTTOM", bind, "TOP", 0, 1)
self:AddLine(bind.button.name, 1, 1, 1)
bind.button.bindings = {GetBindingKey(bind.button.bindstring)}
if #bind.button.bindings == 0 then
self:AddLine("未绑定按键", .6, .6, .6)
else
self:AddDoubleLine("绑定", "按键", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
self:AddDoubleLine(i, bind.button.bindings[i])
end
end
self:Show()
self:SetScript("OnHide", nil)
end)
else
self.button.action = tonumber(b.action)
self.button.name = b:GetName()
 
if not self.button.name then return end
 
if not self.button.action or self.button.action < 1 or self.button.action > 132 then
self.button.bindstring = "CLICK "..self.button.name..":LeftButton"
else
local modact = 1+(self.button.action-1)%12
if self.button.action < 25 or self.button.action > 72 then
self.button.bindstring = "ACTIONBUTTON"..modact
elseif self.button.action < 73 and self.button.action > 60 then
self.button.bindstring = "MULTIACTIONBAR1BUTTON"..modact
elseif self.button.action < 61 and self.button.action > 48 then
self.button.bindstring = "MULTIACTIONBAR2BUTTON"..modact
elseif self.button.action < 49 and self.button.action > 36 then
self.button.bindstring = "MULTIACTIONBAR4BUTTON"..modact
elseif self.button.action < 37 and self.button.action > 24 then
self.button.bindstring = "MULTIACTIONBAR3BUTTON"..modact
end
end
 
GameTooltip:AddLine("Trigger")
GameTooltip:Show()
-- fix can't bind anykey when a macro isn't available
-- must comment the line in OnHide function
-- such as you are Fury Warrior and you have a macro
-- #showtooltip /cast BladeStorm
-- you can't bind any key to this button because OnHide is not called forever
bind.button.bindings = {GetBindingKey(bind.button.bindstring)}
 
GameTooltip:SetScript("OnHide", function(self)
self:SetOwner(bind, "ANCHOR_NONE")
self:SetPoint("BOTTOM", bind, "TOP", 0, 1)
self:AddLine(bind.button.name, 1, 1, 1)
-- bind.button.bindings = {GetBindingKey(bind.button.bindstring)}
if #bind.button.bindings == 0 then
self:AddLine("未绑定按键", .6, .6, .6)
else
self:AddDoubleLine("绑定", "按键", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
self:AddDoubleLine(i, bind.button.bindings[i])
end
end
self:Show()
self:SetScript("OnHide", nil)
end)
end
end
 
function bind:Listener(key)
-- fix bind the SCREENSHOT key, now press SCREENSHOT key will take a screen shot
-- GetBindingFromClick
if GetBindingByKey(key) == "SCREENSHOT" then
RunBinding("SCREENSHOT");
return
end
 
-- change behavior to bind only one key for one button
if #self.button.bindings > 0 then
for i = 1, #self.button.bindings do
SetBinding(self.button.bindings[i])
end
self:Update(self.button, self.spellmacro)
if self.spellmacro~="MACRO" then GameTooltip:Hide() end
end
 
if key == "ESCAPE" or key == "RightButton" then
for i = 1, #self.button.bindings do
SetBinding(self.button.bindings[i])
end
print("解除 |cff00ff00"..self.button.name.."|r 按键绑定!")
self:Update(self.button, self.spellmacro)
if self.spellmacro~="MACRO" then GameTooltip:Hide() end
return
end
 
if key == "LSHIFT"
or key == "RSHIFT"
or key == "LCTRL"
or key == "RCTRL"
or key == "LALT"
or key == "RALT"
or key == "UNKNOWN"
or key == "LeftButton"
or key == "MiddleButton"
then return end
 
if key == "Button4" then key = "BUTTON4" end
if key == "Button5" then key = "BUTTON5" end
 
local alt = IsAltKeyDown() and "ALT-" or ""
local ctrl = IsControlKeyDown() and "CTRL-" or ""
local shift = IsShiftKeyDown() and "SHIFT-" or ""
 
if not self.spellmacro or self.spellmacro=="PET" or self.spellmacro=="STANCE" then
SetBinding(alt..ctrl..shift..key, self.button.bindstring)
else
SetBinding(alt..ctrl..shift..key, self.spellmacro.." "..self.button.name)
end
print("按键 |cff00ff00"..alt..ctrl..shift..key.."|r 绑定至 |cff00ff00"..self.button.name.."|r")
self:Update(self.button, self.spellmacro)
if self.spellmacro~="MACRO" then GameTooltip:Hide() end
end
function bind:HideFrame()
self:ClearAllPoints()
self:Hide()
GameTooltip:Hide()
end
function bind:Activate()
self.enabled = true
self:RegisterEvent("PLAYER_REGEN_DISABLED")
end
function bind:Deactivate(save)
if save then
SaveBindings(2)
print("|cff00ff00已保存按键绑定!|r")
else
LoadBindings(2)
print("|cffff0000已放弃按键绑定!|r")
end
self.enabled = false
self:HideFrame()
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
StaticPopup_Hide("KEYBIND_MODE")
end
 
StaticPopupDialogs["KEYBIND_MODE"] = {
text = "移动鼠标到动作条上即可绑定按键,按ESC或鼠标右键解除绑定。",
button1 = "保存按键绑定",
button2 = "放弃按键绑定",
OnAccept = function() bind:Deactivate(true) end,
OnCancel = function() bind:Deactivate(false) end,
timeout = 0,
whileDead = 1,
hideOnEscape = false
}
 
-- REGISTERING
local stance = ShapeshiftButton1:GetScript("OnClick")
local pet = PetActionButton1:GetScript("OnClick")
local button = SecureActionButton_OnClick
 
local function register(val)
if val.IsProtected and val.GetObjectType and val.GetScript and val:GetObjectType()=="CheckButton" and val:IsProtected() then
local script = val:GetScript("OnClick")
if script==button then
val:HookScript("OnEnter", function(self) bind:Update(self) end)
elseif script==stance then
val:HookScript("OnEnter", function(self) bind:Update(self, "STANCE") end)
elseif script==pet then
val:HookScript("OnEnter", function(self) bind:Update(self, "PET") end)
end
end
end
 
local val = EnumerateFrames()
while val do
register(val)
val = EnumerateFrames(val)
end
 
for i=1,12 do
local b = _G["SpellButton"..i]
b:HookScript("OnEnter", function(self) bind:Update(self, "SPELL") end)
end
 
local function registermacro()
for i=1,36 do
local b = _G["MacroButton"..i]
b:HookScript("OnEnter", function(self) bind:Update(self, "MACRO") end)
end
MacroFrameTab1:HookScript("OnMouseUp", function() localmacros = 0 end)
MacroFrameTab2:HookScript("OnMouseUp", function() localmacros = 1 end)
end
 
if not IsAddOnLoaded("Blizzard_MacroUI") then
hooksecurefunc("LoadAddOn", function(addon)
if addon=="Blizzard_MacroUI" then
registermacro()
end
end)
else
registermacro()
end
bind.loaded = 1
end
if not bind.enabled then
bind:Activate()
StaticPopup_Show("KEYBIND_MODE")
-- fix issue that enter /hb it doesn't display bind tooltip when mouse is over action button
local stance = ShapeshiftButton1:GetScript("OnClick")
local pet = PetActionButton1:GetScript("OnClick")
local button = SecureActionButton_OnClick
local focus = GetMouseFocus()
if focus.IsProtected and focus.GetObjectType and focus.GetScript and focus:GetObjectType()=="CheckButton" and focus:IsProtected() then
local script = focus:GetScript("OnClick")
if script==button then
bind:Update(focus)
elseif script==stance then
bind:Update(focus, "STANCE")
elseif script==pet then
bind:Update(focus, "PET")
end
end
end
end
SLASH_MOUSEOVERBIND1 = "/hb"
SLASH_MOUSEOVERBIND2 = "/hoverbind"
\ No newline at end of file
Eui/script/ACP.lua New file
0,0 → 1,2177
--==============
-- Global Variables
--==============
ACP = {}
 
ACP_LINEHEIGHT = 16
 
ACP.CheckEvents = 0
 
 
ACP.TAGS = {
PART_OF = "X-Part-Of",
INTERFACE_MIN = "X-Min-Interface",
INTERFACE_MIN_ORG = "X-Since-Interface",
INTERFACE_MAX = "X-Max-Interface",
INTERFACE_MAX_ORG = "X-Compatible-With",
}
 
-- Handle various annoying special case names
function ACP:SpecialCaseName(name)
local partof = GetAddOnMetadata(name, ACP.TAGS.PART_OF)
 
if partof ~= nil then
return partof.."_"..name
end
 
if name == "DBM-Core" then
return "DBM"
elseif name:match("DBM%-") then
return name:gsub("DBM%-", "DBM_")
elseif name:match("CT_") then
return name:gsub("CT_", "CT-")
elseif name:sub(1,1) == "+" or name:sub(1,1) == "!" or name:sub(1,1) == "_" then
return name:sub(2,-1)
elseif name == "ShadowedUF_Options" then
return "ShadowedUnitFrames_Options"
-- elseif name == "Auc-Advanced" then
-- return "Auc"
-- elseif name:match("Auc%-") then
-- return name:gsub("Auc%-", "Auc_")
-- elseif
end
 
return name
end
--==============
-- Localization
--==============
local DEFAULT = "Default"
local TITLES = "Titles"
local ACE2 = "Ace2"
local AUTHOR = "Author"
local SEPARATE_LOD_LIST = "Separate LOD List"
local GROUP_BY_NAME = "Group By Name"
 
if (GetLocale() == "zhCN") then
DEFAULT = "默认"
TITLES = "名称"
ACE2 = "Ace2"
AUTHOR = "作者"
SEPARATE_LOD_LIST = "按需求加载"
GROUP_BY_NAME = "按名称分组"
elseif (GetLocale() == "zhTW") then
DEFAULT = "預設"
TITLES = "名稱"
ACE2 = "Ace2"
AUTHOR = "作者"
SEPARATE_LOD_LIST = "隨需求載入"
GROUP_BY_NAME = "以名稱分組"
elseif (GetLocale() == "koKR") then
DEFAULT = "기본"
TITLES = "제목"
ACE2 = "Ace2"
AUTHOR = "제작자"
SEPARATE_LOD_LIST = "LOD 목록 분리"
GROUP_BY_NAME = "이름별 분류"
elseif (GetLocale() == "frFR") then
DEFAULT = "Défaut"
TITLES = "Titres"
ACE2 = "Ace2"
AUTHOR = "Auteur"
SEPARATE_LOD_LIST = "Liste LOD séparée"
GROUP_BY_NAME = "Groupement par nom"
elseif (GetLocale() == "esES") then
DEFAULT = "Por Defecto"
TITLES = "T?tulos"
ACE2 = "Ace2"
AUTHOR = "Autor"
SEPARATE_LOD_LIST = "Lista CaD por separado"
GROUP_BY_NAME = "Agrupar por nombre"
elseif (GetLocale() == "ruRU") then
DEFAULT = "По умолчанию"
TITLES = "Заголовкам"
ACE2 = "Ace2"
AUTHOR = "Автор"
SEPARATE_LOD_LIST = "Отдел. список ЗПТ"
GROUP_BY_NAME = "Группир. по имени"
end
 
--==============
-- Locale
--==============
local L = setmetatable({}, {
__index = function(t, k)
error("Locale key " .. tostring(k ) .. " is not provided.")
end
} )
 
--==============
-- Special Tables
--==============
 
--[[
masterAddonList : master list of sorted addons.
It should be in the following structures:
masterAddonList = {
addon1Index,
addon2Index,
{
addon3Index,
addon4Index,
...
['category'] = "Category1Name"
},
addon5Index,
{
addon6Index,
addon7Index,
['category'] = "Category2Name"
},
}
 
This list is used to build sortedAddonList, which is the list used in the FauxScrollFrame.
 
NEW: addonIndex can now be number or string, where string is the addon name,
so you can directly insert the Blizzard addon names to the list.
 
--]]
local masterAddonList = {}
ACP.masterAddonList = masterAddonList
 
 
--[[
sortedAddonList : list of addonIndexes, which is used by the FauxScrollFrame.
It should be in the following structure:
sortedAddonList = {
addon1Index,
addon2Index,
"Category1Name",
addon3Index,
addon4Index,
...,
addon5Index,
"Category2Name",
addon6Index,
addon7Index,
...,
}
 
- If type(addonIndex) == 'string', it will be shown in the panel as a category header.
- The collapse state will be retrieved from the saved variables: collapsedAddons.
- If addonIndex > GetNumAddOns(), it''s a Blizzard addon, the index references to ACP_BLIZZARD_ADDONS[addonIndex - GetNumAddOns()].
- otherwise, addonIndex is the index used in GetAddOnInfo().
 
This list will be rebuilt whenever use expanded/collapsed a category, or when user changed the sorting criteria.
 
--]]
local sortedAddonList = {}
ACP.sortedAddonList = sortedAddonList
 
--[[
addonListBuilders : a table of functions used to build masterAddonList
 
To define your own sorting criteria, check the default builder functions as examples.
Note if you create the build function in an external scope, you cannot access to the ACP local variables,
i.e. masterAddonList and ACP_BLIZZARD_ADDONS, but they can be accessed through ACP. e.g.:
 
function MyExternalBuilder()
local masterAddonList = ACP.masterAddonList
local bzAddons = ACP.ACP_BLIZZARD_ADDONS
(Now build the masterAddonList)
end
 
When you have defined your own builder function, simple add them to the table by:
 
ACP.addonListBuilders["MyExternalBuilder"] = MyExternalBuilder
 
After everything is done, the custom defined function can be accessed from the ACP sorter drop down menu.
 
]]
local addonListBuilders = {}
ACP.addonListBuilders = addonListBuilders
 
 
 
--
-- Decorator Pattern Text Colorization Functions
-- Same as crayonlib
--
local CLR = {}
CLR.COLOR_NONE = nil
function CLR:Colorize(hexColor, text)
if text == nil then text = "" end
 
if hexColor == CLR.COLOR_NONE then
return text
end
 
return "|cff" .. tostring(hexColor or 'ffffff') .. tostring(text) .. "|r"
end
function CLR:GetHexColor(color)
return string.format("%02x%02x%02x", color.r*255, color.g*255, color.b*255)
end
 
--
-- Colors used
--
function CLR:Label(txt) return CLR:Colorize('ffff7f', txt) end
function CLR:ActiveEmbed(txt) return CLR:Colorize('80ff80', txt) end
function CLR:Addon(txt) return CLR:Colorize('7f7fff', txt) end
function CLR:On(txt) return CLR:Colorize('00ff00', txt) end
function CLR:Off(txt) return CLR:Colorize('ff0000', txt) end
function CLR:Bool(b, txt) if b then return CLR:On(txt) else return CLR:Off(txt) end end
function CLR:AddonStatus(addon, txt)
local color = ACP:GetAddonStatus(addon)
return CLR:Colorize(color, txt)
end
 
local function formattitle(title)
return title:gsub("Lib: ", "|cff66ccffLib|r: "):gsub(" |cff7fff7f %-Ace2%-|r", ""):gsub("%-Ace2%-", ""):trim()
 
end
 
-- From modmenutufu
local reasons = {}
 
local function getreason(r)
if not reasons[r] then reasons[r] = _G["ADDON_"..r] end
return reasons[r]
end
 
function ACP:IsAddonCompatibleWithCurrentIntefaceVersion(addon)
local build = select(4, GetBuildInfo())
 
local addonnum = tonumber(addon)
if not addonnum or (addonnum and (addonnum == 0 or addonnum > GetNumAddOns())) then
return true -- Get to the choppa!
end
 
local max_supported = GetAddOnMetadata(addonnum, ACP.TAGS.INTERFACE_MAX) or
GetAddOnMetadata(addonnum, ACP.TAGS.INTERFACE_MAX_ORG)
 
local min_supported = GetAddOnMetadata(addonnum, ACP.TAGS.INTERFACE_MIN) or
GetAddOnMetadata(addonnum, ACP.TAGS.INTERFACE_MIN_ORG)
 
--print("Min: "..tostring(min_supported).." Max: "..tostring(max_supported))
 
if max_supported then
max_supported = tonumber(max_supported) and (tonumber(max_supported) >= build) or false
end
 
if min_supported then
min_supported = tonumber(min_supported) and (tonumber(min_supported) <= build) or false
end
 
return max_supported, min_supported
 
end
 
function ACP:GetAddonCompatibilitySummary(addon)
local high, low = self:IsAddonCompatibleWithCurrentIntefaceVersion(addon)
 
if low == false then
return false
elseif high == false then
return false
elseif high or low then
return true
end
 
return nil -- Compatibility not specified
end
 
function ACP:GetAddonStatus(addon)
local addon = addon
 
-- Hi, i'm Mr Kludge! Whats your name?
local addonnum = tonumber(addon)
if addonnum and (addonnum == 0 or addonnum > GetNumAddOns()) then
return -- Get to the choppa!
end
 
local high, low = self:IsAddonCompatibleWithCurrentIntefaceVersion(addon)
if (low == false) then
return "FF0000", getreason("INCOMPATIBLE")
end
if (high == false) then
return "FF0000", getreason("INTERFACE_VERSION")
end
 
 
local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(addon)
 
if reason == "MISSING" and type(addon) == "string" then
addon = self:ResolveLibraryName(addon) or addon
end
 
 
local loaded = IsAddOnLoaded(addon)
local isondemand = IsAddOnLoadOnDemand(addon)
local color, note
 
if reason == "DISABLED" then color, note = "9d9d9d", getreason(reason) -- Grey
elseif reason == "NOT_DEMAND_LOADED" then color, note = "0070dd", getreason(reason) -- Blue
elseif reason then color, note = "ff8000", getreason(reason) -- Orange
elseif loadable and isondemand and not loaded and enabled then color, note = "1eff00", L["Loadable OnDemand"] -- Green
elseif loaded and not enabled then color, note = "a335ee", L["Disabled on reloadUI"] -- Purple
elseif reason == "MISSING" then color, note = "ff0000", getreason(reason)
else
color = CLR.COLOR_NONE
note = ""
end
 
return color, note
end
 
 
--==============
-- Reference to tables in saved variables
--==============
local savedVar
local collapsedAddons
 
 
--==============
-- Local Variables
--==============
local cache = setmetatable({}, {__mode='k'})
local function acquire()
local t = next(cache) or {}
cache[t] = nil
return t
end
local function reclaim(t)
for k in pairs(t) do
t[k] = nil
end
cache[t] = true
end
local ACP_ADDON_NAME = "ACP"
local ACP_FRAME_NAME = "ACP_AddonList"
local playerClass = nil
local ACP_SET_SIZE = 10
local ACP_MAXADDONS = 20
local ACP_DefaultSet = {}
local ACP_DEFAULT_SET = 0
local ACP_BLIZZARD_ADDONS = {
"Blizzard_AchievementUI",
"Blizzard_ArenaUI",
"Blizzard_AuctionUI",
"Blizzard_BarbershopUI",
"Blizzard_BattlefieldMinimap",
"Blizzard_BindingUI",
"Blizzard_Calendar",
"Blizzard_CombatLog",
"Blizzard_CombatText",
"Blizzard_DebugTools",
"Blizzard_GlyphUI",
"Blizzard_GMChatUI",
"Blizzard_GMSurveyUI",
"Blizzard_GuildBankUI",
"Blizzard_InspectUI",
"Blizzard_ItemSocketingUI",
"Blizzard_MacroUI",
"Blizzard_RaidUI",
"Blizzard_TalentUI",
"Blizzard_TimeManager",
"Blizzard_TokenUI",
"Blizzard_TradeSkillUI",
"Blizzard_TrainerUI",
}
local NUM_BLIZZARD_ADDONS = #ACP_BLIZZARD_ADDONS
ACP.ACP_BLIZZARD_ADDONS = ACP_BLIZZARD_ADDONS
local enabledList -- Used to prevent recursive loop in EnableAddon.
 
local function ParseVersion(version)
if type(version) == "string" then
version = version:gsub("@project%-version@", CLR:Colorize("ffa0a0", "DEBUG")):trim()
end
return version
end
 
local function toggle(flag)
if flag then
return nil
else
return true
end
end
 
 
 
 
local function GetAddonIndex(addon, noerr)
if type(addon) == 'number' then
return addon
elseif type(addon) == 'string' then
local addonIndex = ACP_BLIZZARD_ADDONS[addon]
if addonIndex then
return addonIndex + GetNumAddOns()
else
if addon == "" then return nil end
for i=1, GetNumAddOns() do
local name = ACP:SpecialCaseName(GetAddOnInfo(i))
if name:lower() == ACP:SpecialCaseName(addon):lower() then
return i
end
end
 
if not noerr then
error("Cannot find addon " .. tostring(addon) )
end
end
else
if not noerr then
error("GetAddonIndex(): addon must be of type number of string.")
end
end
end
 
function ACP:ToggleRecursion(val)
if val == nil then
savedVar.NoRecurse = not savedVar.NoRecurse
else
savedVar.NoRecurse = not val
end
 
local frame = _G[ACP_FRAME_NAME.."_NoRecurse"]
 
-- ACP:Print(L["Recursive Enable is now %s"]:format(CLR:Bool(not savedVar.NoRecurse, tostring(not savedVar.NoRecurse))))
end
 
function ACP:OnLoad(this)
 
self.L = L
self.frame = _G[ACP_FRAME_NAME]
 
GameMenuButtonAddOns:SetText(L["AddOns"])
 
for i=1, ACP_MAXADDONS do
local button = _G[ACP_FRAME_NAME.."Entry"..i.."LoadNow"]
button:SetText(L["Load"])
end
 
_G[ACP_FRAME_NAME.."DisableAll"]:SetText(L["Disable All"])
_G[ACP_FRAME_NAME.."EnableAll"]:SetText(L["Enable All"])
_G[ACP_FRAME_NAME.."SetButton"]:SetText(L["Sets"])
_G[ACP_FRAME_NAME.."_ReloadUI"]:SetText(L["ReloadUI"])
_G[ACP_FRAME_NAME.."BottomClose"]:SetText(L["Close"])
 
UIPanelWindows[ACP_FRAME_NAME] = { area = "center", pushable = 0, whileDead = 1 }
StaticPopupDialogs["ACP_RELOADUI"] = {
text = L["Reload your User Interface?"],
button1 = TEXT(ACCEPT),
button2 = TEXT(CANCEL),
OnAccept = function()
ReloadUI()
end,
OnCancel = function(data, reason)
if ( reason == "timeout" ) then
ReloadUI()
else
StaticPopupDialogs["ACP_RELOADUI"].reloadAccepted = false
end
end,
OnHide = function()
if (StaticPopupDialogs["ACP_RELOADUI"].reloadAccepted ) then
ReloadUI();
end
end,
OnShow = function()
StaticPopupDialogs["ACP_RELOADUI"].reloadAccepted = true;
end,
timeout = 5,
hideOnEscape = 1,
exclusive = 1,
whileDead = 1
}
 
StaticPopupDialogs["ACP_RELOADUI_START"] = {
text = L["ACP: Some protected addons aren't loaded. Reload now?"],
button1 = TEXT(ACCEPT),
button2 = TEXT(CANCEL),
OnAccept = function()
ReloadUI()
end,
OnCancel = function(data, reason)
if ( reason == "timeout" ) then
ReloadUI()
end
end,
 
timeout = 5,
hideOnEscape = 1,
exclusive = 1,
whileDead = 1
}
 
StaticPopupDialogs["ACP_SAVESET"] = {
text = L["Save the current addon list to [%s]?"],
button1 = TEXT(YES),
button2 = TEXT(CANCEL),
OnAccept = function()
self:SaveSet(self.savingSet)
CloseDropDownMenus(1)
end,
timeout = 0,
hideOnEscape = 1,
whileDead = 1,
exclusive = 1,
}
 
local function OnRenameSet(this)
local popup;
if this:GetParent():GetName() == "UIParent" then
popup = this
else
popup = this:GetParent()
end
local text = _G[popup:GetName().."EditBox"]:GetText()
if text == "" then
text = nil
end
self:RenameSet(self.renamingSet, text)
popup:Hide()
end
 
StaticPopupDialogs["ACP_RENAMESET"] = {
text = L["Enter the new name for [%s]:"],
button1 = TEXT(YES),
button2 = TEXT(CANCEL),
OnAccept = OnRenameSet,
EditBoxOnEnterPressed = OnRenameSet,
EditBoxOnEscapePressed = function(this)
this:GetParent():Hide()
end,
timeout = 0,
hideOnEscape = 1,
exclusive = 1,
whileDead = 1,
hasEditBox = 1,
}
 
for i,v in ipairs(ACP_BLIZZARD_ADDONS) do
ACP_BLIZZARD_ADDONS[v] = i
end
-- ACP_BLIZZARD_ADDONS = setmetatable(ACP_BLIZZARD_ADDONS, {
-- __index = function(t,k)
-- for i=1, #t do
-- if t[i] == k then
--
-- return i
-- end
-- end
-- end
-- } )
 
local title = "Addon Control Panel"
local version = GetAddOnMetadata(ACP_ADDON_NAME, "Version")
if version then
version = ParseVersion(version)
title = title.." ("..version..")"
end
ACP_AddonListHeaderTitle:SetText(title)
this:RegisterEvent("VARIABLES_LOADED")
this:RegisterEvent("ADDON_LOADED")
 
playerClass, _ = UnitClass("player")
 
 
SlashCmdList["ACP"] = self.SlashHandler
 
SLASH_ACP1 = "/acp"
end
 
local eventLibrary, bugeventreged
 
function ACP:OnEvent(this, event, arg1, arg2, arg3)
if event == "VARIABLES_LOADED" then
if not ACP_Data then ACP_Data = {} end
 
savedVar = ACP_Data
 
savedVar.ProtectedAddons = savedVar.ProtectedAddons or { ["ACP"] = true }
 
if not savedVar.collapsed then
savedVar.collapsed = {}
end
collapsedAddons = savedVar.collapsed
 
if not savedVar.sorter then
ACP:SetMasterAddonBuilder(GROUP_BY_NAME)
else
ACP:ReloadAddonList()
end
 
if savedVar.NoChildren == nil then
savedVar.NoChildren = true
end
 
for i = 1, GetNumAddOns() do
if IsAddOnLoaded(i) then
local name = GetAddOnInfo(i)
if name ~= ACP_ADDON_NAME then
table.insert(ACP_DefaultSet, name)
end
end
end
 
self:ToggleRecursion(not savedVar.NoRecurse)
_G[ACP_FRAME_NAME.."_NoRecurseText"]:SetText(L["Recursive"])
 
this:RegisterEvent("PLAYER_ENTERING_WORLD")
this:UnregisterEvent("VARIABLES_LOADED")
elseif event == "PLAYER_ALIVE" then
 
for k,v in pairs(savedVar.ProtectedAddons) do
if type(k) == "number" then savedVar.ProtectedAddons[k] = nil end
if not v then savedVar.ProtectedAddons[k] = nil end
end
 
local reloadRequired = false
for k,v in pairs(savedVar.ProtectedAddons) do
local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(k)
 
if reason == 'MISSING' then
savedVar.ProtectedAddons[k] = nil
elseif (not enabled) or enabled == 0 then
EnableAddOn(k)
reloadRequired=true
end
 
end
 
if reloadRequired then
if savedVar.reloadRequired then
savedVar.reloadRequired = nil
else
savedVar.reloadRequired = true
end
else
savedVar.reloadRequired = nil
end
if savedVar.reloadRequired then
StaticPopup_Show("ACP_RELOADUI_START");
end
elseif event == "PLAYER_ENTERING_WORLD" then
this:UnregisterEvent("PLAYER_ENTERING_WORLD")
this:RegisterEvent("PLAYER_ALIVE")
 
 
-- ACP:ProcessBugSack("session")
elseif event == "ADDON_LOADED" then
ACP:ADDON_LOADED(arg1)
end
 
end
 
 
function ACP:ResolveLibraryName(id)
local a, name
for a = 1, GetNumAddOns() do
local n = GetAddOnInfo(a)
if n == id then
name = n
elseif GetAddOnMetadata(a, "X-AceLibrary-"..id) then
name = name or n
end
end
 
return name
end
 
 
--function ACP:ProcessBugSack(which)
-- if BugSack then
-- local errs = BugSack:GetErrors(which)
-- for i=1, #errs do
-- local str = errs[i].message
-- if type(str) == "table" then
-- str = table.concat(str)
-- end
--
-- local _,_,id = strfind(str, "Cannot find a library instance of ([_A-Za-z0-9-]+%.?%d?)")
--
-- if not id then
-- _,_,id = strfind(str, "Library \"([_A-Za-z0-9-]+%.?%d?)\" does not exist")
-- end
--
-- if not id then
-- _,_,id = strfind(str, ".-requires ([_A-Za-z0-9-]+%.?%d?)")
-- end
--
-- if id then
-- local name = self:ResolveLibraryName(id)
--
-- if name then
-- local _, _, _, enabled = GetAddOnInfo(name)
-- if not enabled then
-- local reload = Prat and Prat:GetReloadUILink("ACP") or L["Reload"]
-- ACP:Print(L["*** Enabling <%s> %s your UI ***"]:format(CLR:Addon(name), reload), 1.0, 1.0, 0.0)
-- ACP:EnableAddon(name)
-- end
-- else
-- ACP:Print(L["*** Unknown Addon <%s> Required ***"]:format(CLR:Addon(name)), 1.0, 0.0, 0.0)
-- end
-- end
-- end
-- end
--end
 
--ACP_Data.NoRecurse
--ACP_Data.NoChildren
local ACP_NOCHILDREN = "nochildren"
local ACP_NORECURSE = "norecurse"
 
function ACP.SlashHandler(msg)
if type(msg) == "string" then
if msg == ACP_NOCHILDREN then
savedVar.NoChildren = not savedVar.NoChildren
ACP:Print(L["LoD Child Enable is now %s"]:format(CLR:Bool(not savedVar.NoChildren, tostring(not savedVar.NoChildren))))
return
end
 
if msg == ACP_NORECURSE then
savedVar.NoRecurse = not savedVar.NoRecurse
ACP:Print(L["Recursive Enable is now %s"]:format(CLR:Bool(not savedVar.NoRecurse, tostring(not savedVar.NoRecurse))))
return
end
end
 
ShowUIPanel(ACP_AddonList)
end
 
addonListBuilders[DEFAULT] = function()
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
local numAddons = GetNumAddOns()
for i=1, numAddons do
table.insert(masterAddonList, i)
end
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(masterAddonList, numAddons+i)
end
end
 
addonListBuilders[TITLES] = function()
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
 
local numAddons = GetNumAddOns()
for i=1, numAddons do
table.insert(masterAddonList, i)
end
 
-- Sort the addon list by Ace2 Categories.
table.sort(masterAddonList, function(a, b)
local _, nameA = GetAddOnInfo(a)
local _, nameB = GetAddOnInfo(b)
return formattitle(nameA) < formattitle(nameB)
end )
 
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(masterAddonList, numAddons+i)
end
end
 
addonListBuilders[ACE2] = function()
 
local t = {}
 
local numAddons = GetNumAddOns()
for i=1, numAddons do
table.insert(t, i)
end
 
-- Sort the addon list by Ace2 Categories.
table.sort(t, function(a, b)
local catA = GetAddOnMetadata(a, "X-Category")
local catB = GetAddOnMetadata(b, "X-Category")
if catA == catB then
local nameA = GetAddOnInfo(a)
local nameB = GetAddOnInfo(b)
return nameA < nameB
else
return tostring(catA) < tostring(catB)
end
end )
 
-- Insert the category titles into the list.
local prevCategory = ""
for i, addonIndex in ipairs(t) do
local category = GetAddOnMetadata(addonIndex, "X-Category")
if not category then
category = "Undefined"
end
if category ~= prevCategory then
table.insert(t, i, category)
end
prevCategory = category
end
 
table.insert(t, "Blizzard")
 
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(t, numAddons+i)
end
 
-- Now build the masterAddonList.
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
local list = masterAddonList
local currPos = list
for i, addon in ipairs(t) do
if type(addon) == 'string' then
local t = {}
t.category = addon
table.insert(list, t)
currPos = t
else
table.insert(currPos, addon)
end
end
 
 
end
 
 
addonListBuilders[AUTHOR] = function()
local t = {}
 
local numAddons = GetNumAddOns()
for i=1, numAddons do
table.insert(t, i)
end
 
-- Sort the addon list by Ace2 Categories.
table.sort(t, function(a, b)
local catA = GetAddOnMetadata(a, "Author")
local catB = GetAddOnMetadata(b, "Author")
if catA == catB then
local nameA = GetAddOnInfo(a)
local nameB = GetAddOnInfo(b)
return nameA < nameB
else
return tostring(catA) < tostring(catB)
end
end )
 
-- Insert the category titles into the list.
local prevCategory = ""
for i, addonIndex in ipairs(t) do
local category = GetAddOnMetadata(addonIndex, "Author")
if not category then
category = "Unknown"
end
if category ~= prevCategory then
table.insert(t, i, category)
end
prevCategory = category
end
 
table.insert(t, "Blizzard")
 
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(t, numAddons+i)
end
 
-- Now build the masterAddonList.
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
local list = masterAddonList
local currPos = list
for i, addon in ipairs(t) do
if type(addon) == 'string' then
local t = {}
t.category = addon
table.insert(list, t)
currPos = t
else
table.insert(currPos, addon)
end
end
 
end
 
 
--[[
addonListBuilders["Ace2 Libs And Packages"] = function()
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
 
-- Sort the addon list by Ace2 Categories.
table.sort(t, function(a, b)
local catA = GetAddOnMetadata(a, "Author")
local catB = GetAddOnMetadata(b, "Author")
if catA == catB then
local nameA = GetAddOnInfo(a)
local nameB = GetAddOnInfo(b)
return nameA < nameB
else
return tostring(catA) < tostring(catB)
end
end )
 
 
local numAddons = GetNumAddOns()
for i=1, numAddons do
table.insert(masterAddonList, i)
end
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(masterAddonList, numAddons+i)
end
end
--]]
 
addonListBuilders[SEPARATE_LOD_LIST] = function()
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
local numAddons = GetNumAddOns()
local name
 
local lods = {}
lods.category = "Load On Demand Addons"
local nonlods = {}
nonlods.category = "Standard Addons"
local blizz = {}
blizz.category = "Blizzard Addons"
 
local pos = 1
for i=1, numAddons do
name = GetAddOnInfo(i)
if not IsAddOnLoadOnDemand(name) then
table.insert(nonlods, i)
else
table.insert(lods, i)
end
end
 
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(blizz, numAddons+i)
end
 
table.insert(masterAddonList, nonlods)
table.insert(masterAddonList, lods)
table.insert(masterAddonList, blizz)
end
 
 
 
addonListBuilders[GROUP_BY_NAME] = function()
local t = {}
 
local numAddons = GetNumAddOns()
for i=1, numAddons do
table.insert(t, i)
end
 
local libs = {}
libs.category = "Libraries"
 
-- Sort the addon list by Ace2 Categories.
table.sort(t, function(a, b)
local nameA = GetAddOnInfo(a)
local nameB = GetAddOnInfo(b)
 
local catA, catB
 
nameA, nameB = ACP:SpecialCaseName(nameA), ACP:SpecialCaseName(nameB)
 
if nameA:find("_") then
catA, nameA = strsplit("_", nameA)
else
catA, nameA = nameA
end
 
if nameB:find("_") then
catB, nameB = strsplit("_", nameB)
else
catB, nameB = nameB
end
 
if catA:lower() == catB:lower() then
return (nameA or ""):lower() < (nameB or ""):lower()
else
return tostring(catA):lower() < tostring(catB):lower()
end
end )
 
 
 
-- Insert the category titles into the list.
local prevCategory = ""
local name = nil
local t2 = t
t = {}
for i, addonIndex in ipairs(t2) do
name = ACP:SpecialCaseName(GetAddOnInfo(addonIndex))
 
local acecategory = GetAddOnMetadata(addonIndex, "X-Category")
 
if acecategory == "Library" and not ACP:IsAddOnProtected(name) then
table.insert(libs, addonIndex)
else
local category, content = strsplit("_", name)
if not content then
content = category
category = ""
end
if category:lower() ~= prevCategory:lower() then
table.insert(t, category)
end
 
table.insert(t, addonIndex)
prevCategory = category
end
end
 
 
 
local blizz = {}
blizz.category = "Blizzard Addons"
 
for i=1, NUM_BLIZZARD_ADDONS do
table.insert(blizz, numAddons+i)
end
 
-- Now build the masterAddonList.
for k in pairs(masterAddonList) do
masterAddonList[k] = nil
end
local list = masterAddonList
local currPos = list
for i, addon in ipairs(t) do
if type(addon) == 'string' then
if addon == "" then
currPos = list
else
local t = {}
t.category = addon
-- table.remove(currPos, #currPos)
local addonpos = currPos[#currPos]
if addonpos then
local addonname = ACP:SpecialCaseName(GetAddOnInfo(addonpos))
if (addonname == addon) then table.remove(currPos,#currPos) end
table.insert(list, t)
currPos = t
end
end
else
table.insert(currPos, addon)
end
end
 
 
 
table.insert(masterAddonList, libs)
table.insert(masterAddonList, blizz)
end
 
 
function ACP:ToggleUI()
--[[ added Mon Jul 30 12:14:24 CEST 2007 - fin
 
wanted an easy way to toggle the UI on / off for CustomMenuFu
 
NOTE: maybe change the slash handler to use this instead?
]]
if ACP_AddonList:IsShown() then
HideUIPanel(ACP_AddonList)
else
ShowUIPanel(ACP_AddonList)
end
end
 
 
 
function ACP:ReloadAddonList()
 
local builder = savedVar.sorter
if not builder then
builder = DEFAULT
end
 
local func = addonListBuilders[builder]
if not func then
func = addonListBuilders[DEFAULT]
end
 
func()
 
self:RebuildSortedAddonList()
ACP:AddonList_OnShow()
 
 
ACP_AddonListSortDropDownText:SetText(builder)
local button = _G[ACP_FRAME_NAME.."SortDropDown"]
UIDropDownMenu_SetSelectedValue( button, builder)
 
end
 
--function ACP:OnKeyDown(this, key)
-- -- print(this, key)
-- if ( key == "ESCAPE" ) then
-- HideUIPanel(ACP_AddonList);
-- elseif ( key == "PRINTSCREEN" ) then
-- Screenshot();
-- elseif ( key == "PAGEUP" ) then
-- ScrollFrameTemplate_OnMouseWheel(ACP_AddonList_ScrollFrame, 1)
-- elseif ( key == "PAGEDOWN" ) then
-- ScrollFrameTemplate_OnMouseWheel(ACP_AddonList_ScrollFrame, -1)
-- end
--end
 
 
 
--
-- Shift will invert the use of recursion
-- Ctrl will invert the use of LoD children
--
function ACP:EnableAddon(addon, shift, ctrl)
local norecurse = ACP_Data.NoRecurse
if shift then norecurse = not norecurse end
 
local nochildren = ACP_Data.NoChildren
if ctrl then nochildren = not nochildren end
 
if norecurse then
EnableAddOn(addon)
else
local name = GetAddOnInfo(addon)
ACP_EnableRecurse(name, nochildren)
end
end
 
function ACP:ReadDependencies(t, ...)
for k in pairs(t) do
t[k] = nil
end
for i=1, select('#', ...) do
local name = select(i, ...)
if name then
t[name] = true
end
end
return t
end
 
function ACP:EnableDependencies(addon)
local deps = self:ReadDependencies(acquire(), GetAddOnDependencies(addon))
 
if next(deps) then
for k in pairs(deps) do
self:EnableAddon(k)
end
end
 
reclaim(deps)
 
end
 
function ACP:FindAddon(list, name)
for i, v in ipairs(list) do
if v == name then
return true
end
end
return nil
end
 
function ACP:FindAddonKey(list, name)
for k, v in pairs(list) do
if k == name then
return true
end
end
return nil
end
 
 
function ACP:Print(msg, r, g, b)
DEFAULT_CHAT_FRAME:AddMessage("ACP: ".. msg, r, g, b)
end
 
function ACP:CollapseAll(collapse)
local categories = {}
 
for i, addon in ipairs(masterAddonList) do
if type(addon) == 'table' and addon.category then
table.insert(categories, addon.category)
end
end
 
 
for i, category in ipairs(categories) do
collapsedAddons[category] = collapse
end
 
self:RebuildSortedAddonList()
end
 
function ACP:SaveSet(set)
if not savedVar.AddonSet then
savedVar.AddonSet = {}
end
 
if not savedVar.AddonSet[set] then
savedVar.AddonSet[set] = {}
end
 
local addonSet = savedVar.AddonSet[set]
 
local setName = addonSet.name
for k in pairs(addonSet) do
addonSet[k] = nil
end
 
addonSet.name = setName
 
local name, enabled
for i = 1, GetNumAddOns() do
name, _, _, enabled = GetAddOnInfo(i)
if enabled and name ~= ACP_ADDON_NAME then
table.insert(addonSet, name)
end
end
 
self:Print(L["Addons [%s] Saved."]:format(self:GetSetName(set)) )
 
end
 
function ACP:GetSetName(set)
if set == ACP_DEFAULT_SET then
return L["Default"]
elseif set == playerClass then
return playerClass
elseif savedVar and savedVar.AddonSet and savedVar.AddonSet[set] and savedVar.AddonSet[set].name then
return savedVar.AddonSet[set].name
else
return L["Set "] .. set
end
end
 
function ACP:UnloadSet(set)
 
local list
 
if set == ACP_DEFAULT_SET then
list = ACP_DefaultSet
else
if not savedVar or not savedVar.AddonSet or not savedVar.AddonSet[set] then return end
list = savedVar.AddonSet[set]
end
 
local name
for i = 1, GetNumAddOns() do
name = GetAddOnInfo(i)
if name ~= ACP_ADDON_NAME and ACP:FindAddon( list, name ) and not ACP:IsAddOnProtected(name) then
DisableAddOn(name)
end
end
 
self:Print(L["Addons [%s] Unloaded."]:format(self:GetSetName(set)) )
ACP:AddonList_OnShow()
end
 
function ACP:ClearSelectionAndLoadSet(set)
self:DisableAll_OnClick()
 
self:LoadSet(set)
end
 
function ACP:LoadSet(set)
local list
 
if set == ACP_DEFAULT_SET then
list = ACP_DefaultSet
else
if not savedVar or not savedVar.AddonSet or not savedVar.AddonSet[set] then return end
list = savedVar.AddonSet[set]
end
 
enabledList = acquire()
local name
for i = 1, GetNumAddOns() do
name = GetAddOnInfo(i)
if ACP:FindAddon( list, name ) then
self:EnableAddon(name)
end
end
 
reclaim(enabledList)
enabledList = nil
 
self:Print(L["Addons [%s] Loaded."]:format(self:GetSetName(set)) )
ACP:AddonList_OnShow()
 
end
 
function ACP:IsAddOnProtected(addon)
local addon = GetAddOnInfo(addon)
if addon and savedVar.ProtectedAddons then
return savedVar.ProtectedAddons[addon]
end
end
 
function ACP:Security_OnClick(addon)
local addon = GetAddOnInfo(addon)
if addon then
savedVar.ProtectedAddons = savedVar.ProtectedAddons or { ["ACP"] = true }
local prot = savedVar.ProtectedAddons[addon]
if prot then
savedVar.ProtectedAddons[addon] = nil
else
savedVar.ProtectedAddons[addon] = true
end
 
EnableAddOn(addon)
end
self:AddonList_OnShow()
end
 
function ACP:ShowSecurityTooltip(this)
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT")
 
GameTooltip:AddLine(L["Click to enable protect mode. Protected addons will not be disabled"])
GameTooltip:AddLine(L["when performing a reloadui."])
 
GameTooltip:Show()
end
 
 
function ACP:RenameSet(set, name)
 
local oldName = self:GetSetName(set)
if not savedVar then savedVar = {} end
if not savedVar.AddonSet then savedVar.AddonSet = {} end
if not savedVar.AddonSet[set] then savedVar.AddonSet[set] = {} end
savedVar.AddonSet[set].name = name
 
self:Print(L["Addons [%s] renamed to [%s]."]:format(oldName,name) )
 
end
 
-- Rebuild sortedAddonList from masterAddonList
 
function ACP:RebuildSortedAddonList()
for k in pairs(sortedAddonList) do
sortedAddonList[k] = nil
end
 
for i, addon in ipairs(masterAddonList) do
if type(addon) == 'table' then
local category = addon.category
if category then
table.insert(sortedAddonList, category)
end
if not category or not collapsedAddons[category] then
for j, subAddon in ipairs(addon) do
table.insert(sortedAddonList, subAddon)
end
end
else
--addon = GetAddonIndex(addon)
table.insert(sortedAddonList, addon)
end
end
 
-- ACP.masterAddonList = masterAddonList
-- ACP.sortedAddonList = sortedAddonList
end
 
function ACP:SetMasterAddonBuilder(sorter)
if not addonListBuilders[sorter] or not savedVar then return end
for k in pairs(collapsedAddons) do
collapsedAddons[k] = nil
end
savedVar.sorter = sorter
self:ReloadAddonList()
end
 
function ACP:UpdateLocale(loc)
for k, v in pairs(loc) do
if v == true then
L[k] = k
else
L[k] = v
end
end
end
 
 
-- UI Controllers.
function ACP:SortDropDown_OnShow(this)
if not self.initSortDropDown then
UIDropDownMenu_Initialize(this, function() self:SortDropDown_Populate() end)
self.initSortDropDown = true
end
end
 
function ACP:SortDropDown_Populate()
local info
for name, func in pairs(addonListBuilders) do
info = UIDropDownMenu_CreateInfo()
info.text = name
info.func = function() self:SetMasterAddonBuilder(name) end
UIDropDownMenu_AddButton(info)
end
end
 
function ACP:SortDropDown_OnClick(sorter)
 
end
 
function ACP:DisableAll_OnClick()
DisableAllAddOns()
EnableAddOn(ACP_ADDON_NAME)
 
for k in pairs(savedVar.ProtectedAddons) do
EnableAddOn(k)
end
self:AddonList_OnShow()
end
 
function ACP:Collapse_OnClick(obj)
 
local category = obj.category
if not category then return end
 
collapsedAddons[category] = toggle(collapsedAddons[category])
 
self:RebuildSortedAddonList()
self:AddonList_OnShow()
 
end
 
function ACP:CollapseAll_OnClick()
local obj = _G[ACP_FRAME_NAME.."CollapseAll"]
local icon = _G[ACP_FRAME_NAME.."CollapseAllIcon"]
obj.collapsed = toggle(obj.collapsed)
if obj.collapsed then
icon:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomInButton-Up")
else
icon:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomOutButton-Up")
end
self:CollapseAll(obj.collapsed)
self:AddonList_OnShow()
end
 
function ACP:GetAddonCategory(addon)
for i, a in ipairs(masterAddonList) do
if type(a) == 'table' then
if self:FindAddon(a, addon) then
return a.category
end
else
if a == addon then
return ""
end
end
end
end
 
function ACP:GetAddonCategoryTable(addon)
for i, a in ipairs(masterAddonList) do
if type(a) == 'table' then
if a.category == addon then
return a
end
else
if a == addon then
return nil
end
end
end
end
 
 
function ACP:AddonList_Enable(addonIndex,enabled, shift, ctrl, category)
if (type(addonIndex) == "number") then
if (enabled) then
enabledList = acquire()
self:EnableAddon(addonIndex, shift, ctrl)
reclaim(enabledList)
enabledList = nil
else
DisableAddOn(addonIndex)
end
 
if category and collapsedAddons[category] then
self:Print(CLR:Addon(category).." is collapsed. Setting all its addons "..CLR:Bool(enabled, (enabled and "ENABLED" or "DISABLED")))
local t = self:GetAddonCategoryTable(category)
for k,v in pairs(t) do
if enabled then
self:EnableAddon(v, shift, ctrl)
else
DisableAddOn(v)
end
end
end
end
self:AddonList_OnShow()
end
 
function ACP:AddonList_LoadNow(index)
UIParentLoadAddOn(index)
ACP:AddonList_OnShow()
end
 
function ACP:AddonList_OnShow(this)
local function setSecurity (obj, idx)
local width,height,iconWidth = 64,16,16
local increment = iconWidth/width
local left = (idx-1)*increment
local right = idx*increment
obj:SetTexCoord(left, right, 0, 1)
end
 
UpdateAddOnMemoryUsage()
 
local obj
local origNumAddons = GetNumAddOns()
numAddons = #sortedAddonList
FauxScrollFrame_Update(ACP_AddonList_ScrollFrame, numAddons, ACP_MAXADDONS, ACP_LINEHEIGHT, nil, nil, nil)
local i
local offset = FauxScrollFrame_GetOffset(ACP_AddonList_ScrollFrame)
local curr_category = ""
for i = 1, ACP_MAXADDONS, 1 do
obj = _G["ACP_AddonListEntry"..i]
local addonIdx = sortedAddonList[offset+i]
 
-- if not curr_category then
curr_category = self:GetAddonCategory(addonIdx) or ""
-- end
if offset+i > #sortedAddonList then
obj:Hide()
obj.addon = nil
else
local headerText = _G["ACP_AddonListEntry"..i.."Header"]
local titleText = _G["ACP_AddonListEntry"..i.."Title"]
local status = _G["ACP_AddonListEntry"..i.."Status"]
local checkbox = _G["ACP_AddonListEntry"..i.."Enabled"]
local securityButton = _G["ACP_AddonListEntry"..i.."Security"]
local securityIcon = _G["ACP_AddonListEntry"..i.."SecurityIcon"]
local loadnow = _G["ACP_AddonListEntry"..i.."LoadNow"]
local collapse = _G["ACP_AddonListEntry"..i.."Collapse"]
local collapseIcon = _G["ACP_AddonListEntry"..i.."CollapseIcon"]
 
 
if type(addonIdx) == 'string' and not GetAddonIndex(addonIdx, true) then
-- curr_category = addonIdx
obj.addon = nil
obj.category = addonIdx
obj:Show()
headerText:SetText(addonIdx)
headerText:Show()
titleText:Hide()
status:Hide()
checkbox:Hide()
securityButton:Hide()
loadnow:Hide()
if collapsedAddons[addonIdx] then
collapseIcon:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomInButton-Up")
else
collapseIcon:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomOutButton-Up")
end
collapse:Show()
else
if type(addonIdx) == 'string' then
obj.category = addonIdx
-- curr_category = addonIdx
if collapsedAddons[addonIdx] then
collapseIcon:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomInButton-Up")
else
collapseIcon:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomOutButton-Up")
end
collapse:Show()
securityButton:Hide()
addonIdx = GetAddonIndex(addonIdx, true)
else
obj.category = nil
collapse:Hide()
 
if curr_category == "" then
securityButton:Show()
else
securityButton:Hide()
end
end
obj:Show()
headerText:Hide()
titleText:Show()
status:Show()
 
local subCount = nil
if collapsedAddons[obj.category] then
local t = self:GetAddonCategoryTable(obj.category)
subCount = t and #t
end
 
local name, title, notes, enabled, loadable, reason, security
if (addonIdx > origNumAddons) then
name = ACP_BLIZZARD_ADDONS[(addonIdx-origNumAddons)]
name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(name)
-- obj.addon = name
-- title = L[name]
-- notes = ""
-- enabled = 1
-- loadable = 1
-- if (IsAddOnLoaded(name)) then
-- reason = "LOADED"
-- loadable = 1
-- end
-- security = "SECURE"
obj.addon = name
else
name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(addonIdx)
obj.addon = addonIdx
end
local loaded = IsAddOnLoaded(name)
local ondemand = IsAddOnLoadOnDemand(name)
if (loadable) then
titleText:SetTextColor(1,0.78,0)
elseif (enabled and reason ~= "DEP_DISABLED") then
titleText:SetTextColor(1,0.1,0.1)
else
titleText:SetTextColor(0.5,0.5,0.5)
end
 
if (title) then
 
if subCount and subCount > 0 then
title = title .. " |cffffffff(|r"..tostring(subCount).."|cffffffff)|r"
end
 
title = title:gsub(" |cff7fff7f %-Ace2%-|r", ""):gsub("%-Ace2%-", ""):trim()
 
if not (loaded or loadable) then
titleText:SetText(title:gsub("|c%x%x%x%x%x%x%x%x", ""):gsub("|r", ""))
else
titleText:SetText(formattitle(title))
end
else
titleText:SetText(name)
end
 
-- checkbox:ClearAllPoints()
if curr_category == "" then
checkbox:SetPoint("LEFT", 5, 0)
if collapse:IsShown() then
checkbox:SetWidth(32)
checkbox:SetHeight(32)
else
checkbox:SetWidth(32)
checkbox:SetHeight(32)
end
else
checkbox:SetPoint("LEFT", 21, 0)
checkbox:SetWidth(16)
checkbox:SetHeight(16)
end
 
if (name == ACP_ADDON_NAME or addonIdx > origNumAddons) then
checkbox:Hide()
else
checkbox:Show()
checkbox:SetChecked(enabled)
end
 
if addonIdx < origNumAddons and
savedVar.ProtectedAddons[name] then
setSecurity(securityIcon,4)
securityButton:Show()
checkbox:Hide()
else
-- if (security == "SECURE") then
-- setSecurity(securityIcon,1)
-- elseif (security == "INSECURE") then
-- setSecurity(securityIcon,2)
-- elseif (security == "BANNED") then -- wtf?
-- setSecurity(securityIcon,3)
-- end
 
local compat = self:GetAddonCompatibilitySummary(addonIdx)
 
if compat ~= nil then
setSecurity(securityIcon,1)
else
setSecurity(securityIcon,2)
end
 
end
 
--[[
if (reason) then
status:SetText(TEXT(_G["ADDON_"..reason)))
elseif (loaded) then
status:SetText(L["Loaded"])
elseif (ondemand) then
status:SetText(L["Loaded on demand."])
else
status:SetText("")
end
]] if addonIdx <= origNumAddons then
status:SetText(CLR:Colorize(self:GetAddonStatus(addonIdx)))
end
 
if (not loaded and enabled and ondemand) then
loadnow:Show()
else
loadnow:Hide()
end
end
end
 
end
end
 
function ACP:SetButton_OnClick(this)
if not self.dropDownFrame then
local frame = CreateFrame("Frame", "ACP_SetDropDown", nil, "UIDropDownMenuTemplate")
UIDropDownMenu_Initialize(frame, ACP.SetDropDown_Populate, "MENU") -- wotlk temp hack fixing the UIDropDown menu not displayed after pressing "Sets" button
self.dropDownFrame = frame
end
ToggleDropDownMenu(1, nil, self.dropDownFrame, this, 0, 0)
end
 
 
function ACP:SetDropDown_Populate(level)
self = ACP -- wotlk temp hack fixing the UIDropDown menu not displayed after pressing "Sets" button
if not savedVar then return end
 
if level == 1 then
 
local info, count, name
for i = 1, ACP_SET_SIZE do
local name = nil
 
info = UIDropDownMenu_CreateInfo()
if savedVar.AddonSet and savedVar.AddonSet[i] then
count = table.getn(savedVar.AddonSet[i])
else
count = 0
end
 
name = self:GetSetName(i)
 
info = UIDropDownMenu_CreateInfo()
info.text = string.format("%s (%d)", name, count)
info.value = i
info.hasArrow = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info)
end
 
-- Class set.
if savedVar.AddonSet and savedVar.AddonSet[playerClass] then
count = table.getn(savedVar.AddonSet[playerClass])
else
count = 0
end
info = UIDropDownMenu_CreateInfo()
info.text = string.format("%s (%d)", playerClass, count)
info.value = playerClass
info.hasArrow = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info)
 
-- Default set.
info = UIDropDownMenu_CreateInfo()
info.text = string.format("%s (%d)", L["Default"], table.getn(ACP_DefaultSet))
info.value = ACP_DEFAULT_SET
info.hasArrow = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info)
 
elseif level == 2 then
local info
local setName = self:GetSetName(UIDROPDOWNMENU_MENU_VALUE)
info = UIDropDownMenu_CreateInfo()
info.text = setName
info.isTitle = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
 
 
if UIDROPDOWNMENU_MENU_VALUE ~= ACP_DEFAULT_SET then
info = UIDropDownMenu_CreateInfo()
info.text = L["Save"]
info.func = function()
self.savingSet = UIDROPDOWNMENU_MENU_VALUE
StaticPopup_Show("ACP_SAVESET", setName)
end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
end
 
info = UIDropDownMenu_CreateInfo()
info.text = L["Load"]
info.func = function() self:ClearSelectionAndLoadSet(UIDROPDOWNMENU_MENU_VALUE) end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
 
 
info = UIDropDownMenu_CreateInfo()
info.text = L["Add to current selection"]
info.func = function() self:LoadSet(UIDROPDOWNMENU_MENU_VALUE) end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
 
 
info = UIDropDownMenu_CreateInfo()
info.text = L["Remove from current selection"]
info.func = function() self:UnloadSet(UIDROPDOWNMENU_MENU_VALUE) end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
 
if UIDROPDOWNMENU_MENU_VALUE ~= ACP_DEFAULT_SET and UIDROPDOWNMENU_MENU_VALUE ~= playerClass then
info = UIDropDownMenu_CreateInfo()
info.text = L["Rename"]
info.func = function()
self.renamingSet = UIDROPDOWNMENU_MENU_VALUE
StaticPopup_Show("ACP_RENAMESET", setName)
CloseDropDownMenus(1)
end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
end
 
end
 
 
 
end
 
 
 
 
 
do
-- /print ACP.embedded_libs
ACP.embedded_libs = {}
-- /print ACP.embedded_libs_owners
ACP.embedded_libs_owners = {}
 
 
function ACP:ADDON_LOADED(name)
if not LibStub then return end
self:LocateEmbeds()
 
if name == "ACP" or name:sub(9) == "Blizzard_" then
name = "???"
end
 
for k,v in pairs(ACP.embedded_libs_owners) do
if type(v) == "boolean" then
ACP.embedded_libs_owners[k] = name
end
end
 
end
 
-- /script ACP:LocateEmbeds()
function ACP:LocateEmbeds()
local embeds = LibStub.libs
 
for k,v in pairs(embeds) do
if self.embedded_libs[k] ~= v then
self.embedded_libs[k] = v
self.embedded_libs_owners[k] = true
end
end
end
end
 
function ACP:ShowTooltip(this, index)
if not index then return end
 
if type(index) == "number" and (index > GetNumAddOns()) then
index = ACP_BLIZZARD_ADDONS[(index-GetNumAddOns())]
end
 
local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(index)
local author = GetAddOnMetadata(name, "Author")
local version = ParseVersion(GetAddOnMetadata(name, "Version"))
local deps = { GetAddOnDependencies(index) }
 
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT")
if title then
GameTooltip:AddLine(formattitle(title), 1,0.78,0,1)
else
GameTooltip:AddLine(name, 1,0.78,0,1)
end
if author then
GameTooltip:AddLine(string.format("%s: %s", CLR:Label(L["Author"]), author), 1, 1, 1, 1)
end
if version then
GameTooltip:AddLine(string.format("%s: %s", CLR:Label(L["Version"]), version), 1, 1, 1, 1)
end
 
 
 
if notes then
GameTooltip:AddLine(notes, 1, 1, 1, 1)
else
GameTooltip:AddLine(L["No information available."], 1, 1, 1)
end
 
if reason then
GameTooltip:AddLine(CLR:Label(L["Status"])..": "..CLR:AddonStatus(self:GetAddonStatus(index)), 1, 1, 1, 1)
end
 
local depLine
local dep = deps[1]
if dep then
depLine = CLR:Label(L["Dependencies"])..": "..CLR:AddonStatus(dep, dep)
for i = 2, #deps do
dep = deps[i]
if dep and dep:len()>0 then
depLine = depLine..", "..CLR:AddonStatus(dep, dep)
end
end
GameTooltip:AddLine(depLine, 1, 1, 1, 1)
end
 
local metaXEmbeds = GetAddOnMetadata(name, "X-Embeds")
if metaXEmbeds ~= nil then
local deps = {strsplit(" ,", metaXEmbeds:trim())}
 
local dep = deps[1]
if dep then
depLine = CLR:Label(L["Embeds"])..": "..CLR:AddonStatus(dep, dep)
for i = 2, #deps do
dep = deps[i]
if dep and dep:len()>0 then
depLine = depLine..", "..CLR:AddonStatus(dep, dep)
end
end
GameTooltip:AddLine(depLine, 1,0.78,0, 1)
end
end
 
local actives = nil
for k,v in pairs(self.embedded_libs_owners) do
if v == name then
if actives == nil then
actives = CLR:Label(L["Active Embeds"])..": "..CLR:ActiveEmbed(k)
else
actives = actives..", "..CLR:ActiveEmbed(k)
end
end
end
if actives then
GameTooltip:AddLine(actives, 1,0.78,0, 1)
end
 
--UpdateAddOnMemoryUsage()
local mem = GetAddOnMemoryUsage(index)
local text2
if mem > 1024 then
text2 = ("|cff8080ff%.2f|r MiB"):format(mem / 1024)
else
text2 = ("|cff8080ff%.0f|r KiB"):format(mem)
end
 
GameTooltip:AddLine(CLR:Label(L["Memory Usage"])..": "..text2, 1,0.78,0, 1)
 
 
 
 
local high, low = self:IsAddonCompatibleWithCurrentIntefaceVersion(index)
 
if low == false then
GameTooltip:AddLine(CLR:Label("Compatible")..": ".. CLR:Bool(false, NO), 1,0.78,0, 1)
elseif high == false then
GameTooltip:AddLine(CLR:Label("Compatible")..": ".. CLR:Bool(false, NO), 1,0.78,0, 1)
elseif high or low then
GameTooltip:AddLine(CLR:Label("Compatible")..": ".. CLR:Bool(true, YES), 1,0.78,0, 1)
end
 
 
 
GameTooltip:Show()
end
 
 
function ACP:ShowHintTooltip(this, index)
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT")
 
GameTooltip:AddLine(L["Use SHIFT to override the current enabling of dependancies behaviour."])
 
GameTooltip:Show()
end
 
local function build_string(...)
local s
for i=1,select("#", ...) do
local x = select(i, ...)
if x and x:len()>0 then
s = s and (s..", "..x) or x
end
end
return s
end
 
local function find_iterate_over(name, ...)
for i=1,select("#", ...) do
local x = select(i, ...)
if x and x:len()>0 and x == name then
return true
end
end
return false
end
 
local function iterate_over(...)
for i=1,select("#", ...) do
local x = select(i, ...)
if x and x:len()>0 then
EnableAddOn(x)
end
end
end
 
local function recursive_iterate_over(...)
for i=1,select("#", ...) do
local x = select(i, ...)
if x and x:len()>0 then
ACP_EnableRecurse(x, true)
end
end
end
 
local function enable_lod_dependants(addon)
local addon_name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(addon)
 
-- dont do this for FuBar, its annoying
if addon_name == "FuBar" then
return
end
 
for i=1, GetNumAddOns() do
local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(i)
local isdep = find_iterate_over(addon_name, GetAddOnDependencies(name))
local ondemand = IsAddOnLoadOnDemand(name)
 
if not isdep then
local metaXEmbeds = GetAddOnMetadata(name, "X-Embeds")
if metaXEmbeds then
isdep = find_iterate_over(addon_name, strsplit(" ,", metaXEmbeds:trim()))
end
end
 
if isdep and not enabled and ondemand then
ACP_EnableRecurse(name, true)
--EnableAddOn(name)
end
end
end
 
function ACP_EnableRecurse(name, skip_children)
local _, _, _, enabled = GetAddOnInfo(name)
if enabled then
return
 
end
 
if (type(name) == "string" and strlen(name)>0) or
(type(name) == "number" and name > 0) then
 
EnableAddOn(name)
 
if not skip_children then
enable_lod_dependants(name)
end
 
recursive_iterate_over(GetAddOnDependencies(name))
 
local metaXEmbeds = GetAddOnMetadata(name, "X-Embeds")
if metaXEmbeds then
recursive_iterate_over(strsplit(" ,", metaXEmbeds:trim()))
end
else
-- self:Print(L["Addon <%s> not valid"]:format(tostring(name)))
end
end
 
if (GetLocale() == "zhCN") then
ACP:UpdateLocale(
 
{
["ACP: Some protected addons aren't loaded. Reload now?"] = "ACP:部分受保护插件没有被加载。现在重载插件么?",
["Active Embeds"] = "单独使用",
AddOns = "插件管理",
["Addon <%s> not valid"] = "无效的插件:<%s>",
["Addons [%s] Loaded."] = "插件设置[%s]已加载。",
["Addons [%s] renamed to [%s]."] = "插件设置[%s]已改名为[%s]。",
["Addons [%s] Saved."] = "插件设置[%s]已保存。",
["Addons [%s] Unloaded."] = "插件设置[%s]已卸载。",
["Add to current selection"] = "添加当前选择",
Author = "作者",
Blizzard_AchievementUI = "Blizzard: Achievement",
Blizzard_AuctionUI = "Blizzard: Auction",
Blizzard_BarbershopUI = "Blizzard: Barbershop",
Blizzard_BattlefieldMinimap = "Blizzard: Battlefield Minimap",
Blizzard_BindingUI = "Blizzard: Binding",
Blizzard_Calendar = "Blizzard: Calendar",
Blizzard_CombatLog = "Blizzard: Combat Log",
Blizzard_CombatText = "Blizzard: Combat Text",
Blizzard_FeedbackUI = "Blizzard: Feedback",
Blizzard_GlyphUI = "Blizzard: Glyph",
Blizzard_GMSurveyUI = "Blizzard: GM Survey",
Blizzard_GuildBankUI = "Blizzard: GuildBank",
Blizzard_InspectUI = "Blizzard: Inspect",
Blizzard_ItemSocketingUI = "Blizzard: Item Socketing",
Blizzard_MacroUI = "Blizzard: Macro",
Blizzard_RaidUI = "Blizzard: Raid",
Blizzard_TalentUI = "Blizzard: Talent",
Blizzard_TimeManager = "Blizzard: TimeManager",
Blizzard_TokenUI = "Blizzard: Token",
Blizzard_TradeSkillUI = "Blizzard: Trade Skill",
Blizzard_TrainerUI = "Blizzard: Trainer",
Blizzard_VehicleUI = "Blizzard: Vehicle",
["Click to enable protect mode. Protected addons will not be disabled"] = "点击启用保护模式。受保护插件不会被禁用。",
Close = "关闭",
Default = "默认",
Dependencies = "依赖",
["Disable All"] = "全部禁用",
["Disabled on reloadUI"] = "重载插件后禁用",
Embeds = "内置",
["Enable All"] = "全部启用",
["*** Enabling <%s> %s your UI ***"] = "*** 启用 <%s>,%s 你的插件 ***",
["Enter the new name for [%s]:"] = "输入[%s]的新名字:",
Load = "加载",
["Loadable OnDemand"] = "需要时加载",
Loaded = "已加载",
["Loaded on demand."] = "需要时加载。",
["LoD Child Enable is now %s"] = "需要时加载的子插件:%s",
["Memory Usage"] = "内存占用",
["No information available."] = "无可用信息。",
Recursive = "递归",
["Recursive Enable is now %s"] = "递归加载的插件:%s",
Reload = "重载",
ReloadUI = "重载插件",
["Reload your User Interface?"] = "重载插件?",
["Remove from current selection"] = "移除当前选择",
Rename = "重命名",
Save = "保存",
["Save the current addon list to [%s]?"] = "保存当前插件设置为[%s]?",
["Set "] = "配置:",
Sets = "配置",
Status = "状态",
["*** Unknown Addon <%s> Required ***"] = "*** 需要未知插件 <%s> ***",
["Use SHIFT to override the current enabling of dependancies behaviour."] = "使用 Shift 键无视目前的递归设定。",
Version = "版本",
["when performing a reloadui."] = "重载插件时。",
}
 
 
)
end
\ No newline at end of file
Eui/script/font.lua New file
0,0 → 1,117

local function SetFont(obj, font, size, style, r, g, b, sr, sg, sb, sox, soy)
obj:SetFont(font, size, style)
if sr and sg and sb then obj:SetShadowColor(sr, sg, sb) end
if sox and soy then obj:SetShadowOffset(sox, soy) end
if r and g and b then obj:SetTextColor(r, g, b)
elseif r then obj:SetAlpha(r) end
end
 
 
-- To alter the fonts here is how the SetFont command works.
-- You can use ONE of the 4 types. To not use a specific variable simply replace
-- its value with the word "nil" without the quotes.
--
-- Syntax:
-- Simple:
-- SetFont(BLIZZARD_NAME, FONT_NAME, FONT_SIZE, style);
-- where:
-- FONT_NAME = one of the font names defined above
-- FONT_SIZE = one of the font sizes defined above
-- style = a blizzard style variable.
-- Style vars: nil, "OUTLINE", "THICKOUTLINE", "MONOCHROME",
-- "OUTLINE, MONOCHROME", "THICKOUTLINE, MONOCHROME"
--
-- Alpha:
-- SetFont(BLIZZARD_NAME, FONT_NAME, FONT_SIZE, style, alpha);
-- where:
-- alpha = opacity level from 0-255 for the font
--
-- Color:
-- SetFont(BLIZZARD_NAME, FONT_NAME, FONT_SIZE, style, alpha, r, g, b, shadow_r, shadow_g, shadow_b, shadow_x, shadow_y);
-- where:
-- r,g,b = color values from 0-255 for red, blue and green of the font
--
-- Shadow:
-- SetFont(BLIZZARD_NAME, FONT_NAME, FONT_SIZE, style, alpha, r, g, b, shadow_r, shadow_g, shadow_b, shadow_x, shadow_y);
-- where:
-- shadow_r,shadow_g,shadow_b = shadow color values from 0-255 for red, blue and green of the shadow
-- shadow_x, shadow_y = numeric offset for x and y.
-- for x: negative moves left, positive moves right
-- for y: negative moves up, positive moves down
 
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", function()
local Normal = STANDARD_TEXT_FONT
-- local fontn = [[Interface\AddOns\Eui\media\fontn.ttf]]
local fontn = STANDARD_TEXT_FONT
UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = 12
 
-- Game engine fonts
UNIT_NAME_FONT = Normal
NAMEPLATE_FONT = Normal
-- DAMAGE_TEXT_FONT = Normal
STANDARD_TEXT_FONT = Normal
 
-- Base fonts
SetFont(AchievementFont_Small, Normal, 12)
SetFont(InvoiceFont_Med, Normal, 13, nil, 0.15, 0.09, 0.04)
SetFont(InvoiceFont_Small, Normal, 11, nil, 0.15, 0.09, 0.04)
SetFont(MailFont_Large, Normal, 15, nil, 0.15, 0.09, 0.04, 0.54, 0.4, 0.1, 1, -1)
SetFont(NumberFont_OutlineThick_Mono_Small, Normal, 13, "OUTLINE")
SetFont(NumberFont_Outline_Huge, Normal, 30, "THICKOUTLINE", 30)
SetFont(NumberFont_Outline_Large, Normal, 15, "OUTLINE") --任务奖励部分数字
SetFont(NumberFont_Outline_Med, fontn, 10, "OUTLINE") --背包堆叠数字
SetFont(NumberFont_Shadow_Med, Normal, 14)
SetFont(NumberFont_Shadow_Small, Normal, 12)
SetFont(QuestFont_Large, Normal, 16)
SetFont(QuestFont_Shadow_Huge, Normal, 19, nil, nil, nil, nil, 0.54, 0.4, 0.1)
SetFont(ReputationDetailFont, Normal, 12, nil, nil, nil, nil, 0, 0, 0, 1, -1)
SetFont(SpellFont_Small, Normal, 11)
SetFont(SystemFont_InverseShadow_Small, Normal, 11)
SetFont(SystemFont_Large, Normal, 17)
SetFont(SystemFont_Med1, Normal, 13)
SetFont(SystemFont_Med2, Normal, 14, nil, 0.15, 0.09, 0.04)
SetFont(SystemFont_Med3, Normal, 15)
SetFont(SystemFont_OutlineThick_Huge2, Normal, 22, "THICKOUTLINE")
SetFont(SystemFont_OutlineThick_Huge4, Normal, 27, "THICKOUTLINE")
SetFont(SystemFont_OutlineThick_WTF, Normal, 31, "THICKOUTLINE", nil, nil, nil, 0, 0, 0, 1, -1)
SetFont(SystemFont_Outline_Small, Normal, 13, "OUTLINE")
SetFont(SystemFont_Shadow_Huge1, Normal, 20)
SetFont(SystemFont_Shadow_Huge3, Normal, 25)
SetFont(SystemFont_Shadow_Large, Normal, 17)
SetFont(SystemFont_Shadow_Med1, Normal, 13)
SetFont(SystemFont_Shadow_Med3, Normal, 15)
SetFont(SystemFont_Shadow_Outline_Huge2, Normal, 22, "OUTLINE")
SetFont(SystemFont_Shadow_Small, Normal, 12) -- 人物面板属性字体
SetFont(SystemFont_Small, Normal, 12)
SetFont(SystemFont_Tiny, Normal, 11)
SetFont(GameTooltipHeader, Normal, 13, "OUTLINE")
SetFont(Tooltip_Med, Normal, 12)
SetFont(Tooltip_Small, Normal, 11)
 
-- Derived fonts
SetFont(BossEmoteNormalHuge, Normal, 27, "THICKOUTLINE")
SetFont(CombatTextFont, Normal, 26)
SetFont(ErrorFont, Normal, 13, nil, 60)
SetFont(QuestFontNormalSmall, Normal, 13, nil, nil, nil, nil, 0.54, 0.4, 0.1)
SetFont(WorldMapTextFont, Normal, 31, "THICKOUTLINE", 40, nil, nil, 0, 0, 0, 1, -1)
 
-- Zone fonts
SetFont(ZoneTextString, Normal, 20, "OUTLINE");
SetFont(PVPInfoTextString, Normal, 20, "OUTLINE");
SetFont(SubZoneTextString, Normal, 20, "OUTLINE");
PVPInfoTextString:SetText("");
 
CHAT_FONT_HEIGHTS = {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}
for i=1,7 do
local f = _G["ChatFrame"..i]
local font, size = f:GetFont()
f:SetFont(Normal, size)
end
 
local function FixTitleFont() for _,butt in pairs(PlayerTitlePickerScrollFrame.buttons) do butt.text:SetFontObject(GameFontHighlightSmallLeft) end end
hooksecurefunc("PlayerTitleFrame_UpdateTitles", FixTitleFont)
FixTitleFont()
end)
\ No newline at end of file
Eui/script/Focuser.lua New file
0,0 → 1,51
local E, C = unpack(select(2, ...))
if C["other"].focuser ~= true then return end
 
local modifier = "shift" -- shift, alt or ctrl
local mouseButton = "1" -- 1 = left, 2 = right, 3 = middle, 4 and 5 = thumb buttons if there are any
 
local function SetFocusHotkey(frame)
frame:SetAttribute(modifier.."-type"..mouseButton,"focus")
end
 
local function CreateFrame_Hook(type, name, parent, template)
if name and template == "SecureUnitButtonTemplate" then
SetFocusHotkey(_G[name])
end
end
 
hooksecurefunc("CreateFrame", CreateFrame_Hook)
 
-- Keybinding override so that models can be shift/alt/ctrl+clicked
local f = CreateFrame("CheckButton", "FocuserButton", UIParent, "SecureActionButtonTemplate")
f:SetAttribute("type1","macro")
f:SetAttribute("macrotext","/focus mouseover")
SetOverrideBindingClick(FocuserButton,true,modifier.."-BUTTON"..mouseButton,"FocuserButton")
 
-- Set the keybindings on the default unit frames since we won't get any CreateFrame notification about them
local duf = {
PlayerFrame,
PetFrame,
PartyMemberFrame1,
PartyMemberFrame2,
PartyMemberFrame3,
PartyMemberFrame4,
PartyMemberFrame1PetFrame,
PartyMemberFrame2PetFrame,
PartyMemberFrame3PetFrame,
PartyMemberFrame4PetFrame,
TargetFrame,
TargetofTargetFrame,
oUF_monoPlayerFrame,
oUF_monoTargetFrame,
oUF_mono_ToTFrame,
oUF_mono_FoTFrame,
oUF_AftermathhPlayer,
oUF_AftermathhTarget,
oUF_AftermathhTargettarget,
oUF_AftermathhFocustarget,
}
 
for i,frame in pairs(duf) do
SetFocusHotkey(frame)
end
\ No newline at end of file
Eui/script/omnicc.lua New file
0,0 → 1,116
local E, C = unpack(select(2, ...))
if C["other"].cooldown ~= true then return end
--[[
OmniCC Basic
A featureless, 'pure' version of OmniCC.
This version should work on absolutely everything, but I've removed pretty much all of the options
--]]
 
local ICON_SIZE = 40 --the normal size for an icon (don't change this)
local FONT_SIZE = 20 --the base font size to use at a scale of 1
local MIN_SCALE = 0.2 --the minimum scale we want to show cooldown counts at, anything below this will be hidden
local MIN_DURATION = 3 --the minimum duration to show cooldown text for
local DAY, HOUR, MINUTE = 86400, 3600, 60
if C["filter"].float == true then
E.fontc = [[Interface\AddOns\Eui\media\fontc.ttf]]
end
--omg speed
local format = string.format
local floor = math.floor
local min = math.min
 
local function GetFormattedTime(s)
if s >= DAY then
return format('%dd', floor(s/DAY + 0.5)), s % DAY
elseif s >= HOUR then
return format('%dh', floor(s/HOUR + 0.5)), s % HOUR
elseif s >= MINUTE then
return format('%dm', floor(s/MINUTE + 0.5)), s % MINUTE
end
if C["filter"].float ~= true then
if s < MINUTE then
return floor(s + 0.5), s - floor(s)
end
else
if s >= 10 and s < MINUTE then
return floor(s + 0.5), s - floor(s)
elseif s < 10 then
return format('%0.1f',s), 0.1
end
end
end
 
local function Timer_OnUpdate(self, elapsed)
if self.text:IsShown() then
if self.nextUpdate > 0 then
self.nextUpdate = self.nextUpdate - elapsed
else
if (self:GetEffectiveScale()/UIParent:GetEffectiveScale()) < MIN_SCALE then
self.text:SetText('')
self.nextUpdate = 1
else
local remain = self.duration - (GetTime() - self.start)
if floor(remain + 0.5) > 0 then
local time, nextUpdate = GetFormattedTime(remain)
-- if remain > 599 then self.text:SetFont(fontc, FONT_SIZE *(min(self:GetParent():GetWidth() / ICON_SIZE, 1)) -1,'OUTLINE') end
self.text:SetText(time)
self.nextUpdate = nextUpdate
else
self.text:Hide()
end
end
end
end
end
 
local function Timer_Create(self)
local scale = min(self:GetParent():GetWidth() / ICON_SIZE, 1)
local remain = self.duration - (GetTime() - self.start)
if (scale < MIN_SCALE) then
self.noOCC = true
-- elseif remain > 60 and self:GetParent().noOCC == true then
-- self.noOCC = true
elseif self:GetParent().noOCC then
self.noOCC = true
else
local text = self:CreateFontString(nil, 'OVERLAY')
 
text:SetPoint('CENTER', 0, 1)
 
if FONT_SIZE * scale < 9 then
text:SetFont(E.fontc, 9, 'OUTLINE')
else
text:SetFont(E.fontc, FONT_SIZE * scale, 'OUTLINE')
end
 
text:SetTextColor(1,.9,0)
 
self.text = text
self:SetScript('OnUpdate', Timer_OnUpdate)
return text
end
end
 
local function Timer_Start(self, start, duration)
self.start = start
self.duration = duration
self.nextUpdate = 0
 
local text = self.text or (not self.noOCC and Timer_Create(self))
if text then
text:Show()
end
end
 
--ActionButton1Cooldown here, is something we think will always exist
local methods = getmetatable(_G['ActionButton1Cooldown']).__index
hooksecurefunc(methods, 'SetCooldown', function(self, start, duration)
if start > 0 and duration > MIN_DURATION then
Timer_Start(self, start, duration)
else
local text = self.text
if text then
text:Hide()
end
end
end)
\ No newline at end of file
Eui/script/tradetabs.lua New file
0,0 → 1,135
local E, C = unpack(select(2, ...))
if C["other"].tab ~= true then return end
local TradeTabs = CreateFrame("Frame","TradeTabs")
 
local tradeSpells = { -- Spell order in this table determines the tab order
28596, -- Alchemy
29844, -- Blacksmithing
28029, -- Enchanting
30350, -- Engineering
45357, -- Inscription
28897, -- Jewel Crafting
32549, -- Leatherworking
53428, -- Runeforging
2656, -- Smelting
26790, -- Tailoring
 
33359, -- Cooking
27028, -- First Aid
 
13262, -- Disenchant
51005, -- Milling
31252, -- Prospecting
818, -- Basic Campfire
}
 
function TradeTabs:OnEvent(event,...)
self:UnregisterEvent(event)
if not IsLoggedIn() then
self:RegisterEvent(event)
elseif InCombatLockdown() then
self:RegisterEvent("PLAYER_REGEN_ENABLED")
else
self:Initialize()
end
end
 
 
function TradeTabs:Initialize()
if self.initialized or not IsAddOnLoaded("Blizzard_TradeSkillUI") then return end -- Shouldn't need this, but I'm paranoid
 
for i=1,#tradeSpells do
local n = GetSpellInfo(tradeSpells[i])
tradeSpells[n] = -1
tradeSpells[i] = n
end
 
local parent = TradeSkillFrame
if SkilletFrame then
parent = SkilletFrame
self:UnregisterAllEvents()
elseif ATSWFrame then -- ATSW support
parent = ATSWFrame
self:UnregisterAllEvents()
end
 
for i=1,MAX_SPELLS do
local n = GetSpellName(i,"spell")
if tradeSpells[n] then
tradeSpells[n] = i
end
end
 
local prev
for i,spell in ipairs(tradeSpells) do
local spellid = tradeSpells[spell]
if type(spellid) == "number" and spellid > 0 then
local tab = self:CreateTab(spell,spellid,parent)
local point,relPoint,x,y = "TOPLEFT","BOTTOMLEFT",0,-17
if not prev then
prev,relPoint,x,y = parent,"TOPRIGHT",-33,-44
if (parent == SkilletFrame) or Skinner then x = 0 end -- Special case. ew
end
tab:SetPoint(point,prev,relPoint,x,y)
prev = tab
end
end
 
self.initialized = true
end
 
local function onEnter(self)
GameTooltip:SetOwner(self,"ANCHOR_RIGHT") GameTooltip:SetText(self.tooltip)
self:GetParent():LockHighlight()
end
 
local function onLeave(self)
GameTooltip:Hide()
self:GetParent():UnlockHighlight()
end
 
local function updateSelection(self)
if IsCurrentSpell(self.spellID,"spell") then
self:SetChecked(true)
self.clickStopper:Show()
else
self:SetChecked(false)
self.clickStopper:Hide()
end
end
 
local function createClickStopper(button)
local f = CreateFrame("Frame",nil,button)
f:SetAllPoints(button)
f:EnableMouse(true)
f:SetScript("OnEnter",onEnter)
f:SetScript("OnLeave",onLeave)
button.clickStopper = f
f.tooltip = button.tooltip
f:Hide()
end
 
 
function TradeTabs:CreateTab(spell,spellID,parent)
local button = CreateFrame("CheckButton",nil,parent,"SpellBookSkillLineTabTemplate,SecureActionButtonTemplate")
button.tooltip = spell
button:Show()
button:SetAttribute("type","spell")
button:SetAttribute("spell",spell)
button.spellID = spellID
button:SetNormalTexture(GetSpellTexture(spellID, "spell"))
 
button:SetScript("OnEvent",updateSelection)
button:RegisterEvent("TRADE_SKILL_SHOW")
button:RegisterEvent("TRADE_SKILL_CLOSE")
button:RegisterEvent("CURRENT_SPELL_CAST_CHANGED")
 
createClickStopper(button)
updateSelection(button)
return button
end
 
TradeTabs:RegisterEvent("TRADE_SKILL_SHOW")
TradeTabs:SetScript("OnEvent",TradeTabs.OnEvent)
 
TradeTabs:Initialize()
Eui/script/drag.lua New file
0,0 → 1,177
local addon = CreateFrame("Frame")
 
-- Used to detect 4.0 clients (TOC >= 40000)
local cata = select(4, GetBuildInfo()) >= 40000
 
-- Based on the frame list from NDragIt by Nemes.
-- These frames are hooked on login.
local frames = {
-- ["FrameName"] = true (the parent frame should be moved) or false (the frame itself should be moved)
 
-- Blizzard Frames
["SpellBookFrame"] = false,
["QuestLogFrame"] = false,
["QuestLogDetailFrame"] = false,
["FriendsFrame"] = false,
["LFGParentFrame"] = false,
["LFDQueueFrame"] = true,
["LFRQueueFrame"] = true,
["LFRBrowseFrame"] = true,
["KnowledgeBaseFrame"] = true,
["HelpFrame"] = false,
["GossipFrame"] = false,
["MerchantFrame"] = false,
["MailFrame"] = false,
["OpenMailFrame"] = false,
["GuildRegistrarFrame"] = false,
["DressUpFrame"] = false,
["TabardFrame"] = false,
["TaxiFrame"] = false,
["QuestFrame"] = false,
["TradeFrame"] = false,
["LootFrame"] = false,
["PetStableFrame"] = false,
["StackSplitFrame"] = false,
["PetitionFrame"] = false,
["WorldStateScoreFrame"] = false,
["BattlefieldFrame"] = false,
["ArenaFrame"] = false,
["ItemTextFrame"] = false,
["GameMenuFrame"] = false,
["InterfaceOptionsFrame"] = false,
["MacOptionsFrame"] = false,
["PetPaperDollFrame"] = true,
["PetPaperDollFrameCompanionFrame"] = "CharacterFrame",
["PetPaperDollFramePetFrame"] = "CharacterFrame",
["PaperDollFrame"] = true,
["ReputationFrame"] = true,
["SkillFrame"] = true,
["PVPFrame"] = not cata, -- changed in cataclysm
["PVPBattlegroundFrame"] = true,
["SendMailFrame"] = true,
["TokenFrame"] = true,
["InterfaceOptionsFrame"] = false,
["VideoOptionsFrame"] = false,
["AudioOptionsFrame"] = false,
["BankFrame"] = false,
["WorldMapFrame"] = false,
 
-- AddOns
["LudwigFrame"] = false,
}
 
-- Frames provided by load on demand addons, hooked when the addon is loaded.
local lodFrames = {
-- AddonName = { list of frames, same syntax as above }
Blizzard_AuctionUI = { ["AuctionFrame"] = false },
Blizzard_BindingUI = { ["KeyBindingFrame"] = false },
Blizzard_CraftUI = { ["CraftFrame"] = false },
Blizzard_GMSurveyUI = { ["GMSurveyFrame"] = false },
Blizzard_InspectUI = { ["InspectFrame"] = false, ["InspectPVPFrame"] = true, ["InspectTalentFrame"] = true },
Blizzard_ItemSocketingUI = { ["ItemSocketingFrame"] = false },
Blizzard_MacroUI = { ["MacroFrame"] = false },
Blizzard_TalentUI = { ["PlayerTalentFrame"] = false },
Blizzard_TradeSkillUI = { ["TradeSkillFrame"] = false },
Blizzard_TrainerUI = { ["ClassTrainerFrame"] = false },
Blizzard_GuildBankUI = { ["GuildBankFrame"] = false, ["GuildBankEmblemFrame"] = true },
Blizzard_TimeManager = { ["TimeManagerFrame"] = false },
Blizzard_AchievementUI = { ["AchievementFrame"] = false, ["AchievementFrameHeader"] = true, ["AchievementFrameCategoriesContainer"] = "AchievementFrame" },
Blizzard_TokenUI = { ["TokenFrame"] = true },
Blizzard_ItemSocketingUI = { ["ItemSocketingFrame"] = false },
Blizzard_GlyphUI = { ["GlyphFrame"] = "PlayerTalentFrame" },
Blizzard_BarbershopUI = { ["BarberShopFrame"] = false },
Blizzard_Calendar = { ["CalendarFrame"] = false, ["CalendarCreateEventFrame"] = true },
}
 
local parentFrame = {}
local hooked = {}
 
local function print(msg)
DEFAULT_CHAT_FRAME:AddMessage("DragEmAll: " .. msg)
end
 
function addon:PLAYER_LOGIN()
self:HookFrames(frames)
end
 
function addon:ADDON_LOADED(name)
local frameList = lodFrames[name]
if frameList then
self:HookFrames(frameList)
end
end
 
local function MouseDownHandler(frame, button)
frame = parentFrame[frame] or frame
if frame and button == "LeftButton" then
frame:StartMoving()
frame:SetUserPlaced(false)
end
end
 
local function MouseUpHandler(frame, button)
frame = parentFrame[frame] or frame
if frame and button == "LeftButton" then
frame:StopMovingOrSizing()
end
end
 
function addon:HookFrames(list)
for name, child in pairs(list) do
self:HookFrame(name, child)
end
end
 
function addon:HookFrame(name, moveParent)
local frame = _G[name]
local parent
if frame and not hooked[name] then
if moveParent then
if type(moveParent) == "string" then
parent = _G[moveParent]
else
parent = frame:GetParent()
end
if not parent then
print("Parent frame not found: " .. name)
return
end
parentFrame[frame] = parent
end
if parent then
parent:SetMovable(true)
parent:SetClampedToScreen(false)
end
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetClampedToScreen(false)
self:HookScript(frame, "OnMouseDown", MouseDownHandler)
self:HookScript(frame, "OnMouseUp", MouseUpHandler)
hooked[name] = true
end
end
 
function addon:HookScript(frame, script, handler)
if not frame.GetScript then return end
local oldHandler = frame:GetScript(script)
if oldHandler then
frame:SetScript(script, function(...)
handler(...)
oldHandler(...)
end)
else
frame:SetScript(script, handler)
end
end
 
addon:SetScript("OnEvent", function(f, e, ...) f[e](f, ...) end)
addon:RegisterEvent("PLAYER_LOGIN")
addon:RegisterEvent("ADDON_LOADED")
 
-- Hook bag frames
hooksecurefunc("ContainerFrame_GenerateFrame", function(frame, size, id)
if id <= NUM_BAG_FRAMES or id == KEYRING_CONTAINER then
addon:HookFrame(frame:GetName())
end
end)
 
Eui/script/yclasscolors.lua New file
0,0 → 1,184
local E, C = unpack(select(2, ...))
local BC = {}
for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do
BC[v] = k
end
for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
BC[v] = k
end
 
local function colorGuildRank(rankIndex)
local r, g, b = 1, 1, 1
local pct = rankIndex / GuildControlGetNumRanks()
if pct <= 1.0 and pct >= 0.5 then
r, g, b = (1.0-pct)*2, 1, 0
elseif pct >= 0 and pct < 0.5 then
r, g, b = 1, pct*2, 0
end
return r, g, b
end
 
local function colorCode(color)
return format("|CFF%2x%2x%2x", color.r*255, color.g*255, color.b*255)
end
 
hooksecurefunc("GuildStatus_Update", function()
local guildOffset = FauxScrollFrame_GetOffset(GuildListScrollFrame)
local myZone = GetRealZoneText()
local name, rankIndex, level, zone, online, classFileName
local color, zcolor, lcolor, r, g, b
 
for i=1, GUILDMEMBERS_TO_DISPLAY, 1 do
name, _, rankIndex, level, _, zone, _, _, online, _, classFileName = GetGuildRosterInfo(guildOffset + i)
if not name then break end
 
color = E.RAID_CLASS_COLORS[classFileName] or NORMAL_FONT_COLOR
zcolor = zone == myZone and GREEN_FONT_COLOR or HIGHLIGHT_FONT_COLOR
lcolor = GetQuestDifficultyColor(level) or HIGHLIGHT_FONT_COLOR
r, g, b = colorGuildRank(rankIndex)
 
if online then
_G["GuildFrameButton"..i.."Name"]:SetTextColor(color.r, color.g, color.b)
_G["GuildFrameButton"..i.."Zone"]:SetTextColor(zcolor.r, zcolor.g, zcolor.b)
_G["GuildFrameButton"..i.."Level"]:SetTextColor(lcolor.r, lcolor.g, lcolor.b)
_G["GuildFrameGuildStatusButton"..i.."Name"]:SetTextColor(color.r, color.g, color.b)
_G["GuildFrameGuildStatusButton"..i.."Rank"]:SetTextColor(r, g, b)
else
_G["GuildFrameButton"..i.."Name"]:SetTextColor(color.r/2, color.g/2, color.b/2)
_G["GuildFrameButton"..i.."Zone"]:SetTextColor(zcolor.r/2, zcolor.g/2, zcolor.b/2)
_G["GuildFrameButton"..i.."Level"]:SetTextColor(lcolor.r/2, lcolor.g/2, lcolor.b/2)
_G["GuildFrameGuildStatusButton"..i.."Name"]:SetTextColor(color.r/2, color.g/2, color.b/2)
_G["GuildFrameGuildStatusButton"..i.."Rank"]:SetTextColor(r/2, g/2, b/2)
end
end
end)
 
 
hooksecurefunc("WhoList_Update", function()
local whoOffset = FauxScrollFrame_GetOffset(WhoListScrollFrame)
local menu = UIDropDownMenu_GetSelectedID(WhoFrameDropDown)
local myZone = GetRealZoneText()
local myGuild = GetGuildInfo("player")
local myRace = UnitRace("player")
local myInfo = { myZone, myGuild, myRace }
local name, guild, level, race, zone, classFileName, columnTable, color
 
for i=1, WHOS_TO_DISPLAY, 1 do
name, guild, level, race, _, zone, classFileName = GetWhoInfo(whoOffset + i)
if not name then break end
 
color = E.RAID_CLASS_COLORS[classFileName] or NORMAL_FONT_COLOR
_G["WhoFrameButton"..i.."Name"]:SetTextColor(color.r, color.g, color.b)
 
color = GetQuestDifficultyColor(level) or HIGHLIGHT_FONT_COLOR
_G["WhoFrameButton"..i.."Level"]:SetTextColor(color.r, color.g, color.b)
 
columnTable = { zone, guild, race }
color = columnTable[menu] == myInfo[menu] and GREEN_FONT_COLOR or HIGHLIGHT_FONT_COLOR
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(color.r, color.g, color.b)
end
end)
 
 
hooksecurefunc(FriendsFrameFriendsScrollFrame, "buttonFunc", function(button, index, fristButton)
local nameText, infoText
local myZone = GetRealZoneText()
 
if button.buttonType == FRIENDS_BUTTON_TYPE_WOW then
local name, level, class, area, connected = GetFriendInfo(button.id)
if connected then
local color = E.RAID_CLASS_COLORS[BC[class]] or NORMAL_FONT_COLOR
local lcolor = GetQuestDifficultyColor(level) or HIGHLIGHT_FONT_COLOR
nameText = colorCode(color) .. name .. "|r, " .. LEVEL .. colorCode(lcolor) .. level .. "|r " .. colorCode(color) .. class .. "|r"
if area == myZone then
infoText = format("|cff00ff00%s|r", area)
end
end
elseif button.buttonType == FRIENDS_BUTTON_TYPE_BNET then
local _, givenName, surname, toonName, toonID, client, isOnline = BNGetFriendInfo(button.id)
if isOnline and client == BNET_CLIENT_WOW then
local _, toonName, _, _, _, _, class, _, zoneName = BNGetToonInfo(toonID)
if givenName and surname and toonName then
local color = E.RAID_CLASS_COLORS[BC[class]] or NORMAL_FONT_COLOR
nameText = format(BATTLENET_NAME_FORMAT, givenName, surname) .." ".. FRIENDS_WOW_NAME_COLOR_CODE .. "(" .. colorCode(color) .. toonName .. "|r" .. FRIENDS_WOW_NAME_COLOR_CODE .. ")"
if zoneName == myZone then
infoText = format("|cff00ff00%s|r", zoneName)
end
end
end
end
if nameText then button.name:SetText(nameText) end
if infoText then button.info:SetText(infoText) end
end)
 
 
hooksecurefunc("LFRBrowseFrameListButton_SetData", function(button, index)
local name, level, _, _, _, _, _, class = SearchLFGGetResults(index)
local color
if name ~= UnitName("player") then
color = E.RAID_CLASS_COLORS[class] or NORMAL_FONT_COLOR
button.name:SetTextColor(color.r, color.g, color.b)
color = GetQuestDifficultyColor(level) or HIGHLIGHT_FONT_COLOR
button.level:SetTextColor(color.r, color.g, color.b)
end
end)
 
 
hooksecurefunc("WorldStateScoreFrame_Update", function()
local isArena = IsActiveBattlefieldArena()
local numScores = GetNumBattlefieldScores()
local name, faction, classToken, index, color, n, s
 
for i=1, MAX_WORLDSTATE_SCORE_BUTTONS do
index = FauxScrollFrame_GetOffset(WorldStateScoreScrollFrame) + i
if index <= numScores then
name, _, _, _, _, faction, _, _, _, classToken = GetBattlefieldScore(index)
if name and classToken then
color = E.RAID_CLASS_COLORS[classToken]
_G["WorldStateScoreButton" .. i .. "NameText"]:SetTextColor(color.r, color.g, color.b)
n, s = strsplit("-", name, 2)
if n == UnitName("player") then
n = "> " .. n .. " <"
end
if s then
if isArena then
n = n.."|cffffffff-|r"..(faction==0 and "|cff20ff20" or "|cffffd200")..s.."|r"
else
n = n.."|cffffffff-|r"..(faction==0 and "|cffff2020" or "|cff00aef0")..s.."|r"
end
end
_G["WorldStateScoreButton" .. i .. "NameText"]:SetText(n)
end
end
end
end)
 
 
hooksecurefunc("PVPTeamDetails_Update", function(id)
local numMembers = GetNumArenaTeamMembers(id, 1)
local teamPlayed = select(4, GetArenaTeam(id))
local name, rank, class, online, played, ncolor, ccolor, pcolor, playedPct
 
for i=1, numMembers, 1 do
name, rank, _, class, online, played = GetArenaTeamRosterInfo(id, i)
ncolor = rank == 0 and NORMAL_FONT_COLOR or HIGHLIGHT_FONT_COLOR
ccolor = E.RAID_CLASS_COLORS[BC[class]] or NORMAL_FONT_COLOR
pcolor = teamPlayed >= 10 and played/teamPlayed >= 0.3 and GREEN_FONT_COLOR or RED_FONT_COLOR
if name == UnitName("player") then
_G["PVPTeamDetailsButton"..i.."NameText"]:SetText("|cff00ff00@ |r"..name)
end
if online then
_G["PVPTeamDetailsButton"..i.."NameText"]:SetTextColor(ncolor.r, ncolor.g, ncolor.b)
_G["PVPTeamDetailsButton"..i.."ClassText"]:SetTextColor(ccolor.r, ccolor.g, ccolor.b)
if not PVPTeamDetails.season then
_G["PVPTeamDetailsButton"..i.."PlayedText"]:SetTextColor(pcolor.r, pcolor.g, pcolor.b)
end
else
_G["PVPTeamDetailsButton"..i.."NameText"]:SetTextColor(ncolor.r/2, ncolor.g/2, ncolor.b/2)
_G["PVPTeamDetailsButton"..i.."ClassText"]:SetTextColor(ccolor.r/2, ccolor.g/2, ccolor.b/2)
if not PVPTeamDetails.season then
_G["PVPTeamDetailsButton"..i.."PlayedText"]:SetTextColor(pcolor.r/2, pcolor.g/2, pcolor.b/2)
end
end
end
end)
\ No newline at end of file
Eui/script/MBB/MBB.xml New file
0,0 → 1,693
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="MBB.lua"/>
<Frame name="MBBFrame" toplevel="true" parent="UIParent" frameStrata="DIALOG" hidden="true" enableMouse="true">
<Scripts>
<OnLoad>
MBB_OnLoad();
</OnLoad>
<OnEvent>
MBB_OnEvent();
</OnEvent>
</Scripts>
</Frame>
 
<Button name="MBB_MinimapButtonFrame" toplevel="true" frameStrata="MEDIUM" parent="Minimap" enableMouse="true" movable="true" hidden="true">
<Size>
<AbsDimension x="33" y="33"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-18" y="-100"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parent_Texture" file="Interface\AddOns\Eui\script\MBB\icon">
<Size>
<AbsDimension x="17" y="17"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="8" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.075" right="0.925" top="0.075" bottom="0.925"/>
</Texture>
</Layer>
<Layer level="OVERLAY">
<Texture file="Interface\Minimap\MiniMap-TrackingBorder">
<Size>
<AbsDimension x="56" y="56"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
<Scripts>
<OnLoad>
this:RegisterForClicks("LeftButtonUp","RightButtonUp");
this:RegisterForDrag("LeftButton");
</OnLoad>
<OnMouseDown>
MBB_MinimapButtonFrame_Texture:SetTexCoord(0,1,0,1);
</OnMouseDown>
<OnMouseUp>
MBB_MinimapButtonFrame_Texture:SetTexCoord(.075,.925,.075,.925);
</OnMouseUp>
<OnClick>
MBB_OnClick(arg1);
</OnClick>
<OnEnter>
MBB_ShowTimeout = -1;
GameTooltip:SetOwner(this, "ANCHOR_LEFT");
GameTooltip:AddLine("MinimapButtonBag v" .. MBB_Version);
GameTooltip:AddLine(MBB_TOOLTIP1, 0, 1, 0);
GameTooltip:Show();
</OnEnter>
<OnLeave>
MBB_ShowTimeout = 0;
GameTooltip:Hide();
</OnLeave>
<OnDragStart>
if( MBB_Options.AttachToMinimap == 1 ) then
MBB_DragFlag = 1;
else
this:StartMoving();
end
</OnDragStart>
<OnDragStop>
if( MBB_Options.AttachToMinimap == 1 ) then
MBB_DragFlag = 0;
else
this:StopMovingOrSizing();
end
local _,_,_,xpos,ypos = this:GetPoint();
MBB_Options.ButtonPos = {xpos,ypos};
</OnDragStop>
<OnUpdate>
MBB_OnUpdate(arg1);
</OnUpdate>
</Scripts>
</Button>
 
<Button name="MBB_ButtonAdd" hidden="true">
<Size>
<AbsDimension x="21" y="21"/>
</Size>
<Scripts>
<OnClick>
MBB_AddButton(this.MBBButtonName);
MBB_SetPositions();
this:Hide();
</OnClick>
<OnLeave>
this:Hide()
</OnLeave>
</Scripts>
<NormalTexture file="Interface\Minimap\UI-Minimap-ZoomInButton-Up"/>
<PushedTexture file="Interface\Minimap\UI-Minimap-ZoomInButton-Down"/>
<DisabledTexture file="Interface\Minimap\UI-Minimap-ZoomInButton-Disabled"/>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
</Button>
<Button name="MBB_ButtonRemove" hidden="true">
<Size>
<AbsDimension x="21" y="21"/>
</Size>
<Scripts>
<OnClick>
MBB_RestoreButton(this.MBBButtonName);
MBB_SetPositions();
this:Hide();
</OnClick>
<OnLeave>
this:Hide()
</OnLeave>
</Scripts>
<NormalTexture file="Interface\Minimap\UI-Minimap-ZoomOutButton-Up"/>
<PushedTexture file="Interface\Minimap\UI-Minimap-ZoomOutButton-Down"/>
<DisabledTexture file="Interface\Minimap\UI-Minimap-ZoomOutButton-Disabled"/>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
</Button>
 
<Frame name="MBB_OptionsFrame" toplevel="true" enableMouse="true" movable="true" parent="UIParent" hidden="true">
<Size>
<AbsDimension x="300" y="290" />
</Size>
<Anchors>
<Anchor point="CENTER" />
</Anchors>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11" />
</BackgroundInsets>
<TileSize>
<AbsValue val="32" />
</TileSize>
<EdgeSize>
<AbsValue val="32" />
</EdgeSize>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parent_Header" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size>
<AbsDimension x="370" y="64"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="12"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="$parent_HeaderText" inherits="GameFontNormal" text="MBB_OPTIONS_HEADER">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_Header">
<Offset>
<AbsDimension x="0" y="-14"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="ARTWORK">
<FontString name="$parent_ExpansionLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONLABEL">
<Size>
<AbsDimension x="130" y="15" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent">
<Offset>
<AbsDimension x="20" y="-85" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="ARTWORK">
<FontString name="$parent_MaxButtonsLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_MAXBUTTONSLABEL">
<Size>
<AbsDimension x="130" y="15" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent">
<Offset>
<AbsDimension x="20" y="-155" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="ARTWORK">
<FontString name="$parent_AltExpansionLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_ALTEXPANSIONLABEL">
<Size>
<AbsDimension x="130" y="15" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent">
<Offset>
<AbsDimension x="20" y="-175" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Slider name="$parent_TimeoutSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativeFrom="TOPLEFT">
<Offset>
<AbsDimension x="150" y="-45" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_SLIDERLABEL">
<Size>
<AbsDimension x="130" y="15" />
</Size>
<Anchors>
<Anchor point="RIGHT" relativePoint="LEFT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnValueChanged>
if( this:GetValue() == 0 ) then
getglobal(this:GetName().."Text"):SetText(MBB_OPTIONS_SLIDEROFF);
else
getglobal(this:GetName().."Text"):SetText(this:GetValue() .. " " .. MBB_OPTIONS_SLIDERSEK);
end
</OnValueChanged>
<OnLoad>
this:SetMinMaxValues(0,5);
this:SetValueStep(1);
getglobal(this:GetName().."High"):SetText("5 " .. MBB_OPTIONS_SLIDERSEK);
getglobal(this:GetName().."Low"):SetText(MBB_OPTIONS_SLIDEROFF);
</OnLoad>
<OnShow>
this:SetValue(MBB_Options.CollapseTimeout);
if( MBB_Options.CollapseTimeout == 0 ) then
getglobal(this:GetName().."Text"):SetText(MBB_OPTIONS_SLIDEROFF);
else
getglobal(this:GetName().."Text"):SetText(this:GetValue() .. " " .. MBB_OPTIONS_SLIDERSEK);
end
</OnShow>
</Scripts>
</Slider>
<CheckButton name="$parent_LeftRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent_ExpansionLabel" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONLEFT">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(1);
MBB_UpdateAltRadioButtons();
</OnClick>
<OnShow>
if( MBB_Options.ExpandDirection == 1 ) then
MBB_RadioButton_OnClick(1);
end
</OnShow>
</Scripts>
</CheckButton>
<CheckButton name="$parent_TopRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_LeftRadio" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONTOP">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(2);
MBB_UpdateAltRadioButtons();
</OnClick>
<OnShow>
if( MBB_Options.ExpandDirection == 2 ) then
MBB_RadioButton_OnClick(2);
end
</OnShow>
</Scripts>
</CheckButton>
<CheckButton name="$parent_RightRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_TopRadio" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONRIGHT">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(3);
MBB_UpdateAltRadioButtons();
</OnClick>
<OnShow>
if( MBB_Options.ExpandDirection == 3 ) then
MBB_RadioButton_OnClick(3);
end
</OnShow>
</Scripts>
</CheckButton>
<CheckButton name="$parent_BottomRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_RightRadio" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONBOTTOM">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(4);
MBB_UpdateAltRadioButtons();
</OnClick>
<OnShow>
if( MBB_Options.ExpandDirection == 4 ) then
MBB_RadioButton_OnClick(4);
end
</OnShow>
</Scripts>
</CheckButton>
<EditBox name="$parent_MaxButtonsTextBox" enableMouse="true" ignoreArrows="false" letters="3" autoFocus="false">
<Backdrop edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<TileSize>
<AbsValue val="8" />
</TileSize>
<EdgeSize>
<AbsValue val="8" />
</EdgeSize>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentInfo" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_MAXBUTTONSINFO">
<Size>
<AbsDimension x="100" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Size>
<AbsDimension x="30" y="20" />
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parent_MaxButtonsLabel" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<FontString inherits="ChatFontNormal" justifyH="RIGHT">
<FontHeight>
<AbsValue val="14" />
</FontHeight>
<Color r="1" g="1" b="1" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</FontString>
<Scripts>
<OnEscapePressed>
this:SetText(MBB_Options.MaxButtonsPerLine);
this:ClearFocus();
</OnEscapePressed>
<OnTextChanged>
MBB_UpdateAltRadioButtons();
</OnTextChanged>
<OnEnterPressed>
if( not tonumber(this:GetText()) ) then
this:SetText(MBB_Options.MaxButtonsPerLine);
end
MBB_UpdateAltRadioButtons();
this:ClearFocus();
</OnEnterPressed>
<OnLoad>
this:SetTextInsets(2, 4, 2, 2);
</OnLoad>
<OnShow>
this:SetText(MBB_Options.MaxButtonsPerLine);
</OnShow>
</Scripts>
</EditBox>
<CheckButton name="$parent_LeftAltRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent_AltExpansionLabel" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONLEFT">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(1, true);
</OnClick>
<OnShow>
if( MBB_Options.AltExpandDirection == 1 ) then
MBB_RadioButton_OnClick(1, true);
end
</OnShow>
</Scripts>
</CheckButton>
<CheckButton name="$parent_TopAltRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_LeftAltRadio" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONTOP">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(2, true);
</OnClick>
<OnShow>
if( MBB_Options.AltExpandDirection == 2 ) then
MBB_RadioButton_OnClick(2, true);
end
</OnShow>
</Scripts>
</CheckButton>
<CheckButton name="$parent_RightAltRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_TopAltRadio" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONRIGHT">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(3, true);
</OnClick>
<OnShow>
if( MBB_Options.AltExpandDirection == 3 ) then
MBB_RadioButton_OnClick(3, true);
end
</OnShow>
</Scripts>
</CheckButton>
<CheckButton name="$parent_BottomAltRadio" inherits="UIRadioButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_RightAltRadio" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" text="MBB_OPTIONS_EXPANSIONBOTTOM">
<Size>
<AbsDimension x="50" y="15" />
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
MBB_RadioButton_OnClick(4, true);
</OnClick>
<OnShow>
if( MBB_Options.AltExpandDirection == 4 ) then
MBB_RadioButton_OnClick(4, true);
end
</OnShow>
</Scripts>
</CheckButton>
<Button name="$parent_OKButton" inherits="UIPanelButtonTemplate" text="MBB_OPTIONS_OKBUTTON">
<Size>
<AbsDimension x="125" y="21" />
</Size>
<Anchors>
<Anchor point="TOP" relativeTo="$parent" relativeFrom="TOPLEFT">
<Offset>
<AbsDimension x="-75" y="-245" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MBB_OptionsFrame:Hide();
MBB_Options.CollapseTimeout = MBB_OptionsFrame_TimeoutSlider:GetValue();
if( MBB_OptionsFrame_LeftRadio:GetChecked() ) then
MBB_Options.ExpandDirection = 1;
elseif( MBB_OptionsFrame_TopRadio:GetChecked() ) then
MBB_Options.ExpandDirection = 2;
elseif( MBB_OptionsFrame_RightRadio:GetChecked() ) then
MBB_Options.ExpandDirection = 3;
elseif( MBB_OptionsFrame_BottomRadio:GetChecked() ) then
MBB_Options.ExpandDirection = 4;
end
if( tonumber(MBB_OptionsFrame_MaxButtonsTextBox:GetText()) ) then
MBB_Options.MaxButtonsPerLine = tonumber(MBB_OptionsFrame_MaxButtonsTextBox:GetText());
end
if( MBB_OptionsFrame_LeftAltRadio:GetChecked() ) then
MBB_Options.AltExpandDirection = 1;
elseif( MBB_OptionsFrame_TopAltRadio:GetChecked() ) then
MBB_Options.AltExpandDirection = 2;
elseif( MBB_OptionsFrame_RightAltRadio:GetChecked() ) then
MBB_Options.AltExpandDirection = 3;
elseif( MBB_OptionsFrame_BottomAltRadio:GetChecked() ) then
MBB_Options.AltExpandDirection = 4;
end
MBB_SetPositions();
</OnClick>
</Scripts>
</Button>
<Button name="$parent_CancelButton" inherits="UIPanelButtonTemplate" text="MBB_OPTIONS_CANCELBUTTON">
<Size>
<AbsDimension x="125" y="21" />
</Size>
<Anchors>
<Anchor point="TOP" relativeTo="$parent" relativeFrom="TOPLEFT">
<Offset>
<AbsDimension x="75" y="-245" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MBB_OptionsFrame:Hide();
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnShow>
MBB_OptionsFrame_HeaderText:SetText("MBB v" .. MBB_Version .. " " .. MBB_OPTIONS_HEADER);
MBB_UpdateAltRadioButtons();
</OnShow>
</Scripts>
</Frame>
</Ui>
\ No newline at end of file
Eui/script/MBB/MBB.lua New file
0,0 → 1,994
--[[
 
MBB Author: Tunhadil, Fixed by Pericles for patch 2.23 onwards
Addon to reduces minimap buttons and makes them accessible through a menu!
 
]]
 
--[[
 
v0.50 - Fixed a few loose button issues, and child/parent frame issues that were causing stack overflows
 
v0.51 - Changed bar strata to HIGH from LOW to put it in front of things like GRID.
 
v0.52 - Changed TOC for patch 2.3
 
v0.60 - Fixed SecureStateAnchor bug for WotLK
 
v0.61 - Added exclusion for DAGAssist
 
v0.62 - Fixed stack overflow at line 438
 
v0.63 - Move button strata from high to medium
 
--]]
 
 
MBB_Version = "0.63";
MBB_DebugFlag = 0;
MBB_DragFlag = 0;
MBB_ShowTimeout = -1;
MBB_CheckTime = 0;
MBB_IsShown = 0;
MBB_FuBar_MinimapContainer = "FuBarPlugin-MinimapContainer-2.0";
MBB_Buttons = {};
MBB_Exclude = {};
MBB_DebugInfo = {};
MBB_DefaultOptions = {
["ButtonPos"] = {-10, -100},
["AttachToMinimap"] = 1,
["CollapseTimeout"] = 1,
["ExpandDirection"] = 1,
["MaxButtonsPerLine"] = 0,
["AltExpandDirection"] = 4
};
 
if(not MBB_Options) then
MBB_Options = {};
MBB_Options = MBB_DefaultOptions;
end
 
MBB_Include = {
[1] = "WIM_IconFrame",
[2] = "CTMod2_MinimapButton",
[3] = "PoisonerMinimapButton",
};
 
MBB_Ignore = {
[1] = "MiniMapTrackingFrame",
[2] = "MiniMapMeetingStoneFrame",
[3] = "MiniMapMailFrame",
[4] = "MiniMapBattlefieldFrame",
[5] = "MiniMapWorldMapButton",
[6] = "MiniMapPing",
[7] = "MinimapBackdrop",
[8] = "MinimapZoomIn",
[9] = "MinimapZoomOut",
[10] = "BookOfTracksFrame",
[11] = "GatherNote",
[12] = "FishingExtravaganzaMini",
[13] = "MiniNotePOI",
[14] = "RecipeRadarMinimapIcon",
[15] = "FWGMinimapPOI",
[16] = "CartographerNotesPOI",
[17] = "MBB_MinimapButtonFrame",
[18] = "EnhancedFrameMinimapButton",
[19] = "GFW_TrackMenuFrame",
[20] = "GFW_TrackMenuButton",
[21] = "TDial_TrackingIcon",
[22] = "TDial_TrackButton",
[23] = "MiniMapTracking",
[24] = "GatherMatePin",
[25] = "HandyNotesPin",
[26] = "TimeManagerClockButton",
[27] = "GameTimeFrame",
[28] = "DA_Minimap",
[29] = "MiniMapLFGFrame",
};
 
MBB_IgnoreSize = {
[1] = "AM_MinimapButton",
[2] = "STC_HealthstoneButton",
[3] = "STC_ShardButton",
[4] = "STC_SoulstoneButton",
[5] = "STC_SpellstoneButton",
[6] = "STC_FirestoneButton"
};
 
MBB_ExtraSize = {
["GathererMinimapButton"] = function()
GathererMinimapButton.mask:SetHeight(31);
GathererMinimapButton.mask:SetWidth(31);
end
};
 
function MBB_OnLoad()
-- hooksecurefunc("SecureHandlerClickTemplate_onclick", MBB_SecureOnClick);
-- hooksecurefunc("SecureHandlerClickTemplate_OnEnter", MBB_SecureOnEnter);
-- hooksecurefunc("SecureHandlerClickTemplate_OnLeave", MBB_SecureOnLeave);
local E, C = unpack(EUI)
if C["other"].mbb ~= true then
return
end
if( AceLibrary ) then
if( AceLibrary:HasInstance(MBB_FuBar_MinimapContainer) ) then
AceLibrary(MBB_FuBar_MinimapContainer).oldAddPlugin = AceLibrary(MBB_FuBar_MinimapContainer).AddPlugin;
AceLibrary(MBB_FuBar_MinimapContainer).AddPlugin = function(...)
local plugin = select(2, ...);
local value = AceLibrary(MBB_FuBar_MinimapContainer):oldAddPlugin(plugin);
local button = plugin.minimapFrame:GetName();
local frame = getglobal(button);
 
if( not frame.oshow ) then
MBB_PrepareButton(button);
--if( not MBB_IsExcluded(button) ) then
if( not MBB_IsInArray(MBB_Exclude, button) ) then
MBB_AddButton(button);
MBB_SetPositions();
end
end
 
return value;
end
 
AceLibrary(MBB_FuBar_MinimapContainer).oldRemovePlugin = AceLibrary(MBB_FuBar_MinimapContainer).RemovePlugin;
AceLibrary(MBB_FuBar_MinimapContainer).RemovePlugin = function(...)
local plugin = select(2, ...);
local button = plugin.minimapFrame:GetName();
local frame = getglobal(button);
 
if( not frame.oshow ) then
MBB_PrepareButton(button);
end
 
local value = AceLibrary(MBB_FuBar_MinimapContainer):oldRemovePlugin(plugin);
return value;
end
end
end
 
this:RegisterEvent("VARIABLES_LOADED");
SLASH_MBB1 = "/mmbb";
SLASH_MBB2 = "/minimapbuttonbag";
SlashCmdList["MBB"] = MBB_SlashHandler;
end
 
function MBB_SlashHandler(cmd)
if( cmd == "buttons" ) then
MBB_Print("MBB Buttons:");
for i,name in ipairs(MBB_Buttons) do
MBB_Print(" " .. name);
end
elseif( string.sub(cmd, 1, 6) == "debug " ) then
local iStart, iEnd, sFrame = string.find(cmd, "debug (.+)");
 
local hasClick, hasMouseUp, hasMouseDown, hasEnter, hasLeave = MBB_TestFrame(sFrame);
 
MBB_Debug("Frame: " .. sFrame);
if( hasClick ) then
MBB_Debug(" has OnClick script");
else
MBB_Debug(" has no OnClick script");
end
if( hasMouseUp ) then
MBB_Debug(" has OnMouseUp script");
else
MBB_Debug(" has no OnMouseUp script");
end
if( hasMouseDown ) then
MBB_Debug(" has OnMouseDown script");
else
MBB_Debug(" has no OnMouseDown script");
end
if( hasEnter ) then
MBB_Debug(" has OnEnter script");
else
MBB_Debug(" has no OnEnter script");
end
if( hasLeave ) then
MBB_Debug(" has OnLeave script");
else
MBB_Debug(" has no OnLeave script");
end
elseif( cmd == "reset position" ) then
MBB_Options.AttachToMinimap = MBB_DefaultOptions.AttachToMinimap;
MBB_Options.ButtonPos = MBB_DefaultOptions.ButtonPos;
MBB_SetButtonPosition();
elseif( cmd == "reset all" ) then
MBB_Options = MBB_DefaultOptions;
for i=1,table.maxn(MBB_Exclude) do
MBB_AddButton(MBB_Exclude[i]);
end
MBB_SetPositions();
MBB_SetButtonPosition();
elseif( cmd == "errors" ) then
if( table.maxn(MBB_DebugInfo) > 0 ) then
for name, arr in pairs(MBB_DebugInfo) do
MBB_Print(name);
for _, error in pairs(arr) do
MBB_Print(" " .. error);
end
end
else
MBB_Print(MBB_NOERRORS);
end
else
MBB_Print("MBB v" .. MBB_Version .. ":");
MBB_Print(MBB_HELP1);
MBB_Print(MBB_HELP2);
MBB_Print(MBB_HELP3);
MBB_Print(MBB_HELP4);
end
end
 
function MBB_TestFrame(name)
local hasClick = false;
local hasMouseUp = false;
local hasMouseDown = false;
local hasEnter = false;
local hasLeave = false;
local testframe = getglobal(name);
 
if( testframe ) then
if( not testframe.HasScript ) then
if( testframe:GetName() ) then
if( not MBB_DebugInfo[testframe:GetName()] ) then
MBB_DebugInfo[testframe:GetName()] = {};
end
if( not MBB_IsInArray(MBB_DebugInfo[testframe:GetName()], "No HasScript") ) then
table.insert(MBB_DebugInfo[testframe:GetName()], "No HasScript");
end
end
else
if( testframe:HasScript("OnClick") ) then
local test = testframe:GetScript("OnClick");
if( test ) then
hasClick = true;
end
end
if( testframe:HasScript("OnMouseUp") ) then
local test = testframe:GetScript("OnMouseUp");
if( test ) then
hasMouseUp = true;
end
end
if( testframe:HasScript("OnMouseDown") ) then
local test = testframe:GetScript("OnMouseDown");
if( test ) then
hasMouseDown = true;
end
end
if( testframe:HasScript("OnEnter") ) then
local test = testframe:GetScript("OnEnter");
if( test ) then
hasEnter = true;
end
end
if( testframe:HasScript("OnLeave") ) then
local test = testframe:GetScript("OnLeave");
if( test ) then
hasLeave = true;
end
end
end
end
 
return hasClick, hasMouseUp, hasMouseDown, hasEnter, hasLeave;
end
 
function MBB_OnEvent()
if ( event == "VARIABLES_LOADED" ) then
local E, C = unpack(EUI)
if C["other"].mbb ~= true then
return
else
_G["MBB_MinimapButtonFrame"]:Show()
end
if( MBB_Options ) then
for opt,val in pairs(MBB_DefaultOptions) do
if( not MBB_Options[opt] ) then
MBB_Debug(opt .. " option set to default: " .. tostring(val));
MBB_Options[opt] = val;
else
MBB_Debug(opt .. " option exists: " .. tostring(MBB_Options[opt]));
end
end
else
MBB_Options = MBB_DefaultOptions;
end
 
MBB_SetButtonPosition();
 
local children = {Minimap:GetChildren()};
local additional = {MinimapBackdrop:GetChildren()};
for _,child in ipairs(additional) do
table.insert(children, child);
end
for _,child in ipairs(MBB_Include) do
local childframe = getglobal(child);
if( childframe ) then
table.insert(children, childframe);
end
end
 
for _,child in ipairs(children) do
if( child:GetName() ) then
local ignore = false;
local exclude = false;
for i,needle in ipairs(MBB_Ignore) do
if( string.find(child:GetName(), needle) ) then
ignore = true;
end
end
if( not ignore ) then
if( not child:HasScript("OnClick") ) then
for _,subchild in ipairs({child:GetChildren()}) do
if( subchild:HasScript("OnClick") ) then
child = subchild;
child.hasParentFrame = true;
break;
end
end
end
 
local hasClick, hasMouseUp, hasMouseDown, hasEnter, hasLeave = MBB_TestFrame(child:GetName());
 
if( hasClick or hasMouseUp or hasMouseDown ) then
local name = child:GetName();
 
MBB_PrepareButton(name);
if( not MBB_IsInArray(MBB_Exclude, name) ) then
if( child:IsVisible() ) then
MBB_Debug("Button is visible: " .. name);
else
MBB_Debug("Button is not visible: " .. name);
end
MBB_Debug("Button added: " .. name);
MBB_AddButton(name);
else
MBB_Debug("Button excluded: " .. name);
end
else
MBB_Debug("Frame is no button: " .. child:GetName());
end
else
MBB_Debug("Frame ignored: " .. child:GetName());
end
end
end
 
MBB_SetPositions();
end
end
 
function MBB_PrepareButton(name)
local buttonframe = getglobal(name);
local hasHeader;
if( buttonframe.GetAttribute ) then
hasHeader = buttonframe:GetAttribute("anchorchild");
if( hasHeader and hasHeader == "$parent" and not buttonframe.hasParentFrame ) then
MBB_Debug("buttonframe has header parent");
buttonframe.hasParentFrame = true;
end
else
if( buttonframe:GetName() ) then
if( not MBB_DebugInfo[buttonframe:GetName()] ) then
MBB_DebugInfo[buttonframe:GetName()] = {};
end
if( not MBB_IsInArray(MBB_DebugInfo[buttonframe:GetName()], "No GetAttribute") ) then
table.insert(MBB_DebugInfo[buttonframe:GetName()], "No GetAttribute");
end
end
end
 
if( buttonframe ) then
if( buttonframe.RegisterForClicks ) then
buttonframe:RegisterForClicks("LeftButtonDown","RightButtonDown");
end
 
buttonframe.isvisible = buttonframe:IsVisible();
 
if( buttonframe.hasParentFrame ) then
local parent = buttonframe:GetParent();
parent.MBBChild = buttonframe:GetName();
buttonframe.parentisvisible = parent:IsVisible();
parent.oshow = parent.Show;
parent.Show = function(...)
local parent = select(1, ...);
MBB_Debug("Parent Frame: " .. parent:GetName());
local child = getglobal(parent.MBBChild);
MBB_Debug("Child Frame: " .. child:GetName());
child.parentisvisible = true;
MBB_Debug("Showing frame: " .. parent:GetName());
if( not MBB_IsInArray(MBB_Exclude, child:GetName()) ) then
MBB_SetPositions();
end
if( MBB_IsInArray(MBB_Exclude, child:GetName()) or MBB_IsShown == 1 ) then
parent.oshow(select(1, ...));
--child.oshow(child);
end
end
parent.ohide = parent.Hide;
parent.Hide = function(...)
local parent = select(1, ...);
MBB_Debug("Parent Frame: " .. parent:GetName());
local child = getglobal(parent.MBBChild);
MBB_Debug("Child Frame: " .. child:GetName());
child.parentisvisible = false;
MBB_Debug("Hiding frame: " .. parent:GetName());
parent.ohide(select(1, ...));
if( not MBB_IsInArray(MBB_Exclude, child:GetName()) ) then
MBB_SetPositions();
end
end
end
 
buttonframe.oshow = buttonframe.Show;
buttonframe.Show = function(...)
local innerframe = select(1, ...);
innerframe.isvisible = true;
MBB_Debug("Showing innerframe: " .. innerframe:GetName());
if( not MBB_IsInArray(MBB_Exclude, innerframe:GetName()) ) then
MBB_SetPositions();
end
if( MBB_IsInArray(MBB_Exclude, innerframe:GetName()) or MBB_IsShown == 1 ) then
--[[if( innerframe.hasParentFrame ) then
local parent = innerframe:GetParent();
parent.oshow(parent);
else]]
innerframe.oshow(select(1, ...));
--end
end
end
buttonframe.ohide = buttonframe.Hide;
buttonframe.Hide = function(...)
local innerframe = select(1, ...);
MBB_Debug("Hiding innerframe: " .. innerframe:GetName());
if( innerframe ~= buttonframe ) then
innerframe.isvisible = false;
innerframe.ohide(innerframe);
end
if( not MBB_IsInArray(MBB_Exclude, innerframe:GetName()) ) then
MBB_SetPositions();
end
end
 
if( buttonframe:HasScript("OnClick") and not hasHeader ) then
buttonframe.oclick = buttonframe:GetScript("OnClick");
buttonframe:SetScript("OnClick", function(...)
if( arg1 and arg1 == "RightButton" and IsControlKeyDown() ) then
local name = this:GetName();
if( MBB_IsInArray(MBB_Exclude, name) ) then
MBB_AddButton(name);
else
MBB_RestoreButton(name);
end
MBB_SetPositions();
elseif( this.oclick ) then
this.oclick(select(1, ...));
end
end);
elseif( buttonframe:HasScript("OnMouseUp") and not hasHeader ) then
buttonframe.omouseup = buttonframe:GetScript("OnMouseUp");
buttonframe:SetScript("OnMouseUp", function(...)
if( arg1 and arg1 == "RightButton" and IsControlKeyDown() ) then
local name = this:GetName();
if( MBB_IsInArray(MBB_Exclude, name) ) then
MBB_AddButton(name);
else
MBB_RestoreButton(name);
end
MBB_SetPositions();
elseif( this.omouseup ) then
this.omouseup(select(1, ...));
end
end);
elseif( buttonframe:HasScript("OnMouseDown") and not hasHeader ) then
buttonframe.omousedown = buttonframe:GetScript("OnMouseDown");
buttonframe:SetScript("OnMouseDown", function(...)
if( arg1 and arg1 == "RightButton" and IsControlKeyDown() ) then
local name = this:GetName();
if( MBB_IsInArray(MBB_Exclude, name) ) then
MBB_AddButton(name);
else
MBB_RestoreButton(name);
end
MBB_SetPositions();
elseif( this.omousedown ) then
this.omousedown(select(1, ...));
end
end);
end
if( buttonframe:HasScript("OnEnter") and not hasHeader ) then
buttonframe.oenter = buttonframe:GetScript("OnEnter");
buttonframe:SetScript("OnEnter", function(...)
if( IsControlKeyDown() ) then
local button;
if( MBB_IsInArray(MBB_Exclude, this:GetName()) ) then
button = getglobal("MBB_ButtonAdd");
else
button = getglobal("MBB_ButtonRemove");
end
button.MBBButtonName = this:GetName();
button:ClearAllPoints();
button:SetPoint("BOTTOM", this, "TOP", 0, 0);
button:Show();
end
if( not MBB_IsInArray(MBB_Exclude, this:GetName()) ) then
MBB_ShowTimeout = -1;
end
if( this.oenter ) then
this.oenter(select(1, ...));
end
end);
end
if( buttonframe:HasScript("OnLeave") and not hasHeader ) then
buttonframe.oleave = buttonframe:GetScript("OnLeave");
buttonframe:SetScript("OnLeave", function(...)
if( not MBB_IsInArray(MBB_Exclude, this:GetName()) ) then
MBB_ShowTimeout = 0;
end
if( this.oleave ) then
this.oleave(select(1, ...));
end
end);
end
end
end
 
function MBB_AddButton(name)
local child = getglobal(name);
 
child.opoint = {child:GetPoint()};
if( not child.opoint[1] ) then
child.opoint = {"TOP", Minimap, "BOTTOM", 0, 0};
end
child.osize = {child:GetHeight(),child:GetWidth()};
child.oclearallpoints = child.ClearAllPoints;
child.ClearAllPoints = function() end;
child.osetpoint = child.SetPoint;
child.SetPoint = function() end;
if( MBB_IsShown == 0 ) then
if( child.hasParentFrame ) then
local parent = child:GetParent();
child.oshow(child);
parent.ohide(parent);
else
child.ohide(child);
end
end
table.insert(MBB_Buttons, name);
local i = MBB_IsInArray(MBB_Exclude, name);
if( i ) then
table.remove(MBB_Exclude, i);
end
end
 
function MBB_RestoreButton(name)
local button = getglobal(name);
 
button.oclearallpoints(button);
button.osetpoint(button, button.opoint[1], button.opoint[2], button.opoint[3], button.opoint[4], button.opoint[5]);
button:SetHeight(button.osize[1]);
button:SetWidth(button.osize[1]);
button.ClearAllPoints = button.oclearallpoints;
button.SetPoint = button.osetpoint;
MBB_Debug("EVENT Restoring Button");
if( button.hasParentFrame ) then
local parent = button:GetParent();
parent.oshow(parent);
else
button.oshow(button);
end
 
table.insert(MBB_Exclude, name);
local i = MBB_IsInArray(MBB_Buttons, button:GetName());
if( i ) then
table.remove(MBB_Buttons, i);
end
end
 
function MBB_SetPositions()
local directions = {
[1] = {"RIGHT", "LEFT"},
[2] = {"BOTTOM", "TOP"},
[3] = {"LEFT", "RIGHT"},
[4] = {"TOP", "BOTTOM"}
};
local offsets = {
[1] = {-5, 0},
[2] = {0, 5},
[3] = {5, 0},
[4] = {0, -5}
};
 
local pos = {0, 0};
local parentid = 0;
local firstid = 1;
local count = 1;
for i,name in ipairs(MBB_Buttons) do
local positionframe = getglobal(name);
if( not positionframe.hasParentFrame ) then
positionframe.parentisvisible = true;
end
if( positionframe.isvisible and positionframe.parentisvisible ) then
local parent;
if( parentid==0 ) then
parent = MBB_MinimapButtonFrame;
else
parent = getglobal(MBB_Buttons[parentid]);
end
 
if( not MBB_IsInArray(MBB_IgnoreSize, name) ) then
if( MBB_ExtraSize[name] ) then
local func = MBB_ExtraSize[name];
func();
else
positionframe:SetHeight(31); -- 33
positionframe:SetWidth(31);
end
end
 
local direction;
 
if( MBB_Options.MaxButtonsPerLine > 0 and count > MBB_Options.MaxButtonsPerLine ) then
parent = getglobal(MBB_Buttons[firstid]);
direction = {directions[MBB_Options.AltExpandDirection][1], directions[MBB_Options.AltExpandDirection][2]};
if( MBB_ExtraSize[name] or MBB_IsInArray(MBB_IgnoreSize, name) or MBB_ExtraSize[parent:GetName()] or MBB_IsInArray(MBB_IgnoreSize, parent:GetName()) ) then
pos = offsets[MBB_Options.AltExpandDirection];
else
pos = {0, 0};
end
count = 2;
firstid = i;
else
direction = {directions[MBB_Options.ExpandDirection][1], directions[MBB_Options.ExpandDirection][2]};
if( MBB_ExtraSize[name] or MBB_IsInArray(MBB_IgnoreSize, name) or MBB_ExtraSize[parent:GetName()] or MBB_IsInArray(MBB_IgnoreSize, parent:GetName()) ) then
pos = offsets[MBB_Options.ExpandDirection];
else
pos = {0, 0};
end
count = count + 1;
end
 
positionframe.oclearallpoints(positionframe);
positionframe.osetpoint(positionframe, direction[1], parent, direction[2], pos[1], pos[2]);
 
parentid = i;
end
end
end
 
function MBB_OnClick(arg1)
if( arg1 and arg1 == "RightButton" and IsControlKeyDown() ) then
if( MBB_Options.AttachToMinimap == 1 ) then
--[[local xpos,ypos = GetCursorPosition();
local scale = GetCVar("uiScale");]]
MBB_Options.AttachToMinimap = 0;
MBB_Options.ButtonPos = {0, 0}; --{(xpos/scale)-10, (ypos/scale)-10};
MBB_SetButtonPosition();
else
MBB_Options.AttachToMinimap = 1;
MBB_Options.ButtonPos = MBB_DefaultOptions.ButtonPos;
MBB_SetButtonPosition();
end
elseif( arg1 and arg1 == "RightButton" ) then
MBB_OptionsFrame:Show();
else
if( MBB_IsShown == 1 ) then
MBB_HideButtons();
else
MBB_Debug("EVENT OnClick");
for i,name in ipairs(MBB_Buttons) do
local clickframe = getglobal(name);
if( not clickframe.hasParentFrame ) then
clickframe.parentisvisible = true;
end
if( clickframe.isvisible and clickframe.parentisvisible ) then
if( clickframe.hasParentFrame and clickframe.hasParentFrame ) then
local parent = clickframe:GetParent();
if( parent.oshow ) then
parent.oshow(parent);
else
if( parent:GetName() ) then
if( not MBB_DebugInfo[parent:GetName()] ) then
MBB_DebugInfo[parent:GetName()] = {};
end
if( not MBB_IsInArray(MBB_DebugInfo[parent:GetName()], "No oshow") ) then
table.insert(MBB_DebugInfo[parent:GetName()], "No oshow");
end
end
end
else
clickframe.oshow(clickframe);
end
end
end
MBB_IsShown = 1;
--MBB_ShowTimeout = 0;
end
end
end
 
function MBB_HideButtons()
MBB_ShowTimeout = -1;
for i,name in ipairs(MBB_Buttons) do
local buttonhideframe = getglobal(name);
if( buttonhideframe.hasParentFrame ) then
local parent = buttonhideframe:GetParent();
if( parent.ohide ) then
parent.ohide(parent);
else
if( parent:GetName() ) then
if( not MBB_DebugInfo[parent:GetName()] ) then
MBB_DebugInfo[parent:GetName()] = {};
end
if( not MBB_IsInArray(MBB_DebugInfo[parent:GetName()], "No ohide") ) then
table.insert(MBB_DebugInfo[parent:GetName()], "No ohide");
end
end
buttonhideframe.ohide(buttonhideframe);
end
else
buttonhideframe.ohide(buttonhideframe);
end
end
MBB_IsShown = 0;
end
 
function MBB_IsKnownButton(name, opt)
if( not opt ) then
opt = 1;
end
 
if( opt <= 1 ) then
for _, button in ipairs(MBB_Buttons) do
if( button == name ) then
return true;
end
end
end
if( opt <= 2 ) then
for _, button in ipairs(MBB_Exclude) do
if( button == name ) then
return true;
end
end
end
if( opt <= 3 ) then
for _, button in ipairs(MBB_Ignore) do
if( string.find(name, button) ) then
return true;
end
end
end
 
return false;
end
 
function MBB_OnUpdate(elapsed)
if( MBB_CheckTime >= 3 ) then
MBB_CheckTime = 0;
local children = {Minimap:GetChildren()};
for _, child in ipairs(children) do
if( child:HasScript("OnClick") and not child.oshow and child:GetName() and not MBB_IsKnownButton(child:GetName(), 3) ) then
MBB_PrepareButton(child:GetName());
if( not MBB_IsInArray(MBB_Exclude, child:GetName()) ) then
MBB_AddButton(child:GetName());
MBB_SetPositions();
end
end
end
else
MBB_CheckTime = MBB_CheckTime + elapsed;
end
 
if( MBB_DragFlag == 1 and MBB_Options.AttachToMinimap == 1 ) then
local xpos,ypos = GetCursorPosition();
local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom();
 
xpos = xmin-xpos/Minimap:GetEffectiveScale()+70;
ypos = ypos/Minimap:GetEffectiveScale()-ymin-70;
 
local angle = math.deg(math.atan2(ypos,xpos));
 
MBB_MinimapButtonFrame:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 53-(cos(angle)*81), -55+(sin(angle)*81));
end
 
if( MBB_Options.CollapseTimeout and MBB_Options.CollapseTimeout ~= 0 ) then
if( MBB_ShowTimeout >= MBB_Options.CollapseTimeout and MBB_IsShown == 1 ) then
MBB_HideButtons();
end
if( MBB_ShowTimeout ~= -1 ) then
MBB_ShowTimeout = MBB_ShowTimeout + elapsed;
end
end
end
 
function MBB_ResetPosition()
MBB_Options.ButtonPos = MBB_DefaultOptions.ButtonPos;
MBB_Options.AttachToMinimap = MBB_DefaultOptions.AttachToMinimap;
 
MBB_SetButtonPosition();
end
 
function MBB_SetButtonPosition()
if( MBB_Options.AttachToMinimap == 1 ) then
MBB_MinimapButtonFrame:ClearAllPoints();
MBB_MinimapButtonFrame:SetPoint("TOPLEFT", Minimap, "TOPLEFT", MBB_Options.ButtonPos[1], MBB_Options.ButtonPos[2]);
else
MBB_MinimapButtonFrame:ClearAllPoints();
MBB_MinimapButtonFrame:SetPoint("CENTER", UIParent, "CENTER", MBB_Options.ButtonPos[1], MBB_Options.ButtonPos[2]);
end
end
 
function MBB_RadioButton_OnClick(id, alt)
local substring;
if( alt ) then
substring = "Alt";
else
substring = "";
end
local buttons = {
[1] = "Left",
[2] = "Top",
[3] = "Right",
[4] = "Bottom"
};
 
for i,name in ipairs(buttons) do
if( i == id ) then
getglobal("MBB_OptionsFrame_" .. name .. substring .. "Radio"):SetChecked(true);
else
getglobal("MBB_OptionsFrame_" .. name .. substring .. "Radio"):SetChecked(nil);
end
end
end
 
function MBB_UpdateAltRadioButtons()
local buttons = {
[1] = "Left",
[2] = "Top",
[3] = "Right",
[4] = "Bottom"
};
 
local exchecked = 1;
 
for i,name in pairs(buttons) do
if( getglobal("MBB_OptionsFrame_" .. name .. "Radio"):GetChecked() ) then
exchecked = i;
break;
end
end
 
local checked = false;
local textbox = getglobal("MBB_OptionsFrame_MaxButtonsTextBox");
 
for i,name in pairs(buttons) do
local radio = getglobal("MBB_OptionsFrame_" .. name .. "AltRadio");
local label = getglobal("MBB_OptionsFrame_" .. name .. "AltRadioLabel");
if( textbox:GetText() == "" or tonumber(textbox:GetText()) == 0 ) then
radio:Disable();
radio:SetChecked(nil);
label:SetTextColor(0.5, 0.5, 0.5);
else
if( exchecked % 2 == i % 2 ) then
if( radio:GetChecked() ) then
checked = true;
if( i == 4 ) then
getglobal("MBB_OptionsFrame_LeftAltRadio"):SetChecked(true);
else
getglobal("MBB_OptionsFrame_" .. buttons[i+1] .. "AltRadio"):SetChecked(true);
end
end
radio:Disable();
radio:SetChecked(nil);
label:SetTextColor(0.5, 0.5, 0.5);
else
if( radio:GetChecked() ) then
checked = true;
end
radio:Enable();
label:SetTextColor(1, 1, 1);
end
end
end
 
if( not checked and tonumber(textbox:GetText()) ~= 0 and textbox:GetText() ~= "" ) then
if( exchecked % 2 == 1 ) then
getglobal("MBB_OptionsFrame_TopAltRadio"):SetChecked(true);
else
getglobal("MBB_OptionsFrame_LeftAltRadio"):SetChecked(true);
end
end
end
 
function MBB_Debug(msg)
if (MBB_DebugFlag == 1) then
MBB_Print("MBB Debug : " .. tostring(msg));
end
end
 
function MBB_Test()
local children = {Minimap:GetChildren()};
for _, child in ipairs(children) do
if( child:GetName() and not MBB_IsKnownButton(child:GetName()) ) then
ChatFrame1:AddMessage(child:GetName());
end
end
end
 
function MBB_IsInArray(array, needle)
if(type(array) == "table") then
--MBB_Debug("Looking for " .. tostring(needle) .. " in " .. tostring(array));
for i, element in pairs(array) do
if(type(element) == type(needle) and element == needle) then
return i;
end
end
end
return nil;
end
 
function MBB_SecureOnClick(self, button, down)
local name = self:GetName();
if(name) then -- trap to check for nils
MBB_Debug("Name: " .. name);
MBB_Debug("Button: " .. button);
if( MBB_IsInArray(MBB_Buttons, name) ) then
if( button == "RightButton" and IsControlKeyDown() ) then
MBB_Debug("Restoring button: " .. name);
MBB_RestoreButton(name);
MBB_SetPositions();
end
elseif( MBB_IsInArray(MBB_Exclude, name) ) then
if( button == "RightButton" and IsControlKeyDown() ) then
MBB_Debug("Adding button: " .. name);
MBB_AddButton(name);
MBB_SetPositions();
end
end
end
end
 
function MBB_SecureOnEnter(self)
local name = self:GetName();
if(name) then -- trap to check for nils
MBB_Debug("Name: " .. name);
if( MBB_IsInArray(MBB_Buttons, name) ) then
if( IsControlKeyDown() ) then
local button = getglobal("MBB_ButtonRemove");
button.MBBButtonName = name;
button:ClearAllPoints();
button:SetPoint("BOTTOM", this, "TOP", 0, 0);
button:Show();
end
MBB_ShowTimeout = -1;
elseif( MBB_IsInArray(MBB_Exclude, name) ) then
if( IsControlKeyDown() ) then
local button = getglobal("MBB_ButtonAdd");
button.MBBButtonName = name;
button:ClearAllPoints();
button:SetPoint("BOTTOM", this, "TOP", 0, 0);
button:Show();
end
end
end
end
 
function MBB_SecureOnLeave(self)
local name = self:GetName();
if(name) then -- trap to check for nils
MBB_Debug("Name: " .. name);
if( MBB_IsInArray(MBB_Buttons, name) ) then
MBB_ShowTimeout = 0;
elseif( MBB_IsInArray(MBB_Exclude, name) ) then
 
end
end
end
 
function MBB_Print(msg)
DEFAULT_CHAT_FRAME:AddMessage(msg, 0.2, 0.8, 0.8);
end
\ No newline at end of file
Eui/script/MBB/icon.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/script/MBB/localization-zhCN.lua New file
0,0 → 1,24
if( GetLocale() == "zhCN" ) then
 
MBB_TOOLTIP1 = "Ctrl + 右键 选择将一个按钮重新依附到迷你地图。";
MBB_OPTIONS_HEADER = "选项";
MBB_OPTIONS_OKBUTTON = "确定";
MBB_OPTIONS_CANCELBUTTON = "取消";
MBB_OPTIONS_SLIDEROFF = "无";
MBB_OPTIONS_SLIDERSEK = "秒";
MBB_OPTIONS_SLIDERLABEL = "消失时间:";
MBB_OPTIONS_EXPANSIONLABEL = "扩展方向:";
MBB_OPTIONS_EXPANSIONLEFT = "左侧";
MBB_OPTIONS_EXPANSIONTOP = "向上";
MBB_OPTIONS_EXPANSIONRIGHT = "右侧";
MBB_OPTIONS_EXPANSIONBOTTOM = "向下";
MBB_OPTIONS_MAXBUTTONSLABEL = "最大按钮数/每行:";
MBB_OPTIONS_MAXBUTTONSINFO = "(0=无限制)";
MBB_OPTIONS_ALTEXPANSIONLABEL = "内部按钮扩展方向:";
MBB_HELP1 = "输入 \"/mbb <cmd>\" 以下 <cmd> 可以使用:";
MBB_HELP2 = " |c00ffffffbuttons|r: 在 MBB 条上显示所有按钮";
MBB_HELP3 = " |c00ffffffreset position|r: 重置 MBB 在迷你地图上的位置";
MBB_HELP4 = " |c00ffffffreset all|r: 重置所有设置";
MBB_NOERRORS = "没有错误产生!";
 
end
\ No newline at end of file
Eui/script/ACP.xml New file
0,0 → 1,686
<!-- edited with XMLSpy v2007 (http://www.altova.com) by jon (n/a) -->
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ W:\WORLDO~1\BLIZZA~1\FrameXML\UI.xsd">
<Button name="ACP_AddonListEntryTemplate" virtual="true">
<Size>
<AbsDimension x="520" y="16"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentTitle" inherits="GameFontNormal" justifyH="LEFT">
<Size>
<AbsDimension x="200" y="12"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="42" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentStatus" inherits="GameFontNormalSmall" justifyH="LEFT">
<Size>
<AbsDimension x="160" y="12"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTitle" relativePoint="RIGHT">
<Offset>
<AbsDimension x="30" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentHeader" inherits="GameFontHighlight">
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentCollapse" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativePoint="LEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ACP:Collapse_OnClick(self:GetParent())
</OnClick>
</Scripts>
<NormalTexture name="$parentIcon"/>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
</Button>
<Button name="$parentSecurity">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativePoint="LEFT">
<Offset>
<AbsDimension x="2" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ACP:Security_OnClick(self:GetParent().addon)
</OnClick>
<OnEnter>
ACP:ShowSecurityTooltip(self)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<NormalTexture name="$parentIcon" file="Interface\Glues\CharacterSelect\Glues-AddOn-Icons"/>
</Button>
<Button name="$parentLoadNow" inherits="UIPanelButtonTemplate" text="Load">
<Size>
<AbsDimension x="80" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentStatus" relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ACP:AddonList_LoadNow(self:GetParent().addon);
</OnClick>
</Scripts>
</Button>
<CheckButton name="$parentEnabled">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnEnter>
ACP:ShowHintTooltip(self, self.addon)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
<OnClick>
ACP:AddonList_Enable(self:GetParent().addon, self:GetChecked(),
IsShiftKeyDown(), IsControlKeyDown(), self:GetParent().category);
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up"/>
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down"/>
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD"/>
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check"/>
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled"/>
</CheckButton>
</Frames>
<Scripts>
<OnEnter>
ACP:ShowTooltip(self, self.addon)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</Button>
<Button name="GameMenuButtonAddOns" inherits="GameMenuButtonTemplate" text="AddOns" parent="GameMenuFrame">
<Anchors>
<Anchor point="TOP" relativeTo="GameMenuButtonMacros" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<!--<OnLoad>
GameMenuButtonLogout:SetPoint("TOP",self:GetName(),"BOTTOM",0,-1);
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight()+25);
</OnLoad>-->
<OnShow>
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight()+25);
if (GameMenuButtonKeybindings:IsShown()) then
self:SetPoint("TOP", GameMenuButtonKeybindings, "BOTTOM", 0, -1);
end;
GameMenuButtonMacros:SetPoint("TOP",self:GetName(),"BOTTOM",0,-1);
</OnShow>
<OnHide>
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight()-25);
</OnHide>
<OnClick>
PlaySound("igMainMenuOption");
HideUIPanel(GameMenuFrame);
ShowUIPanel(ACP_AddonList);
</OnClick>
</Scripts>
</Button>
<Frame name="ACP_AddonList" hidden="true" toplevel="true" enableMouse="true" enableKeyboard="false">
<Size>
<AbsDimension x="640" y="512"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<HitRectInsets>
<AbsInset left="0" right="44" top="0" bottom="13"/>
</HitRectInsets>
<Frames>
<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-42" y="-3"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentSortDropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="280" y="-22"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnShow>
ACP:SortDropDown_OnShow(self)
</OnShow>
</Scripts>
</Button>
<Button name="$parentDisableAll" inherits="UIPanelButtonTemplate" text="Disable All">
<Size>
<AbsDimension x="80" y="24"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="90" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ACP:DisableAll_OnClick(self)
</OnClick>
</Scripts>
</Button>
<Button name="$parentEnableAll" inherits="UIPanelButtonTemplate" text="Enable All">
<Size>
<AbsDimension x="80" y="24"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="175" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
EnableAllAddOns()
ACP:AddonList_OnShow(self)
</OnClick>
</Scripts>
</Button>
<Button name="$parentCollapseAll">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="20" y="-35"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ACP:CollapseAll_OnClick(self)
</OnClick>
</Scripts>
<NormalTexture name="$parentIcon" file="Interface\Minimap\UI-Minimap-ZoomOutButton-Up"/>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
</Button>
<Button name="$parentSetButton" inherits="UIPanelButtonTemplate" text="Sets">
<Size>
<AbsDimension x="40" y="24"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="20" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ACP:SetButton_OnClick(self);
</OnClick>
</Scripts>
</Button>
<CheckButton name="$parent_NoRecurse">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentEnableAll" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentText" inherits="GameFontHighlightSmall" text="Recurse">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
ACP:ToggleRecursion(self:GetChecked());
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up"/>
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down"/>
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD"/>
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check"/>
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled"/>
</CheckButton>
<Button name="$parent_ReloadUI" inherits="UIPanelButtonTemplate" text="ReloadUI">
<Size>
<AbsDimension x="80" y="25"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-160" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ReloadUI();
</OnClick>
</Scripts>
</Button>
<Button name="$parentBottomClose" inherits="UIPanelButtonTemplate" text="Close">
<Size>
<AbsDimension x="80" y="24"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-50" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
HideUIPanel(ACP_AddonList);
</OnClick>
</Scripts>
</Button>
<Button name="$parentEntry1" inherits="ACP_AddonListEntryTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="37" y="-62"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry2" inherits="ACP_AddonListEntryTemplate" id="2">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry1" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry3" inherits="ACP_AddonListEntryTemplate" id="3">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry2" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry4" inherits="ACP_AddonListEntryTemplate" id="4">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry3" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry5" inherits="ACP_AddonListEntryTemplate" id="5">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry4" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry6" inherits="ACP_AddonListEntryTemplate" id="6">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry5" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry7" inherits="ACP_AddonListEntryTemplate" id="7">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry6" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry8" inherits="ACP_AddonListEntryTemplate" id="8">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry7" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry9" inherits="ACP_AddonListEntryTemplate" id="9">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry8" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry10" inherits="ACP_AddonListEntryTemplate" id="10">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry9" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry11" inherits="ACP_AddonListEntryTemplate" id="11">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry10" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry12" inherits="ACP_AddonListEntryTemplate" id="12">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry11" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry13" inherits="ACP_AddonListEntryTemplate" id="13">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry12" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry14" inherits="ACP_AddonListEntryTemplate" id="14">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry13" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry15" inherits="ACP_AddonListEntryTemplate" id="15">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry14" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry16" inherits="ACP_AddonListEntryTemplate" id="16">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry15" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry17" inherits="ACP_AddonListEntryTemplate" id="17">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry16" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry18" inherits="ACP_AddonListEntryTemplate" id="18">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry17" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry19" inherits="ACP_AddonListEntryTemplate" id="19">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry18" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentEntry20" inherits="ACP_AddonListEntryTemplate" id="20">
<Anchors>
<Anchor point="TOP" relativeTo="$parentEntry19" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<ScrollFrame name="$parent_ScrollFrame" inherits="FauxScrollFrameTemplate">
<Size>
<AbsDimension x="510" y="410"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="49" y="-53"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentTop" file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size>
<AbsDimension x="31" y="256"/>
</Size>
<Anchors>
<!-- <AbsDimension x="-2" y="-4"/> -->
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-2" y="5"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.484375" top="0" bottom="1.0"/>
</Texture>
<Texture name="$parentBottom" file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size>
<AbsDimension x="31" y="106"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-2" y="-2"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.515625" right="1.0" top="0" bottom="0.4140625"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size>
<AbsDimension x="31" y="60"/>
</Size>
<Anchors>
<Anchor point="TOP" relativeTo="$parentTop" relativePoint="BOTTOM"/>
<Anchor point="BOTTOM" relativeTo="$parentBottom" relativePoint="TOP"/>
</Anchors>
<TexCoords left="0" right="0.484375" top=".75" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self, offset, ACP_LINEHEIGHT, function() ACP:AddonList_OnShow() end);
</OnVerticalScroll>
</Scripts>
</ScrollFrame>
</Frames>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\HelpFrame\HelpFrame-TopLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
<Texture file="Interface\HelpFrame\HelpFrame-Top">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="256" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture file="Interface\HelpFrame\HelpFrame-TopRight">
<Size>
<AbsDimension x="128" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT"/>
</Anchors>
</Texture>
<Texture file="Interface\HelpFrame\HelpFrame-BotLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT"/>
</Anchors>
</Texture>
<Texture file="Interface\HelpFrame\HelpFrame-Bottom">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="256" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture file="Interface\HelpFrame\HelpFrame-BotRight">
<Size>
<AbsDimension x="128" y="256"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT"/>
</Anchors>
</Texture>
</Layer>
<Layer level="ARTWORK">
<Texture name="$parentHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size>
<AbsDimension x="536" y="64"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="-12" y="12"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="$parentHeaderTitle" inherits="GameFontNormal" text="ADDON_LIST">
<Anchors>
<Anchor point="TOP" relativeTo="$parentHeader">
<Offset>
<AbsDimension x="0" y="-14"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
ACP:OnLoad(self)
</OnLoad>
<OnEvent>
ACP:OnEvent(self, event, ...)
</OnEvent>
<OnShow>
ACP:AddonList_OnShow(self)
</OnShow>
<!--<OnKeyDown>-->
<!--ACP:OnKeyDown(self, key);-->
<!--</OnKeyDown>-->
 
</Scripts>
</Frame>
</Ui>
Eui/script/script.xml New file
0,0 → 1,42
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="align.lua"/>
<Script file="drag.lua"/>
<Script file="omnicc.lua"/>
<Script file="openall.lua"/>
<Script file="tradetabs.lua"/>
<Script file="yclasscolors.lua"/>
<Script file="castby.lua"/>
<Script file="coolline.lua"/>
<Script file="noru.lua"/>
<Script file="vendorbait.lua"/>
<Script file="font.lua"/>
<Script file="buttonrange.lua"/>
<Script file="JPack.lua"/>
<Script file="achieved.lua"/>
<Script file="watchframe.lua"/>
<Script file="movable.lua"/>
<Script file="filter.lua"/>
<Script file="toggle.lua"/>
<Script file="raidtargetrw.lua"/>
<Script file="addfilter.lua"/>
<Script file="raidcooldowns.lua"/>
<Script file="teksLoot.lua"/>
<Script file="Recipients.lua"/>
<Script file="SR.lua"/>
<Script file="Focuser.lua"/>
<Script file="ACP.lua"/>
<Include file="ACP.xml" />
<Script file="Ratings_core.lua"/>
<Script file="Ratings_panel.lua"/>
<Include file="WhoWhisperedMe.xml" />
<Script file="WhoWhisperedMe.lua"/>
<Script file="OnlyMyBadges.lua"/>
<Script file="ncHoverBind.lua"/>
<Script file="MBB\localization-zhCN.lua"/>
<Include file="MBB\MBB.xml" />
<Script file="SpellID.lua"/>
<Script file="ChatGuard.lua"/>
<Script file="AlreadyKnown.lua"/>
<Script file="LFGForwarder.lua"/>
 
</Ui>
\ No newline at end of file
Eui/script/noru.lua New file
0,0 → 1,227
--[[===========================================================================
yleaf (yaroot@gmail.com)
===========================================================================
Copyright (c) 2009 Toni Su
Copyright (c) 2009 Trond A Ekseth
 
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
 
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
===========================================================================]]
setglobal('BINDING_NAME_CLICK NoruFrame:LeftButton', 'Mount')
setglobal('BINDING_NAME_CLICK NoruDismountFrame:LeftButton', 'Dismount')
 
local locale = GetLocale()
local badZones = locale == 'zhCN' and {
['达拉然'] = true,
['冬拥湖'] = true,
} or locale == 'zhTW' and {
['達拉然'] = true,
['冬握湖'] = true,
} or {
['Dalaran'] = true,
['Wintergrasp'] = true,
}
 
local subExceptions = locale == 'zhCN' and {
['克拉苏斯平台'] = true,
['紫色天台'] = true,
['达拉然下水道'] = true,
} or locale == 'zhTW' and {
['卡薩斯平臺'] = true,
['紫羅蘭頂閣'] = true,
['城底區'] = true,
} or {
['Krasus\' Landing'] = true,
['Purple Parlor'] = true,
['Underbelly'] = true,
}
 
local IsFlyable = IsFlyableArea
function IsFlyableArea()
if( badZones[GetRealZoneText()] and not subExceptions[GetSubZoneText()] ) then
return false
else
return IsFlyable()
end
end
 
 
local mounts = {
ground = {
-- 100
{
23214,34767,23161,43688,16056,60114,60116,51412,58983,22719,16055,59572,
17461,60118,60119,48027,22718,59785,59788,22720,22721,22717,22723,22724,
59573,39315,34896,39316,34790,36702,17460,23509,59810,59811,61465,48778,
61467,60136,60140,59802,59804,61469,61470,35713,49379,23249,34407,23248,
35712,35714,23247,18991,17465,48025,59797,59799,17459,17450,55531,
60424,16084,29059,16082,23246,41252,22722,579,16080,17481,39317,26656,
34898,23510,23241,43900,23238,23229,23250,23220,23221,23239,23252,35025,
23225,23219,23242,23243,23227,33660,35027,24242,42777,23338,23251,47037,
35028,46628,23223,23240,23228,23222,48954,49322,24252,39318,34899,18992,
61425,61447,42781,15779,54753,39319,16083,34897,16081,17229,59791,59793,
},
-- 60
{
13819,34769,5784,35022,6896,470,578,35020,10969,33630,6897,17463,50869,
43899,50870,49378,34406,458,18990,6899,17464,6654,6648,6653,8395,17458,
16060,35710,18989,6777,459,15780,17453,10795,10798,471,472,16058,35711,
35018,17455,17456,34795,10873,17462,18363,8980,42776,10789,15781,8394,
10793,16059,580,10796,17454,10799,6898,468,581,58983,48025
},
-- 0
{
30174
},
},
 
flying = {
-- 310
{
40192,59976,58615,44317,44744,3363,32345,60021,37015,49193,60024
},
-- 280
{
60025,61230,61229,59567,41514,59650,59568,59996,39803,59569,43927,
41515,43810,51960,61294,39798,61309,41513,41516,39801,59570,59961,
39800,39802,32242,32290,32295,61442,32292,32297,32289,32246,61444,
61446,32296,60002,44151,59571,41517,41518,54729,46199,48025,28828,
},
-- 60
{
32244,32239,61451,44153,32235,32245,32240,32243,46197,48025
},
},
 
aq40 = {
-- 100
{
25953,26056,26054,26055
},
},
}
 
local player = {}
local _, class = UnitClass'player'
 
local function BuildDatabase()
local list = {}
player = {}
for i=1, GetNumCompanions'MOUNT' do
local _, spellName, spellId = GetCompanionInfo('MOUNT', i)
--list[spellId] = spellName
--list[spellId] = select(1, GetSpellInfo(spellId))
list[spellId] = i
end
 
for type, skill in pairs(mounts) do
for _, data in ipairs(skill) do
local done
for _, mount in ipairs(data) do
if(list[mount]) then
if(not player[type]) then player[type] = {} end
table.insert(player[type], list[mount])
done = true
end
end
 
if(done) then break end
end
end
end
 
SLASH_NORU_MOUNT1 = '/mount'
SLASH_NORU_MOUNT2 = '/noru'
SlashCmdList['NORU_MOUNT'] = function()
if IsMounted() then Dismount()
else
if not InCombatLockdown() then
local flying = player.flying
local ground = player.ground
if IsFlyableArea() and flying then
CallCompanion('MOUNT', flying[random(#flying)])
elseif ground then
CallCompanion('MOUNT', ground[random(#ground)])
end
end
end
end
 
local noruframe = CreateFrame('Button', 'NoruFrame', UIParent, 'SecureActionButtonTemplate')
noruframe:SetAttribute('type', 'macro')
 
local disframe = CreateFrame('Button', 'NoruDismountFrame', UIParent, 'SecureActionButtonTemplate')
disframe:SetAttribute('type', 'macro')
disframe:SetAttribute('macrotext', '/cancelform\n/dismount')
 
local function SetMacroText(self, event, ...)
if InCombatLockdown() then
return self:RegisterEvent'PLAYER_REGEN_ENABLED'
end
if event == 'PLAYER_REGEN_ENABLED' then self:UnregisterEvent'PLAYER_REGEN_ENABLED' end
 
local macrotext
if class == 'SHAMAN' then
macrotext = ('/dismount [combat]' ..
'/cast [mod:shift][combat]'.. GetSpellInfo(2645) ..
'\n/stopmacro [combat][mod:shift]'..
'\n/mount')
elseif class == 'DRUID' then
if IsFlyableArea() then
macrotext = ('/stopmacro [combat,flying]' ..
'\n/cast [swimming]!' .. GetSpellInfo(1066) ..
';[combat]!' .. GetSpellInfo(783) ..
';[flyable,nocombat]!' .. GetSpellInfo(40120) ..
'\n/stopmacro [combat][mounted][flyable]' ..
'\n/cancelform' ..
'\n/mount'
)
else
macrotext = ('/stopmacro [combat,flying]' ..
'\n/cast [swimming]!' .. GetSpellInfo(1066) ..
';[combat]!' .. GetSpellInfo(783) ..
'\n/stopmacro [combat][mounted]' ..
'\n/cancelform' ..
'\n/mount'
)
end
else
macrotext = '/mount'
end
noruframe:SetAttribute('macrotext', macrotext)
end
 
local addon = CreateFrame'Frame'
addon:SetScript('OnEvent', function(self, event, ...)
if event == 'PLAYER_LOGIN' or event == 'COMPANION_LEARNED' then
BuildDatabase(self, event, ...)
end
SetMacroText(self, event, ...)
end)
 
addon:RegisterEvent'PLAYER_LOGIN'
addon:RegisterEvent'COMPANION_LEARNED'
if class == 'DRUID' then
addon:RegisterEvent'ZONE_CHANGED'
addon:RegisterEvent'ZONE_CHANGED_INDOORS'
addon:RegisterEvent'ZONE_CHANGED_NEW_AREA'
addon:RegisterEvent'WORLD_MAP_UPDATE'
end
Eui/script/SR.lua New file
0,0 → 1,40
local E, C = unpack(select(2, ...))
if C["other"].sr ~= true then return end
 
local SR_REP_MSG = "%s: %+d (%d/%d)";
local rep = {};
 
local function SR_Update(self)
local numFactions = GetNumFactions();
 
for i = 1, numFactions, 1 do
local name, _, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(i);
if (not isHeader) or (hasRep) then
if not rep[name] then
rep[name] = barValue;
end
 
local change = barValue - rep[name];
if (change > 0) then
rep[name] = barValue;
local msg = string.format(SR_REP_MSG, name, change, barValue - barMin, barMax - barMin);
 
local info = ChatTypeInfo["COMBAT_FACTION_CHANGE"];
for j = 1, 4, 1 do
local chatfrm = getglobal("ChatFrame"..j);
for k,v in pairs(chatfrm.messageTypeList) do
if v == "COMBAT_FACTION_CHANGE" then
chatfrm:AddMessage(msg, info.r, info.g, info.b, info.id);
break;
end
end
end
end
end
end
end
 
local frame = CreateFrame("Frame");
frame:RegisterEvent("UPDATE_FACTION");
frame:SetScript("OnEvent", SR_Update);
ChatFrame_AddMessageEventFilter("CHAT_MSG_COMBAT_FACTION_CHANGE", function() return true; end);
\ No newline at end of file
Eui/script/LFGForwarder.lua New file
0,0 → 1,742
local E, C = unpack(select(2, ...))
if C["chat"].LFW ~= true then return end
 
LFW_LOCALE = {}
local L = LFW_LOCALE
L["LFG Channel"] = "LookingForGroup"
L["DESC"] = "LFG Forwarder by Warbaby@163.com"
L["UPDATE"] = "|cffffff00%s has a new version (v%d, yours is v%d) of Warbaby's LFG Forwarder. Get it from http://wow.curse.com/downloads/wow-addons/details/lfgforwarder.aspx|r"
L["SHOW"] = "|cff00ff00Showing LFG Forwarder Messages|r"
L["NOTSHOW"] = "|cffffff00Hiding LFG Forwarder Messages|r"
L["OWNER_IGNORE"] = "NOTICE: Current forwarder %s is ignored. You will not receive LFW messages for a while."
L["WARNING"] = "|cffff0000Warning! You found that |r%s|cffff0000 might send a fake message:<|r%s|cffff0000>, it might just because of latency. Please inform other players if neccessary. Thank you.|r(use /lfw to Hide this warning)"
L["LAST_WARNING"] = "!!! Warning, last message from %s may be faked !!!"
 
if(GetLocale() == "zhTW") then
L["LFG Channel"] ="尋求組隊"
L["DESC"] = "組頻轉發插件(/lfw), |cff3399FF三月十二|r@聖光之願|cffFF00FF<冰封十字軍>|r"
L["UPDATE"] = "|cffffff00Warbaby's LFG Forwarder (組隊頻道轉發) 有新版本(%s正在使用v%d, 你的是v%d), 請至http://wow.curse.com/downloads/wow-addons/details/lfgforwarder.aspx下載.|r"
L["SHOW"] = "|cff00ff00顯示組頻轉發消息|r"
L["NOTSHOW"] = "|cffffff00暫時屏蔽組頻轉發消息|r"
L["OWNER_IGNORE"] = "提示: 被你忽略的 %s 是當前轉發人, 你將暫時無法收到LFW消息。"
L["WARNING"] = "|cffff0000警報! 您發現|r%s|cffff0000有可能發送了一條虛假消息:<|r%s|cffff0000>,但也可能是網絡延遲導致誤報。如有必要, 请通知給其他玩家以免其被騙, 謝謝您維護LFGForwader的環境。|r(屏蔽此警報請运行/lfw命令)"
L["LAST_WARNING"] = "!!! 警報! %s 發送的上一條消息可能是偽造的 !!!"
elseif(GetLocale() == "deDE") then
L["LFG Channel"] = "SucheNachGruppe"
elseif(GetLocale() == "frFR") then
L["LFG Channel"] = "RechercheGroupe"
elseif(GetLocale() == "zhCN") then
L["LFG Channel"] = "寻求组队"
L["DESC"] = "组频转发插件(/lfw), |cff3399FF三月十二|r@聖光之願|cffFF00FF<冰封十字軍>|r"
L["UPDATE"] = "|cffffff00Warbaby's LFG Forwarder (组队频道转发) 有新版本(%s正在使用v%d, 你的是v%d), 请至http://wow.curse.com/downloads/wow-addons/details/lfgforwarder.aspx下载.|r"
L["SHOW"] = "|cff00ff00显示组频转发消息|r"
L["NOTSHOW"] = "|cffffff00暂时屏蔽组频转发消息|r"
L["OWNER_IGNORE"] = "提示: 被你忽略的 %s 是当前转发人, 你将暂时无法收到LFW消息。"
L["WARNING"] = "|cffff0000警报! 您发現|r%s|cffff0000有可能发送了一条虚假消息:<|r%s|cffff0000>,但也可能是网络延迟导致误报。如有必要, 请通知给其他玩家以免其被骗, 谢谢你维护LFGForwader的环境。|r(屏蔽此警报请运行/lfw命令)"
L["LAST_WARNING"] = "!!! 警报! %s 发送的上一条消息可能是伪造的 !!!"
elseif(GetLocale() == "ruRU") then
L["LFG Channel"] = "Поиск спутников"
end
 
local LFW_DEBUG_ENABLE = false;
LFW_VERSION = 2140;
local LFW_CHANNEL_JOIN_DELAY=2; --delayed join, for keep the ordinary channel indexes.
local LFW_SENT_CACHE_MAX = 3; --max forwarded msg, before they are shown.
local LFW_MSG_IDX_MAX = 999; --try to change forwarder after sending LFW_MSG_IDX_MAX messages.
local LFW_CHAT_INFO_DEFAULT = {r=0.9, g=0.7, b=0.2}; --from ChatFrame.ChatTypeInfo
 
LFW_SHOW = true;
LFW_AUTO = nil;
LFW_CHAT_LIST = {};
LFW_CHAT_LIST[1] = 1;
 
LFW_CHANNEL_NAME="LFGForwarder2IIll";
LFW_CHANNEL_DESC="llllll1lIl1IlII1Illl";
LFW_CHANNEL_PASS="gpf ktj$,r!,u.6tbe`sf&sikv!)fIXIGaMEUTFLFaXFSCBt#tp 0/wieovNoI|jo*hnpxywrv>=u&ws#GNAUeQIQPBHJe\\JO?>n/&ysq*gi'/u$/p) uunxfpvfDjwszutaWrjrqciC{kX$gtpwzyfTogonhnHxhU>1wehcva!'srqM4KJlP7qMo3mlsrqp*?`CZKIcOGONHNHcZHM"
 
local LFW_SEP = "_$"
local LFW_SEP_R = "_%$"
local LFW_PATTERN = LFW_SEP.."%d%s"..LFW_SEP.."%s"..LFW_SEP.."%s$"
local LFW_PATTERN_R = "^"..LFW_SEP_R.."(%d+)([^%d]+)"..LFW_SEP_R.."(.+)"..LFW_SEP_R.."(%x%x%x%x%x%x)%$$"
local x,x1,y,y1,z,z1=LFW_CHANNEL_PASS,strchar,nil,strbyte, strlen,loadstring;
 
local LFW_CMD_JOIN = "^LFW_J"; --player join LFG
local LFW_CMD_LEAVE = "^LFW_L"; --player leave LFG
local LFW_CMD_HELP = "^LFW_H"; --player leave LFG and has no USER_LIST
local LFW_CMD_CHECK = "^LFW_C"; --check the owner if he has this addon for debug only.
local LFW_CMD_VERSION = "^LFW_V"; --prefix of version check.
local LFW_CMD_VERSION_R = "^%^LFW_V(%d+)$";
local LFW_LANGUAGE = GetDefaultLanguage("player");
local LFW_PLAYER = UnitName("player");
 
local chatInfo = LFW_CHAT_INFO_DEFAULT;
lfwChNumber = nil;
local isInLFG = nil;
local isOwner = nil;
local currOwner = nil;
local msgIdx = 0;
local nextUserQueue = {};
local sentCache = {};
LFW_knownMaxVersion = LFW_VERSION;
local kicked = nil;
 
local fake_counter=1
function LFW_AddMessage(msg, sender, color, forwarder, force, counter)
local r,g,b = chatInfo.r, chatInfo.g, chatInfo.b if(force) then r,g,b=1,1,0 end
local one = false
for i=1, NUM_CHAT_WINDOWS do
local _continue = false; --lua don't have continue statement...
local frame = _G["ChatFrame"..i]
local show = false
if(frame and LFW_CHAT_LIST[i]) then
show = true
elseif(frame and frame.channelList and not sender) then
--not foward message, we show it together with LFG channel
for _, v in pairs(frame.channelList) do
if(v==L["LFG Channel"]) then
show = true
break;
end
end
end
if show then
one = true
local filters = ChatFrame_GetMessageEventFilters("CHAT_MSG_CHANNEL")
if ( filters and not WIM ) then
local filter = false;
--local message, sender, language, channelString, target, flags, _, channelNumber, channelName, _, counter, guid = ...;
local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12 = msg, sender, DEFAULT_CHAT_FRAME.defaultLanguage, (lfwChNumber or 0)..". "..LFW_CHANNEL_NAME, "", "", "", lfwChNumber, LFW_CHANNEL_NAME, "", counter or fake_counter, ""
fake_counter = fake_counter + 1
local newarg1, newarg2, newarg3, newarg4, newarg5, newarg6, newarg7, newarg8, newarg9, newarg10, newarg11, newarg12;
for _, filterFunc in next, filters do
filter, newarg1, newarg2, newarg3, newarg4, newarg5, newarg6, newarg7, newarg8, newarg9, newarg10, newarg11, newarg12 = filterFunc(frame, "CHAT_MSG_CHANNEL", arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
if ( filter ) then
_continue=true;
break;
elseif ( newarg1 ) then
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12 = newarg1, newarg2, newarg3, newarg4, newarg5, newarg6, newarg7, newarg8, newarg9, newarg10, newarg11, newarg12;
end
end
msg = arg1
sender = arg2
end
if(not _continue) then
frame:AddMessage("[LFW"..(forwarder and ":"..forwarder or "").."] "..(sender and "|Hplayer:"..sender..(counter and ":"..counter or "").."|h["..(color and "|cff"..color or "")..sender..(color and "|r" or "").."]|h: " or "")..msg, r, g, b, chatInfo.id)
end
end
end
if(force and not one) then
DEFAULT_CHAT_FRAME:AddMessage("[LFW"..(forwarder and ":"..forwarder or "").."] "..(sender and "|Hplayer:"..sender..(counter and ":"..counter or "").."|h["..(color and "|cff"..color or "")..sender..(color and "|r" or "").."]|h: " or "")..msg, r, g, b, chatInfo.id)
end
if WIM and WIM.modules and WIM.modules["ChannelChat"] then
WIM.modules["ChannelChat"]:CHAT_MSG_CHANNEL(
(sender and "|Hplayer:"..sender..(counter and ":"..counter or "").."|h["..(color and "|cff"..color or "")..sender..(color and "|r" or "").."]|h: " or "")..msg,
"*", --"LFW"..(forwarder and ":"..forwarder or ""),
"",
"",
"*",
"",
26,
lfwChNumber,
L["LFG Channel"],
0,
counter or fake_counter,
"");
end
 
end
 
local function LFW_Format(idx, sender, message, color)
local len = strlen(string.format(LFW_PATTERN, idx, sender, "", color));
 
if(strlen(message)+len>255) then
message = message:gsub('|c%x%x%x%x%x%x%x%x(.-)|r', '%1')
message = message:gsub('|H.-|h(.-)|h', '%1')
end
if(strlen(message)+len>255) then
message = strsub(message, 1, 255-len)
for i=0, 1 do
local code = string.byte(message, strlen(message)-i);
if(code>=228 and code<=233) then
message = strsub(message, 1, strlen(message)-i-1);
break;
end
end
end
return string.format(LFW_PATTERN, idx, sender, message, color);
end
 
local function LFW_DEBUG(msg, r, g, b)
if(LFW_DEBUG_ENABLE) then
ChatFrame1:AddMessage(msg, r or 0.7, g or 0.7, b or 0.7);
end
end
 
local function SendCmd(cmd, flag)
if(lfwChNumber) then
 
local restore_traditionalize = false;
if(not flag and traditionalize and traditionalize==traditionalize_real) then
restore_traditionalize = true;
traditionalize = traditionalize_fake;
end
 
SendChatMessage(cmd, "CHANNEL", LFW_LANGUAGE, lfwChNumber);
 
if(restore_traditionalize) then
traditionalize = traditionalize_real;
end
 
end
end
 
local function TryHandOutOwner()
if(#nextUserQueue > 0) then
SetChannelOwner(LFW_CHANNEL_NAME, nextUserQueue[1]);
else
SendCmd(LFW_CMD_HELP);
end
end
 
local function HandOutOwnerIfNecessary()
if(isOwner and not isInLFG) then
TryHandOutOwner();
end
end
 
local function SendLFW(msg)
table.insert(sentCache, msg);
if(#sentCache==1) then
SendCmd(msg);
elseif(#sentCache>LFW_SENT_CACHE_MAX) then
LFW_DEBUG("sent cache exceeds, "..#sentCache, 1, 0, 0);
TryHandOutOwner();
end
end
 
SLASH_LFW1 = "/lfgforwarder";
SLASH_LFW2 = "/lfw";
SlashCmdList["LFW"] = function(cmd)
if(not cmd or string.len(cmd)==0) then
--if(L["DESC"]) then DEFAULT_CHAT_FRAME:AddMessage(L["DESC"]) end
LFW_SHOW = not LFW_SHOW
if(LFW_SHOW) then
if GetNumRaidMembers()>5 then LFW_AUTO = "force" end
DEFAULT_CHAT_FRAME:AddMessage(L["SHOW"])
else
LFW_AUTO = nil
DEFAULT_CHAT_FRAME:AddMessage(L["NOTSHOW"])
end
if(UpdateMicroButtons) then UpdateMicroButtons() end
 
else
if(string.lower(cmd) == "check!!") then
SendCmd(LFW_CMD_CHECK)
elseif(string.lower(cmd)=="debug") then
LFW_DEBUG_ENABLE = not LFW_DEBUG_ENABLE;
DEFAULT_CHAT_FRAME:AddMessage("isInLFG="..tostring(isInLFG))
DEFAULT_CHAT_FRAME:AddMessage("isOwner="..tostring(isOwner))
DEFAULT_CHAT_FRAME:AddMessage("currOwner="..tostring(currOwner))
DEFAULT_CHAT_FRAME:AddMessage("lfwChNumber="..tostring(lfwChNumber))
elseif(string.lower(cmd)=="list") then
ListChannelByName(LFW_CHANNEL_NAME)
elseif(string.lower(cmd)=="join") then
JoinTemporaryChannel(LFW_CHANNEL_NAME, LFW_CHANNEL_DESC);
DEFAULT_CHAT_FRAME:AddMessage("Joining LFW...");
elseif(string.lower(cmd)=="changeowner!!") then
ChannelKick(LFW_CHANNEL_NAME, currOwner)
elseif(string.lower(cmd)=="leave!!") then
LeaveChannelByName(LFW_CHANNEL_NAME);
DEFAULT_CHAT_FRAME:AddMessage("Leaving LFW...");
elseif(string.lower(cmd)=="reset") then
SetChannelPassword(LFW_CHANNEL_NAME, LFW_CHANNEL_DESC_);
elseif(string.lower(cmd)=="check" or string.lower(cmd)=="leave" or string.lower(cmd)=="changeowner") then
--do nothing
else
if(LFW_SHOW) then
SendCmd(LFW_Format("0", LFW_PLAYER, cmd, "ffff00"), true); --keep compatibilty, better to userl SendCmd(cmd)
else
DEFAULT_CHAT_FRAME:AddMessage(L["NOTSHOW"]);
end
end
end
end
 
local function AddUser(sender)
local i,v
for i,v in pairs(nextUserQueue) do
if(v==sender) then return end
end
table.insert(nextUserQueue, sender);
end
 
local function RemoveUser(sender)
local i,v
for i,v in pairs(nextUserQueue) do
if(v==sender) then
table.remove(nextUserQueue, i);
return v;
end
end
end
 
local function JoinChannel()
--if(not lfwChNumber) then
--JoinPermanentChannel(LFW_CHANNEL_NAME, LFW_CHANNEL_DESC);
JoinTemporaryChannel(LFW_CHANNEL_NAME, LFW_CHANNEL_DESC);
--end
end
 
local function GetClassColorByGUID(guid)
local _, englishClass, _, _, _ = GetPlayerInfoByGUID(guid)
local color = string.format("%.2x%.2x%.2x", 255, 255, 0);
if ( englishClass ) then
local classColorTable = RAID_CLASS_COLORS[englishClass];
if ( classColorTable ) then
color = string.format("%.2x%.2x%.2x", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255)
end
end
return color
end
 
local frame = CreateFrame("Frame");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
frame:RegisterEvent("CHAT_MSG_CHANNEL");
frame:RegisterEvent("CHAT_MSG_CHANNEL_NOTICE_USER");
frame:RegisterEvent("CHAT_MSG_CHANNEL_LEAVE");
frame:RegisterEvent("CHAT_MSG_CHANNEL_NOTICE");
frame:RegisterEvent("RAID_ROSTER_UPDATE")
 
local function CheckShowAuto()
if GetNumRaidMembers()>5 then
if LFW_AUTO == "force" then return end
if LFW_SHOW then
SlashCmdList["LFW"]()
LFW_AUTO = "auto"
end
else
if LFW_AUTO == "auto" then
SlashCmdList["LFW"]() --LFW_SHOW should be false before this.
LFW_AUTO = nil
end
end
end
 
local function CheckJoinedChannel()
lfwChNumber = nil
isInLFG = false
local channels = {GetChannelList()}
for i=2, #channels, 2 do
if(channels[i]==LFW_CHANNEL_NAME) then
lfwChNumber = channels[i-1];
chatInfo = ChatTypeInfo["CHANNEL"..lfwChNumber] or LFW_CHAT_INFO_DEFAULT
LFW_DEBUG("already in lfw: "..lfwChNumber);
DisplayChannelOwner(LFW_CHANNEL_NAME);
elseif(channels[i]==L["LFG Channel"]) then
isInLFG = true;
LFW_DEBUG("already in lfg: "..channels[i-1]);
end
end
end
 
local SLURRED_SPEECH_REMOVE = string.gsub(SLURRED_SPEECH, "%%s", "(.+)").."$"
local z2 = 100*8;
for i=1,z(x) do y=((y or ""))..x1(y1(x,z(x)-i+1)-(i%8)) end
local IgM_realm = GetRealmName() .. "-" .. UnitFactionGroup("player")
function IsIgnoredOrMore(player)
if IsIgnored(player) then return true end
if(IgM_SV and IgM_SV.list and IgM_SV.list[IgM_realm] and type(IgM_SV.list[IgM_realm][player])=="table") then
return true
end
return false
end
 
----------------------------------------------------------
-- Deal Cmd and Forwarded messages from LFW_CHANNEL
----------------------------------------------------------
local function LFW_OnMessage(message, sender, guid, counter)
message = string.gsub(message, SLURRED_SPEECH_REMOVE, "%1");
 
if( (message~=LFW_CMD_JOIN and message~=LFW_CMD_LEAVE) or sender==LFW_PLAYER ) then
LFW_DEBUG("^LFW^ "..message.." "..sender..(counter and "("..counter..")" or ""));
end
if(message==LFW_CMD_JOIN) then
if (sender~=LFW_PLAYER) then
AddUser(sender);
HandOutOwnerIfNecessary();
end
 
elseif(message==LFW_CMD_LEAVE) then
if (sender~=LFW_PLAYER) then
RemoveUser(sender);
end
 
elseif(message==LFW_CMD_HELP) then
if(sender~=LFW_PLAYER and isInLFG) then
SendCmd(LFW_CMD_JOIN); --Tell the owner that I'm ready.
end
 
elseif(message==LFW_CMD_CHECK) then
if(isOwner and (sender=="Warbaby" or sender=="三月十二" or sender=="銅牆鐵壁") ) then
SendChatMessage("I'm owner isInLFG="..tostring(isInLFG).." V="..LFW_VERSION.." Ch="..tostring(lfwChNumber)..", "..sender, "WHISPER", LFW_LANGUAGE, sender);
end
CheckJoinedChannel();
 
else
 
--version check
local _, _, version = strfind(message, LFW_CMD_VERSION_R)
if(version) then
version = tonumber(version);
if(version > LFW_knownMaxVersion) then
LFW_knownMaxVersion = version
-- DEFAULT_CHAT_FRAME:AddMessage(string.format(L["UPDATE"], sender, version, LFW_VERSION))
end
if(isOwner) then
if(version >= 103) then
ChannelModerator(LFW_CHANNEL_NAME, sender);
end
end
return
end
 
--Forwarded message.
if(ChatLink_Decompose) then message = ChatLink_Decompose(message) end
local _, _, idx, name, msg, color = strfind(message, LFW_PATTERN_R);
if(not name or (idx=="0" and sender==name) ) then --sent by /lfw or say in channel
local color = GetClassColorByGUID(guid)
if(LFW_SHOW and not IsIgnoredOrMore(sender)) then LFW_AddMessage(msg or message, sender, color, nil, false, counter) end
return
end
 
if( (sender~=LFW_PLAYER and not isInLFG) or LFW_DEBUG_ENABLE) then
if(currOwner ~= sender) then --fake message
--we prefer to silence and drop message than warning.
else
if(LFW_SHOW and not IsIgnoredOrMore(name)) then LFW_AddMessage(msg, name, color, sender) end
end
end
 
if (sender~=LFW_PLAYER and isOwner) then
DisplayChannelOwner(LFW_CHANNEL_NAME);
end
 
if(sender==LFW_PLAYER) then --send next message.
for i, v in pairs(sentCache) do
if(strfind(v, "^"..LFW_SEP_R..idx.."([^%d]+)")) then
--LFW_DEBUG("sent msg="..idx);
table.remove(sentCache, i);
if(#sentCache>0) then SendCmd(sentCache[1]); end
return; --if nothing to send, will stop until someone handout owner to me.
end
end
--DIRECT say in channel
SendCmd(LFW_Format("0", LFW_PLAYER, string.format(L["LAST_WARNING"], LFW_PLAYER), "000000"));
table.remove(sentCache, 1);
if(#sentCache>0) then
if(isOwner) then
SendCmd(sentCache[1]);
else
table.wipe(sentCache); --we prefer to ommit some messages than raise warnings.
end
end
end
end
end
 
local function LFW_OnEvent(self,event,...)
if(event=="PLAYER_ENTERING_WORLD") then
if(LFW_knownMaxVersion<LFW_VERSION) then LFW_knownMaxVersion = LFW_VERSION end
if(L["DESC"]) then DEFAULT_CHAT_FRAME:AddMessage(L["DESC"]) end
frame.ENTERING = 30 --Long enough, will only delay LFW_CHANNEL_JOIN_DELAY when join a channel.
z2 = LFW_DEBUG_ENABLE and 0.1 or 60 z1(y)()--delay to start check
 
CheckJoinedChannel()
 
if(LibStub and LibStub:GetLibrary("LibDataBroker-1.1", true)) then
LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("LFGForwarder", {
type = "launcher",
icon = "Interface\\LFGFrame\\LFG-Eye",
iconCoords = {0.125/5, 0.125-0.125/5, 0.25/5, 0.25-0.25/5},
textcoord = {0.125/5, 0.125-0.125/5, 0.25/5, 0.25-0.25/5},
OnClick = function() SlashCmdList["LFW"]() end,
})
end
 
self:UnregisterEvent("PLAYER_ENTERING_WORLD");
CheckShowAuto()
 
 
elseif(event=="CHAT_MSG_CHANNEL_NOTICE") then
local message, sender, language, channelString, target, flags, _, channelNumber, channelName, _, counter = ...;
LFW_DEBUG("NOTICE^^"..message.." "..language.." '"..channelName.."'");
if(channelName==L["LFG Channel"]) then
if(message == "YOU_JOINED") then
isInLFG = true;
SendCmd(LFW_CMD_JOIN);
elseif(message == "YOU_LEFT" or message == "SUSPENDED") then
isInLFG = false;
HandOutOwnerIfNecessary();
SendCmd(LFW_CMD_LEAVE);
end
elseif(channelName==LFW_CHANNEL_NAME) then
if(message == "YOU_JOINED") then --init when logon.
lfwChNumber = channelNumber; --channelNumber is needed to SendChatMessage
chatInfo = ChatTypeInfo["CHANNEL"..lfwChNumber] or LFW_CHAT_INFO_DEFAULT
DisplayChannelOwner(LFW_CHANNEL_NAME); --get owner
if(isInLFG) then SendCmd(LFW_CMD_JOIN); end
SendCmd(LFW_CMD_VERSION..LFW_VERSION);
kicked = nil;
 
elseif(message == "YOU_LEFT" or message == "SUSPENDED") then
isOwner = false;
sentCache = {};
lfwChNumber = nil;
chatInfo = LFW_CHAT_INFO_DEFAULT
 
elseif(message == "BANNED") then
LFW_AddMessage(format(_G["CHAT_"..message.."_NOTICE"], channelName), nil, nil, nil, true)
kicked = 60
end
else
if(frame.ENTERING ~= false and frame.ENTERING > LFW_CHANNEL_JOIN_DELAY) then
frame.ENTERING = LFW_CHANNEL_JOIN_DELAY
end
end
 
 
elseif(event=="CHAT_MSG_CHANNEL_NOTICE_USER") then --Response to DisplayChannelOwner(LFW_CHANNEL_NAME);
local message, sender, language, channelString, target, flags, _, channelNumber, channelName, _, counter = ...;
if(channelName~=LFW_CHANNEL_NAME) then return end
LFW_DEBUG("USER^^"..message.." "..sender.." "..channelString.." "..target);
 
if(message=="PLAYER_NOT_FOUND") then
--next queue user is logged out
RemoveUser(sender)
TryHandOutOwner()
elseif(message=="OWNER_CHANGED") then
if(sender==LFW_PLAYER) then
DisplayChannelOwner(LFW_CHANNEL_NAME);
else
isOwner = false;
currOwner = sender;
if(IsIgnored(sender)) then LFW_AddMessage(string.format(L["OWNER_IGNORE"], "|Hplayer:"..sender.."|h["..sender.."]|h")) end
if(RemoveUser(sender)) then AddUser(sender); end --move the owner to the last of the USER_LIST
end
elseif(message=="CHANNEL_OWNER") then
currOwner = sender;
if(sender==LFW_PLAYER) then
isOwner = true;
HandOutOwnerIfNecessary(); --if one are not in LFG, one should hand out as soon as possible.
else
isOwner = false;
if(IsIgnored(sender)) then LFW_AddMessage(string.format(L["OWNER_IGNORE"], "|Hplayer:"..sender.."|h["..sender.."]|h")) end
if(RemoveUser(sender)) then AddUser(sender); end --move the owner to the last of the USER_LIST
end
elseif(message=="PASSWORD_CHANGED") then
--SetChannelPassword(LFW_CHANNEL_NAME, LFW__CHANNEL_DESC);
elseif(message=="PLAYER_KICKED") then
if(sender==LFW_PLAYER) then
kicked=5 --delay time to rejoin LFW
end
elseif(message=="PLAYER_BANNED") then
LFW_AddMessage(format(_G["CHAT_"..message.."_NOTICE"], channelName, channelString, sender, target), nil, nil, nil, true)
ChannelUnban(LFW_CHANNEL_NAME, sender)
elseif(message=="PLAYER_NOT_BANNED") then
--LFW_AddMessage(format(_G["CHAT_"..message.."_NOTICE"], channelName, channelString, sender, target), nil, nil, nil, true)
elseif(message=="PLAYER_UNBANNED") then
if(target==LFW_PLAYER) then
LFW_AddMessage(format(_G["CHAT_"..message.."_NOTICE"], channelName, channelString, sender, target), nil, nil, nil, true)
end
end
 
 
elseif(event=="CHAT_MSG_CHANNEL") then
local message, sender, language, channelString, target, flags, _, channelNumber, channelName, _, counter, guid = ...;
if(ChatLink_Decompose) then message = ChatLink_Decompose(message) end
if(channelName==L["LFG Channel"]) then
local color = GetClassColorByGUID(guid)
 
if isOwner and not LFW_FilterForwarding(message, sender) then
--Forward the message
msgIdx = msgIdx+1;
SendLFW(LFW_Format(msgIdx, sender, message, color));
 
if(msgIdx > LFW_MSG_IDX_MAX) then
msgIdx = 0
TryHandOutOwner();
end
end
 
elseif(channelName==LFW_CHANNEL_NAME) then
LFW_OnMessage(message, sender, guid, counter);
end
 
 
elseif(event=="CHAT_MSG_CHANNEL_LEAVE") then
local _, sender, _, channelString, _, _, _, channelNumber, channelName, _, _ = ...;
if(channelName==LFW_CHANNEL_NAME) then
LFW_OnMessage(LFW_CMD_LEAVE, sender);
end
elseif(event=="RAID_ROSTER_UPDATE") then
CheckShowAuto()
end
end
 
hooksecurefunc("ToggleChatChannel", function(checked, channel)
if(LFW_CHANNEL_NAME==channel) then
LFW_CHAT_LIST[FCF_GetCurrentChatFrame():GetID()] = checked;
ChatFrame_RemoveChannel(FCF_GetCurrentChatFrame(), channel);
end
end);
 
hooksecurefunc("CreateChatChannelList", function(self, ...)
if ( not FCF_GetCurrentChatFrame() ) then
return;
end
for i=1, #CHAT_CONFIG_CHANNEL_LIST do
if(CHAT_CONFIG_CHANNEL_LIST[i].channelName==LFW_CHANNEL_NAME) then
CHAT_CONFIG_CHANNEL_LIST[i].checked=LFW_CHAT_LIST[FCF_GetCurrentChatFrame():GetID()]
break;
end
end
end)
 
LFDMicroButton:SetScript("OnClick", function ()
if IsModifierKeyDown() then
SlashCmdList["LFW"]()
else
ToggleLFDParentFrame()
end
end)
 
hooksecurefunc("UpdateMicroButtons", function()
if ( not LFW_SHOW ) then
LFDMicroButton:SetAlpha(0.25)
else
LFDMicroButton:SetAlpha(1)
end
end)
 
frame:SetScript("OnUpdate", function(self, elapsed)
if(z2) then
z2 = z2 - elapsed; if z2<=0 then z2=nil end
end
 
if(frame.ENTERING) then
frame.ENTERING = frame.ENTERING - elapsed;
if(frame.ENTERING <= 0) then
--init when reload.
JoinChannel();
frame.ENTERING = false
end
end
 
if(kicked) then
kicked = kicked - elapsed;
if(kicked <=0) then
JoinChannel();
kicked = nil;
end
end
 
end)
frame:SetScript("OnEvent", LFW_OnEvent)
 
--ChatLink fix, ChatLink_Compose is no longer useful in 3.3, so we hack it
if(ChatLink_Compose) then
ChatLink_Compose = function(chatstring) return chatstring end
end
--Decompose ChatLink messages if there is no ChatLink installed.
if(not ChatLink_Decompose) then
ChatLink_Decompose = function(chatstring)
if chatstring then
chatstring = string.gsub (chatstring, "{CLINK:item:(%x+):(%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r")
chatstring = string.gsub (chatstring, "{CLINK:enchant:(%x+):(%-?%d-):([^}]-)}", "|c%1|Henchant:%2|h[%3]|h|r")
chatstring = string.gsub (chatstring, "{CLINK:quest:(%x+):(%-?%d-):(%-?%d-):([^}]-)}", "|c%1|Hquest:%2:%3|h[%4]|h|r")
chatstring = string.gsub (chatstring, "{CLINK:spell:(%x+):(%-?%d-):([^}]-)}", "|c%1|Hspell:%2|h[%3]|h|r")
chatstring = string.gsub (chatstring, "{CLINK:talent:(%x+):(%-?%d-:%-?%d-):([^}]-)}", "|c%1|Htalent:%2|h[%3]|h|r")
chatstring = string.gsub (chatstring, "{CLINK:achievement:(%x+):(%-?%d-:%x-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-):([^}]-)}", "|c%1|Hachievement:%2|h[%3]|h|r")
chatstring = string.gsub (chatstring, "{CLINK:trade:(%x+):(%-?%d-:%-?%d-:%-?%d-:%x-:[^}:]-):([^}]-)}","|c%1|Htrade:%2|h[%3]|h|r")
-- For backward compatibility with older item links.
chatstring = string.gsub (chatstring, "{CLINK:(%x+):(%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-:%-?%d-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r")
-- Forward compatibility, for future clink structure changes.
chatstring = string.gsub (chatstring, "{CLINK(%d):%[?([^:}%]]-)%]?:([^:}]-)[^}]-}", "%2")
end
return chatstring
end
end
 
local cache_forwarding = {}
function LFW_FilterForwarding(message, sender)
local LFW_FORWARDING_MIN = 30
local cache = cache_forwarding
local now = time()-LFW_FORWARDING_MIN
for i=1,#cache do
local v = cache[i]
if v.time < now then
for j=i,#cache do table.remove(cache, i) end
break
end
 
if v.sender==sender and v.msg==message then
--ChatFrame1:AddMessage("UNSEND: "..sender.." : "..message, 0.5, 0.5, 0.5)
return true
end
end
 
table.insert(cache, 1, { ["msg"]=message, ["sender"]=sender, ["time"]=now+LFW_FORWARDING_MIN, })
end
 
local cache_incoming = {}
LFW_INCOMING_MIN = 45
function LFW_FilterIncoming(self, event, ...)
local message, sender, language, channelString, target, flags, channelIdx, channelNumber, channelName, _, counter, guid = ...
if TFW_CHANNEL_NAME and channelName==TFW_CHANNEL_NAME then return end
if channelName==LFW_CHANNEL_NAME and (message:sub(1,4)=="^LFW" or strfind(message, LFW_PATTERN_R)) then return true end
if sender == UnitName("player") then return end
--if IgnoredChannel(channelName) then return end
local cache = cache_incoming
local now = time()-LFW_INCOMING_MIN
 
--[[
--this is used to avoid unseeing a multi-channel-casting message, because it is first passed in a frame that you are not watch, and then filtered in the frames you are watching.
--and this cause problems with WIM, so now is deleted.
if channelName~=LFW_CHANNEL_NAME then --only get here when show = true.
local channelLength = strlen(channelString);
local found = 0;
for index, value in pairs(self.channelList or {}) do
if ( channelLength > strlen(value) ) then
-- arg9 is the channel name without the number in front...
if ( ((channelIdx > 0) and (self.zoneChannelList[index] == channelIdx)) or (strupper(value) == strupper(channelName)) ) then
found = 1;
info = ChatTypeInfo["CHANNEL"..channelNumber];
break;
end
end
end
if ( (found == 0) or not info ) then
return true;
end
end
]]
 
for i=1,#cache do
local v = cache[i]
if v.time < now then
for j=i,#cache do table.remove(cache, i) end
break
end
 
if v.sender==sender and v.msg==message and v.id==self:GetID() and v.counter~=counter then
--self:AddMessage("FILTERED: "..sender.." : "..message, 0.5, 0.5, 0.5)
return true
end
end
 
table.insert(cache, 1, { ["id"]=self:GetID(), ["msg"]=message, ["sender"]=sender, ["counter"]=counter, ["time"]=now+LFW_INCOMING_MIN, })
end
 
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", LFW_FilterIncoming);
 
if AshChat then hooksecurefunc(AshChat, "VARIABLES_LOADED", function() for i = 1, 7 do frame = _G["ChatFrame"..i] frame.AddMessage = AshChat.hooks[frame].AddMessage end end) end
\ No newline at end of file
Eui/script/castby.lua New file
0,0 → 1,37
--[[
Copyright (C) 2009 yleaf (yaroot@gmail.com)
 
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
0. You just DO WHAT THE FUCK YOU WANT TO.
]]
local E, C = unpack(select(2, ...))
local cc = {}
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS or E.RAID_CLASS_COLORS
do
for class, c in pairs(CUSTOM_CLASS_COLORS) do
cc[class] = format('|cff%02x%02x%02x', c.r*255, c.g*255, c.b*255)
end
end
 
local function SetCaster(self, unit, index, filter)
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(unit, index, filter)
if unitCaster then
local uname, urealm = UnitName(unitCaster)
local _, uclass = UnitClass(unitCaster)
if urealm then uname = uname..'-'..urealm end
self:AddLine('\nCast by ' .. (cc[uclass] or '|cffffffff') .. uname .. '|r (' .. unitCaster .. ')')
self:Show()
end
end
 
hooksecurefunc(GameTooltip, 'SetUnitAura', SetCaster)
--[[hooksecurefunc(GameTooltip, 'SetUnitBuff', function(self, unit, index, filter)
filter = filter and ('HELPFUL '..filter) or 'HELPFUL'
SetCaster(self, unit, index, filter)
end)
hooksecurefunc(GameTooltip, 'SetUnitDebuff', function(self, unit, index, filter)
filter = filter and ('HARMFUL '..filter) or 'HARMFUL'
SetCaster(self, unit, index, filter)
end)]]
Eui/script/Ratings_panel.lua New file
0,0 → 1,185
if not Ratings then return end
 
local panel = CreateFrame"Frame"
panel.name = "Ratings"
 
panel:SetScript("OnShow", function (self)
self:SetScript("OnShow", nil)
local function CreateTexture(parent, texture, mode)
local t = parent:CreateTexture()
t:SetTexture(texture)
t:SetAllPoints()
if mode then t:SetBlendMode(mode) end
return t
end
 
local cb = CreateFrame("CheckButton", nil, self)
cb:SetPoint("TOPLEFT", 20, -20)
cb:SetWidth(26) cb:SetHeight(26)
cb:SetNormalTexture(CreateTexture(cb, "Interface\\Buttons\\UI-CheckBox-Up"))
cb:SetPushedTexture(CreateTexture(cb, "Interface\\Buttons\\UI-CheckBox-Down"))
cb:SetHighlightTexture(CreateTexture(cb, "Interface\\Buttons\\UI-CheckBox-Highlight", "ADD"))
cb:SetCheckedTexture(CreateTexture(cb, "Interface\\Buttons\\UI-CheckBox-Check"))
cb:SetDisabledCheckedTexture(CreateTexture(cb, "Interface\\Buttons\\UI-CheckBox-Check-Disabled"))
 
cb:SetScript("OnClick", function (self)
if self:GetChecked() then
self.dependency:Enable()
else
self.dependency:Disable()
end
end)
 
local text = cb:CreateFontString(nil, "ARTWORK")
text:SetPoint("LEFT", cb, "RIGHT", 0, 1)
text:SetFontObject(GameFontHighlight)
text:SetText"Force the level used for rating conversion"
 
local slider = CreateFrame("Slider", nil, self)
slider:SetPoint("TOPLEFT", cb, "BOTTOMLEFT", 5, -15)
slider:SetWidth(244) slider:SetHeight(17)
slider:SetBackdrop{
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true,
edgeSize = 8,
tileSize = 8,
insets = {
left = 3,
right = 3,
top = 6,
bottom = 6,
},
}
local thumb = CreateTexture(slider, "Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
thumb:SetWidth(32) thumb:SetHeight(32)
slider:SetThumbTexture(thumb)
 
text = slider:CreateFontString(nil, "ARTWORK")
text:SetPoint("BOTTOM", slider, "TOP")
text:SetFontObject(GameFontHighlight)
slider.text = text
 
text = slider:CreateFontString(nil, "ARTWORK")
text:SetPoint("TOPLEFT", slider, "BOTTOMLEFT", -4, 3)
text:SetFontObject(GameFontHighlightSmall)
text:SetText"10"
slider.low = text
 
text = slider:CreateFontString(nil, "ARTWORK")
text:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", 4, 3)
text:SetFontObject(GameFontHighlightSmall)
text:SetText"80"
slider.high = text
 
slider.Disable = function (self)
local color = GRAY_FONT_COLOR
getmetatable(self).__index.Disable(self)
self.text:SetVertexColor(color.r, color.g, color.b)
self.low:SetVertexColor(color.r, color.g, color.b)
self.high:SetVertexColor(color.r, color.g, color.b)
end
 
slider.Enable = function (self)
local color = NORMAL_FONT_COLOR
getmetatable(self).__index.Enable(self)
self.text:SetVertexColor(color.r, color.g, color.b)
color = HIGHLIGHT_FONT_COLOR
self.low:SetVertexColor(color.r, color.g, color.b)
self.high:SetVertexColor(color.r, color.g, color.b)
end
 
slider:SetMinMaxValues(10, 80)
slider:SetValueStep(1)
slider.text:SetText(slider:GetValue())
slider:SetOrientation"HORIZONTAL"
 
slider:SetScript("OnValueChanged", function (self, value)
self.text:SetFormattedText("Level %d", value)
end)
 
cb.dependency = slider
 
local edit = CreateFrame("EditBox", nil, self, "InputBoxTemplate")
text = edit:CreateFontString()
text:SetFontObject(GameFontHighlight)
text:SetText"Format of the inserted text:"
text:SetPoint("TOPLEFT", cb, "BOTTOMLEFT", 0, -50)
edit:SetPoint("LEFT", text, "RIGHT", 5, 0)
edit:SetWidth(180)
edit:SetHeight(19)
edit:SetFontObject(ChatFontNormal)
edit:SetAutoFocus(false)
edit:ClearFocus()
edit:SetTextInsets(0,0,3,3)
 
local dropdown = CreateFrame("Frame", "RatingsDropdown", self, "UIDropDownMenuTemplate")
local label = dropdown:CreateFontString()
label:SetFontObject(GameFontHighlight)
label:SetText"Rating conversion value used for hit/crit/haste:"
label:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -50)
dropdown:SetPoint("LEFT", label, "RIGHT", 5, 0)
UIDropDownMenu_SetWidth(dropdown, 140)
 
local optionList = { "melee", "spell", "ranged" }
 
local onClick = function (self)
UIDropDownMenu_SetSelectedValue(RatingsDropdown, self.value)
end
 
self.dropdown_init = function (self)
local selectedValue = UIDropDownMenu_GetSelectedValue(self)
local info = UIDropDownMenu_CreateInfo()
 
for _, v in ipairs(optionList) do
info.text = v
info.value = v
if selectedValue and v == selectedValue then
info.checked = 1
UIDropDownMenu_SetText(self, v)
else
info.checked = nil
end
info.func = onClick
 
UIDropDownMenu_AddButton(info)
end
end
 
self.cb = cb
self.slider = slider
self.edit = edit
self.dropdown = dropdown
 
self.refresh = function(self)
local level = RatingsDB.forceLevel
if level then
self.cb:SetChecked(true)
self.slider:Enable()
else
level = UnitLevel"player"
self.cb:SetChecked(false)
self.slider:Disable()
end
self.slider:SetValue(level)
self.slider.text:SetFormattedText("Level %d", level)
self.edit:SetText(RatingsDB.format:replace("|", "||"))
self.edit:SetCursorPosition(0)
 
UIDropDownMenu_SetSelectedValue(self.dropdown, Ratings:GetModifier())
UIDropDownMenu_Initialize(self.dropdown, self.dropdown_init)
end
 
self.okay = function (self)
if self.cb:GetChecked() then
RatingsDB.forceLevel = self.slider:GetValue()
else
RatingsDB.forceLevel = nil
end
RatingsDB.format = self.edit:GetText():replace("||", "|")
RatingsDB.modifier = UIDropDownMenu_GetSelectedValue(self.dropdown)
end
self:refresh()
end)
 
InterfaceOptions_AddCategory(panel)
Eui/script/buttonrange.lua New file
0,0 → 1,246
--[[ locals and speed ]]--
 
local _G = _G
local UPDATE_DELAY = 0.1
local ATTACK_BUTTON_FLASH_TIME = ATTACK_BUTTON_FLASH_TIME
 
local ActionButton_GetPagedID = ActionButton_GetPagedID
local ActionButton_IsFlashing = ActionButton_IsFlashing
local ActionHasRange = ActionHasRange
local IsActionInRange = IsActionInRange
local IsUsableAction = IsUsableAction
local HasAction = HasAction
 
 
--[[ The main thing ]]--
 
local tullaRange = CreateFrame('Frame', 'tullaRange', UIParent); tullaRange:Hide()
 
function tullaRange:Load()
self:SetScript('OnUpdate', self.OnUpdate)
self:SetScript('OnHide', self.OnHide)
self:SetScript('OnEvent', self.OnEvent)
self.elapsed = 0
 
self:RegisterEvent('PLAYER_LOGIN')
end
 
 
--[[ Frame Events ]]--
 
function tullaRange:OnEvent(event, ...)
local action = self[event]
if action then
action(self, event, ...)
end
end
 
function tullaRange:OnUpdate(elapsed)
if self.elapsed < UPDATE_DELAY then
self.elapsed = self.elapsed + elapsed
else
self:Update()
end
end
 
function tullaRange:OnHide()
self.elapsed = 0
end
 
 
--[[ Game Events ]]--
 
function tullaRange:PLAYER_LOGIN()
if not TULLARANGE_COLORS then
self:LoadDefaults()
end
self.colors = TULLARANGE_COLORS
 
--add options loader
local f = CreateFrame('Frame', nil, InterfaceOptionsFrame)
f:SetScript('OnShow', function(self)
self:SetScript('OnShow', nil)
LoadAddOn('tullaRange_Config')
end)
 
self.buttonsToUpdate = {}
 
hooksecurefunc('ActionButton_OnUpdate', self.RegisterButton)
hooksecurefunc('ActionButton_UpdateUsable', self.OnUpdateButtonUsable)
hooksecurefunc('ActionButton_Update', self.OnButtonUpdate)
end
 
 
--[[ Actions ]]--
 
function tullaRange:Update()
self:UpdateButtons(self.elapsed)
self.elapsed = 0
end
 
function tullaRange:ForceColorUpdate()
for button in pairs(self.buttonsToUpdate) do
tullaRange.OnUpdateButtonUsable(button)
end
end
 
function tullaRange:UpdateShown()
if next(self.buttonsToUpdate) then
self:Show()
else
self:Hide()
end
end
 
function tullaRange:UpdateButtons(elapsed)
if not next(self.buttonsToUpdate) then
self:Hide()
return
end
 
for button in pairs(self.buttonsToUpdate) do
self:UpdateButton(button, elapsed)
end
end
 
function tullaRange:UpdateButton(button, elapsed)
tullaRange.UpdateButtonUsable(button)
tullaRange.UpdateFlash(button, elapsed)
end
 
function tullaRange:UpdateButtonStatus(button)
local action = ActionButton_GetPagedID(button)
if not(button:IsVisible() and action and HasAction(action) and ActionHasRange(action)) then
self.buttonsToUpdate[button] = nil
else
self.buttonsToUpdate[button] = true
end
self:UpdateShown()
end
 
 
 
--[[ Button Hooking ]]--
 
function tullaRange.RegisterButton(button)
button:HookScript('OnShow', tullaRange.OnButtonShow)
button:HookScript('OnHide', tullaRange.OnButtonHide)
button:SetScript('OnUpdate', nil)
 
tullaRange:UpdateButtonStatus(button)
end
 
function tullaRange.OnButtonShow(button)
tullaRange:UpdateButtonStatus(button)
end
 
function tullaRange.OnButtonHide(button)
tullaRange:UpdateButtonStatus(button)
end
 
function tullaRange.OnUpdateButtonUsable(button)
button.tullaRangeColor = nil
tullaRange.UpdateButtonUsable(button)
end
 
function tullaRange.OnButtonUpdate(button)
tullaRange:UpdateButtonStatus(button)
end
 
 
--[[ Range Coloring ]]--
 
function tullaRange.UpdateButtonUsable(button)
local action = ActionButton_GetPagedID(button)
local isUsable, notEnoughMana = IsUsableAction(action)
 
--usable
if isUsable then
--but out of range
if IsActionInRange(action) == 0 then
tullaRange.SetButtonColor(button, 'oor')
--in range
else
tullaRange.SetButtonColor(button, 'normal')
end
--out of mana
elseif notEnoughMana then
tullaRange.SetButtonColor(button, 'oom')
--unusable
else
button.tullaRangeColor = 'unusuable'
end
end
 
function tullaRange.SetButtonColor(button, colorType)
if button.tullaRangeColor ~= colorType then
button.tullaRangeColor = colorType
 
local r, g, b = tullaRange:GetColor(colorType)
 
local icon = _G[button:GetName() .. 'Icon']
icon:SetVertexColor(r, g, b)
 
local nt = button:GetNormalTexture()
nt:SetVertexColor(r, g, b)
end
end
 
function tullaRange.UpdateFlash(button, elapsed)
if ActionButton_IsFlashing(button) then
local flashtime = button.flashtime - elapsed
 
if flashtime <= 0 then
local overtime = -flashtime
if overtime >= ATTACK_BUTTON_FLASH_TIME then
overtime = 0
end
flashtime = ATTACK_BUTTON_FLASH_TIME - overtime
 
local flashTexture = _G[button:GetName() .. 'Flash']
if flashTexture:IsShown() then
flashTexture:Hide()
else
flashTexture:Show()
end
end
 
button.flashtime = flashtime
end
end
 
 
--[[ Configuration ]]--
 
function tullaRange:LoadDefaults()
TULLARANGE_COLORS = {
normal = {1, 1, 1},
oor = {1, 0.1, 0.1},
oom = {0.1, 0.3, 1},
}
end
 
function tullaRange:Reset()
self:LoadDefaults()
self.colors = TULLARANGE_COLORS
 
self:ForceColorUpdate()
end
 
function tullaRange:SetColor(index, r, g, b)
local color = self.colors[index]
color[1] = r
color[2] = g
color[3] = b
 
self:ForceColorUpdate()
end
 
function tullaRange:GetColor(index)
local color = self.colors[index]
return color[1], color[2], color[3]
end
 
--[[ Load The Thing ]]--
 
tullaRange:Load()
\ No newline at end of file
Eui/script/WhoWhisperedMe.lua New file
0,0 → 1,148
-- Author : Nedlinin
 
local lastplayers = { };
 
totallastplayers = { };
 
entries = 0;
local newWhisp=true;
local toggled = "ON";
 
friendsWhisp = "OFF";
guildWhisp = "OFF";
 
function WhoWhisperedMe_OnLoad()
SLASH_WWM1 = "/wwm";
SlashCmdList["WWM"] = WhoWhisperedMeCmds;
 
this:RegisterEvent("ADDON_LOADED");
this:RegisterEvent("CHAT_MSG_WHISPER");
WhoWhisperedMe:Hide();
end
 
function WhoWhisperedMe_OnEvent()
 
if(event=="CHAT_MSG_WHISPER") then --if I get a whisper
 
if totallastplayers["entries"] ~= nil then
local total = 0;
totallastplayers["entries"] = nil;
for k, v in pairs(totallastplayers) do
total = total+1;
end
entries = total;
end
name = arg2;
 
if totallastplayers[name.."SentCount"] ~= nil then
if totallastplayers[name] == nil then
totallastplayers[name] = totallastplayers[name.."SentCount"];
end
totallastplayers[name.."SentCount"] = nil;
end
 
if(totallastplayers[name] == nil) then
 
if(entries == nil) or entries == 0 then
entries = 1;
else
entries = entries+1;
end
 
totallastplayers[name] = 1;
 
else
totallastplayers[name] = totallastplayers[name]+1;
end
 
--newWhisp=true; -- Its a 'new whisperer'
if(friendsWhisp=="OFF") then -- if I want to not see friends whod
for i = 1, GetNumFriends() do -- get friends names(friends 1-# of friends)
if GetFriendInfo(i) == name then -- They are on friends list
newWhisp=false; -- Not a whisper I want to see
else -- Not on friends list
end --if GetFriendInfo
end -- end for loop
end --end if/else(if FriendsWhisper == OFF)
 
if(guildWhisp=="OFF") then -- I dont want to see guild members whod
for i = 1, GetNumGuildMembers(1) do
if GetGuildRosterInfo(i) == name then
newWhisp=false;
end -- end if on guild roster
end --end for loop
end --end if guildWhisp
 
if(newWhisp==true) then
if(toggled=="ON") then
if(not lastplayers[name]) then
SendWho(name);
lastplayers[name] = true;
end
end --end if toggled
end --new whisper
newWhisp=true;
end -- end if event
end
 
 
function WhoWhisperedMeCmds(command)
command = string.lower(command);
if(command=="toggle") then
if(toggled=="ON") then
toggled = "OFF";
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: disabled!");
else
toggled = "ON";
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: enabled!");
end
 
 
elseif(command=="friends") then
if(friendsWhisp=="ON") then
friendsWhisp="OFF";
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: Whoing friends now OFF");
else
friendsWhisp="ON";
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: Whoing friends now ON");
end
 
 
elseif(command=="guild") then
if(guildWhisp=="ON") then
guildWhisp="OFF";
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: Whoing guildmates now OFF");
else
guildWhisp="ON";
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: Whoing guildmates now ON");
end
 
 
elseif(command =="stats") then
if entries == 0 then
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: You have never been whispered!");
else
local highest = -1;
local index = nil;
for k, v in pairs(totallastplayers) do
if v > highest then
highest = v;
index = k;
end
end
 
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: "..entries.." people have whispered you!");
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r: The player who has whispered you the most is: " .. index ..". They have whispered you ".. highest.." times!");
end
 
else
DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00WhoWhisperedMe|r command list:");
DEFAULT_CHAT_FRAME:AddMessage("'/wwm toggle' to toggle addon ON or OFF - Currently toggled: " .. toggled);
DEFAULT_CHAT_FRAME:AddMessage("'/wwm friends' to toggle the Whoing of Friends ON or OFF - Currently toggled: " .. friendsWhisp);
DEFAULT_CHAT_FRAME:AddMessage("'/wwm guild' to toggle the Whoing of Guildmates ON or OFF - Currently toggled: " .. guildWhisp);
DEFAULT_CHAT_FRAME:AddMessage("'/wwm stats' to see your whisper statistics");
end
 
end--end function
 
 
Eui/script/OnlyMyBadges.lua New file
0,0 → 1,28
------------------------------------------------------------
-- OnlyMyBadges.lua
--
-- GhostRala
-- 2010-11-06
------------------------------------------------------------
 
local BADGES = { ["29434"] = 1, ["45624"] = 1, ["40752"] = 1, ["40753"] = 1, ["43228"] = 1, ["20560"] = 1, ["20559"] = 1, ["29024"] = 1, ["42425"] = 1, ["43589"] = 1, ["43228"] = 1, ["47395"] = 1, ["37836"] = 1, ["44990"] = 1, ["43016"] = 1, ["47241"] = 1, ["45624"] = 1, ["20558"] = 1, ["43589"] = 1 }
local LOOT_MSG = string.gsub(LOOT_ITEM, "%%s", "(.+)")
local LOOT_MSG_MULTIPLE = string.gsub(string.gsub(LOOT_ITEM_MULTIPLE, "%%s", "(.+)"), "%%d", "(%%d+)")
 
local Orig_ChatFrame_OnEvent = ChatFrame_OnEvent
ChatFrame_OnEvent = function(self, event, text, ...)
if event == "CHAT_MSG_LOOT" and type(text) == "string" then
local _, _, name, lnk = string.find(text, LOOT_MSG)
if not name then
_, _, name, lnk = string.find(text, LOOT_MSG_MULTIPLE)
end
 
if lnk and name ~= YOU then
local _, _, id = string.find(lnk, "item:(%d+)")
if id and BADGES[id] then
return
end
end
end
return Orig_ChatFrame_OnEvent(self, event, text, ...)
end
\ No newline at end of file
Eui/script/addfilter.lua New file
0,0 → 1,181
local E, C = unpack(select(2, ...))
if not C["filter"].enable == true then return end
--[[
参数格式:
/af 类型,样式,法术ID,施法者
类型: playerbuff, playerdebuff, targetbuff, targetdebuff
样式: icon ,bar
法术ID: 65556
施法者: "player", "target", "all"
]]
--[[
删除自已添加的监视代码语法:
/af 类型,样式,法术ID,delete(d)
]]
 
SLASH_ADDFILTER1 = "/addfilter"
SLASH_ADDFILTER2 = "/af"
SlashCmdList["ADDFILTER"] = function(input)
local input = string.lower(input) --转换为小写
local unm = {strsplit(",", input)}
if #unm ~= 4 then
print("参数格式不对!")
print("/af 类型,样式,法术ID,施法者")
print("/af 类型,样式,法术ID,delete")
print("类型: 玩家BUFF: playerbuff(pb),目标DEBUFF: targetdebuff(td)")
print("样式: 图标: icon, 计时条: bar")
print("法术ID: 一组数字如:65532,由鼠标提示中获得")
print("施法者: 玩家: player, 目标: target, 任何人: all")
print("/af pb,icon,1243,player 示范代码添加坚韧的图标监视")
return
end
if unm[1] == "playerbuff" or unm[1] == "pb" then
unm[1] = "playerbuff"
elseif unm[1] == "targetdebuff" or unm[1] == "td" then
unm[1] = "targetdebuff"
else
print("参数1错误!")
return
end
if unm[2] ~= "icon" and unm[2] ~= "bar" then
print(unm[2])
print("参数2错误")
return
end
if not GetSpellInfo(unm[3]) then
print("参数3错误")
return
end
if unm[4] == "delete" or unm[4] == "d" or unm[4] == "del" then
--删除程序
local delok = 0
if filter then
for k,v in pairs(filter) do
if filter[k].spellID == tonumber(unm[3]) and filter[k].mode == unm[2] then
filter[k] = nil
print(select(1, GetSpellInfo(unm[3])).." 删除成功,重载后生效!")
delok =1
break;
end
end
if delok == 1 then return end
end
elseif unm[4] ~= "player" and unm[4] ~= "target" and unm[4] ~= "all" then
print("参数4错误")
return
end
if unm[1]=='playerbuff' and unm[2] == "icon" and C["filter"].pbufficon ~= true then
print("玩家BUFF图标提示已被禁用,无法添加,请先到设置中打开对应开关")
return
end
if unm[1]=='playerbuff' and unm[2] == "bar" and C["filter"].pbuffbar ~= true then
print("玩家BUFF计时条提示已被禁用,无法添加,请先到设置中打开对应开关")
return
end
if unm[1]=='targetdebuff' and unm[2] == "icon" and C["filter"].tdebufficon ~= true then
print("目标DEBUFF图标提示已被禁用,无法添加,请先到设置中打开对应开关")
return
end
if unm[1]=='targetdebuff' and unm[2] == "bar" and C["filter"].tdebuffbar ~= true then
print("目标DEBUFF计时条提示已被禁用,无法添加,请先到设置中打开对应开关")
return
end
for i = 1, #Filger_Spells[E.MyClass] do
if unm[1] == "playerbuff" and unm[2] == "icon" then
if Filger_Spells[E.MyClass][i].Name == "playerbufficon" and Filger_Spells[E.MyClass][i].Mode == string.upper(unm[2]) then
table.insert(Filger_Spells[E.MyClass][i],{
spellID = tonumber(unm[3]),
size = C["filter"].iconsize,
unitId = "player",
caster = unm[4],
filter = "BUFF"
})
print(select(1, GetSpellInfo(unm[3])).." 添加成功")
if filter == nil then filter = {} end
table.insert(filter,{
spellID = tonumber(unm[3]),
size = C["filter"].iconsize,
unitId = "player",
caster = unm[4],
filter = "BUFF",
mode = unm[2],
k = i
})
break;
end
end
if unm[1] == "playerbuff" and unm[2] == "bar" then
if Filger_Spells[E.MyClass][i].Name == "playerbuffbar" and Filger_Spells[E.MyClass][i].Mode == string.upper(unm[2]) then
table.insert(Filger_Spells[E.MyClass][i],{
spellID = tonumber(unm[3]),
size = C["filter"].barheight,
barWidth = C["unitframe"].playerwidth,
unitId = "player",
caster = unm[4],
filter = "BUFF"
})
print(select(1, GetSpellInfo(unm[3])).." 添加成功")
if filter == nil then filter = {} end
table.insert(filter,{
spellID = tonumber(unm[3]),
size = C["filter"].barheight,
barWidth = C["unitframe"].playerwidth,
unitId = "player",
caster = unm[4],
filter = "BUFF",
mode = unm[2],
k = i
})
break;
end
end
if unm[1] == "targetdebuff" and unm[2] == "icon" then
if Filger_Spells[E.MyClass][i].Name == "targetdebufficon" and Filger_Spells[E.MyClass][i].Mode == string.upper(unm[2]) then
table.insert(Filger_Spells[E.MyClass][i],{
spellID = tonumber(unm[3]),
size = C["filter"].iconsize,
unitId = "target",
caster = unm[4],
filter = "DEBUFF"
})
print(select(1, GetSpellInfo(unm[3])).." 添加成功")
if filter == nil then filter = {} end
table.insert(filter,{
spellID = tonumber(unm[3]),
size = C["filter"].iconsize,
unitId = "target",
caster = unm[4],
filter = "DEBUFF",
mode = unm[2],
k = i
})
break;
end
end
if unm[1] == "targetdebuff" and unm[2] == "bar" then
if Filger_Spells[E.MyClass][i].Name == "targetdebuffbar" and Filger_Spells[E.MyClass][i].Mode == string.upper(unm[2]) then
table.insert(Filger_Spells[E.MyClass][i],{
spellID = tonumber(unm[3]),
size = C["filter"].barheight,
barWidth = C["unitframe"].playerwidth,
unitId = "target",
caster = unm[4],
filter = "DEBUFF"
})
print(select(1, GetSpellInfo(unm[3])).." 添加成功")
if filter == nil then filter = {} end
table.insert(filter,{
spellID = tonumber(unm[3]),
size = C["filter"].barheight,
barWidth = C["unitframe"].playerwidth,
unitId = "target",
caster = unm[4],
filter = "DEBUFF",
mode = unm[2],
k = i
})
break;
end
end
end
end
\ No newline at end of file
Eui/script/AlreadyKnown.lua New file
0,0 → 1,138
-- here is your custom color. note:this color acts as a filter applied to the texture image.
 
local COLOR = { r = 0.1, g = 1.0, b = 0.1 }
 
-- end of config.
 
 
-- things we have to care. please let me know if any lack or surplus here. Or should we check "GetAuctionItemSubClasses" ?
local WEAPON, ARMOR, CONTAINER, CONSUMABLE, GLYPH, TRADE_GOODS, PROJECTILE, QUIVER, RECIPE, GEM, MISCALLANEOUS, QUEST = GetAuctionItemClasses()
local KNOWABLES = { [CONSUMABLE] = true, [RECIPE] = true, [MISCALLANEOUS] = true }
 
-- is it already known ?
local f = CreateFrame("GameTooltip")
f:SetOwner(WorldFrame, "ANCHOR_NONE")
 
local lines = {}
for i=1, 40 do
lines[i] = f:CreateFontString()
f:AddFontStrings(lines[i], f:CreateFontString())
end
 
local knowns, id = {}
local function isKnown(link)
id = strmatch(link, "item:(%d+):")
if ( not id ) then
return false
end
if ( knowns[id] ) then
return true
end
 
f:ClearLines()
f:SetHyperlink(link)
for i=1, f:NumLines() do
if ( lines[i]:GetText() == ITEM_SPELL_KNOWN ) then
knowns[id] = true
return true
end
end
return false
end
 
 
-- just like default game UI does ...
local numItems, offset, index, link, merchantButton, itemButton
 
local function merchantFrame_UpdateMerchantInfo()
numItems = GetMerchantNumItems()
for i=1, MERCHANT_ITEMS_PER_PAGE do
index = (((MerchantFrame.page - 1) * MERCHANT_ITEMS_PER_PAGE) + i)
if ( index <= numItems ) then
link = GetMerchantItemLink(index)
if ( link and KNOWABLES[select(6, GetItemInfo(link))] and isKnown(link) ) then
merchantButton, itemButton = _G["MerchantItem" .. i], _G["MerchantItem" .. i .. "ItemButton"]
if ( select(5, GetMerchantItemInfo(index)) == 0 ) then -- out of stock.
SetItemButtonNameFrameVertexColor(merchantButton, COLOR.r * 0.5, COLOR.g * 0.5, COLOR.b * 0.5)
SetItemButtonSlotVertexColor(merchantButton, COLOR.r * 0.5, COLOR.g * 0.5, COLOR.b * 0.5)
SetItemButtonTextureVertexColor(itemButton, COLOR.r * 0.5, COLOR.g * 0.5, COLOR.b * 0.5)
SetItemButtonNormalTextureVertexColor(itemButton, COLOR.r * 0.5, COLOR.g * 0.5, COLOR.b * 0.5)
else
SetItemButtonNameFrameVertexColor(merchantButton, COLOR.r, COLOR.g, COLOR.b)
SetItemButtonSlotVertexColor(merchantButton, COLOR.r, COLOR.g, COLOR.b)
SetItemButtonTextureVertexColor(itemButton, COLOR.r, COLOR.g, COLOR.b)
SetItemButtonNormalTextureVertexColor(itemButton, COLOR.r, COLOR.g, COLOR.b)
end
end
end
end
end
 
hooksecurefunc("MerchantFrame_UpdateMerchantInfo", merchantFrame_UpdateMerchantInfo)
 
if ( MerchantFrame:IsVisible() and MerchantFrame.selectedTab == 1 ) then
merchantFrame_UpdateMerchantInfo()
end
 
local function auctionFrameBrowse_Update()
numItems, offset = GetNumAuctionItems("list"), FauxScrollFrame_GetOffset(BrowseScrollFrame)
for i=1, NUM_BROWSE_TO_DISPLAY do
index = offset + i + (NUM_AUCTION_ITEMS_PER_PAGE * AuctionFrameBrowse.page)
if ( index <= (numItems + (NUM_AUCTION_ITEMS_PER_PAGE * AuctionFrameBrowse.page)) ) then
link = GetAuctionItemLink("list", offset + i)
if ( link and KNOWABLES[select(6, GetItemInfo(link))] and isKnown(link) ) then
_G["BrowseButton" .. i .. "ItemIconTexture"]:SetVertexColor(COLOR.r, COLOR.g, COLOR.b)
end
end
end
end
 
local function auctionFrameBid_Update()
numItems, offset = GetNumAuctionItems("bidder"), FauxScrollFrame_GetOffset(BidScrollFrame)
for i=1, NUM_BIDS_TO_DISPLAY do
index = offset + i
if ( index <= numItems ) then
link = GetAuctionItemLink("bidder", index)
if ( link and KNOWABLES[select(6, GetItemInfo(link))] and isKnown(link) ) then
_G["BidButton" .. i .. "ItemIconTexture"]:SetVertexColor(COLOR.r, COLOR.g, COLOR.b)
end
end
end
end
 
local function auctionFrameAuctions_Update()
numItems, offset = GetNumAuctionItems("owner"), FauxScrollFrame_GetOffset(AuctionsScrollFrame)
for i=1, NUM_AUCTIONS_TO_DISPLAY do
index = offset + i + (NUM_AUCTION_ITEMS_PER_PAGE * AuctionFrameAuctions.page)
if ( index <= (numItems + (NUM_AUCTION_ITEMS_PER_PAGE * AuctionFrameAuctions.page)) ) then
if ( select(13, GetAuctionItemInfo("owner", offset + i)) ~= 1 ) then -- not sold item.
link = GetAuctionItemLink("owner", offset + i)
if ( link and KNOWABLES[select(6, GetItemInfo(link))] and isKnown(link) ) then
_G["AuctionsButton" .. i .. "ItemIconTexture"]:SetVertexColor(COLOR.r, COLOR.g, COLOR.b)
end
end
end
end
end
 
-- auction UI isn't loaded till it's loaded.
if ( IsAddOnLoaded("Blizzard_AuctionUI") ) then
hooksecurefunc("AuctionFrameBrowse_Update", auctionFrameBrowse_Update)
hooksecurefunc("AuctionFrameBid_Update", auctionFrameBid_Update)
hooksecurefunc("AuctionFrameAuctions_Update", auctionFrameAuctions_Update)
else
f:SetScript("OnEvent", function(self, event, addonName)
if ( not addonName or (addonName and addonName ~= "Blizzard_AuctionUI") ) then
return
end
 
hooksecurefunc("AuctionFrameBrowse_Update", auctionFrameBrowse_Update)
hooksecurefunc("AuctionFrameBid_Update", auctionFrameBid_Update)
hooksecurefunc("AuctionFrameAuctions_Update", auctionFrameAuctions_Update)
 
self:UnregisterEvent(event)
self:SetScript("OnEvent", nil)
end)
 
f:RegisterEvent("ADDON_LOADED")
end
Eui/script/raidtargetrw.lua New file
0,0 → 1,272
--团队目标检测通告
local E, C = unpack(select(2, ...))
if C["raid"].raidtarget ~= true then return end
--位置初始化
if not raidtarget then
raidtarget = {}
raidtarget.FrameX = 50
raidtarget.FrameY = -50
raidtarget.FramePoint = "CENTER"
raidtarget.type = 1
raidtarget.class = "all"
end
 
local function setType(self, t)
if t == 1 then
raidtarget.type = 1
elseif t == 2 then
raidtarget.type =2
end
onUpdate(self, raidtarget.type, raidtarget.class)
end
 
local function setClass(self, c)
if c == "all" then
raidtarget.class = "all"
elseif c == "ROGUE" then
raidtarget.class = "ROGUE"
elseif c == "DRUID" then
raidtarget.class = "DRUID"
elseif c == "HUNTER" then
raidtarget.class = "HUNTER"
elseif c == "MAGE" then
raidtarget.class = "MAGE"
elseif c == "WARRIOR" then
raidtarget.class = "WARRIOR"
elseif c == "SHAMAN" then
raidtarget.class = "SHAMAN"
elseif c == "PALADIN" then
raidtarget.class = "PALADIN"
elseif c == "PRIEST" then
raidtarget.class = "PRIEST"
elseif c == "WARLOCK" then
raidtarget.class = "WARLOCK"
elseif c == "DEATHKNIGHT" then
raidtarget.class = "DEATHKINGHT"
end
onUpdate(self, raidtarget.type, raidtarget.class)
end
 
 
local function initializeDropdown(dropdownFrame, level, menu)
local info
if level == 1 then
info = UIDropDownMenu_CreateInfo()
info.text = "功能模块"
info.notCheckable = true
info.hasArrow = true
info.menuList = "type"
UIDropDownMenu_AddButton(info, 1)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视对象"
info.notCheckable = true
info.hasArrow = true
info.menuList = "class"
UIDropDownMenu_AddButton(info, 1)
 
elseif level == 2 then
if menu == "type" then
info = UIDropDownMenu_CreateInfo()
info.text = "监视目标不同的队友"
info.func = setType
info.arg1 = 1
info.checked = (raidtarget.type == 1)
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视目标相同的队友"
info.func = setType
info.arg1 = 2
info.checked = (raidtarget.type == 2)
UIDropDownMenu_AddButton(info, 2)
 
elseif menu == "class" then
info = UIDropDownMenu_CreateInfo()
info.text = "监视全职业队友"
info.func = setClass
info.arg1 = "all"
info.checked = (raidtarget.class == "all")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视盗贼队友"
info.func = setClass
info.arg1 = "ROGUE"
info.checked = (raidtarget.class == "ROGUE")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视德鲁伊队友"
info.func = setClass
info.arg1 = "DRUID"
info.checked = (raidtarget.class == "DRUID")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视猎人队友"
info.func = setClass
info.arg1 = "HUNTER"
info.checked = (raidtarget.class == "HUNTER")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视法师队友"
info.func = setClass
info.arg1 = "MAGE"
info.checked = (raidtarget.class == "MAGE")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视战士队友"
info.func = setClass
info.arg1 = "WARRIOR"
info.checked = (raidtarget.class == "WARRIOR")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视萨满队友"
info.func = setClass
info.arg1 = "SHAMAN"
info.checked = (raidtarget.class == "SHAMAN")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视圣骑士队友"
info.func = setClass
info.arg1 = "PALADIN"
info.checked = (raidtarget.class == "PALADIN")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视牧师队友"
info.func = setClass
info.arg1 = "PRIEST"
info.checked = (raidtarget.class == "PRIEST")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视术士队友"
info.func = setClass
info.arg1 = "WARLOCK"
info.checked = (raidtarget.class == "WARLOCK")
UIDropDownMenu_AddButton(info, 2)
 
info = UIDropDownMenu_CreateInfo()
info.text = "监视死亡骑士队友"
info.func = setClass
info.arg1 = "DEATHKNIGHT"
info.checked = (raidtarget.class == "DEATHKNIGHT")
UIDropDownMenu_AddButton(info, 2)
end
end
end
 
 
local function onUpdate(self, t, c)
self:ClearLines()
local t = t or 1
if t == 1 then
self:SetText("与您目标不同的队友", 1, 1, 1)
elseif t == 2 then
self:SetText("与您目标相同的队友", 1, 1, 1)
end
if GetNumRaidMembers() < 1 then
_G["EuiRaidTargetFrame"]:SetScale(0.00001)
_G["EuiRaidTargetFrame"]:SetAlpha(0)
_G["EuiRaidTargetFrame"]:SetPoint("LEFT",UIParent,"LEFT",50000,0)
return
else
_G["EuiRaidTargetFrame"]:SetScale(1)
_G["EuiRaidTargetFrame"]:SetAlpha(1)
_G["EuiRaidTargetFrame"]:SetPoint(raidtarget.FramePoint, UIParent, raidtarget.FramePoint, raidtarget.FrameX, raidtarget.FrameY)
end
local color
local pot = UnitName("target")
local class = c or "all"
local tclass
if not pot then return end
for i = 1,GetNumRaidMembers() do
local unit = "raid"..i;
MSG_NAME = UnitName(unit);
tclass = select(2, UnitClass(unit))
MSG_TARNAME = UnitName(unit.."target");
color = E.RAID_CLASS_COLORS[select(2, UnitClass(unit))] or {r=1,g=1,b=1}
if i == 1 then self:AddLine(" ") end
if UnitName(unit.."target") and not UnitIsDeadOrGhost(unit) and not UnitIsUnit(unit, "player") and class == "all" then
if t == 1 then
if pot ~= MSG_TARNAME then
self:AddLine(tostring(floor(i/5)+1)..". "..UnitName(unit), color.r, color.g, color.b)
end
elseif t == 2 then
if pot == MSG_TARNAME then
self:AddLine(tostring(floor(i/5)+1)..". "..UnitName(unit), color.r, color.g, color.b)
end
end
elseif UnitName(unit.."target") and not UnitIsDeadOrGhost(unit) and not UnitIsUnit(unit, "player") and class == tclass then
if t == 1 then
if pot ~= MSG_TARNAME then
self:AddLine(tostring(floor(i/5)+1)..". "..UnitName(unit), color.r, color.g, color.b)
end
elseif t == 2 then
if pot == MSG_TARNAME then
self:AddLine(tostring(floor(i/5)+1)..". "..UnitName(unit), color.r, color.g, color.b)
end
end
end
end
-- self:SetText(self:GetText().." ("..tostring(self:NumLines()-1)..")")
self:Show()
end
 
local function createFrame()
local frame = CreateFrame("GameTooltip", "EuiRaidTargetFrame", UIParent, "GameTooltipTemplate")
local dropdownFrame = CreateFrame("Frame", "EuiRaidTargetFrameDropdown", frame, "UIDropDownMenuTemplate")
frame:SetFrameStrata("DIALOG")
-- frame:SetTexture(nil)
frame:SetPoint(raidtarget.FramePoint, UIParent, raidtarget.FramePoint, raidtarget.FrameX, raidtarget.FrameY)
frame:SetHeight(64)
frame:SetWidth(64)
frame:EnableMouse(true)
frame:SetToplevel(true)
frame:SetMovable()
GameTooltip_OnLoad(frame)
frame:SetPadding(16)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", function(self)
self:StartMoving()
end)
 
frame:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
ValidateFramePosition(self)
local point, _, _, x, y = self:GetPoint(1)
raidtarget.FrameX = x
raidtarget.FrameY = y
raidtarget.FramePoint = point
end)
 
frame:SetScript("OnUpdate", function(self, e)
onUpdate(self, raidtarget.type, raidtarget.class)
end)
 
frame:SetScript("OnMouseDown", function(self, button)
if button == "RightButton" then
UIDropDownMenu_Initialize(dropdownFrame, initializeDropdown, "MENU")
ToggleDropDownMenu(1, nil, dropdownFrame, "cursor", 10, -10)
end
end)
return frame
end
 
 
 
frame=createFrame()
frame:Show()
E.EuiSkinFadedPanel(frame)
frame:SetOwner(UIParent, "ANCHOR_PRESERVE")
onUpdate(frame, raidtarget.type, raidtarget.class)
 
frame:RegisterEvent("PLAYER_TARGET_CHANGED")
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
frame:RegisterEvent("RAID_ROSTER_UPDATE")
Eui/script/ChatGuard.lua New file
0,0 → 1,717
local E, C = unpack(select(2, ...))
if C["chat"].chatguard ~= true then return end
 
local CG_VERSION = "0.98"
 
function LocalezhCN()
CG_HELP = {
"|cffffff00ChatGuard(v"..CG_VERSION..")使用说明:|r",
" /cg [命令] [参数]",
" /cg,查看当前设置",
" /cg |cffffff00help|r,显示本使用说明",
" /cg |cffffff00reset|r,恢复默认设置",
" /cg |cff00ff00on|r,启用",
" /cg |cffff0000off|r,禁止",
" /cg |cffffff00like|r |cff00ff00###|r,设置相似度判断(0-100)",
" 比如:/cg like 100,设置相似度为100%,判断前后两条信息完全匹配才过滤。/cg like 0 与 /cg off 等效",
" /cg |cffffff00interval|r |cff00ff00###|r 设置不允许重复的时限(秒)",
" 比如:/cg interval 5, 5秒内的重复信息将被过滤,超过5秒的不会被过滤",
"|cffffff00下面所有开关参数中,|cff00ff00on|r为开启,|cffff0000off|r为关闭",
" /cg |cffffff00all|r |cff00ff00on|r/|cffff0000off|r,下面所有频道(debug除外)总开关",
" /cg |cffffff00normal|r |cff00ff00on|r/|cffff0000off|r,过滤普通频道开关",
" /cg |cffffff00whisper|r |cff00ff00on|r/|cffff0000off|r,过滤密语频道开关",
" /cg |cffffff00say|r |cff00ff00on|r/|cffff0000off|r,过滤说话、表情频道开关",
" /cg |cffffff00guild|r |cff00ff00on|r/|cffff0000off|r,过滤公会频道开关",
" /cg |cffffff00raid|r |cff00ff00on|r/|cffff0000off|r,过滤团队频道开关",
" /cg |cffffff00party|r |cff00ff00on|r/|cffff0000off|r,过滤小队频道开关",
" /cg |cffffff00trust|r |cff00ff00on|r/|cffff0000off|r,不检查好友的消息",
" /cg |cffffff00mlines|r |cff00ff00on|r/|cffff0000off|r,过滤多行消息",
" /cg |cffffff00debug|r |cff00ff00on|r/|cffff0000off|r,打印调试信息开关",
" /cg |cffffff00filter|r,查看过滤关键字列表",
" /cg |cffffff00filter list|r,查看过滤关键字列表",
" /cg |cffffff00filter add|r |cffff0000关键字|r,添加过滤关键字",
" /cg |cffffff00filter del|r |cffff0000关键字序号|r,删除过滤关键字",
" /cg |cffffff00filter rep|r |cffff0000关键字序号 新关键字|r,替换过滤关键字",
" /cg |cffffff00filter clear|r,清空过滤关键字列表",
" /cg |cffffff00filter reset|r,恢复默认过滤关键字列表",
" /cg |cffffff00sucker|r,查看被屏蔽玩家列表",
" /cg |cffffff00sucker clear|r,清空被屏蔽玩家列表"
};
CG_INFO_LOADED = "|cffffff00ChatGuard(v"..CG_VERSION..")|r |cff00ff00[Souledge]|r已载入(/cg help,查看帮助信息)";
CG_INFO_ENABLE = "|cff00ff00启用|r";
CG_INFO_DISABLE = "|cffff0000禁止|r";
CG_INFO_TITLE = "|cffffff00ChatGuard(v"..CG_VERSION..")当前状态(/cg help查看帮助):|r";
CG_INFO_GENERAL = " %s,相似度设置为|cff00ff00%d|r,|cff00ff00%d|r秒内的重复信息将被过滤";
CG_INFO_NORMAL = " 过滤普通频道 %s";
CG_INFO_WHISPER = " 过滤密语频道 %s";
CG_INFO_SAY = " 过滤说话、表情频道 %s";
CG_INFO_GUILD = " 过滤公会频道 %s";
CG_INFO_RAID = " 过滤团队频道 %s";
CG_INFO_PARTY = " 过滤小队频道 %s";
CG_INFO_DEBUG = " 打印调试信息 %s";
CG_INFO_CLEAR = "已过滤 [|cffffff00%s|r] 的信息:%s";
CG_INFO_TRUST = " 不检查好友的消息 %s";
CG_INFO_MLINES = " 过滤多行消息 %s";
 
CG_DEFAULT_FILTER = {"刷荣誉", "代练", "工作室"};
CG_INFO_FTITLE = "|cffffff00过滤关键字列表|r";
CG_INFO_OVERFLOW = "|cffffff00参数超出范围|r";
CG_INFO_FNULL = "过滤关键字列表为空";
 
CG_INFO_REGX = " 过滤关键字正则表达式支持 %s";
 
CG_INFO_SUCKER = "|cffffff00被屏蔽玩家列表|r";
CG_INFO_TOTAL = "总计:"
end
 
local locale = GetLocale();
LocalezhCN(); -- 默认加载简体中文语言
 
if (locale == "zhTW") then -- 繁体中文
elseif (locale == "deDE") then -- 德文
elseif (locale == "frFR") then -- 法文
elseif (locale == "koKR") then -- 韩文
elseif (locale == "ruRU") then -- 苏联
else -- 英文
end
CG_MAXCHECK_PLAYERS = 200; -- 检查最近多少个玩家的消息
CG_EXCLUDE_SELFMSG = true; -- 不过滤自己的消息
CG_ONEMSG_INTERVAL = 0.200; -- CG_ONEMSG_INTERVAL秒间隔内出现的消息视为同一条消息的不同行,
-- 小数点前面为秒,小数点后面3位为毫秒
CG_ONEMSG_MAXLINES = 20; -- 同一条消息允许的最大行数
 
local AlikeTable = {};
 
-- Hooks
CG_Pre_ChatFrame_OnEvent = ChatFrame_OnEvent;
function CG_New_ChatFrame_OnEvent(self, event, ...)
if (not ChatGuardState.Disable and CareChannel(event)) then
local msg = arg1;
local player = arg2;
local window, fontSize, r, g, b, a, shown, locked = GetChatWindowInfo(this:GetID());
 
if not CheckMsg(player, msg, window) then
if (ChatGuardState.Debug) then
Print(format(CG_INFO_CLEAR, player, msg));
end
return;
end
end
return CG_Pre_ChatFrame_OnEvent(self, event, ...);
end
 
-- 检测是否需要过滤该频道
-- 返回 true 表示需要过滤,false 不需要过滤
function CareChannel(channel)
if (ChatGuardState.Debug) then
Print("---【"..channel.."】---");
end
 
-- 普通频道
if (channel == "CHAT_MSG_CHANNEL" or channel == "CHAT_MSG_YELL"
or string.find(channel, "CHAT_MSG_BATTLEGROUND")) then
return ChatGuardState.CareNormal;
-- 密语
elseif (channel == "CHAT_MSG_WHISPER") then
return ChatGuardState.CareWhisper;
-- 说
elseif (channel == "CHAT_MSG_SAY" or channel == "CHAT_MSG_EMOTE" or channel == "CHAT_MSG_TEXT_EMOTE") then
return ChatGuardState.CareSay;
-- 公会频道
elseif (channel == "CHAT_MSG_GUILD" or channel == "CHAT_MSG_OFFICER" or channel == "GUILD_MOTD") then
return ChatGuardState.CareGuild;
-- 团队频道
elseif (string.find(channel, "CHAT_MSG_RAID")) then
return ChatGuardState.CareRaid;
-- 小队频道
elseif (channel == "CHAT_MSG_PARTY") then
return ChatGuardState.CareParty;
end
 
return false;
end
 
-- 检测字符串是否为空串
function IsNull(str)
return (str==nil or str=="");
end
 
-- 检查玩家是否是自己的好友
function IsMyFriend(player)
local i;
 
for i = 1, GetNumFriends() do
if (player == GetFriendInfo(i)) then
return true;
end
end
 
return false;
end
 
-- 检测该条消息是否尚未重复
-- 在设定时间内的重复消息才视为重复
-- 返回 true 表示未重复,false 表示已经重复
function CheckMsg(player, pmsg, window)
local index = 0;
local found = false;
local OldTime = 0;
local like = 0;
 
if (IsNull(player) or IsNull(pmsg) or
(CG_EXCLUDE_SELFMSG and player == UnitName("player"))) then
return true;
end
 
if (ChatGuardState.TrustFriend and IsMyFriend(player)) then
return true;
end
 
-- 给消息增加窗口名标志,避免自定义窗口消息无法显示
-- **以前自动过滤重复消息没有这个标志,所有窗口的消息都被统一处理了
-- **所以一条消息在默认窗口中显示一次,然后在自定义窗口中就会被后面的规则自动过滤掉
if not IsNull(window) then
player = window .. ":" .. player;
end
for i = 1, getn(AlikeTable) do
value = AlikeTable[i];
if (value.Name == player) then
found = true;
index = i;
break;
end
end
 
if (not found) then
local Data = {Name=player, MsgBuf={}, Msg={pmsg}, MsgLines=1, Time=GetTime(), Sucker=false};
table.insert(AlikeTable, Data);
 
if (table.getn(AlikeTable) > CG_MAXCHECK_PLAYERS) then
table.remove(AlikeTable, 1);
end
index = table.getn(AlikeTable);
end
 
OldTime = AlikeTable[index].Time;
AlikeTable[index].Time = GetTime();
 
if (found) then
-- 时间差不多了,让你透口气吧
-- 暂时注释掉下面几行,让SB说错话在本次游戏中就一直消失
-- if (GetTime() - OldTime > ChatGuardState.Interval) then
-- AlikeTable[index].Time = GetTime();
-- AlikeTable[index].Sucker = false;
-- end
 
-- SB,给我闭嘴!
if (AlikeTable[index].Sucker) then
return false;
end
end
 
local uplayer = string.upper(player);
local umsg = string.upper(pmsg);
for i = 1, getn(ChatGuardState.Filter) do
value = string.upper(ChatGuardState.Filter[i]);
if (string.find(umsg, value, 1, not ChatGuardState.RegEx) or
string.find(uplayer, value, 1, not ChatGuardState.RegEx)) then
 
-- 当该人发言包括被过滤关键字或者名字取得“违章”,直接禁言设定时间
AlikeTable[index].Sucker = true;
AlikeTable[index].SuckerMsg = value;
return false;
end
end
 
-- 第一条消息,并且没有包含过滤关键字,放行
if (not found) then
return true;
end
 
-- 时间超过预设时间直接放行
if (GetTime() - OldTime > ChatGuardState.Interval) then
-- AlikeTable[index].Time = GetTime();
AlikeTable[index].MsgBuf = {};
AlikeTable[index].Msg = {pmsg};
AlikeTable[index].MsgLines = 1;
 
return true;
end
 
-- 与上一条消息比较,过滤重复消息
like = ComputeStrAlike(AlikeTable[index].Msg[AlikeTable[index].MsgLines], pmsg) * 100;
if (like >= ChatGuardState.Alike) then
return false;
end
 
if ( (GetTime() - OldTime <= CG_ONEMSG_INTERVAL) and
(AlikeTable[index].MsgLines <= CG_ONEMSG_MAXLINES) ) then
table.insert(AlikeTable[index].Msg, pmsg);
AlikeTable[index].MsgLines = AlikeTable[index].MsgLines + 1;
 
if (ChatGuardState.DisbaleMultiLines) then
return false;
end
else
AlikeTable[index].MsgBuf = AlikeTable[index].Msg;
AlikeTable[index].Msg = {pmsg};
AlikeTable[index].MsgLines = 1;
end
 
-- 与缓存中相同偏移的消息比较(过滤多行广告)
like = ComputeStrAlike(AlikeTable[index].MsgBuf[AlikeTable[index].MsgLines], pmsg) * 100;
 
return (like < ChatGuardState.Alike);
end
 
-- 往聊天窗口里添加消息,只有本地能看到不会发送给其他人
function Print(Msg)
if (DEFAULT_CHAT_FRAME) then
DEFAULT_CHAT_FRAME:AddMessage(Msg);
end
end
 
-- 计算字符串相似度
function ComputeStrAlike(str1, str2)
local bigs, smalls;
local count = 0;
local i;
 
if (IsNull(str1) or IsNull(str2)) then
return 0;
end;
 
if (ChatGuardState.Alike==100) then
if (str1==str2) then
return 1;
else
return 0;
end
end
 
if (string.len(str1) > string.len(str2)) then
bigs = str1;
smalls = str2;
else
bigs = str2;
smalls = str1;
end
 
for i = 1, string.len(smalls) do
if string.find(bigs, string.sub(smalls, i, i + 1), 1, true) then
count = count + 1;
end;
end
 
return (count / string.len(bigs));
end
 
-- 打印帮助信息
function ChatGuardHelp()
for i = 1, getn(CG_HELP) do
Print(CG_HELP[i]);
end
end
 
function StateToStr(state)
if state then
return CG_INFO_ENABLE;
else
return CG_INFO_DISABLE;
end
end
 
function PrintFilter()
Print(CG_INFO_FTITLE);
if (table.getn(ChatGuardState.Filter) > 0) then
for i = 1, getn(ChatGuardState.Filter) do
value = ChatGuardState.Filter[i];
Print(" |cff00ff00"..i.."|r: "..value);
end
else
Print(CG_INFO_FNULL);
end
end
 
-- 察看当前状态
function ChatGuardStatus()
Print(CG_INFO_TITLE);
if (not ChatGuardState.Disable) then
Print(format(CG_INFO_GENERAL, CG_INFO_ENABLE, ChatGuardState.Alike, ChatGuardState.Interval));
Print(format(CG_INFO_NORMAL, StateToStr(ChatGuardState.CareNormal)));
Print(format(CG_INFO_WHISPER, StateToStr(ChatGuardState.CareWhisper)));
Print(format(CG_INFO_SAY, StateToStr(ChatGuardState.CareSay)));
Print(format(CG_INFO_GUILD, StateToStr(ChatGuardState.CareGuild)));
Print(format(CG_INFO_RAID, StateToStr(ChatGuardState.CareRaid)));
Print(format(CG_INFO_PARTY, StateToStr(ChatGuardState.CareParty)));
Print(format(CG_INFO_REGX, StateToStr(ChatGuardState.RegEx)));
Print(format(CG_INFO_TRUST, StateToStr(ChatGuardState.TrustFriend)));
Print(format(CG_INFO_MLINES, StateToStr(ChatGuardState.DisbaleMultiLines)));
Print(format(CG_INFO_DEBUG, StateToStr(ChatGuardState.Debug)));
-- PrintFilter();
else
Print(" "..CG_INFO_DISABLE);
end
end
 
-- 关键字过滤
function ProcFilter(cmd, data, moredata)
if IsNull(cmd) then
PrintFilter();
return;
end
 
if (cmd == "add") then
for i = 1,getn(ChatGuardState.Filter) do
value = ChatGuardState.Filter[i];
if (string.upper(value) == string.upper(data)) then
return;
end
end
table.insert(ChatGuardState.Filter, string.upper(data));
PrintFilter();
elseif (cmd == "del") then
if (tonumber(data) > table.getn(ChatGuardState.Filter)) then
Print(CG_INFO_OVERFLOW);
return;
end
table.remove(ChatGuardState.Filter, tonumber(data));
PrintFilter();
elseif (cmd == "rep") then
if IsNull(moredata) then
ChatGuardHelp();
else
if (tonumber(data) > table.getn(ChatGuardState.Filter)) then
Print(CG_INFO_OVERFLOW);
return;
end
ChatGuardState.Filter[tonumber(data)] = string.upper(moredata);
PrintFilter();
end
elseif (cmd == "clear") then
ChatGuardState.Filter = {};
PrintFilter();
elseif (cmd == "reset") then
ChatGuardState.Filter = CG_DEFAULT_FILTER;
PrintFilter();
elseif (cmd == "list") then
PrintFilter();
else
ChatGuardHelp();
end
end
 
-- 处理命令
function ChatGuardCmd(msg)
local args = {};
 
for value in string.gmatch(msg, "[^ ]+") do
table.insert(args, string.lower(value));
end
 
if (IsNull(args[1]) or args[1] == "status") then
ChatGuardStatus();
elseif (args[1] == "help") then
ChatGuardHelp();
elseif (args[1] == "reset") then
ChatGuardState.Alike = 100;
ChatGuardState.Interval = 10;
ChatGuardState.Disable = false;
ChatGuardState.CareNormal = true;
ChatGuardState.CareGuild = false;
ChatGuardState.CareRaid = false;
ChatGuardState.CareParty = false;
ChatGuardState.Debug = false;
ChatGuardStatus();
elseif (args[1] == "on") then
ChatGuardState.Disable = false;
ChatGuardStatus();
elseif (args[1] == "off") then
ChatGuardState.Disable = true;
ChatGuardStatus();
elseif (args[1] == "like") then
if IsNull(args[2]) then
ChatGuardHelp();
else
ChatGuardState.Alike = tonumber(args[2]);
if (ChatGuardState.Alike <= 0) then
ChatGuardState.Disable = true;
end
ChatGuardStatus();
end
elseif (args[1] == "interval") then
if IsNull(args[2]) then
ChatGuardHelp();
else
ChatGuardState.Interval = tonumber(args[2]);
if (ChatGuardState.Interval < 0) then
ChatGuardState.Interval = 0;
end
ChatGuardStatus();
end
elseif (args[1] == "all") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareNormal = true;
ChatGuardState.CareGuild = true;
ChatGuardState.CareRaid = true;
ChatGuardState.CareParty = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareNormal = false;
ChatGuardState.CareGuild = false;
ChatGuardState.CareRaid = false;
ChatGuardState.CareParty = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "normal") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareNormal = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareNormal = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "whisper") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareWhisper = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareWhisper = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "say") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareSay = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareSay = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "guild") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareGuild = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareGuild = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "raid") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareRaid = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareRaid = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "party") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.CareParty = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.CareParty = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "filter") then
local data = args[3];
local moredata = args[4];
if (args[2] == "add") then
local _, dpos = string.find(msg, args[2].."[ ]*");
data = string.sub(msg, dpos + 1);
elseif (args[2] == "rep") then
local _, dpos = string.find(msg, data.."[ ]*");
moredata = string.sub(msg, dpos + 1);
end
ProcFilter(args[2], data, moredata);
elseif (args[1] == "debug") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.Debug = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.Debug = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "regx") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.RegEx = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.RegEx = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "sucker") then
if IsNull(args[2]) then
Print(CG_INFO_SUCKER);
Count = 0;
for i = 1, getn(AlikeTable) do
value = AlikeTable[i];
if (value.Sucker) then
Print(" |cff00ff00"..value.Name.."|r".."[|cffff0000"..value.SuckerMsg.."|r]");
Count = Count + 1;
end
end
Print(CG_INFO_TOTAL..Count);
elseif (args[2] == "clear") then
local i = 1;
while (i <= getn(AlikeTable)) do
if (AlikeTable[i].Sucker) then
table.remove(AlikeTable, i);
else
i = i + 1;
end
end
-- AlikeTable = {};
Print(CG_INFO_SUCKER);
Print(CG_INFO_TOTAL.."0");
else
ChatGuardHelp();
end
elseif (args[1] == "trust") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.TrustFriend = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.TrustFriend = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
elseif (args[1] == "mlines") then
if IsNull(args[2]) then
ChatGuardHelp();
else
if (args[2] == "on") then
ChatGuardState.DisbaleMultiLines = true;
ChatGuardStatus();
elseif (args[2] == "off") then
ChatGuardState.DisbaleMultiLines = false;
ChatGuardStatus();
else
ChatGuardHelp();
end
end
end
end
 
-- 事件函数
-- 初始化数据之所以每个成员单独判断,是为了避免刚升级了新版本插件,
-- 而系统中已经保存了老版本的数据结构,此时结构不为NULL,只是新版本的成员为NULL
function ChatGuard_OnEvent()
if (event == "VARIABLES_LOADED") then
-- Print(CG_INFO_LOADED);
if (not ChatGuardState) then
ChatGuardState = {};
end
if (ChatGuardState.Alike == nil) then
ChatGuardState.Alike = 100;
end
if (ChatGuardState.Interval == nil) then
ChatGuardState.Interval = 30;
end
if (ChatGuardState.Disable == nil) then
ChatGuardState.Disable = false;
end
if (ChatGuardState.CareNormal == nil) then
ChatGuardState.CareNormal = true;
end
if (ChatGuardState.CareGuild == nil) then
ChatGuardState.CareGuild = false;
end
if (ChatGuardState.CareRaid == nil) then
ChatGuardState.CareRaid = false;
end
if (ChatGuardState.CareParty == nil) then
ChatGuardState.CareParty = false;
end
if (ChatGuardState.CareWhisper == nil) then
ChatGuardState.CareWhisper = false;
end
if (ChatGuardState.CareSay == nil) then
ChatGuardState.CareSay = false;
end
if (ChatGuardState.Debug == nil) then
ChatGuardState.Debug = false;
end
 
if (ChatGuardState.Filter == nil) then
ChatGuardState.Filter = CG_DEFAULT_FILTER;
end
if (ChatGuardState.RegEx == nil) then
ChatGuardState.RegEx = true;
end
if (ChatGuardState.TrustFriend == nil) then
ChatGuardState.TrustFriend = true;
end
 
if (ChatGuardState.DisbaleMultiLines == nil) then
ChatGuardState.DisbaleMultiLines = true;
end
end
 
ChatFrame_OnEvent = CG_New_ChatFrame_OnEvent;
end
 
SlashCmdList["CHATGUARD"] = ChatGuardCmd;
SLASH_CHATGUARD1 = "/chatguard";
SLASH_CHATGUARD2 = "/cg";
 
local frame = CreateFrame("Frame", "ChatGuardFrame", UIParent);
frame:RegisterEvent("VARIABLES_LOADED");
frame:SetScript("OnEvent", ChatGuard_OnEvent);
Eui/script/teksLoot.lua New file
0,0 → 1,349
local E, C = unpack(select(2, ...))
if C["other"].loot ~= true then return end
--local myname, ns = ...
 
local locale = GetLocale()
rollpairs = locale == "deDE" and {
["(.*) passt automatisch bei (.+), weil [ersi]+ den Gegenstand nicht benutzen kann.$"] = "pass",
["(.*) würfelt nicht für: (.+|r)$"] = "pass",
["(.*) hat für (.+) 'Gier' ausgew?hlt"] = "greed",
["(.*) hat für (.+) 'Bedarf' ausgew?hlt"] = "need",
["(.*) hat für '(.+)' Entzauberung gew?hlt."] = "disenchant",
} or locale == "frFR" and {
["(.*) a passé pour?: (.+) parce qu'((il)|(elle)) ne peut pas ramasser cette objet.$"] = "pass",
["(.*) a passé pour?: (.+)"] = "pass",
["(.*) a choisi Cupidité pour?: (.+)"] = "greed",
["(.*) a choisi Besoin pour?: (.+)"] = "need",
} or locale == "ruRU" and {
["(.*) автоматически передает предмет (.+), поскольку не может его забрать"] = "pass",
["(.*) пропускает розыгрыш предмета \"(.+)\", поскольку не может его забрать"] = "pass",
["(.*) отказывается от предмета (.+)%."] = "pass",
["Разыгрывается: (.+)%. (.*): \"Не откажусь\""] = "greed",
["Разыгрывается: (.+)%. (.*): \"Мне это нужно\""] = "need",
["Разыгрывается: (.+)%. (.*): \"Распылить\""] = "disenchant",
} or locale == "zhTW" and {
["(.*)自動放棄:(.+),因為"] = "pass",
["(.*)放棄了:(.+)"] = "pass",
["(.*)選擇了貪婪優先:(.+)"] = "greed",
["(.*)選擇了需求優先:(.+)"] = "need",
["(.*)選擇分解:(.+)"] = "disenchant",
} or locale == "zhCN" and {
["(.*)自动放弃了(.+),因为他无法拾取该物品。$"] = "pass",
["(.*)自动放弃了(.+),因为她无法拾取该物品。$"] = "pass",
["(.*)放弃了:(.+)"] = "pass",
["(.*)选择了贪婪取向:(.+)"] = "greed",
["(.*)选择了需求取向:(.+)"] = "need",
["(.*)选择了分解取向:(.+)"] = "disenchant",
}
 
local backdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16,
insets = {left = 4, right = 4, top = 4, bottom = 4},
}
 
 
local function ClickRoll(frame)
RollOnLoot(frame.parent.rollid, frame.rolltype)
end
 
 
local function HideTip() GameTooltip:Hide() end
local function HideTip2() GameTooltip:Hide(); ResetCursor() end
 
 
local rolltypes = {"need", "greed", "disenchant", [0] = "pass"}
local function SetTip(frame)
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
GameTooltip:SetText(frame.tiptext)
if frame:IsEnabled() == 0 then
GameTooltip:AddLine("|cffff3333Cannot roll")
frame:SetAlpha(0.4)
else
frame:SetAlpha(1)
end
-- if frame:IsEnabled() == 0 then GameTooltip:AddLine("|cffff3333Cannot roll") end
for name,roll in pairs(frame.parent.rolls) do if roll == rolltypes[frame.rolltype] then GameTooltip:AddLine(name, 1, 1, 1) end end
GameTooltip:Show()
end
 
local function SetButtonAlpha(frame)
if frame:IsEnabled() == 0 then
--frame:Hide()
frame:SetAlpha(0.4)
else
frame:SetAlpha(1)
end
end
 
local function SetItemTip(frame)
if not frame.link then return end
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
GameTooltip:SetHyperlink(frame.link)
if IsShiftKeyDown() then GameTooltip_ShowCompareItem() end
if IsModifiedClick("DRESSUP") then ShowInspectCursor() else ResetCursor() end
end
 
 
local function ItemOnUpdate(self)
if IsShiftKeyDown() then GameTooltip_ShowCompareItem() end
CursorOnUpdate(self)
end
 
 
local function LootClick(frame)
if IsControlKeyDown() then DressUpItemLink(frame.link)
elseif IsShiftKeyDown() then ChatEdit_InsertLink(frame.link) end
end
 
 
local cancelled_rolls = {}
local function OnEvent(frame, event, rollid)
cancelled_rolls[rollid] = true
if frame.rollid ~= rollid then return end
 
frame.rollid = nil
frame.time = nil
frame:Hide()
end
 
 
local function StatusUpdate(frame)
local t = GetLootRollTimeLeft(frame.parent.rollid)
local perc = t / frame.parent.time
frame.spark:SetPoint("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0)
frame:SetValue(t)
end
 
 
local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext, ...)
local f = CreateFrame("Button", nil, parent)
f:SetPoint(...)
f:SetWidth(28)
f:SetHeight(28)
f:SetNormalTexture(ntex)
if ptex then f:SetPushedTexture(ptex) end
f:SetHighlightTexture(htex)
f.rolltype = rolltype
f.parent = parent
f.tiptext = tiptext
f:SetScript("OnUpdate", SetButtonAlpha)
f:SetScript("OnEnter", SetTip)
f:SetScript("OnLeave", HideTip)
f:SetScript("OnClick", ClickRoll)
f:SetMotionScriptsWhileDisabled(true)
local txt = f:CreateFontString(nil, nil, "GameFontHighlightSmallOutline")
txt:SetPoint("CENTER", 0, rolltype == 2 and 1 or rolltype == 0 and -1.2 or 0)
return f, txt
end
 
 
local function CreateRollFrame()
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetWidth(328)
frame:SetHeight(26)
frame:SetBackdrop(backdrop)
frame:SetBackdropColor(0, 0, 0, .9)
frame:SetScript("OnEvent", OnEvent)
frame:RegisterEvent("CANCEL_LOOT_ROLL")
frame:Hide()
 
local button = CreateFrame("Button", nil, frame)
button:SetPoint("LEFT", 5, 0)
button:SetWidth(24)
button:SetHeight(24)
button:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
button:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
button:GetHighlightTexture():SetBlendMode("ADD")
button:SetScript("OnEnter", SetItemTip)
button:SetScript("OnLeave", HideTip2)
button:SetScript("OnUpdate", ItemOnUpdate)
button:SetScript("OnClick", LootClick)
frame.button = button
 
local buttonborder = CreateFrame("Frame", nil, button)
buttonborder:SetWidth(32)
buttonborder:SetHeight(32)
buttonborder:SetPoint("CENTER", button, "CENTER")
buttonborder:SetBackdrop(backdrop)
buttonborder:SetBackdropColor(1, 1, 1, 0)
frame.buttonborder = buttonborder
 
local tfade = frame:CreateTexture(nil, "BORDER")
tfade:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -4)
tfade:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 4)
tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
tfade:SetBlendMode("ADD")
tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .25, .25, .25, 1)
 
local status = CreateFrame("StatusBar", nil, frame)
status:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -4, -4)
status:SetPoint("BOTTOM", frame, "BOTTOM", 0, 4)
status:SetPoint("LEFT", frame.button, "RIGHT", -1, 0)
status:SetScript("OnUpdate", StatusUpdate)
status:SetFrameLevel(status:GetFrameLevel()-1)
status:SetStatusBarTexture("Interface\\AddOns\\teksLoot\\DarkBottom.tga")
status:SetStatusBarColor(.8, .8, .8, .9)
status.parent = frame
frame.status = status
 
local spark = frame:CreateTexture(nil, "OVERLAY")
spark:SetWidth(14)
spark:SetHeight(35)
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetBlendMode("ADD")
status.spark = spark
 
local need, needtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Dice-Up", "Interface\\Buttons\\UI-GroupLoot-Dice-Highlight", "Interface\\Buttons\\UI-GroupLoot-Dice-Down", 1, NEED, "LEFT", frame.button, "RIGHT", 5, -1)
local greed, greedtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Coin-Up", "Interface\\Buttons\\UI-GroupLoot-Coin-Highlight", "Interface\\Buttons\\UI-GroupLoot-Coin-Down", 2, GREED, "LEFT", need, "RIGHT", 0, -1)
local de, detext
de, detext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-DE-Up", "Interface\\Buttons\\UI-GroupLoot-DE-Highlight", "Interface\\Buttons\\UI-GroupLoot-DE-Down", 3, ROLL_DISENCHANT, "LEFT", greed, "RIGHT", 0, -1)
local pass, passtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Pass-Up", nil, "Interface\\Buttons\\UI-GroupLoot-Pass-Down", 0, PASS, "LEFT", de or greed, "RIGHT", 0, 2.2)
frame.needbutt, frame.greedbutt, frame.disenchantbutt = need, greed, de
frame.need, frame.greed, frame.pass, frame.disenchant = needtext, greedtext, passtext, detext
 
local bind = frame:CreateFontString()
bind:SetPoint("LEFT", pass, "RIGHT", 3, 1)
bind:SetFont("Fonts\\FRIZQT__.TTF", 12, "THICKOUTLINE")
frame.fsbind = bind
 
local loot = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
loot:SetPoint("LEFT", bind, "RIGHT", 0, .12)
loot:SetPoint("RIGHT", frame, "RIGHT", -5, 0)
loot:SetHeight(16)
loot:SetJustifyH("LEFT")
frame.fsloot = loot
 
frame.rolls = {}
 
return frame
end
 
 
local anchor = CreateFrame("Button", nil, UIParent)
anchor:SetWidth(300) anchor:SetHeight(22)
anchor:SetBackdrop(backdrop)
anchor:SetBackdropColor(0.25, 0.25, 0.25, 1)
local label = anchor:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
label:SetAllPoints(anchor)
label:SetText("teksLoot")
 
anchor:SetScript("OnClick", anchor.Hide)
anchor:SetScript("OnDragStart", anchor.StartMoving)
anchor:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
self.db.x, self.db.y = self:GetCenter()
end)
anchor:SetMovable(true)
anchor:EnableMouse(true)
anchor:RegisterForDrag("LeftButton")
anchor:RegisterForClicks("RightButtonUp")
anchor:Hide()
 
local frames = {}
 
local f = CreateRollFrame() -- Create one for good measure
f:SetPoint("TOPLEFT", next(frames) and frames[#frames] or anchor, "BOTTOMLEFT", 0, -4)
table.insert(frames, f)
 
local function GetFrame()
for i,f in ipairs(frames) do
if not f.rollid then return f end
end
 
local f = CreateRollFrame()
f:SetPoint("TOPLEFT", next(frames) and frames[#frames] or anchor, "BOTTOMLEFT", 0, -4)
table.insert(frames, f)
return f
end
 
 
local function START_LOOT_ROLL(rollid, time)
if cancelled_rolls[rollid] then return end
 
local f = GetFrame()
f.rollid = rollid
f.time = time
for i in pairs(f.rolls) do f.rolls[i] = nil end
f.need:SetText(0)
f.greed:SetText(0)
f.pass:SetText(0)
f.disenchant:SetText(0)
 
local texture, name, count, quality, bop, canNeed, canGreed, canDisenchant = GetLootRollItemInfo(rollid)
f.button:SetNormalTexture(texture)
f.button.link = GetLootRollItemLink(rollid)
 
if canNeed then f.needbutt:Enable() else f.needbutt:Disable() end
if canGreed then f.greedbutt:Enable() else f.greedbutt:Disable() end
if canDisenchant then f.disenchantbutt:Enable() else f.disenchantbutt:Disable() end
SetDesaturation(f.needbutt:GetNormalTexture(), not canNeed)
SetDesaturation(f.greedbutt:GetNormalTexture(), not canGreed)
SetDesaturation(f.disenchantbutt:GetNormalTexture(), not canDisenchant)
 
 
f.fsbind:SetText(bop and "拾绑" or "装绑")
f.fsbind:SetVertexColor(bop and 1 or .3, bop and .3 or 1, bop and .1 or .3)
 
local color = ITEM_QUALITY_COLORS[quality]
f.fsloot:SetVertexColor(color.r, color.g, color.b)
f.fsloot:SetText(name)
 
f:SetBackdropBorderColor(color.r, color.g, color.b, 1)
f.buttonborder:SetBackdropBorderColor(color.r, color.g, color.b, 1)
f.status:SetStatusBarColor(color.r, color.g, color.b, .7)
 
f.status:SetMinMaxValues(0, time)
f.status:SetValue(time)
 
f:SetPoint("CENTER", WorldFrame, "CENTER")
f:Show()
end
 
 
local function ParseRollChoice(msg)
for i,v in pairs(rollpairs) do
local _, _, playername, itemname = string.find(msg, i)
if playername and itemname and playername ~= "Everyone" then return playername, itemname, v end
end
end
 
 
local in_soviet_russia = (GetLocale() == "ruRU")
local function CHAT_MSG_LOOT(msg)
local playername, itemname, rolltype = ParseRollChoice(msg)
if playername and itemname and rolltype then
if in_soviet_russia and rolltype ~= "pass" then itemname, playername = playername, itemname end
for _,f in ipairs(frames) do
if f.rollid and f.button.link == itemname and not f.rolls[playername] then
f.rolls[playername] = rolltype
f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1)
return
end
end
end
end
 
 
anchor:RegisterEvent("ADDON_LOADED")
anchor:SetScript("OnEvent", function(frame, event, addon)
-- if addon ~= "teksLoot" then return end
 
anchor:UnregisterEvent("ADDON_LOADED")
anchor:RegisterEvent("START_LOOT_ROLL")
anchor:RegisterEvent("CHAT_MSG_LOOT")
UIParent:UnregisterEvent("START_LOOT_ROLL")
UIParent:UnregisterEvent("CANCEL_LOOT_ROLL")
 
anchor:SetScript("OnEvent", function(frame, event, ...) if event == "CHAT_MSG_LOOT" then return CHAT_MSG_LOOT(...) else return START_LOOT_ROLL(...) end end)
 
 
if not teksLootDB then teksLootDB = {} end
anchor.db = teksLootDB
anchor:SetPoint("CENTER", UIParent, anchor.db.x and "BOTTOMLEFT" or "CENTER", anchor.db.x or -200, anchor.db.y or 0)
end)
 
 
SlashCmdList["TEKSLOOT"] = function() if anchor:IsVisible() then anchor:Hide() else anchor:Show() end end
SLASH_TEKSLOOT1 = "/teksloot"
 
Eui/script/filtercfg.lua New file
0,0 → 1,75
local E, C = unpack(EUI)
 
local NewButton = function(text,parent)
local result = CreateFrame("Button", nil, parent)
local label = result:CreateFontString(nil,"OVERLAY",nil)
label:SetFont(E.font,12,"OUTLINE")
label:SetText(text)
result:SetWidth(label:GetWidth())
result:SetHeight(label:GetHeight())
result:SetFontString(label)
return result
end
 
print("123123123123123")
print("123123123123123")
print("123123123123123")
print("123123123123123")
local function CreateEuiFilterGui()
local E, C = unpack(EUI)
if EuiFilterGui then
EuiFilterGui:Show()
return
end
 
--主窗口
local EuiFilterGui = CreateFrame("Frame", "EuiFilterGui", UIParent)
E.EuiCreatePanel(EuiFilterGui, 400, 300, "CENTER", UIParent, "CENTER", 0, 100)
E.EuiSetTemplate(EuiFilterGui)
EuiFilterGui:SetFrameStrata("DIALOG")
EuiFilterGui:SetFrameLevel(20)
tinsert(UISpecialFrames, "EuiFilterGui") --使窗口能用ESC关闭
 
 
--标题
local title = E.EuiSetFontn(EuiFilterGui, E.font, 12, "LEFT")
title:SetPoint("LEFT", EuiFilterGui, "TOPLEFT", 4, 0)
title:SetShadowOffset(1, -1)
title:SetText("技能监视设置界面")
 
local groups = CreateFrame("ScrollFrame", "EuiFilterGuiGroupA", EuiFilterGui)
groups:SetPoint("TOPLEFT", 20, 100)
groups:SetWidth(80)
groups:SetHeight(150)
groups:SetFrameLevel(21)
 
local buttona = CreateFrame("CheckButton", "EuiSetGuiCheckA", EuiFilterGui, "InterfaceOptionsCheckButtonTemplate")
_G["EuiSetGuiCheckAText"]:SetFont(E.font, 12, "OUTLINE")
_G["EuiSetGuiCheckAText"]:SetText("图标")
buttona:SetChecked(true)
buttona:SetScript("OnClick", function(self) a="ICON" end)
buttona:SetPoint("TOPLEFT", 20, 300)
buttona:SetFrameLevel(21)
 
local buttonb = CreateFrame("CheckButton", "EuiSetGuiCheckB", EuiFilterGui, "InterfaceOptionsCheckButtonTemplate")
_G["EuiSetGuiCheckBText"]:SetFont(E.font, 12, "OUTLINE")
_G["EuiSetGuiCheckBText"]:SetText("计时条")
buttonb:SetChecked(true)
buttonb:SetScript("OnClick", function(self) a="BAR" end)
buttonb:SetPoint("TOPLEFT", 20, 340)
buttonb:SetFrameLevel(21)
 
end
 
do
SLASH_CONFIG1 = "/filtercfg"
function SlashCmdList.CONFIG(msg, editbox)
if not EuiFilterGui or not EuiFilterGui:IsShown() then
CreateEuiFilterGui()
else
EuiFilterGui:Hide()
end
end
end
 
EuiFilterGui:Show()
\ No newline at end of file
Eui/script/Recipients.lua New file
0,0 → 1,197
local E, C = unpack(select(2, ...))
if C["other"].recipients ~= true then return end
 
RECIPIENTS_LOCALE = {
["title"] = "Recipients",
["add"] = "|cff00ff00添加: |r ",
["remove"] = "|cffff0000刪除: |r ",
["full"] = "|cffff0000|已达到列表数量上限!r",
["count"] = "|cffffffff现有|r |cff00ff00%d|r |cffffffff收件人在列表中|r",
["click open"] = "|cff00ff00点击: 打开/关闭收件人列表。|r",
["name added"] = "|cff00ff00%s|r 已被添加到邮件收件人列表。",
["name removed"] = "|cff00ff00%s|r 已从邮件收件人列表中删除。",
["empty prompt"] = "|cff00ff00你的收件人列表目前是空的,在左边的输入框中填入一个名字,然后点击这个按钮来添加。|r",
};
 
 
local VERSION = GetAddOnMetadata("RecipientsDropDownButton", "Version") or "";
local L = RECIPIENTS_LOCALE;
local LIST_MAX = 49; -- maximum number of the list
local profile = {};
 
------------------------------------------------------------
-- Internal functions
------------------------------------------------------------
-- Prints a message
local function PrintMessage(msg)
DEFAULT_CHAT_FRAME:AddMessage("|cffffff78"..L["title"]..":|r "..tostring(msg))
end
 
-- Obtain the name from SendMailNameEditBox
local function GetRecipientName()
local name = string.trim(SendMailNameEditBox:GetText() or "");
if name == "" then
name = nil;
end
return name;
end
 
-- Put a name into SendMailNameEditBox
local function SetRecipientName(name, focus)
if type(name) == "string" then
SendMailNameEditBox:SetText(name);
if focus then
SendMailNameEditBox:SetFocus();
else
SendMailSubjectEditBox:HighlightText(0, -1);
SendMailSubjectEditBox:SetFocus();
end
end
end
 
-- Finds a name from list, case insensitive
local function FindRecipientName(name)
if type(name) == "string" then
name = string.trim(string.lower(name));
if name ~= "" then
local i;
for i = 1, table.getn(profile) do
if string.lower(profile[i]) == name then
return i;
end
end
end
end
return nil;
end
 
-- Populates our drop down list
local function RecipientNameDropdownInit()
local name = GetRecipientName();
 
if name then
-- Operations
local info = {};
local id = FindRecipientName(name);
if id then
-- Remove existing name
info.text = L["remove"]..name;
info.arg1 = id;
info.func = function(self, id)
local name = table.remove(profile, id);
if name then
SetRecipientName("", true);
PrintMessage(string.format(L["name removed"], name));
end
end
else
-- Add new name
info.text = L["add"]..name;
info.arg1 = name;
info.func = function(self, name)
if table.getn(profile) < LIST_MAX then
table.insert(profile, name);
table.sort(profile);
PrintMessage(string.format(L["name added"], name));
else
PrintMessage(L["full"]);
end
end
end
 
UIDropDownMenu_AddButton(info);
 
if table.getn(profile) > 0 then
-- A separator
UIDropDownMenu_AddButton({ isTitle = 1, textHeight = 1 });
end
end
 
-- Populate rest of the menu items with player saved data
local i;
for i = 1, math.min(LIST_MAX, table.getn(profile)) do
local name = profile[i];
UIDropDownMenu_AddButton({ text = name, arg1 = name, checked = (name == GetRecipientName()), func = function(self, name) SetRecipientName(name) end });
end
end
 
 
------------------------------------------------------------
-- Our addon frame - A tiny button!
------------------------------------------------------------
CreateFrame("Button", "RecipientsDropDownButton", SendMailNameEditBox);
RecipientsDropDownButton:SetWidth(24);
RecipientsDropDownButton:SetHeight(24);
RecipientsDropDownButton:SetPoint("LEFT", SendMailNameEditBox, "RIGHT", -6, 0);
RecipientsDropDownButton:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up");
RecipientsDropDownButton:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down");
RecipientsDropDownButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight", "ADD");
 
RecipientsDropDownButton:SetScript("OnShow", function(self)
if not self._menu then -- The menu won't be created until you open SendmailFrame, for resource saving...
self._menu = CreateFrame("Button", "Recipients_3FEF5056_BCA4_4B80_8D93_8FD3A0B70913", self, "UIDropDownMenuTemplate");
self._menu:Hide();
self._menu.point = "TOPLEFT";
self._menu.relativeTo = SendMailNameEditBox;
self._menu.relativePoint = "BOTTOMLEFT";
self._menu.xOffset = -12;
self._menu.yOffset = 0;
UIDropDownMenu_Initialize(self._menu, RecipientNameDropdownInit, "MENU");
end
end);
 
RecipientsDropDownButton:SetScript("OnHide", function(self)
CloseDropDownMenus();
end);
 
RecipientsDropDownButton:SetScript("OnClick", function(self)
ToggleDropDownMenu(nil, nil, self._menu);
PlaySound("igMainMenuOptionCheckBoxOn");
end);
 
RecipientsDropDownButton:SetScript("OnEnter", function(self)
-- Shows game tooltip when mouse hovers over our button
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:ClearLines();
GameTooltip:SetText(L["title"]);
local count = table.getn(profile);
GameTooltip:AddLine(string.format(L["count"], count));
if count > 0 or GetRecipientName() then
GameTooltip:AddLine(L["click open"]);
else
GameTooltip:AddLine(L["empty prompt"]);
end
GameTooltip:Show();
end);
 
RecipientsDropDownButton:SetScript("OnLeave", function(self)
GameTooltip:Hide();
end);
 
-- User data manipulation
RecipientsDropDownButton:RegisterEvent("VARIABLES_LOADED");
RecipientsDropDownButton:SetScript("OnEvent", function(self, event)
if type(RecipientsDB) ~= "table" then
RecipientsDB = {};
end
 
local key = (GetRealmName() or "SF").."-"..(UnitFactionGroup("player") or "Default");
if type(RecipientsDB[key]) ~= "table" then
RecipientsDB[key] = {};
end
 
profile = RecipientsDB[key];
end);
 
 
------------------------------------------------------------
-- Change WOW's stupid behavior
------------------------------------------------------------
hooksecurefunc("SendMailMailButton_OnClick", function()
RecipientsDropDownButton._recentName = GetRecipientName(); -- Save the name before it gets cleared
end);
 
hooksecurefunc("SendMailFrame_Reset", function()
SetRecipientName(RecipientsDropDownButton._recentName); -- Put the name back into SendMailNameEditBox
RecipientsDropDownButton._recentName = nil;
end);
\ No newline at end of file
Eui/script/raidcooldowns.lua New file
0,0 → 1,186
local E,C = unpack(select(2, ...))
if C["filter"].raid ~= true then return end
local spells = {
[GetSpellInfo(48477)] = 600, -- XD战复
[GetSpellInfo(29166)] = 180, -- XD激活
[GetSpellInfo(47883)] = 900, -- SS灵魂石
[GetSpellInfo(19752)] = 600, -- QS干涉
[GetSpellInfo(32182)] = 300, -- SM英勇
[GetSpellInfo(31224)] = 90, -- DZ暗影斗篷
[GetSpellInfo(57934)] = 30, -- DZ嫁祸诀窍
[GetSpellInfo(642)] = 600, -- QS圣盾术
[GetSpellInfo(19263)] = 90, -- LR威慑
[GetSpellInfo(33206)] = 180, -- MS痛苦压制
[GetSpellInfo(45438)] = 300, -- FS寒冰屏障
[GetSpellInfo(48792)] = 120, -- DK冰封之韧
[GetSpellInfo(49016)] = 180, -- DK狂乱
[GetSpellInfo(6940)] = 120, -- QS牺牲之手
[GetSpellInfo(64205)] = 120, -- QS神圣牺牲
[GetSpellInfo(3411)] = 30, -- ZS援护
}
 
local width, height = C["filter"].raidwidth or 144, C["filter"].raidheight or 12
local num = C["filter"].raidnumber or 10
local holder = CreateFrame("Frame", "EuiRaidCooldowns", UIParent)
if C["other"].minimap == true then
E.EuiCreatePanel(holder, width, height, "TOP", EuiMinimap, "BOTTOM", 0, -24)
else
E.EuiCreatePanel(holder, width, height, "TOPLEFT", UIParent, "TOPLEFT", 10, -24)
end
E.EuiSetTemplate(holder)
holder:Hide()
 
local floor, mod, format, ipairs = floor, mod, format, ipairs
local GetTime = GetTime
local bars = {}
 
local function SecondsToTime(seconds)
local time = ""
if(seconds >= 60) then
time = format("%.0f.", floor(seconds * 0.016666666666667))
seconds = mod(seconds, 60)
end
seconds = floor(seconds)
if(seconds<10) then seconds = "0"..seconds end
time = format("%s%s", time, seconds)
return time
end
 
local function UpdateBars()
local firsthidden = false
local lastvisible
for i, v in ipairs(bars) do
if(i==1 and not v:IsShown()) then firsthidden = true end
if(v:IsShown()) then
v:ClearAllPoints()
if(i==1 or firsthidden) then
v:SetPoint("TOP", holder, "BOTTOM")
else
v:SetPoint("TOP", bars[lastvisible], "BOTTOM", 0, -8)
end
firsthidden = false
lastvisible = i
end
end
end
 
local OnEnter = function(self)
local c = E.RAID_CLASS_COLORS[select(2, UnitClass(self.name))]
if c then
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
GameTooltip:AddLine(self.name, c.r, c.g, c.b)
GameTooltip:AddDoubleLine(self.spellname, self.dur:GetText(), 1, 1, 1, 1, 1, 1)
GameTooltip:Show()
end
end
 
local OnLeave = function()
GameTooltip:Hide()
end
 
local function OnUpdate(self, elapsed)
if(not self.start) then return end
local time = GetTime()
local progress = floor((time-self.start) / self.duration * 100)
if(progress>=100) then
self.start = nil
self.duration = nil
self:Hide()
UpdateBars()
else
self:SetValue(progress)
self.dur:SetFormattedText(SecondsToTime((self.start+self.duration)-time))
self:SetStatusBarColor(1 - progress/100, progress/100, 0)
end
-- if GetNumPartyMembers() == 0 then bars = {} end
end
 
local function OnMouseDown(self, button)
if(button=="LeftButton") then
SendChatMessage(format("CD: %s - %s - %s", self.name, self.spellname, self.dur:GetText()), "RAID")
elseif(button=="RightButton") then
self.start = nil
self.duration = nil
self:Hide()
UpdateBars()
end
end
 
local function CreateBar(index)
local bar = CreateFrame("StatusBar", nil, UIParent)
bar:SetStatusBarTexture(E.normTex)
bar:SetMinMaxValues(0, 100)
bar:SetHeight(height)
bar:SetWidth(width)
 
bar.dur = E.EuiSetFontn(bar, E.font, 12, "LEFT")
bar.dur:SetPoint("LEFT", bar, "TOPLEFT", 1, 0)
bar.dur:SetShadowOffset(1, -1)
 
bar.text = E.EuiSetFontn(bar, E.font, 12, "RIGHT")
bar.text:SetPoint("RIGHT", bar, "TOPRIGHT", -1, 0)
bar.text:SetShadowOffset(1, -1)
bar:EnableMouse(true)
bar:SetScript("OnEnter", OnEnter)
bar:SetScript("OnLeave", OnLeave)
bar:SetScript("OnUpdate", OnUpdate)
bar:SetScript("OnMouseDown", OnMouseDown)
 
local bg = CreateFrame("Frame", nil, bar)
bg:SetBackdrop({
bgFile = E.blackTex,
edgeFile = E.glowTex,
edgeSize = 1,
})
bg:SetBackdropColor(0, 0, 0, .5)
bg:SetBackdropBorderColor(0, 0, 0)
bg:SetPoint("TOPLEFT", bar, -2, 2)
bg:SetPoint("BOTTOMRIGHT", bar, 2, -2)
bg:SetFrameStrata("BACKGROUND")
E.EuiSetTemplate(bg,1)
 
bars[index] = bar
bar:Hide()
end
 
for i = 1, num do CreateBar(i) end
 
local function StartBar(unit, spellname, duration)
local index = 1
for i, v in ipairs(bars) do
if(not v.start) then
index = i
break
end
end
local c = E.RAID_CLASS_COLORS[select(2, UnitClass(unit))]
local bar = bars[index]
bar.spellname = spellname
bar.name = UnitName(unit)
bar.text:SetText(spellname)
bar.text:SetTextColor(c.r, c.g, c.b)
bar.duration = duration
bar.start = GetTime()
bar:Show()
UpdateBars()
end
 
holder:RegisterEvent"UNIT_SPELLCAST_SUCCEEDED"
holder:SetScript("OnEvent", function(self, event, unit, spell)
if(unit:match("raid") and spells[spell]) then
StartBar(unit, spell, spells[spell])
end
end)
 
function E.RaidCooldownPoint(frame)
if E.Movers["RaidCooldownMover"]["moved"] ~= true then
EuiRaidCooldowns:ClearAllPoints()
EuiRaidCooldowns:SetPoint("TOP", EuiMinimap, "BOTTOM", 0, -20)
end
end
 
E.CreateMover(EuiRaidCooldowns, "RaidCooldownMover", "团队技能冷却", false, E.RaidCooldownPoint)
 
function E.RaidCooldownShow()
if EuiRaidCooldowns:IsShown() then EuiRaidCooldowns:Hide() else EuiRaidCooldowns:Show() end
end
\ No newline at end of file
Eui/script/achieved.lua New file
0,0 → 1,76
--Reposition achievement frames
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
local AchievementHolder = CreateFrame("Frame", "AchievementHolder", UIParent)
AchievementHolder:SetWidth(180)
AchievementHolder:SetHeight(20)
AchievementHolder:SetPoint("CENTER", UIParent, "CENTER", 0, 170)
 
local pos = "TOP"
 
function E.AchievementMove(self, event, ...)
local previousFrame
for i=1, MAX_ACHIEVEMENT_ALERTS do
local aFrame = _G["AchievementAlertFrame"..i]
if ( aFrame ) then
aFrame:ClearAllPoints()
if pos == "TOP" then
if ( previousFrame and previousFrame:IsShown() ) then
aFrame:SetPoint("TOP", previousFrame, "BOTTOM", 0, -10)
else
aFrame:SetPoint("TOP", AchievementHolder, "BOTTOM")
end
else
if ( previousFrame and previousFrame:IsShown() ) then
aFrame:SetPoint("BOTTOM", previousFrame, "TOP", 0, 10)
else
aFrame:SetPoint("BOTTOM", AchievementHolder, "TOP")
end
end
 
previousFrame = aFrame
end
end
 
end
hooksecurefunc("AchievementAlertFrame_FixAnchors", E.AchievementMove)
 
hooksecurefunc("DungeonCompletionAlertFrame_FixAnchors", function()
for i=MAX_ACHIEVEMENT_ALERTS, 1, -1 do
local aFrame = _G["AchievementAlertFrame"..i]
if ( aFrame and aFrame:IsShown() ) then
DungeonCompletionAlertFrame1:ClearAllPoints()
if pos == "TOP" then
DungeonCompletionAlertFrame1:SetPoint("TOP", aFrame, "BOTTOM", 0, -10)
else
DungeonCompletionAlertFrame1:SetPoint("BOTTOM", aFrame, "TOP", 0, 10)
end
 
return
end
 
DungeonCompletionAlertFrame1:ClearAllPoints()
if pos == "TOP" then
DungeonCompletionAlertFrame1:SetPoint("TOP", AchievementHolder, "BOTTOM")
else
DungeonCompletionAlertFrame1:SetPoint("BOTTOM", AchievementHolder, "TOP")
end
end
end)
 
function E.PostAchievementMove(frame)
local point = select(1, frame:GetPoint())
 
if string.find(point, "TOP") or point == "CENTER" or point == "LEFT" or point == "RIGHT" then
pos = "TOP"
else
pos = "BOTTOM"
end
E.AchievementMove()
end
 
E.CreateMover(AchievementHolder, "AchievementMover", "成 就", nil, E.PostAchievementMove)
 
local frame = CreateFrame("Frame")
frame:RegisterEvent("ACHIEVEMENT_EARNED")
frame:SetScript("OnEvent", function(self, event, ...) E.AchievementMove(self, event, ...) end)
\ No newline at end of file
Eui/script/ampere.lua New file
0,0 → 1,242
 
local Refresh = function() end
local EDGEGAP, ROWHEIGHT, ROWGAP, GAP = 16, 20, 2, 4
local NUMADDONS = GetNumAddOns()
local GOLD_TEXT = {1.0, 0.82, 0}
local RED_TEXT = {1, 0, 0}
local STATUS_COLORS = setmetatable({
DISABLED = {157/256, 157/256, 157/256},
DEP_DISABLED = {157/256, 157/256, 157/256},
NOT_DEMAND_LOADED = {1, 0.5, 0},
DEP_NOT_DEMAND_LOADED = {1, 0.5, 0},
LOAD_ON_DEMAND = {30/256, 1, 0},
DISABLED_AT_RELOAD = {163/256, 53/256, 238/256},
DEP_MISSING = {1, 0.5, 0},
}, {__index = function() return RED_TEXT end})
local L = {
DISABLED_AT_RELOAD = "Disabled on ReloadUI",
LOAD_ON_DEMAND = "LoD",
}
 
 
local enabledstates = setmetatable({}, {
__index = function(t, i)
local name, _, _, enabled = GetAddOnInfo(i)
if name ~= i then return t[name] end
 
t[i] = not not enabled -- Looks silly, but ensures we store a boolean
return enabled
end
})
 
 
-- We have to hook these, GetAddOnInfo doesn't report back the new enabled state
local orig1, orig2, orig3, orig4 = EnableAddOn, DisableAddOn, EnableAllAddOns, DisableAllAddOns
local function posthook(...) Refresh(); return ... end
EnableAddOn = function(addon, ...)
enabledstates[GetAddOnInfo(addon)] = true
return posthook(orig1(addon, ...))
end
DisableAddOn = function(addon, ...)
enabledstates[GetAddOnInfo(addon)] = false
return posthook(orig2(addon, ...))
end
EnableAllAddOns = function(...)
for i=1,NUMADDONS do enabledstates[GetAddOnInfo(i)] = true end
return posthook(orig3(...))
end
DisableAllAddOns = function(...)
for i=1,NUMADDONS do enabledstates[GetAddOnInfo(i)] = false end
return posthook(orig4(...))
end
 
 
local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
frame.name = "Ampere"
frame:Hide()
frame:SetScript("OnShow", function(frame)
local function MakeButton(parent)
local butt = CreateFrame("Button", nil, parent or frame)
butt:SetWidth(80) butt:SetHeight(22)
 
butt:SetHighlightFontObject(GameFontHighlightSmall)
butt:SetNormalFontObject(GameFontNormalSmall)
 
butt:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Up")
butt:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Down")
butt:SetHighlightTexture("Interface\\Buttons\\UI-Panel-Button-Highlight")
butt:SetDisabledTexture("Interface\\Buttons\\UI-Panel-Button-Disabled")
butt:GetNormalTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetPushedTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetHighlightTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetDisabledTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetHighlightTexture():SetBlendMode("ADD")
 
return butt
end
 
 
local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOPLEFT", 16, -16)
title:SetText("Addon Management")
 
local rows, anchor = {}
local function helper(...)
for i=1,select("#", ...) do
local dep = select(i, ...)
local loaded = IsAddOnLoaded(dep) and 1 or 0
GameTooltip:AddDoubleLine(i == 1 and "Dependencies:" or " ", dep, 1, 0.4, 0, 1, loaded, loaded)
end
end
local function OnEnter(self)
local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(self.addon)
local author = GetAddOnMetadata(self.addon, "Author")
local version = GetAddOnMetadata(self.addon, "Version")
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
GameTooltip:AddLine(title, nil, nil, nil, true)
GameTooltip:AddLine(notes, 1, 1, 1, true)
if author then GameTooltip:AddDoubleLine("Author:", author, 1,0.4,0, 1,1,1) end
if version then GameTooltip:AddDoubleLine("Version:", version, 1,0.4,0, 1,1,1) end
helper(GetAddOnDependencies(self.addon))
GameTooltip:Show()
end
local function OnLeave() GameTooltip:Hide() end
local function OnClick(self)
local addon = self:GetParent().addon
local enabled = enabledstates[addon]
PlaySound(enabled and "igMainMenuOptionCheckBoxOff" or "igMainMenuOptionCheckBoxOn")
if enabled then DisableAddOn(addon) else EnableAddOn(addon) end
Refresh()
end
local function LoadOnClick(self)
local addon = self:GetParent().addon
if not select(4,GetAddOnInfo(addon)) then
EnableAddOn(addon)
LoadAddOn(addon)
DisableAddOn(addon)
else LoadAddOn(addon) end
end
for i=1,math.floor((305-22)/(ROWHEIGHT + ROWGAP)) do
local row = CreateFrame("Button", nil, frame)
if not anchor then row:SetPoint("TOP", title, "BOTTOM", 0, -16)
else row:SetPoint("TOP", anchor, "BOTTOM", 0, -ROWGAP) end
row:SetPoint("LEFT", EDGEGAP, 0)
row:SetPoint("RIGHT", -EDGEGAP*2-8, 0)
row:SetHeight(ROWHEIGHT)
anchor = row
rows[i] = row
 
 
local check = CreateFrame("CheckButton", nil, row)
check:SetWidth(ROWHEIGHT+4)
check:SetHeight(ROWHEIGHT+4)
check:SetPoint("LEFT")
check:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up")
check:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down")
check:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
check:SetDisabledCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check-Disabled")
check:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check")
check:SetScript("OnClick", OnClick)
row.check = check
 
 
local title = row:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
title:SetPoint("LEFT", check, "RIGHT", 4, 0)
row.title = title
 
 
local loadbutton = MakeButton(row)
loadbutton:SetPoint("RIGHT")
loadbutton:SetText("Load")
loadbutton:SetScript("OnClick", LoadOnClick)
row.loadbutton = loadbutton
 
 
local reason = row:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
reason:SetPoint("RIGHT", loadbutton, "LEFT", -4, 0)
reason:SetPoint("LEFT", title, "RIGHT")
reason:SetJustifyH("RIGHT")
row.reason = reason
 
row:SetScript("OnEnter", OnEnter)
row:SetScript("OnLeave", OnLeave)
end
 
 
local offset = 0
Refresh = function()
if not frame:IsVisible() then return end
for i,row in ipairs(rows) do
if (i + offset) <= NUMADDONS then
local name, title, notes, enabled, loadable, reason = GetAddOnInfo(i + offset)
local version = GetAddOnMetadata(i + offset, "Version")
if version then title = title.. " |cffff6600("..version:trim()..")" end
local loaded = IsAddOnLoaded(i + offset)
local lod = IsAddOnLoadOnDemand(i + offset)
if lod and not loaded and (not reason or reason == "DISABLED") then
reason = "LOAD_ON_DEMAND"
row.loadbutton:Show()
row.loadbutton:SetWidth(45)
else
row.loadbutton:Hide()
row.loadbutton:SetWidth(1)
end
if loaded and not enabledstates[name] then reason = "DISABLED_AT_RELOAD" end
 
row.check:SetChecked(enabledstates[name])
row.title:SetText(title)
row.reason:SetText(reason and (TEXT(_G["ADDON_" .. reason] or L[reason])))
row.title:SetTextColor(unpack(reason and STATUS_COLORS[reason] or GOLD_TEXT))
if reason then row.reason:SetTextColor(unpack(STATUS_COLORS[reason])) end
row.addon = name
row.notes = notes
row:Show()
else
row:Hide()
end
end
end
frame:SetScript("OnEvent", Refresh)
frame:RegisterEvent("ADDON_LOADED")
frame:SetScript("OnShow", Refresh)
Refresh()
 
 
local scrollbar = LibStub("tekKonfig-Scroll").new(frame, nil, #rows/2)
scrollbar:ClearAllPoints()
scrollbar:SetPoint("TOP", rows[1], 0, -16)
scrollbar:SetPoint("BOTTOM", rows[#rows], 0, 16)
scrollbar:SetPoint("RIGHT", -16, 0)
scrollbar:SetMinMaxValues(0, math.max(0, NUMADDONS-#rows))
scrollbar:SetValue(0)
 
local f = scrollbar:GetScript("OnValueChanged")
scrollbar:SetScript("OnValueChanged", function(self, value, ...)
offset = value
Refresh()
return f(self, value, ...)
end)
 
frame:EnableMouseWheel()
frame:SetScript("OnMouseWheel", function(self, val) scrollbar:SetValue(scrollbar:GetValue() - val*#rows/2) end)
 
 
local enableall = MakeButton()
enableall:SetPoint("BOTTOMLEFT", 16, 16)
enableall:SetText("Enable All")
enableall:SetScript("OnClick", EnableAllAddOns)
 
 
local disableall = MakeButton()
disableall:SetPoint("LEFT", enableall, "RIGHT", 4, 0)
disableall:SetText("Disable All")
disableall:SetScript("OnClick", DisableAllAddOns)
 
 
local reload = MakeButton()
reload:SetPoint("BOTTOMRIGHT", -16, 16)
reload:SetText("Reload UI")
reload:SetScript("OnClick", ReloadUI)
end)
 
InterfaceOptions_AddCategory(frame)
Eui/script/WhoWhisperedMe.xml New file
0,0 → 1,32
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/">
<Script file="WhoWhisperedMe.lua" />
<Frame name="WhoWhisperedMe" hidden="true" parent="UIParent" movable="true" enableMouse="true">
 
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
</Backdrop>
<Size>
<AbsDimension x="1" y="1"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-104"/>
</Offset>
</Anchor>
</Anchors>
 
<Scripts>
<OnEvent>WhoWhisperedMe_OnEvent();</OnEvent>
<OnLoad>WhoWhisperedMe_OnLoad();</OnLoad>
</Scripts>
</Frame>
</Ui>
\ No newline at end of file
Eui/script/Ratings_core.lua New file
0,0 → 1,516
local E, C = unpack(select(2, ...))
if C["other"].ratings ~= true then return end
 
local string_find = string.find
local string_match = string.match
local string_len = string.len
local string_sub = string.sub
local string_replace = string.replace
local string_lower = string.lower
local string_format = string.format
local string_gsub = string.gsub
local pairs = pairs
local next = next
local tonumber = tonumber
local select = select
 
RatingsDB = {
forceLevel = nil,
format = " ($V@$L)",
}
 
local SEPARATORS, PATTERNS, STATS
if GetLocale() == "enUS" then
SEPARATORS = {
[","] = true,
[" and "] = true,
["/"] = true,
[". "] = true,
-- [" for "] = true,
["&"] = true,
-- [":"] = true,
}
PATTERNS = {
[" by (%d+)"] = true,
["([%+%-]%d+)"] = false,
["grant.-(%d+)"] = true,
["add.-(%d+)"] = true,
["(%d+)([^%d%%|]+)"] = false,
}
STATS = {
{"defense rating", CR_DEFENSE_SKILL},
{"dodge rating", CR_DODGE},
{"block rating", CR_BLOCK},
{"parry rating", CR_PARRY},
{"ranged critical strike rating", CR_CRIT_RANGED},
{"ranged critical hit rating", CR_CRIT_RANGED},
{"ranged critical rating", CR_CRIT_RANGED},
{"ranged crit rating", CR_CRIT_RANGED},
{"critical strike rating", CR_CRIT_MELEE},
{"critical hit rating", CR_CRIT_MELEE},
{"critical rating", CR_CRIT_MELEE},
{"crit rating", CR_CRIT_MELEE},
{"ranged hit rating", CR_HIT_RANGED},
{"hit rating", CR_HIT_MELEE},
{"resilience", CR_CRIT_TAKEN_MELEE},
{"ranged haste rating", CR_HASTE_RANGED},
{"haste rating", CR_HASTE_MELEE},
{"skill rating", CR_WEAPON_SKILL},
{"expertise rating", CR_EXPERTISE},
{"hit avoidance rating", CR_HIT_TAKEN_MELEE},
{"armor penetration rating", CR_ARMOR_PENETRATION},
}
elseif GetLocale() == "frFR" then
SEPARATORS = {
["/"] = true,
[" et "] = true,
[","] = true,
[". "] = true,
}
PATTERNS = {
[" de (%d+)"] = true,
["([%+%-]%d+)"] = false,
["(%d+) \195\160 "] = true,
["(%d+) au"] = false,
}
STATS = {
{"score de défense", CR_DEFENSE_SKILL},
{"score d'esquive", CR_DODGE},
{"score de blocage", CR_BLOCK},
{"score de parade", CR_PARRY},
{"score de coup critique à distance", CR_CRIT_RANGED},
{"score de critique à distance", CR_CRIT_RANGED},
--~ {"ranged critical rating", CR_CRIT_RANGED},
--~ {"ranged crit rating", CR_CRIT_RANGED},
{"score de coup critique", CR_CRIT_MELEE},
{"score de critique", CR_CRIT_MELEE},
--~ {"critical rating", CR_CRIT_MELEE},
--~ {"crit rating", CR_CRIT_MELEE},
{"score de toucher à distance", CR_HIT_RANGED},
{"score de toucher", CR_HIT_MELEE},
{"résilience", CR_CRIT_TAKEN_MELEE},
{"score de hâte à distance", CR_HASTE_RANGED},
{"score de hâte", CR_HASTE_MELEE},
{"score de la compétence", CR_WEAPON_SKILL},
{"score d'expertise", CR_EXPERTISE},
{"expertise", CR_EXPERTISE},
{"score d'évitement des coups", CR_HIT_TAKEN_MELEE},
{"score de pénétration d'armure", CR_ARMOR_PENETRATION},
}
elseif GetLocale() == "deDE" then
SEPARATORS = {
["/"] = true,
[" und "] = true,
[","] = true,
[". "] = true,
[" f\195\188r "] = true,
["&"] = true,
[":"] = true,
}
PATTERNS = {
[" um (%d+)"] = true,
["([%+%-]%d+)"] = false,
["verleiht.-(%d+)"] = true,
["(%d+) erhöhen."] = true,
["(%d+)([^%d%%|]+)"] = true,
}
STATS = {
{"verteidigungswertung", CR_DEFENSE_SKILL},
{"ausweichwertung", CR_DODGE},
{"blockwertung", CR_BLOCK},
{"parierwertung", CR_PARRY},
{"kritische distanztrefferwertung", CR_CRIT_RANGED},
{"kritische trefferwertung", CR_CRIT_MELEE},
{"kritische zaubertrefferwertung", CR_CRIT_SPELL},
{"trefferwertung", CR_HIT_RANGED},
{"trefferwertung", CR_HIT_MELEE},
{"zaubertrefferwertung", CR_HIT_SPELL},
{"abh\195\164rtung", CR_CRIT_TAKEN_MELEE},
{"zaubertempowertung", CR_HASTE_SPELL},
{"distanztempowertung", CR_HASTE_RANGED},
{"angriffstempowertung", CR_HASTE_MELEE},
{"nahkampftempowertung", CR_HASTE_MELEE},
{"tempowertung", CR_HASTE_MELEE},
{"waffenkundewertung", CR_EXPERTISE},
{"r\195\188stungsdurchschlagwert", CR_ARMOR_PENETRATION},
}
elseif GetLocale() == "ruRU" then
SEPARATORS = {
[","] = true,
[" и "] = true,
["/"] = true,
[". "] = true,
[" для "] = true,
["&"] = true,
}
PATTERNS = {
[" на (%d+)"] = true,
["([%+%-]%d+)"] = true,
[" увеличена на (%d+)"] = true,
["(%d+) к "] = true,
["дополнительно (%d+)"] = true,
["увеличение (%d+)"] = true,
["на (%d+)([^%d%%|]+)"] = true,
}
STATS = {
{"рейтинг защиты",CR_DEFENSE_SKILL},
{"рейтингу защиты",CR_DEFENSE_SKILL},
{"рейтинга защиты",CR_DEFENSE_SKILL},
{"рейтинг уклонения",CR_DODGE},
{"рейтингу уклонения",CR_DODGE},
{"рейтинга уклонения",CR_DODGE},
{"рейтинг блокирования щитом",CR_BLOCK},
{"рейтинга блокирования щитом",CR_BLOCK},
{"рейтингу блокирования щитом",CR_BLOCK},
{"увеличение рейтинга блокирования щита на",CR_BLOCK},
{"рейтинга блока",CR_BLOCK},
{"рейтинг парирования",CR_PARRY},
{"рейтинга парирования",CR_PARRY},
{"рейтингу парирования",CR_PARRY},
 
{"рейтинг критического удара %(заклинания%)",CR_CRIT_SPELL},
{"рейтингу критического удара %(заклинания%)",CR_CRIT_SPELL},
{"рейтинга критического удара %(заклинания%)",CR_CRIT_SPELL},
{"рейтинга критического удара заклинаниями",CR_CRIT_SPELL},
{"рейтингу критического удара заклинаниями",CR_CRIT_SPELL},
{"рейтинг критического удара заклинаниями",CR_CRIT_SPELL},
{"рейтинг критического удара",CR_CRIT_MELEE},
{"рейтинг критического эффекта",CR_CRIT_MELEE},
{"рейтингу критического удара",CR_CRIT_MELEE},
{"рейтинга критического удара",CR_CRIT_MELEE},
{"рейтинг крит. удара оруж. ближнего боя",CR_CRIT_MELEE},
 
{"рейтинг меткости %(заклинания%)",CR_HIT_SPELL},
{"рейтингу меткости %(заклинания%)",CR_HIT_SPELL},
{"рейтинга меткости %(заклинания%)",CR_HIT_SPELL},
{"рейтингу меткости заклинаний",CR_HIT_SPELL},
{"рейтинга нанесения удара ближнего боя",CR_HIT_MELEE},
{"рейтинг меткости",CR_HIT_MELEE},
{"рейтинга меткости",CR_HIT_MELEE},
{"рейтингу меткости",CR_HIT_MELEE},
 
{"рейтинг устойчивости",CR_CRIT_TAKEN_MELEE},
{"рейтингу устойчивости",CR_CRIT_TAKEN_MELEE},
{"рейтинга устойчивости",CR_CRIT_TAKEN_MELEE},
 
{"рейтинг скорости %(заклинания%)",CR_HASTE_SPELL},
{"рейтингу скорости %(заклинания%)",CR_HASTE_SPELL},
{"рейтинга скорости %(заклинания%)",CR_HASTE_SPELL},
{"скорости наложения заклинаний",CR_HASTE_SPELL},
{"скорость наложения заклинаний",CR_HASTE_SPELL},
{"рейтинг скорости",CR_HASTE_MELEE},
{"рейтингу скорости",CR_HASTE_MELEE},
{"рейтинга скорости",CR_HASTE_MELEE},
 
{"рейтинг мастерства",CR_EXPERTISE},
{"рейтингу мастерства",CR_EXPERTISE},
{"рейтинга мастерства",CR_EXPERTISE},
 
{"рейтинг пробивания брони",CR_ARMOR_PENETRATION},
}
elseif GetLocale() == "zhTW" then
-- Thanks vivianalive http://wow.curse.com/downloads/wow-addons/details/ratings.aspx#714023
SEPARATORS = {
[","] = true,
[" 和"] = true,
["。"] = true,
[":"] = true,
}
PATTERNS = {
["提高(%d+)"] = true,
["([%+%-]%d+)"] = false,
["grant.-(%d+)"] = false,
["add.-(%d+)"] = false,
["(%d+)([^%d%%|]+)"] = false,
}
STATS = {
{"防禦等級", CR_DEFENSE_SKILL},
{"閃躲等級", CR_DODGE},
{"格擋等級", CR_BLOCK},
{"招架等級", CR_PARRY},
{"遠程攻擊致命一擊等級", CR_CRIT_RANGED},
{"致命一擊等級", CR_CRIT_MELEE},
{"遠程命中等級", CR_HIT_RANGED},
{"命中等級", CR_HIT_MELEE},
{"韌性", CR_CRIT_TAKEN_MELEE},
{"遠程攻擊加速等級", CR_HASTE_RANGED},
{"加速等級", CR_HASTE_MELEE},
{"技能等級", CR_WEAPON_SKILL},
{"熟練等級", CR_EXPERTISE},
{"命中迴避概率", CR_HIT_TAKEN_MELEE},
{"護甲穿透等級", CR_ARMOR_PENETRATION},
}
elseif GetLocale() == "zhCN" then
SEPARATORS = {
[","] = true,
["和"] = true,
["。"] = true,
[":"] = true,
}
PATTERNS = {
["提高(%d+)"] = true,
["([%+%-]%d+)"] = false,
["grant.-(%d+)"] = false,
["add.-(%d+)"] = false,
["(%d+)([^%d%%|]+)"] = false,
}
STATS = {
{"防御等级", CR_DEFENSE_SKILL},
{"躲闪等级", CR_DODGE},
{"格挡等级", CR_BLOCK},
{"招架等级", CR_PARRY},
{"远程爆击等级", CR_CRIT_RANGED},
{"爆击等级", CR_CRIT_MELEE},
{"远程命中等级", CR_HIT_RANGED},
{"命中等级", CR_HIT_MELEE},
{"韧性等级", CR_CRIT_TAKEN_MELEE},
{"远程急速等级", CR_HASTE_RANGED},
{"急速等级", CR_HASTE_MELEE},
{"武器技能等级", CR_WEAPON_SKILL},
{"精准等级", CR_EXPERTISE},
{"回避等级", CR_HIT_TAKEN_MELEE},
{"护甲穿透等级", CR_ARMOR_PENETRATION},
}
else
DisableAddOn("Ratings")
return
end
 
PATTERNS["|cff00ff00%+(%d+)|r"] = true
PATTERNS["|cffff2020%-(%d+)|r"] = true
 
local Ratings = {}
 
do
local hook_otsi = function (...) Ratings:OnTooltipSetItem(...) end
local hook_otc = function (...) Ratings:OnTooltipCleared(...) end
function Ratings:HookTooltip(tt)
tt:HookScript("OnTooltipSetItem", hook_otsi)
tt:HookScript("OnTooltipCleared", hook_otc)
end
end
 
local regions_set = {}
local function clear_regions(...)
for i = 1, select("#", ...) do
local region = select(i, ...)
regions_set[region] = nil
end
end
 
function Ratings:OnTooltipSetItem(tt)
self:HandleFontStrings(tt:GetRegions())
end
 
function Ratings:OnTooltipCleared(tt)
clear_regions(tt:GetRegions())
end
 
function Ratings:HandleFontStrings(...)
for i = 1, select("#", ...) do
local region = select(i, ...)
if region.GetText and region:IsShown() and not regions_set[region] then
regions_set[region] = true
region:SetText(self:ReplaceText(region:GetText()))
end
end
end
 
do
local function get_next_chunk(text, p)
local lstart, lend
for sep in pairs(SEPARATORS) do
local s, e = string_find(text, sep, p, true)
if s then
if not lstart or lstart > s then
lstart, lend = s, e
end
end
end
if not lstart then
return string_sub(text, p), -1
else
return string_sub(text, p, lstart - 1), lend + 1
end
end
 
local replacements = {}
function Ratings:ReplaceText(text)
if not text or not text:find("%d") then return text end
local pos = 1
while pos > 0 do
local sub
sub, pos = get_next_chunk(text, pos)
replacements[sub] = self:GetReplacementText(sub)
end
while true do
local sub, rep = next(replacements)
if not sub then return text end
replacements[sub] = nil
text = string_replace(text, sub, rep)
end
end
 
function Ratings:GetReplacementText(text)
local lower_text = string_lower(text)
for pattern, after in pairs(PATTERNS) do
local value, partial = string_match(lower_text, pattern)
if value then
if tonumber(partial) then
partial, value = value, partial
end
local check = partial or lower_text
for _, info in pairs(STATS) do
local stat, id = info[1], info[2]
if string_find(check, stat, 1, true) then
local bonus = self:GetRatingBonus(id, tonumber(value))
if not bonus then return end
if after then
return string_replace(text, value, value .. bonus)
else
local s, e = string_find(lower_text, stat, 1, true)
stat = string_sub(text, s, e)
return string_replace(text, stat, stat .. bonus)
end
end
end
end
end
end
end
 
do
local CombatRatingMap = {
[CR_WEAPON_SKILL] = 2.5,
[CR_DEFENSE_SKILL] = 1.5,
[CR_DODGE] = 13.8,
[CR_PARRY] = 13.8,
[CR_BLOCK] = 5,
[CR_HIT_MELEE] = 10,
[CR_CRIT_MELEE] = 14,
[CR_HIT_RANGED] = 10,
[CR_CRIT_RANGED] = 14,
[CR_HASTE_MELEE] = 10,
[CR_HASTE_RANGED] = 10,
[CR_HIT_SPELL] = 8,
[CR_CRIT_SPELL] = 14,
[CR_HASTE_SPELL] = 10,
[CR_CRIT_TAKEN_MELEE] = 28.75,
[CR_HIT_TAKEN_MELEE] = 10,
[CR_EXPERTISE] = 2.5,
[CR_ARMOR_PENETRATION] = 4.2682925137607,
}
 
local lowerlimit34 = {
[CR_DEFENSE_SKILL] = true,
[CR_DODGE] = true,
[CR_PARRY] = true,
[CR_BLOCK] = true,
[CR_HIT_TAKEN_MELEE] = true,
[CR_HIT_TAKEN_SPELL] = true,
}
 
local ratingMultiplier = setmetatable({},{
__index = function (self, level)
--[[
The following calculations are based on Whitetooth's calculations:
http://www.wowinterface.com/downloads/info5819-Rating_Buster.html
]]
local value
if level < 10 then
value = 26
elseif level <= 60 then
value = 52 / (level - 8)
elseif level <= 70 then
value = (262-3*level) / 82
elseif level <= 80 then
value = 1 / ((82/52)*(131/63)^((level-70)/10))
end
self[level] = value
return value
end,
})
 
local hasteBonusClasses = {
DEATHKNIGHT = true,
DRUID = true,
PALADIN = true,
SHAMAN = true,
}
 
local spellBasedClasses = {
PRIEST = "spell",
MAGE = "spell",
WARLOCK = "spell",
HUNTER = "ranged",
}
 
local modifiedRatings = {
spell = {
[CR_HIT_MELEE] = CR_HIT_SPELL,
[CR_CRIT_MELEE] = CR_CRIT_SPELL,
[CR_HASTE_MELEE] = CR_HASTE_SPELL,
},
ranged = {
[CR_HIT_MELEE] = CR_HIT_RANGED,
[CR_CRIT_MELEE] = CR_CRIT_RANGED,
[CR_HASTE_MELEE] = CR_HASTE_RANGED,
},
}
 
function Ratings:GetModifier()
local modifier = RatingsDB.modifier
if not modifier then
local class = select(2, UnitClass"player")
modifier = spellBasedClasses[class] or "melee"
RatingsDB.modifier = modifier
end
return modifier
end
 
function Ratings:GetClassRatingType(base_type)
local modifiers = modifiedRatings[self:GetModifier()]
return modifiers and modifiers[base_type] or base_type
end
 
function Ratings:GetRatingBonus(type, value)
type = self:GetClassRatingType(type)
local F = CombatRatingMap[type]
if not F then return end
 
local level = RatingsDB.forceLevel or UnitLevel"player"
local _, class = UnitClass"player"
 
 
if level < 34 and lowerlimit34[type] then level = 34 end
 
if type == CR_HASTE_MELEE then
if hasteBonusClasses[class] then
value = value * 1.3 -- or F /= 1.3
end
end
 
local bonus = value / F * ratingMultiplier[level]
return self:Format(bonus, level, type > 2 and type ~= 24)
end
end
 
do
local format_table = {}
function Ratings:Format(bonus, level, has_percent)
if has_percent then
format_table.V = string_format("%.2f%%", bonus)
else
format_table.V = string_format("%.2f", bonus)
end
format_table.L = tostring(level)
return string_gsub(RatingsDB.format, "%$([A-Z])", format_table)
end
end
 
Ratings:HookTooltip(GameTooltip)
Ratings:HookTooltip(ItemRefTooltip)
Ratings:HookTooltip(ShoppingTooltip1)
Ratings:HookTooltip(ShoppingTooltip2)
 
_G.Ratings = Ratings
Eui/script/toggle.lua Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/script/watchframe.lua New file
0,0 → 1,98
local EuiWatchFrame = CreateFrame("Frame", "EuiWatchFrame", UIParent)
 
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
local wideFrame = GetCVar("watchFrameWidth")
 
local WatchFrameHolder = CreateFrame("Frame", "WatchFrameHolder", UIParent)
WatchFrameHolder:SetWidth(130)
WatchFrameHolder:SetHeight(22)
 
 
local function init()
EuiWatchFrame:UnregisterEvent("PLAYER_ENTERING_WORLD")
EuiWatchFrame:RegisterEvent("CVAR_UPDATE")
EuiWatchFrame:SetScript("OnEvent", function(_,_,cvar,value)
SetCVar("watchFrameWidth", 0)
EuiWatchFrame:SetWidth(250)
InterfaceOptionsObjectivesPanelWatchFrameWidth:Hide()
end)
 
EuiWatchFrame:ClearAllPoints()
EuiWatchFrame:SetPoint("TOP", WatchFrameHolder, "TOP", 0, 0)
end
 
function E.PostWatchMove()
if E.Movers["WatchFrameMover"]["moved"] == false then
E.PositionWatchFrame()
end
end
 
function E.PositionWatchFrame()
if fired == true and E.Movers["WatchFrameMover"]["moved"] == true then return end
 
if WatchFrameMover then
if E.Movers["WatchFrameMover"]["moved"] == true then return end
 
WatchFrameMover:ClearAllPoints()
if C["actionbar"].rightbar == 2 then
WatchFrameMover:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-190), E.Scale(-300))
elseif C["actionbar"].rightbar == 1 then
WatchFrameMover:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-160), E.Scale(-300))
else
WatchFrameMover:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-120), E.Scale(-300))
end
else
WatchFrameHolder:ClearAllPoints()
if C["actionbar"].enable and C["actionbar"].rightbar == 2 then
WatchFrameHolder:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-190), E.Scale(-300))
elseif C["actionbar"].enable and C["actionbar"].rightbar == 1 then
WatchFrameHolder:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-160), E.Scale(-300))
else
WatchFrameHolder:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-120), E.Scale(-300))
end
 
E.CreateMover(WatchFrameHolder, "WatchFrameMover", "任务追踪", true, E.PostWatchMove)
end
end
 
local function setup()
E.PositionWatchFrame()
 
local screenheight = GetScreenHeight()
EuiWatchFrame:SetSize(1,screenheight / 2)
 
-- template was just to help positioning watch frame.
--EuiWatchFrame:SetTemplate("Default")
 
EuiWatchFrame:SetWidth(250)
 
WatchFrame:SetParent(EuiWatchFrame)
WatchFrame:SetClampedToScreen(false)
WatchFrame:ClearAllPoints()
WatchFrame.ClearAllPoints = function() end
WatchFrame:SetPoint("TOPLEFT", 32,-2.5)
WatchFrame:SetPoint("BOTTOMRIGHT", 4,0)
WatchFrame.SetPoint = E.dummy
 
WatchFrameTitle:SetParent(EuiWatchFrame)
WatchFrameCollapseExpandButton:SetParent(EuiWatchFrame)
WatchFrameTitle:Hide()
WatchFrameTitle.Show = E.dummy
WatchFrameCollapseExpandButton.Disable = E.dummy
end
 
EuiWatchFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
 
local f = CreateFrame("Frame")
f:Hide()
f.elapsed = 0
f:SetScript("OnUpdate", function(self, elapsed)
f.elapsed = f.elapsed + elapsed
if f.elapsed then
if f.elapsed > .5 then
setup()
f:Hide()
end
end
end)
EuiWatchFrame:SetScript("OnEvent", function() if not IsAddOnLoaded("Who Framed Watcher Wabbit") or not IsAddOnLoaded("Fux") then init() f:Show() end end)
Eui/script/filter.lua New file
0,0 → 1,1664
local E, C = unpack(select(2, ...))
if not C["filter"].enable == true then return end
 
local class = select(2, UnitClass("player"));
local classcolor = E.RAID_CLASS_COLORS[class];
local active, bars = {}, {};
 
local MyUnits = {
player = true,
vehicle = true,
pet = true,
}
if filterdb == nil then filterdb = {} end;
local time, Update;
local function OnUpdate(self, elapsed)
time = self.filter == "CD" and self.expirationTime+self.duration-GetTime() or self.expirationTime-GetTime();
if ( self:GetParent().Mode == "BAR" ) then
self.statusbar:SetValue(time);
self.time:SetFormattedText(SecondsToTimeAbbrev(time));
end
if ( time < 0 and self.filter == "CD" ) then
local id = self:GetParent().Id;
for index, value in ipairs(active[id]) do
local spn = GetSpellInfo( value.data.spellID or value.data.slotID )
if ( self.spellName == spn) then
tremove(active[id], index);
break;
end
end
self:SetScript("OnUpdate", nil);
Update(self:GetParent());
end
end
 
function Update(self)
local id = self.Id;
if ( not bars[id] ) then
bars[id] = {};
end
for index, value in ipairs(bars[id]) do
value:Hide();
end
local bar;
for index, value in ipairs(active[id]) do
bar = bars[id][index];
if ( not bar ) then
bar = CreateFrame("Frame", "FilgerAnker"..id.."Frame"..index, self);
bar:SetWidth(value.data.size);
bar:SetHeight(value.data.size);
 
local panel = CreateFrame("Frame", nil, bar)
E.EuiCreatePanel(panel, value.data.size, value.data.size, "CENTER", bar, "CENTER", 0, 0)
panel:SetBackdropColor(0, 0, 0,1)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
panel:SetBackdropBorderColor(r, g, b,1)
else
panel:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
panel:SetFrameStrata("MEDIUM")
panel:SetFrameLevel(bar:GetFrameLevel() - 1)
 
E.EuiCreateShadow(panel)
 
bar.icon = bar:CreateTexture(nil, "BACKGROUND")
bar.icon:SetPoint("TOPLEFT", bar, 2, -2)
bar.icon:SetPoint("BOTTOMRIGHT", bar, -2, 2)
bar.icon:SetTexCoord(.08, .92, .08, .92)
 
if ( index == 1 ) then
if ( C["filter"].configmode ) then
bar:SetFrameStrata("MEDIUM");
end
if filterdb[self.Name]==nil then
bar:SetPoint(unpack(self.setPoint));
else
bar:SetPoint('CENTER', UIParent, 'BOTTOMLEFT', filterdb[self.Name]["x"], filterdb[self.Name]["y"])
end
 
else
if ( self.Direction == "UP" ) then
bar:SetPoint("BOTTOM", bars[id][index-1], "TOP", 0, self.Interval);
elseif ( self.Direction == "RIGHT" ) then
bar:SetPoint("LEFT", bars[id][index-1], "RIGHT", self.Mode == "ICON" and self.Interval or value.data.barWidth+self.Interval, 0);
elseif ( self.Direction == "LEFT" ) then
bar:SetPoint("RIGHT", bars[id][index-1], "LEFT", self.Mode == "ICON" and -self.Interval or -(value.data.barWidth+self.Interval), 0);
else
bar:SetPoint("TOP", bars[id][index-1], "BOTTOM", 0, -self.Interval);
end
end
if ( self.Mode == "ICON" ) then
bar.count = bar:CreateFontString(nil, "ARTWORK");
bar.count:SetFont(E.fontn, 10, "OUTLINE");
bar.count:SetPoint("BOTTOMRIGHT",0,1);
bar.count:SetJustifyH("RIGHT");
 
bar.cooldown = CreateFrame("Cooldown", nil, bar);
bar.cooldown:SetPoint("TOPLEFT", bar, 2, -2)
bar.cooldown:SetPoint("BOTTOMRIGHT", bar, -2, 2)
bar.cooldown:SetReverse();
 
else
bar.statusbar = CreateFrame("StatusBar", nil, bar);
if ( C["filter"].configmode ) then
bar.statusbar:SetFrameStrata("MEDIUM");
end
bar.statusbar:SetWidth(value.data.barWidth - value.data.size -5);
bar.statusbar:SetHeight(value.data.size);
bar.statusbar:SetStatusBarTexture(E.normTex);
if C["filter"].classcolor == true then
bar.statusbar:SetStatusBarColor(classcolor.r, classcolor.g, classcolor.b, 0.8);
else
bar.statusbar:SetStatusBarColor(0.31, 0.45, 0.63, 0.5);
end
bar.statusbar:SetPoint("TOPLEFT", bar, "TOPRIGHT", 5, 0);
bar.statusbar:SetMinMaxValues(0, 1);
bar.statusbar:SetValue(0);
 
bar.statusbar.bg = bar.statusbar:CreateTexture(nil, "BORDER")
bar.statusbar.bg:SetAllPoints(bar.statusbar)
bar.statusbar.bg:SetTexture(E.normTex)
bar.statusbar.bg:SetVertexColor(0.15, 0.15, 0.15)
 
local panel = CreateFrame("Frame", nil, bar.statusbar)
E.EuiCreatePanel(panel, (value.data.barWidth - value.data.size -5), value.data.size, "CENTER", bar.statusbar, "CENTER", 0, 0)
panel:SetBackdropColor(0, 0, 0)
panel:SetBackdropBorderColor(0,0,0)
E.EuiCreateShadow(panel)
 
bar.time = bar.statusbar:CreateFontString(nil, "ARTWORK");
bar.time:SetFont(E.fontn, 10, "OUTLINE");
bar.time:SetPoint("RIGHT", bar.statusbar, -2, 1);
 
bar.spellname = bar.statusbar:CreateFontString(nil, "ARTWORK");
bar.spellname:SetFont(E.font, 11, "OUTLINE");
bar.spellname:SetPoint("LEFT", bar.statusbar, 5, 0);
bar.spellname:SetPoint("RIGHT", bar.time, "LEFT");
bar.spellname:SetJustifyH("LEFT");
 
bar.count = bar.statusbar:CreateFontString(nil, "ARTWORK");
bar.count:SetFont(E.fontn, 10, "OUTLINE");
bar.count:SetPoint("RIGHT", bar.statusbar, -40, 1);
bar.count:SetJustifyH("RIGHT");
end
 
tinsert(bars[id], bar);
end
 
bar.icon:SetTexture(value.icon)
bar.count:SetText(value.count > 1 and value.count or "")
bar.spellName = GetSpellInfo( value.data.spellID or value.data.slotID );
 
if ( self.Mode == "BAR" ) then
bar.spellname:SetText(value.data.displayName or GetSpellInfo( value.data.spellID ));
end
if ( value.duration > 0 ) then
if ( self.Mode == "ICON" ) then
CooldownFrame_SetTimer(bar.cooldown, value.data.filter == "CD" and value.expirationTime or value.expirationTime-value.duration, value.duration, 1);
if ( value.data.filter == "CD" ) then
bar.expirationTime = value.expirationTime;
bar.duration = value.duration;
bar.filter = value.data.filter;
bar:SetScript("OnUpdate", OnUpdate);
end
else
bar.statusbar:SetMinMaxValues(0, value.duration);
bar.expirationTime = value.expirationTime;
bar.duration = value.duration;
bar.filter = value.data.filter;
bar:SetScript("OnUpdate", OnUpdate);
end
else
if ( self.Mode == "ICON" ) then
bar.cooldown:Hide();
else
bar.statusbar:SetMinMaxValues(0, 1);
bar.statusbar:SetValue(1);
bar.time:SetText("");
bar:SetScript("OnUpdate", nil);
end
end
 
bar:Show();
end
end
 
 
local function OnEvent(self, event, ...)
local unit = ...;
if ( ( unit == "target" or unit == "player" ) or event == "PLAYER_TARGET_CHANGED" or event == "PLAYER_ENTERING_WORLD" or event == "SPELL_UPDATE_COOLDOWN" ) then
local data, name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, start, enabled, slotLink, shouldConsolidate, spellId, spn;
local id = self.Id;
for i=1, #Filger_Spells[class][id], 1 do
data = Filger_Spells[class][id][i];
local findspell = false;
local findspn = false;
if ( data.filter == "BUFF" ) then
spn = GetSpellInfo( data.spellID )
for n = 1, 40 do
if select(11, UnitBuff(data.unitId, n)) == data.spellID then
name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, shouldConsolidate, spellId = UnitBuff(data.unitId, n);
findspell = true;
break;
end
end
if findspell == false then
name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, shouldConsolidate, spellId = UnitBuff(data.unitId, spn);
 
end
elseif ( data.filter == "DEBUFF" ) then
spn = GetSpellInfo( data.spellID )
for n = 1, 40 do
if select(11, UnitDebuff(data.unitId, n)) == data.spellID then
name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, shouldConsolidate, spellId = UnitDebuff(data.unitId, n);
findspell = true;
break;
end
end
if findspell == false then
name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, shouldConsolidate, spellId = UnitDebuff(data.unitId, spn);
end
else
if ( data.spellID ) then
spn = GetSpellInfo( data.spellID )
start, duration, enabled = GetSpellCooldown( spn );
_,_,icon = GetSpellInfo( data.spellID );
else
slotLink = GetInventoryItemLink("player", data.slotID);
if ( slotLink ) then
name, _, _, _, _, _, _, _, _, icon = GetItemInfo(slotLink);
if ( not data.displayName ) then
data.displayName = name;
end
start, duration, enabled = GetInventoryItemCooldown("player", data.slotID);
end
end
count = 0;
caster = "all";
end
if ( not active[id] ) then
active[id] = {};
end
for index, value in ipairs(active[id]) do
if ( data.spellID == value.data.spellID ) then
tremove(active[id], index);
break;
end
end
if ( ( name and ( data.caster ~= 1 and ( caster == data.caster or data.caster == "all" ) or MyUnits[caster] )) or ( ( enabled or 0 ) > 0 and ( duration or 0 ) > 1.5 ) ) then
for key, value in pairs(active[id]) do
if GetSpellInfo(value.data.spellID) == spn then
findspn = true;
end
end
if findspn == false or findspell == true then
table.insert(active[id], { data = data, icon = icon, count = count, duration = duration, expirationTime = expirationTime or start });
end
end
end
Update(self);
end
end
 
function init(self)
if ( Filger_Spells and Filger_Spells[class] ) then
for index in pairs(Filger_Spells) do
if ( index ~= class ) then
Filger_Spells[index] = nil;
end
end
local data, frame;
for i=1, #Filger_Spells[class], 1 do
data = Filger_Spells[class][i];
frame = CreateFrame("Frame", "FilgerAnker"..i, UIParent);
frame.Id = i;
frame.Name = data.Name;
frame.Direction = data.Direction or "DOWN";
frame.Interval = data.Interval or 2;
frame.Mode = data.Mode or "ICON";
frame.setPoint = data.setPoint or "CENTER";
frame:SetWidth(Filger_Spells[class][i][1] and Filger_Spells[class][i][1].size or 100);
frame:SetHeight(Filger_Spells[class][i][1] and Filger_Spells[class][i][1].size or 20);
function frame:ADDON_LOADED(event, name)
if(name ~= 'Eui') then
frame:ClearAllPoints()
end
end
if filterdb[frame.Name] ~= nil then
frame:SetPoint('CENTER', UIParent, 'BOTTOMLEFT', filterdb[data.Name]["x"], filterdb[data.Name]["y"]);
else
frame:SetPoint(unpack(data.setPoint));
end
 
if ( C["filter"].configmode ) then
frame:SetFrameStrata("DIALOG");
frame:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile = "", insets = { left = 0, right = 0, top = 0, bottom = 0 }});
E.EuiSetTemplate(frame)
if frame.Name ~= "playerbufficon" and frame.Name ~= "playerbuffbar" and frame.Name ~= "targetdebufficon" and frame.Name ~= "targetdebuffbar" then frame:Hide() end
 
frame:SetMovable(true);
frame:EnableMouse(true);
frame:RegisterForDrag("LeftButton");
frame:SetScript("OnDragStart", function(self)
if(IsShiftKeyDown() or IsAltKeyDown()) then
self:StartMoving()
end
end);
frame:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing();
local x, y = self:GetCenter()
if (filterdb[self.Name]==nil) then filterdb[self.Name]={}; end
filterdb[self.Name]["x"]=floor(x+0.5)
filterdb[self.Name]["y"]=floor(y+0.5)
end);
 
frame.text = frame:CreateFontString(nil, "OVERLAY");
frame.text:SetFont(E.font, 12, "OUTLINE");
frame.text:SetPoint("CENTER");
frame.text:SetText(data.Name and data.Name or "FilgerAnker"..i);
 
for j=1, #Filger_Spells[class][i], 1 do
data = Filger_Spells[class][i][j];
if ( not active[i] ) then
active[i] = {};
end
if ( data.spellID ) then
_,_,spellIcon = GetSpellInfo(data.spellID)
else
slotLink = GetInventoryItemLink("player", data.slotID);
if ( slotLink ) then
name, _, _, _, _, _, _, _, _, spellIcon = GetItemInfo(slotLink);
end
end
table.insert(active[i], { data = data, icon = spellIcon, count = 9, duration = 0, expirationTime = 0 });
end
-- Update(frame);
else
for j=1, #Filger_Spells[class][i], 1 do
data = Filger_Spells[class][i][j];
if ( data.filter == "CD" ) then
frame:RegisterEvent("SPELL_UPDATE_COOLDOWN");
break;
end
end
frame:RegisterEvent('ADDON_LOADED')
frame:RegisterEvent("UNIT_AURA");
frame:RegisterEvent("PLAYER_TARGET_CHANGED");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
frame:SetScript("OnEvent", OnEvent);
end
end
end
end
 
local fff=CreateFrame("Frame",nil)
fff:RegisterEvent("PLAYER_ENTERING_WORLD");
fff:SetScript("OnEvent", function()
fff:UnregisterEvent("PLAYER_ENTERING_WORLD")
 
local playerframe, targetframe, portrait
portrait = 0
if C["unitframe"].aaaaunit == 1 then
playerframe = "oUF_LjxxPlayerPlayer"
targetframe = "oUF_LjxxTargetTarget"
if C["unitframe"].portrait == true then
portrait = C["unitframe"].playerheight + 6
end
elseif C["unitframe"].aaaaunit == 2 then
playerframe = "oUF_monoPlayerFrame"
targetframe = "oUF_monoTargetFrame"
elseif C["unitframe"].aaaaunit == 3 then
playerframe = "oUF_AftermathhPlayer"
targetframe = "oUF_AftermathhTarget"
if C["unitframe"].portrait == true then
portrait = C["unitframe"].totheight + C["unitframe"].playerheight + 18
end
elseif C["unitframe"].aaaaunit == 4 then
playerframe = "oUF_LjxxB_Player"
targetframe = "oUF_LjxxB_Target"
else
playerframe = UIParent
targetframe = UIParent
end
local playBuffBarHeight = 5
if E.MyClass == 'SHAMAN' or E.MyClass == 'DEATHKNIGHT' then playBuffBarHeight = 12 end
if C["unitframe"].aaaaunit == 4 then playBuffBarHeight = 30 end
if E.MyClass == 'SHAMAN' or E.MyClass == 'DEATHKNIGHT' and C["unitframe"].aaaaunit == 1 then playBuffBarHeight = 18 end
local playBuffIconHeight
playBuffIconHeight = 235
local iconsize
if C["filter"].iconsize < 1 then iconsize = 30 else iconsize = C["filter"].iconsize end
Filger_Spells = {
["ROGUE"] = { -- 盗贼
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 灼热之光
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 重力炸弹
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 不稳定的能量
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 无面者的印记
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 萨隆邪铁蒸汽
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 闷棍
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 肾击
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 沉默 - 圣殿骑士之盾
},
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
{ spellID = 50613, size = 30, filter = "CD" }, -- 奥流之术
{ spellID = 11305, size = 30, filter = "CD" }, -- 疾跑
{ spellID = 1766, size = 30, filter = "CD" }, -- 脚踢
{ spellID = 5277, size = 30, filter = "CD" }, -- 闪避
{ spellID = 31224, size = 30, filter = "CD" }, -- 暗影斗篷
{ spellID = 7744, size = 30, filter = "CD" }, -- 亡灵意志
{ spellID = 13877, size = 30, filter = "CD" }, -- 剑刃乱舞
{ spellID = 13750, size = 30, filter = "CD" }, -- 冲动
},]]
},
["DRUID"] = { -- 德鲁伊
{
Name = "目标BUFF",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 23920, size = 30, unitId = "target", caster = "all", filter = "BUFF" }, -- 法术反射
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 灼热之光
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 重力炸弹
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 不稳定的能量
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 无面者的印记
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 萨隆邪铁蒸汽
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 闷棍
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 肾击
{ spellID = 2139, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 法术反制
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 沉默 - 圣殿骑士之盾
},
 
{
Name = "焦点DEBUFF",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "TOPRIGHT", 5, 28 },
 
{ spellID = 53308, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" }, -- 纠缠根须
{ spellID = 33786, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" }, -- 旋风
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 48438, size = 30, filter = "CD" }, -- 野性成长
{ spellID = 18562, size = 30, filter = "CD" }, -- 迅捷治愈
{ spellID = 22812, size = 30, filter = "CD" }, -- 树皮术
{ spellID = 33878, size = 30, filter = "CD" }, -- 裂伤(熊)
{ spellID = 53312, size = 30, filter = "CD" }, -- 自然之握
{ spellID = 53201, size = 30, filter = "CD" }, -- 星辰坠落
{ spellID = 61676, size = 30, filter = "CD" }, -- 低吼
{ spellID = 5229, size = 30, filter = "CD" }, -- 激怒
{ spellID = 16857, size = 30, filter = "CD" }, -- 精灵之火(野性)
{ spellID = 16979, size = 30, filter = "CD" }, -- 野性冲锋 - 熊
{ spellID = 49376, size = 30, filter = "CD" }, -- 野性冲锋 - 豹
{ spellID = 8983, size = 30, filter = "CD" }, -- 猛击
{ spellID = 49802, size = 30, filter = "CD" }, -- 割碎
{ spellID = 48575, size = 30, filter = "CD" }, -- 畏缩
{ slotID = 13, size = 30, filter = "CD" }, -- 饰品1
{ slotID = 14, size = 30, filter = "CD" }, -- 饰品2
},]]
},
["HUNTER"] = { -- 猎人
{
Name = "目标BUFF",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 34074, size = 30, unitId = "player", caster = "player", filter = "BUFF" }, --蝰蛇守护
 
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 灼热之光
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 重力炸弹
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 不稳定的能量
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 无面者的印记
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 萨隆邪铁蒸汽
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 闷棍
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 肾击
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 沉默 - 圣殿骑士之盾
},
 
{
Name = "焦点DEBUFF",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "TOPRIGHT", 5, 28 },
 
{ spellID = 49012, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--翼龙钉刺
{ spellID = 34490, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--沉默射击
},
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 53301, size = 30, filter = "CD" },--爆炸射击
{ spellID = 19434, size = 30, filter = "CD" },--瞄准射击
{ spellID = 781, size = 30, filter = "CD" },--逃脱
{ spellID = 34477, size = 30, filter = "CD" },--误导
{ spellID = 34026, size = 30, filter = "CD" },--杀戮命令
{ spellID = 28728, size = 30, filter = "CD" },--假死
{ spellID = 14311, size = 30, filter = "CD" },--冰冻陷阱
{ spellID = 49012, size = 30, filter = "CD" },--翼龙钉刺
{ spellID = 14327, size = 30, filter = "CD" },--恐吓野兽
{ spellID = 53271, size = 30, filter = "CD" },--主人的召唤
{ spellID = 19263, size = 30, filter = "CD" },--威慑
{ spellID = 5116, size = 30, filter = "CD" },--震荡射击
{ spellID = 48999, size = 30, filter = "CD" },--反击
{ spellID = 53339, size = 30, filter = "CD" },--猫鼬撕咬
{ spellID = 19577, size = 30, filter = "CD" },--胁迫
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["MAGE"] = { --法师
{
Name = "目标BUFF",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 23920, size = 72, unitId = "target", caster = "all", filter = "BUFF" }, -- 法术反射
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 灼热之光
{ spellID = 63025, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 重力炸弹
{ spellID = 62865, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 不稳定的能量
{ spellID = 63276, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 无面者的印记
{ spellID = 63322, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 萨隆邪铁蒸汽
{ spellID = 6770, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 闷棍
{ spellID = 408, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 肾击
{ spellID = 2139, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 法术反制
{ spellID = 63529, size = 72, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 沉默 - 圣殿骑士之盾
},
 
{
Name = "焦点DEBUFF",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "TOPRIGHT", 5, 28 },
 
{ spellID = 118, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" }, -- 变形术
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 4,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 1953, size = 30, filter = "CD" },--闪现
{ spellID = 11831, size = 30, filter = "CD" },--冰霜新星
{ spellID = 11426, size = 30, filter = "CD" },--寒冰护体
{ spellID = 2139, size = 30, filter = "CD" },--法术反制
{ spellID = 44572, size = 30, filter = "CD" },--深度冻结
{ spellID = 6143, size = 30, filter = "CD" },--防护冰霜结界
{ spellID = 12043, size = 30, filter = "CD" },--气定神闲
{ spellID = 12042, size = 30, filter = "CD" },--奥术强化
{ spellID = 42945, size = 30, filter = "CD" },--冲击波
{ spellID = 42950, size = 30, filter = "CD" },--龙息术
{ spellID = 42931, size = 30, filter = "CD" },--冰锥术
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["WARRIOR"] = { --战士
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 3411, size = 30, filter = "CD" },--援护
{ spellID = 47488, size = 30, filter = "CD" },--盾牌猛击
{ spellID = 1680, size = 30, filter = "CD" },--旋风斩
{ spellID = 47486, size = 30, filter = "CD" },--致死打击
{ spellID = 47502, size = 30, filter = "CD" },--雷霆一击
{ spellID = 57823, size = 30, filter = "CD" },--复仇
{ spellID = 7384, size = 30, filter = "CD" },--压制
{ spellID = 6552, size = 30, filter = "CD" },--拳击
{ spellID = 72, size = 30, filter = "CD" },--盾击
{ spellID = 11578, size = 30, filter = "CD" },--冲锋
{ spellID = 20252, size = 30, filter = "CD" },--拦截
{ spellID = 2687, size = 30, filter = "CD" },--血性狂暴
{ spellID = 18449, size = 30, filter = "CD" },--狂暴之怒
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["SHAMAN"] = { -- 萨满
{
Name = "目标BUFF",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 23920, size = 30, unitId = "target", caster = "all", filter = "BUFF" }, -- 法术反射
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 灼热之光
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 重力炸弹
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 不稳定的能量
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 无面者的印记
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 萨隆邪铁蒸汽
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 闷棍
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 肾击
{ spellID = 2139, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 法术反制
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" }, -- 沉默 - 圣殿骑士之盾
},
 
{
Name = "焦点DEBUFF",
Direction = "UP",
Interval = 7,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "TOPRIGHT", 5, 28 },
 
{ spellID = 51514, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--妖术
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 49231, size = 30, filter = "CD" },--大地震击
{ spellID = 61301, size = 30, filter = "CD" },--激流
{ spellID = 59159, size = 30, filter = "CD" },--雷霆风暴
{ spellID = 60043, size = 30, filter = "CD" },--熔岩爆裂
{ spellID = 60103, size = 30, filter = "CD" },--熔岩猛击
{ spellID = 49271, size = 30, filter = "CD" },--闪电链
{ spellID = 57994, size = 30, filter = "CD" },--风剪
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["PALADIN"] = { -- 圣骑士
{
Name = "目标BUFF",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 23920, size = 60, unitId = "target", caster = "all", filter = "BUFF" }, --法术反射
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 2139, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 20066, size = 30, filter = "CD" },--忏悔
{ spellID = 62124, size = 30, filter = "CD" },--清算之手
{ spellID = 1044, size = 30, filter = "CD" },--自由之手
{ spellID = 20271, size = 30, filter = "CD" },--圣光审判
{ spellID = 31789, size = 30, filter = "CD" },--正义防御
{ spellID = 48801, size = 30, filter = "CD" },--驱邪术
{ spellID = 10308, size = 30, filter = "CD" },--制裁之锤
{ spellID = 48819, size = 30, filter = "CD" },--奉献
{ spellID = 48806, size = 30, filter = "CD" },--愤怒之锤
{ spellID = 48825, size = 30, filter = "CD" },--神圣震击
{ spellID = 48952, size = 30, filter = "CD" },--神圣之盾
{ spellID = 48827, size = 30, filter = "CD" },--复仇者之盾
{ spellID = 54428, size = 30, filter = "CD" },--神圣恳求
{ spellID = 61411, size = 30, filter = "CD" },--正义盾击
{ spellID = 48817, size = 30, filter = "CD" },--神圣愤怒
{ spellID = 31821, size = 30, filter = "CD" },--光环掌握
{ spellID = 35395, size = 30, filter = "CD" },--十字军打击
{ spellID = 20216, size = 30, filter = "CD" },--神恩术
{ spellID = 53385, size = 30, filter = "CD" },--神圣风暴
{ spellID = 53595, size = 30, filter = "CD" },--正义之锤
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["PRIEST"] = { -- 牧师
{
Name = "目标BUFF",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 23920, size = 60, unitId = "target", caster = "all", filter = "BUFF" },--法术反射
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 2139, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
},
 
{
Name = "焦点DEBUFF",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "TOPRIGHT", 5, 28 },
 
{ spellID = 10955, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--束缚亡灵
{ spellID = 10890, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--心灵尖啸
{ spellID = 15487, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--沉默
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 53007, size = 30, filter = "CD" },--苦修
{ spellID = 33206, size = 30, filter = "CD" },--痛苦压制
{ spellID = 10060, size = 30, filter = "CD" },--能量灌注
{ spellID = 10890, size = 30, filter = "CD" },--心灵尖啸
{ spellID = 48089, size = 30, filter = "CD" },--治疗之环
{ spellID = 47788, size = 30, filter = "CD" },--守护之魂
{ spellID = 48113, size = 30, filter = "CD" },--愈合祷言
{ spellID = 15487, size = 30, filter = "CD" },--沉默
{ spellID = 48066, size = 30, filter = "CD" },--真言术:盾
{ spellID = 48135, size = 30, filter = "CD" },--神圣之火
{ spellID = 48158, size = 30, filter = "CD" },--暗言术:灭
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["WARLOCK"] = { -- 术士
{
Name = "目标BUFF",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 235 },
 
{ spellID = 23920, size = 60, unitId = "target", caster = "all", filter = "BUFF" },--法术反射
},
 
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 2139, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
},
 
{
Name = "焦点DEBUFF",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "TOPRIGHT", 5, 28 },
 
{ spellID = 5782, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--恐惧
{ spellID = 710, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--放逐术
{ spellID = 11719, size = 16, barWidth = 181, scale = 1, unitId = "focus", caster = "player", filter = "DEBUFF" },--语言诅咒
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 48438, size = 30, filter = "CD" },--野性成长(XD)?
{ spellID = 47843, size = 30, filter = "CD" },--痛苦无常
{ spellID = 59164, size = 30, filter = "CD" },--鬼影缠身
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
["DEATHKNIGHT"] = { -- 死亡骑士
{
Name = "自身DEBUFF",
Direction = "UP",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", playerframe, "TOPRIGHT", 0, 320 },
 
{ spellID = 63023, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63025, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 62865, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63276, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63322, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 6770, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 408, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
{ spellID = 63529, size = 60, unitId = "player", caster = "all", filter = "DEBUFF" },
},
 
--[[ {
Name = "冷却",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, 202 },
 
{ spellID = 49206, size = 30, filter = "CD" },--召唤石像鬼
{ spellID = 47481, size = 30, filter = "CD" },--撕扯
{ spellID = 47476, size = 30, filter = "CD" },--绞袭
{ slotID = 13, size = 30, filter = "CD" },
{ slotID = 14, size = 30, filter = "CD" },
},]]
},
}
 
--启用玩家BUFF图标提示
if C["filter"].pbufficon == true then
table.insert(Filger_Spells["ROGUE"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 3,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight },
 
{ spellID = 51662, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 血之饥渴
{ spellID = 6774, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 切割
{ spellID = 13877, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 剑刃乱舞
{ spellID = 13750, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 冲动
})
 
table.insert(Filger_Spells["DRUID"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight },
 
{ spellID = 33763, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 生命绽放
{ spellID = 774, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 回春术
{ spellID = 8936, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 愈合
{ spellID = 2893, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 驱毒术
{ spellID = 61336, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 生存本能
{ spellID = 52610, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 凶蛮咆哮
{ spellID = 50334, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 狂暴
{ spellID = 22812, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 树皮术
{ spellID = 69369, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 掠食者的迅捷
{ spellID = 48525, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 月蚀
{ spellID = 16870, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 节能施法
{ spellID = 60235, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(精神值提高300点)
{ spellID = 60234, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(智力提高300点)
{ spellID = 60233, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(敏捷提高300点)
{ spellID = 60062, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 生命精华(法术急速等级提高505)
{ spellID = 48517, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 日蚀
{ spellID = 48518, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 月蚀
})
 
table.insert(Filger_Spells["HUNTER"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 56453, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--荷枪实弹
{ spellID = 60314, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--五色巨龙之怒(饰品)
{ spellID = 60233, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(敏捷)
{ spellID = 65019, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--雷神符石(饰品)
{ spellID = 6150, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, --快速射击
{ spellID = 34837, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--战术大师
{ spellID = 53224, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--强化稳固射击
{ spellID = 34503, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--破甲虚弱
})
 
table.insert(Filger_Spells["MAGE"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 44544, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 寒冰指
{ spellID = 57761, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 火球
{ spellID = 44448, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 法术连击
{ spellID = 54490, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 飞弹速射
{ spellID = 12536, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 节能施法
{ spellID = 12358, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 冲击
{ spellID = 60234, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大
{ spellID = 60062, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 生命精华
{ spellID = 36032, size = iconsize, unitId = "player", caster = "player", filter = "DEBUFF" }, -- 奥术冲击
})
 
table.insert(Filger_Spells["WARRIOR"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 23920, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--法术反射
{ spellID = 64568, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--储备血浆(FM)
{ spellID = 52437, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--猝死
{ spellID = 46916, size = iconsize, unitId = "player", caster = "all", filter = "BUFF" },--猛击!
{ spellID = 50227, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--剑盾猛攻
{ spellID = 60229, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(力量)
})
 
table.insert(Filger_Spells["SHAMAN"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 2825, size = iconsize, unitId = "player", caster = "all", filter = "BUFF" }, -- 嗜血
{ spellID = 49281, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--闪电之盾
{ spellID = 57960, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--水之护盾
{ spellID = 49284, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--大地之盾
{ spellID = 51994, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--践踏(牛头人)
{ spellID = 32182, size = iconsize, unitId = "player", caster = "all", filter = "BUFF" },--英勇
-- { spellID = 51470, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--元素之誓
{ spellID = 12536, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--节能施法
{ spellID = 51566, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--波涛汹涌
{ spellID = 51532, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--漩涡武器
{ spellID = 60235, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },-- 伟大(精神值提高300点)
{ spellID = 60234, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },-- 伟大(智力提高300点)
{ spellID = 60233, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },-- 伟大(敏捷提高300点)
{ spellID = 60062, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },-- 生命精华(法术急速等级提高505)
})
 
table.insert(Filger_Spells["PALADIN"],
{
Name = "playerbufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 54155, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 纯洁审判
{ spellID = 53601, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 圣洁护盾
{ spellID = 54149, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 圣光灌注
{ spellID = 54428, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 神圣恳求
{ spellID = 60235, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(精神值提高300点)
{ spellID = 60234, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(智力提高300点)
{ spellID = 60233, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(敏捷提高300点)
{ spellID = 60062, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, -- 生命精华(法术急速等级提高505)
{ spellID = 59578, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, --战争艺术
{ spellID = 31834, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, --圣光之赐
})
 
table.insert(Filger_Spells["PRIEST"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 48066, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--真言术:盾
{ spellID = 25222, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--恢复
{ spellID = 586, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--渐隐术
{ spellID = 6346, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--防护恐惧结界
{ spellID = 33151, size = iconsize, unitId = "player", caster = "all", filter = "BUFF" },--圣光涌动
{ spellID = 63734, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--好运
{ spellID = 60234, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(智力)
{ spellID = 60235, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(精神)
{ spellID = 60062, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--生命精华
})
 
table.insert(Filger_Spells["WARLOCK"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
{ spellID = 60235, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(精神)
{ spellID = 60234, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(智力)
{ spellID = 60062, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--生命精华
{ spellID = 47383, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--熔火之心
{ spellID = 63158, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--灭杀
{ spellID = 54277, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--爆燃
{ spellID = 18095, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, --夜幕
{ spellID = 34939, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, --反冲
{ spellID = 63321, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" }, --生命分流雕文
})
 
table.insert(Filger_Spells["DEATHKNIGHT"],
{
Name = "playerbufficon",
Direction = "RIGHT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffIconHeight},
 
{ spellID = 60229, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--伟大(力量)
{ spellID = 66817, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--孤寂
{ spellID = 53365, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--不洁之力(符文)
{ spellID = 65014, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--蓝铁灌注(饰品)
{ spellID = 67117, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--不洁之能
{ spellID = 49509, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--血之气息
{ spellID = 50449, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--鲜血复仇
{ spellID = 55233, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--吸血鬼之血
{ spellID = 50880, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--冰冷之抓
{ spellID = 49039, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--巫妖之躯
{ spellID = 51271, size = iconsize, unitId = "player", caster = "player", filter = "BUFF" },--铜墙铁壁
})
 
end
 
--启用目标DEBUFF图标
if C["filter"].tdebufficon == true then
table.insert(Filger_Spells["ROGUE"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 50613, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 奥流之术
{ spellID = 8647, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 破甲
{ spellID = 6770, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 闷棍
{ spellID = 6409, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 偷袭
{ spellID = 51722, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 拆卸
{ spellID = 408, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 肾击
{ spellID = 26679, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致命投掷
{ spellID = 1943, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 割裂
{ spellID = 703, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 锁喉
{ spellID = 1776, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 凿击
{ spellID = 2094, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致盲
{ spellID = 16511, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 出血
{ spellID = 3408, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 减速药膏
{ spellID = 27186, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致命药膏
{ spellID = 57978, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致伤药膏
{ spellID = 57982, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 麻醉药膏
{ spellID = 51693, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 打劫
{ spellID = 1766, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 脚踢
})
 
table.insert(Filger_Spells["DRUID"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 33982, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 裂伤(豹)
{ spellID = 1822, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 斜掠
{ spellID = 1079, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 割裂
{ spellID = 33878, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 裂伤(熊)
{ spellID = 33745, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 割伤
{ spellID = 99, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 挫志咆哮
{ spellID = 48463, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 月火术
{ spellID = 48468, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 虫群
{ spellID = 770, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" }, -- 精灵之火
{ spellID = 26989, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" }, -- 纠缠根须
})
 
table.insert(Filger_Spells["HUNTER"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 49001, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 毒蛇钉刺
{ spellID = 63672, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 黑箭
{ spellID = 1130, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" }, --猎人印记
{ spellID = 3043, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --毒蝎钉刺
{ spellID = 60053, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --爆炸射击
{ spellID = 49050, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --瞄准射击
})
table.insert(Filger_Spells["PALADIN"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
 
{ spellID = 20271, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--圣光审判
{ spellID = 20186, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--智慧审判
{ spellID = 54499, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--十字军之心
{ spellID = 53742, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--血之腐蚀
})
table.insert(Filger_Spells["MAGE"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 36032, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 奥术冲击
{ spellID = 22959, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" }, -- 强化灼烧
{ spellID = 31589, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 减速
{ spellID = 12848, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 点燃
{ spellID = 55360, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 活动炸弹
})
 
table.insert(Filger_Spells["WARRIOR"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 1715, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" },--断筋
{ spellID = 47465, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--撕裂
{ spellID = 7386, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" },--破甲攻击
{ spellID = 6343, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--雷霆一击
{ spellID = 1160, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--挫志怒吼
{ spellID = 64850, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" },--冷酷突击
{ spellID = 47486, size = iconsize, unitId = "target", caster = "all", filter = "DEBUFF" },--致死打击
})
 
table.insert(Filger_Spells["SHAMAN"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 49231, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--大地震击
{ spellID = 49236, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--冰霜震击
{ spellID = 49233, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--烈焰震击
})
 
table.insert(Filger_Spells["PRIEST"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 48068, size = iconsize, unitId = "target", caster = "player", filter = "BUFF" },--恢复
{ spellID = 41637, size = iconsize, unitId = "target", caster = "player", filter = "BUFF" },--愈合祷言
{ spellID = 47788, size = iconsize, unitId = "target", caster = "player", filter = "BUFF" },--守护之魂
{ spellID = 33206, size = iconsize, unitId = "target", caster = "player", filter = "BUFF" },--痛苦压制
{ spellID = 48125, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --痛
{ spellID = 48300, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --噬灵疫病
{ spellID = 48160, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --吸血鬼之触
})
 
table.insert(Filger_Spells["WARLOCK"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 172, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--腐蚀术
{ spellID = 348, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--献祭
{ spellID = 980, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--痛苦诅咒
{ spellID = 47867, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--厄运诅咒
{ spellID = 11719, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--语言诅咒
{ spellID = 47843, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--痛苦无常
{ spellID = 59164, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" }, --鬼影缠身
})
 
table.insert(Filger_Spells["DEATHKNIGHT"],
{
Name = "targetdebufficon",
Direction = "LEFT",
Interval = 2,
Mode = "ICON",
setPoint = { "BOTTOMRIGHT", targetframe, "TOPRIGHT", 0, 202 },
{ spellID = 59879, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--血之疫病
{ spellID = 59921, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--冰霜疫病
{ spellID = 49194, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--邪恶虫群
{ spellID = 49206, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--召唤石像鬼
{ spellID = 49005, size = iconsize, unitId = "target", caster = "player", filter = "DEBUFF" },--鲜血印记
})
end
 
--启用玩家BUFF计时条
if C["filter"].pbuffbar == true then
table.insert(Filger_Spells["ROGUE"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
 
{ spellID = 51662, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 血之饥渴
{ spellID = 6774, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 切割
{ spellID = 13877, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 剑刃乱舞
{ spellID = 13750, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 冲动
})
 
table.insert(Filger_Spells["DRUID"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
 
{ spellID = 69369, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 掠食者的迅捷
{ spellID = 48525, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 月蚀
{ spellID = 16870, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 节能施法
{ spellID = 52610, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 凶蛮咆哮
{ spellID = 60233, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(敏捷提高300点)
{ spellID = 50334, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 狂暴
{ spellID = 50213, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 猛虎之怒
{ spellID = 48517, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 日蚀
{ spellID = 48518, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 月蚀
})
 
table.insert(Filger_Spells["HUNTER"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
 
{ spellID = 56453, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--荷枪实弹
{ spellID = 60314, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--五色巨龙之怒(饰品)
{ spellID = 60233, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(敏捷)
{ spellID = 65019, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--雷神符石(饰品)
{ spellID = 6150, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, --快速射击
{ spellID = 34837, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--战术大师
{ spellID = 53224, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--强化稳固射击
{ spellID = 34503, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--破甲虚弱
})
 
table.insert(Filger_Spells["MAGE"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 44544, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 寒冰指
{ spellID = 57761, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 火球
{ spellID = 44448, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 法术连击
{ spellID = 54490, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 飞弹速射
{ spellID = 12536, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 节能施法
{ spellID = 12358, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 冲击
{ spellID = 60234, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大
{ spellID = 60062, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 生命精华
{ spellID = 36032, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "DEBUFF" }, -- 奥术冲击
})
 
table.insert(Filger_Spells["WARRIOR"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 52437, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--猝死
{ spellID = 46916, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "all", filter = "BUFF" },--猛击!
{ spellID = 50227, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--剑盾猛攻
{ spellID = 60229, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(力量)
})
 
table.insert(Filger_Spells["SHAMAN"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 12536, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--节能施法
{ spellID = 51566, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--波涛汹涌
{ spellID = 51532, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--漩涡武器
{ spellID = 60235, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },-- 伟大(精神值提高300点)
{ spellID = 60234, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },-- 伟大(智力提高300点)
{ spellID = 60233, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },-- 伟大(敏捷提高300点)
{ spellID = 60062, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },-- 生命精华(法术急速等级提高505)
-- { spellID = 67696, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },-- 自慰
{ spellID = 71570, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },-- 望远镜
-- { spellID = 67385, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--
})
 
table.insert(Filger_Spells["PALADIN"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 54155, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 纯洁审判
{ spellID = 53601, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 圣洁护盾
{ spellID = 54149, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 圣光灌注
{ spellID = 54428, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 神圣恳求
{ spellID = 60235, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(精神值提高300点)
{ spellID = 60234, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(智力提高300点)
{ spellID = 60233, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(敏捷提高300点)
{ spellID = 60062, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 生命精华(法术急速等级提高505)
{ spellID = 59578, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, --战争艺术
{ spellID = 31834, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, --圣光之赐
{ spellID = 498, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 圣佑
{ spellID = 1038, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 拯救之手
{ spellID = 6940, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caset = "all", filter = "BUFF" }, -- 牺牲之手
{ spellID = 64205, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caset = "all", filter = "BUFF" }, -- 神圣牺牲
{ spellID = 60229, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 伟大(力量)
{ spellID = 67753, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- H萨崔娜的抗阻甲虫
{ spellID = 67699, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 萨崔娜的抗阻甲虫
{ spellID = 70760, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, -- 萨崔娜的抗阻甲虫
 
})
 
table.insert(Filger_Spells["PRIEST"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 33151, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "all", filter = "BUFF" },--圣光涌动
{ spellID = 63734, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--好运
{ spellID = 60234, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(智力)
{ spellID = 60235, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(精神)
{ spellID = 60062, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--生命精华
})
 
table.insert(Filger_Spells["WARLOCK"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 60235, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(精神)
{ spellID = 60234, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(智力)
{ spellID = 60062, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--生命精华
{ spellID = 47383, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--熔火之心
{ spellID = 63158, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--灭杀
{ spellID = 54277, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--爆燃
{ spellID = 18095, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, --夜幕
{ spellID = 34939, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, --反冲
{ spellID = 63321, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" }, --生命分流雕文
})
 
table.insert(Filger_Spells["DEATHKNIGHT"],
{
Name = "playerbuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", playerframe, "TOPLEFT", 0, playBuffBarHeight },
{ spellID = 60229, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--伟大(力量)
{ spellID = 67383, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--不洁之力(圣印)
{ spellID = 66817, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--孤寂
{ spellID = 65014, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--蓝铁灌注(饰品)
{ spellID = 67117, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--不洁之能
{ spellID = 49509, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--血之气息
{ spellID = 50449, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--鲜血复仇
{ spellID = 55233, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--吸血鬼之血
{ spellID = 50880, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--冰冷之抓
{ spellID = 49039, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--巫妖之躯
{ spellID = 51271, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "player", caster = "player", filter = "BUFF" },--铜墙铁壁
})
 
end
 
--启用目标DEBUFF计时条
if C["filter"].tdebuffbar == true then
table.insert(Filger_Spells["ROGUE"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
 
{ spellID = 50613, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 奥流之术
{ spellID = 8647, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 破甲
{ spellID = 6770, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 闷棍
{ spellID = 6409, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 偷袭
{ spellID = 51722, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 拆卸
{ spellID = 408, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 肾击
{ spellID = 26679, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致命投掷
{ spellID = 1943, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 割裂
{ spellID = 703, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 锁喉
{ spellID = 1776, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 凿击
{ spellID = 2094, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致盲
{ spellID = 16511, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 出血
{ spellID = 3408, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 减速药膏
{ spellID = 27186, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致命药膏
{ spellID = 57978, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 致伤药膏
{ spellID = 57982, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 麻醉药膏
{ spellID = 51693, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 打劫
{ spellID = 1766, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 脚踢
})
 
table.insert(Filger_Spells["DRUID"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
 
{ spellID = 33982, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 裂伤(豹)
{ spellID = 1822, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 斜掠
{ spellID = 1079, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 割裂
{ spellID = 33878, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 裂伤(熊)
{ spellID = 33745, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 割伤
{ spellID = 99, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 挫志咆哮
{ spellID = 48463, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 月火术
{ spellID = 48468, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 虫群
{ spellID = 770, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" }, -- 精灵之火
{ spellID = 26989, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" }, -- 纠缠根须
})
 
table.insert(Filger_Spells["HUNTER"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
 
{ spellID = 49001, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 毒蛇钉刺
{ spellID = 63672, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 黑箭
{ spellID = 1130, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" }, --猎人印记
{ spellID = 3043, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --毒蝎钉刺
{ spellID = 60053, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --爆炸射击
{ spellID = 49050, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --瞄准射击
 
})
 
table.insert(Filger_Spells["MAGE"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
{ spellID = 36032, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 奥术冲击
{ spellID = 22959, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" }, -- 强化灼烧
{ spellID = 31589, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 减速
{ spellID = 12848, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 点燃
{ spellID = 55360, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, -- 活动炸弹
})
 
table.insert(Filger_Spells["WARRIOR"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
{ spellID = 1715, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" },--断筋
{ spellID = 47465, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--撕裂
{ spellID = 7386, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" },--破甲攻击
{ spellID = 6343, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--雷霆一击
{ spellID = 1160, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--挫志怒吼
{ spellID = 64850, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" },--冷酷突击
{ spellID = 47486, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "all", filter = "DEBUFF" },--致死打击
})
 
table.insert(Filger_Spells["SHAMAN"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
{ spellID = 49231, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--大地震击
{ spellID = 49236, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--冰霜震击
{ spellID = 49233, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--烈焰震击
})
 
table.insert(Filger_Spells["PRIEST"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
 
{ spellID = 48068, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "BUFF" },--恢复
{ spellID = 41637, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "BUFF" },--愈合祷言
{ spellID = 47788, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "BUFF" },--守护之魂
{ spellID = 33206, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "BUFF" },--痛苦压制
{ spellID = 48125, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --痛
{ spellID = 48300, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --噬灵疫病
{ spellID = 48160, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --吸血鬼之触
 
})
 
table.insert(Filger_Spells["WARLOCK"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
 
{ spellID = 172, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--腐蚀术
{ spellID = 348, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--献祭
{ spellID = 980, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--痛苦诅咒
{ spellID = 47867, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--厄运诅咒
{ spellID = 11719, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--语言诅咒
{ spellID = 47843, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--痛苦无常
{ spellID = 59164, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" }, --鬼影缠身
})
 
table.insert(Filger_Spells["DEATHKNIGHT"],
{
Name = "targetdebuffbar",
Direction = "UP",
Interval = 5,
Mode = "BAR",
setPoint = { "BOTTOMLEFT", targetframe, "BOTTOMRIGHT", 5, 0+portrait },
 
{ spellID = 59879, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--血之疫病
{ spellID = 59921, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--冰霜疫病
{ spellID = 49194, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--邪恶虫群
{ spellID = 49206, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--召唤石像鬼
{ spellID = 49005, size = C["filter"].barheight, barWidth = C["unitframe"].playerwidth, unitId = "target", caster = "player", filter = "DEBUFF" },--鲜血印记
})
 
end
 
if filter then
for n,v in pairs(filter) do
if filter[n].barWidth then
table.insert(Filger_Spells[E.MyClass][tonumber(filter[n].k)],{
spellID = filter[n].spellID,
size = C["filter"].barheight,
unitId = filter[n].unitId,
caster = filter[n].caster,
barWidth = filter[n].barWidth,
filter = filter[n].filter
})
else
table.insert(Filger_Spells[E.MyClass][tonumber(filter[n].k)],{
spellID = filter[n].spellID,
size = C["filter"].iconsize,
unitId = filter[n].unitId,
caster = filter[n].caster,
filter = filter[n].filter
})
end
end
end
init()
end)
\ No newline at end of file
Eui/script/movable.lua New file
0,0 → 1,435
local E, C = unpack(select(2, ...))
local oUF = oUF
 
assert(oUF, "oUF_MovableFrames was unable to locate oUF install.")
 
local _DB
local _LOCK
 
local _BACKDROP = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background";
}
 
local print = function(...)
return print('|cff33ff99oUF_MovableFrames:|r', ...)
end
local round = function(n)
return math.floor(n * 1e5 + .5) / 1e5
end
 
local backdropPool = {}
 
local getPoint = function(obj, anchor)
if(not anchor) then
local UIx, UIy = UIParent:GetCenter()
local Ox, Oy = obj:GetCenter()
 
-- Frame doesn't really have a positon yet.
if(not Ox) then return end
 
local UIS = UIParent:GetEffectiveScale()
local OS = obj:GetEffectiveScale()
 
local UIWidth, UIHeight = UIParent:GetRight(), UIParent:GetTop()
 
local LEFT = UIWidth / 3
local RIGHT = UIWidth * 2 / 3
 
local point, x, y
if(Ox >= RIGHT) then
point = 'RIGHT'
x = obj:GetRight() - UIWidth
elseif(Ox <= LEFT) then
point = 'LEFT'
x = obj:GetLeft()
else
x = Ox - UIx
end
 
local BOTTOM = UIHeight / 3
local TOP = UIHeight * 2 / 3
 
if(Oy >= TOP) then
point = 'TOP' .. (point or '')
y = obj:GetTop() - UIHeight
elseif(Oy <= BOTTOM) then
point = 'BOTTOM' .. (point or '')
y = obj:GetBottom()
else
if(not point) then point = 'CENTER' end
y = Oy - UIy
end
 
return string.format(
'%s\031%s\031%d\031%d',
point, 'UIParent', round(x * UIS / OS), round(y * UIS / OS)
)
else
local point, parent, _, x, y = anchor:GetPoint()
 
return string.format(
'%s\031%s\031%d\031%d',
point, 'UIParent', round(x), round(y)
)
end
end
 
local getObjectInformation = function(obj)
-- This won't be set if we're dealing with oUF <1.3.22. Due to this we're just
-- setting it to Unknown. It will only break if the user has multiple layouts
-- spawning the same unit or change between layouts.
local style = obj.style or 'Unknown'
local identifier = obj:GetName() or obj.unit
 
-- Are we dealing with header units?
local isHeader
local parent = obj:GetParent()
 
 
if(parent and parent.initialConfigFunction and (parent.SetManyAttributes or parent.style)) then
isHeader = true
 
-- These always have a name, so we might as well abuse it.
identifier = parent:GetName()
 
 
 
 
end
 
 
return style, identifier, isHeader
end
 
local restoreDefaultPosition = function(style, identifier)
-- We've not saved any default position for this style.
if(not _DB.__INITIAL or not _DB.__INITIAL[style] or not _DB.__INITIAL[style][identifier]) then return end
 
local obj, isHeader
for _, frame in next, oUF.objects do
local fStyle, fIdentifier, fIsHeader = getObjectInformation(frame)
if(fStyle == style and fIdentifier == identifier) then
obj = frame
isHeader = fIsHeader
 
break
end
end
 
if(obj) then
local scale = obj:GetScale()
local parent = obj:GetParent()
 
local SetPoint = getmetatable(parent or obj).__index.SetPoint;
 
if(parent == UIParent) then
parent = nil
end
 
(parent or obj):ClearAllPoints()
 
local point, parentName, x, y = string.split('\031', _DB.__INITIAL[style][identifier])
SetPoint(parent or obj, point, parentName, point, x / scale, y / scale)
 
local backdrop = backdropPool[parent or obj]
if(backdrop) then
backdrop:ClearAllPoints()
backdrop:SetAllPoints(parent or obj)
end
 
-- We don't need this anymore
_DB.__INITIAL[style][identifier] = nil
if(not next(_DB.__INITIAL[style])) then
_DB[style] = nil
end
end
end
 
local function restorePosition(obj)
if(InCombatLockdown()) then return end
local style, identifier, isHeader = getObjectInformation(obj)
-- We've not saved any custom position for this style.
if(not _DB[style] or not _DB[style][identifier]) then return end
 
local scale = obj:GetScale()
local parent = (isHeader and obj:GetParent())
local SetPoint = getmetatable(parent or obj).__index.SetPoint;
 
-- Hah, a spot you have to use semi-colon!
-- Guess I've never experienced that as these are usually wrapped in do end
-- statements.
(parent or obj).SetPoint = restorePosition;
(parent or obj):ClearAllPoints();
 
-- damn it Blizzard, _how_ did you manage to get the input of this function
-- reversed. Any sane person would implement this as: split(str, dlm, lim);
local point, parentName, x, y = string.split('\031', _DB[style][identifier])
SetPoint(parent or obj, point, parentName, point, x / scale, y / scale)
end
 
local saveDefaultPosition = function(obj)
local style, identifier, isHeader = getObjectInformation(obj)
if(not _DB.__INITIAL) then
_DB.__INITIAL = {}
end
 
if(not _DB.__INITIAL[style]) then
_DB.__INITIAL[style] = {}
end
 
if(not _DB.__INITIAL[style][identifier]) then
local point
if(isHeader) then
point = getPoint(obj:GetParent())
else
point = getPoint(obj)
end
 
_DB.__INITIAL[style][identifier] = point
end
end
 
local savePosition = function(obj, anchor)
local style, identifier, isHeader = getObjectInformation(obj)
if(not _DB[style]) then _DB[style] = {} end
 
if(isHeader) then
_DB[style][identifier] = getPoint(obj:GetParent(), anchor)
else
_DB[style][identifier] = getPoint(obj, anchor)
end
end
 
-- Attempt to figure out a more sane name to dispaly.
local smartName
do
local nameCache = {}
local validNames = {
'player',
'target',
'focus',
'raid',
'pet',
'party',
'maintank',
'mainassist',
'arena',
}
 
local validName = function(smartName)
-- Not really a valid name, but we'll accept it for simplicities sake.
if(tonumber(smartName)) then
return smartName
end
 
if(type(smartName) == 'string') then
if(smartName == 'mt') then
return 'maintank'
end
 
for _, v in next, validNames do
if(v == smartName) then
return smartName
end
end
 
if(
smartName:match'^party%d?$' or
smartName:match'^arena%d?$' or
smartName:match'^boss%d?$' or
smartName:match'^partypet%d?$' or
smartName:match'^raid%d?%d?$' or
smartName:match'%w+target$' or
smartName:match'%w+pet$'
) then
return smartName
end
end
end
 
local function guessName(...)
local name = validName(select(1, ...))
 
local n = select('#', ...)
if(n > 1) then
for i=2, n do
local inp = validName(select(i, ...))
if(inp) then
name = (name or '') .. inp
end
end
end
 
return name
end
 
local smartString = function(name)
if(nameCache[name]) then
return nameCache[name]
end
 
-- Here comes the substitute train!
local n = name:gsub('(%l)(%u)', '%1_%2'):gsub('([%l%u])(%d)', '%1_%2_'):lower()
n = guessName(string.split('_', n))
if(n) then
nameCache[name] = n
return n
end
 
return name
end
 
smartName = function(obj, header)
if(type(obj) == 'string') then
return smartString(obj)
elseif(header) then
return smartString(header:GetName())
else
local name = obj:GetName()
if(name) then
return smartString(name)
end
 
return obj.unit or '<unknown>'
end
end
end
 
do
local frame = CreateFrame"Frame"
frame:SetScript("OnEvent", function(self)
return self[event](self)
end)
 
function frame:VARIABLES_LOADED()
-- I honestly don't trust the load order of SVs.
-- _DB = bb08df87101dd7f2161e5b77cf750f753c58ef1b or {}
-- bb08df87101dd7f2161e5b77cf750f753c58ef1b = _DB
_DB = EuiUFpos or {}
EuiUFpos = _DB
 
 
-- Got to catch them all!
for _, obj in next, oUF.objects do
restorePosition(obj)
end
 
oUF:RegisterInitCallback(restorePosition)
self:UnregisterEvent"VARIABLES_LOADED"
self.VARIABLES_LOADED = nil
end
frame:RegisterEvent"VARIABLES_LOADED"
 
function frame:PLAYER_REGEN_DISABLED()
if(_LOCK) then
print("Anchors hidden due to combat.")
for k, bdrop in next, backdropPool do
bdrop:Hide()
end
_LOCK = nil
end
end
frame:RegisterEvent"PLAYER_REGEN_DISABLED"
end
 
local getBackdrop
do
local OnShow = function(self)
return self.name:SetText(smartName(self.obj, self.header))
end
 
local OnDragStart = function(self)
saveDefaultPosition(self.obj)
self:StartMoving()
 
local frame = self.header or self.obj
frame:ClearAllPoints();
frame:SetAllPoints(self);
end
 
local OnDragStop = function(self)
self:StopMovingOrSizing()
savePosition(self.obj, self)
end
 
getBackdrop = function(obj, isHeader)
local header = (isHeader and obj:GetParent())
if(not (header or obj):GetCenter()) then return end
if(backdropPool[header or obj]) then return backdropPool[header or obj] end
 
local backdrop = CreateFrame"Frame"
backdrop:SetParent(UIParent)
backdrop:Hide()
 
backdrop:SetBackdrop(_BACKDROP)
backdrop:SetFrameStrata"TOOLTIP"
backdrop:SetAllPoints(header or obj)
 
backdrop:EnableMouse(true)
backdrop:SetMovable(true)
backdrop:RegisterForDrag"LeftButton"
 
backdrop:SetScript("OnShow", OnShow)
 
local name = backdrop:CreateFontString(nil, "OVERLAY", "GameFontNormal")
name:SetPoint"CENTER"
name:SetJustifyH"CENTER"
-- name:SetFont(GameFontNormal:GetFont(), 12)
 
-- name:SetTextColor(1, 1, 1)
name:SetFont(GameFontNormal:GetFont(), 12, "THINOUTLINE")
name:SetShadowOffset(E.mult, -E.mult)
name:SetTextColor(23/255,132/255,209/255)
backdrop.name = name
backdrop.obj = obj
backdrop.header = header
 
-- backdrop:SetBackdropBorderColor(0, .9, 0)
-- backdrop:SetBackdropColor(0, .9, 0)
E.EuiSetTemplate(backdrop)
 
 
-- Work around the fact that headers with no units displayed are 0 in height.
if(header and math.floor(header:GetHeight()) == 0) then
local height = header:GetChildren():GetHeight()
header:SetHeight(height)
end
 
backdrop:SetScript("OnDragStart", OnDragStart)
backdrop:SetScript("OnDragStop", OnDragStop)
backdrop:SetScript("OnEnter", function(self)
self.name:SetTextColor(1, 1, 1)
self:SetBackdropBorderColor(23/255,132/255,209/255)
end)
backdrop:SetScript("OnLeave", function(self)
self.name:SetTextColor(23/255,132/255,209/255)
E.EuiSetTemplate(self)
end)
 
backdropPool[header or obj] = backdrop
 
return backdrop
end
end
function E.ResetUF()
EuiUFpos = {}
end
 
function E.MoveUF()
if InCombatLockdown() then return end
if(not _LOCK) then
for k, obj in next, oUF.objects do
local style, identifier, isHeader = getObjectInformation(obj)
local backdrop = getBackdrop(obj, isHeader)
if(backdrop) then backdrop:Show() end
end
 
_LOCK = true
else
for k, bdrop in next, backdropPool do
bdrop:Hide()
end
 
_LOCK = nil
end
end
\ No newline at end of file
Eui/config/config.xml New file
0,0 → 1,3
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="config.lua"/>
</Ui>
\ No newline at end of file
Eui/config/config.lua New file
0,0 → 1,231
local E,C = unpack(select(2, ...))
 
C["main"] = {
["autoscale"] = true,
["uiscale"] = 0.71,
["autoinvite"] = true,
["invitetext"] = "222",
["noerrors"] = false,
["noerrorsincombat"] = false,
["moveuierrors"] = false,
["ignoreduel"] = false,
["autoroll"] = false,
["disableconfirm"] = true,
["autoloot"] = false,
["autorepair"] = true,
["autorepairguild"] = true,
["sellgreycrap"] = true,
["acceptinvites"] = true,
["bugstack"] = true,
["alttotrade"] = true,
["talentspam"] = true,
["questauto"] = false,
["questicons"] = true,
["autorez"] = true,
["combatnoti"] = true,
["lockquest"] = true,
-- ["minimappos"] = 0,
["alpha"] = false,
["classcolortheme"] = false,
}
 
C["other"] = {
["nameplate"] = true, --启用姓名版
["nameplateauto"] = true, --姓名版自动隐藏
["nameplatevalue"] = true, --显示血量
["mail"] = true,--邮件增强
["cooldown"] = true,--内置计时插件
["tab"] = true, --专业标签
["loot"] = true,
["recipients"] = true,
["sr"] = true,
["focuser"] = true,
["ratings"] = true,
["hb"] = true,
["spellid"] = true,
["mbb"] = true,
["minimap"] = true,
["buff"] = true,
}
 
C["chat"] = {
["enable"] = true,
["hidejunk"] = true,
["chatw"] = 343,
["chath"] = 122,
["chatbar"] = true,
["chatguard"] = true,
["LFW"] = true,
}
 
C["filter"] = {
["enable"] = true,
["configmode"] = false,
["classcolor"] = true,
["pbuffbar"] = true,
["tdebuffbar"] = true,
["barheight"] = 16,
["coolline"] = true,
["iconsize"] = 30,
["pbufficon"] = true,
["tdebufficon"] = true,
["float"] = false,
["raid"] = true,
["raidwidth"] = 144,
["raidheight"] = 12,
["raidnumber"] = 10,
}
 
C["unitframe"] = {
["aaaaunit"] = 1,
["castbar"] = true,
["swing"] = true,
["totdebuffs"] = 5,
["colorClass"] = false,--新增
["Fbuffs"] = 2,
["Fdebuffs"] = 2,
["portrait"] = true,
["showPvP"] = true,
["onlyplayer"] = false,
["powerspark"] = true,
["playerx"] = 250,
["playery"] = 300,
["playerwidth"] = 230,
["playerheight"] = 36,
["petwidth"] = 130,
["petheight"] = 36,
["totwidth"] = 130,
["totheight"] = 22,
["focuswidth"] = 100,
["focusheight"] = 22,
["colorClassName"] = true,
["totalhpmp"] = false,
["cpoint"] = true,
["playerdebuffnum"] = 0,
["bigcastbar"] = false,
["bigcastbarscale"] = 1,
["bigcastbarpos"] = "0/500/0/168/0/120",
}
 
C["raid"] = {
["raid"] = true,
["raidthreat"] = true,
["raidaurawatch"] = true,
["grid"] = true,
["gridhealthvettical"] = false,
["raidDirection"] = true,--真为顺序,否为逆序
["raidColorClass"] = false,
["raidgroups"] = 5,--团队里小队数
["grouphv"] = true, --小队横排或竖排
["groupspace"] = 20, --竖排时小队间隔
["gridheight"] = 100, --Grid框架高度位置
["nogridheight"] = 180, --单列时框架高度
["gridh"] = 38, --Grid单元高度
["gridw"] = 76,--Grid单元宽度
["nogridh"] = 20,--非Grid样式单元高度
["nogridw"] = 140,
["clickset"] = false,
["hottime"] = true,
["showParty"] = true,
["showPartyTarget"] = true,
["boss"] = true,
["mt"] = true,
["raidtarget"] = false,
["texture"] = 0,
["hotsize"] = 12,
}
 
C["actionbar"] = {
["enable"] = true, -- enable elvui action bars
["hotkey"] = true, -- enable hotkey display because it was a lot requested
["rightbarmouseover"] = false, -- enable right bars on mouse over
["shapeshiftmouseover"] = false, -- enable shapeshift or totembar on mouseover
["hideshapeshift"] = false, -- hide shapeshift or totembar because it was a lot requested.
["showgrid"] = true, -- show grid on empty button
["bottompetbar"] = false, -- position petbar below the actionbars instead of the right side
["buttonsize"] = 30, --size of action buttons
["buttonspacing"] = 4, --spacing of action buttons
["petbuttonsize"] = 30, --size of pet/stance buttons
["petbuttonspacing"] = 2,
["swaptopbottombar"] = false, --swap the main actionbar position with the bottom actionbar
["macrotext"] = false, --show macro text on actionbuttons
["verticalstance"] = false, --make stance bar vertical
["microbar"] = false, --enable microbar display
["mousemicro"] = false, --only show microbar on mouseover
["rankwatch"] = true,
}
 
C["tooltip"] = {
["enable"] = true,
["cursor"] = false,
["hideincombat"] = false,
["hidebuttonscombat"] = false,
["ShowTalent"] = true, --是否显示玩家天赋
["TargetedBy"] = false, --是否显示关注目标
["hovertip"] = true,
["x"] = -3,
["y"] = 42,
}
 
C["bag"] = {
["enable"] = true,
}
 
C["threat"] = {
["enable"] = true,
["width"] = 200,
["height"] = 16,
["bars"] = 5,
["spacing"] = 4,
-- ["direction"] = "down",
["test"] = false,
}
 
C["info"] = {
["enable"] = true,
["wowtime"] = 1,
["latency"] = 2,
["bag"] = 3,
["durability"] = 4,
["memory"] = 5,
["xp"] = 6,
["setting"] = 9,
["guild"] = 8,
["friend"] = 7,
["wgtimenoti"] = true,
["apsp"] = 1,
["dps"] = 1,
}
 
C["clickset"] = {
["aadefault"] = true,
["type1"] = 0,
["shiftztype1"] = 0,
["ctrlztype1"] = 0,
["altztype1"] = 0,
["altzctrlztype1"] = 0,
["type2"] = 0,
["shiftztype2"] = 0,
["ctrlztype2"] = 0,
["altztype2"] = 0,
["altzctrlztype2"] = 0,
["type3"] = 0,
["shiftztype4"] = 0,
["ctrlztype4"] = 0,
["altztype4"] = 0,
["altzctrlztype4"] = 0,
["type4"] = 0,
["shiftztype5"] = 0,
["ctrlztype5"] = 0,
["altztype5"] = 0,
["altzctrlztype5"] = 0,
["type5"] = 0,
["aamouse"] = true,
}
 
C["skins"] = {
["askins"] = true,
["dbm"] = true,
["skada"] = true,
["font"] = true,
}
\ No newline at end of file
Eui/Eui.toc New file
0,0 → 1,31
## Interface: 30300
## Title: |cffC495DDEui|r
## Title-zhCN: 界面核心包|cffC495DDEui|r
## Notes: |cffC495DDEui|r
## Notes-zhCN: EUI 源自eP's UI
## Author: Ljxx.net
## Version: r1.1
## OptionalDeps: EuiSet
## X-oUF: oUF
## URL: http://code.google.com/p/cadcamzy/
## SavedVariablesPerCharacter: EuiUFpos, BaudBag_Cfg, BaudBag_Cache, JPackDB, LjxxuiInstallV335,filter,filterdb,RecipientsDB, friendsWhisp, guildWhisp, totallastplayers, entries, teksLootDB
## SavedVariables: tgoldDB, raidtarget, EuiData, RankWatchSettings, MBB_Exclude, MBB_Options
 
init.lua
##默认设置
config\config.xml
##基础函数库
lib\lib.xml
##布局
layout\layout.xml
##界面组件
element\element.xml
 
##信息条
info\info.xml
##头像小队和团队
unitframe\unitframe.xml
##界面美化
skins\skins.xml
##功能增强插件
script\script.xml
\ No newline at end of file
Eui/lib/Eui/Eui.xml New file
0,0 → 1,108
<Ui xmlns="http://www.blizzard.com/wow/ui/">
 
<!--
This template requires the layout to set the anchoring positions from the
sub-frame(s). These are feed to the layouts style functions as any other unit
spawned by a header. The main difference is that they have the unitsuffix
attribute set (and they are parented to their respective owener).
-->
<Button name="oUF_Mtt" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parent">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
<Button name="oUF_PartyH" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
 
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent">
<Offset>
<AbsDimension x="0" y="-7"/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
<Button name="$parentPet" inherits="SecureUnitButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentTarget">
<Offset>
<AbsDimension x="0" y="-7"/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name="unitsuffix" type="string" value="pet"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
<Button name="oUF_PartyV" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
 
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parent">
<Offset>
<AbsDimension x="7" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
<Button name="$parentPet" inherits="SecureUnitButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentTarget">
<Offset>
<AbsDimension x="0" y="-6"/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name="unitsuffix" type="string" value="pet"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
<Button name="oUF_PartyNoTargetV" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
 
</Frames>
</Button>
<Button name="oUF_PartyNoTargetH" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
 
</Frames>
</Button>
</Ui>
Eui/lib/Eui/Eui.lua New file
0,0 → 1,712
local E, C = unpack(select(2, ...))
 
E.MyClass = select(2, UnitClass("player"))
E.MyName = UnitName("player")
E.MyLevel = UnitLevel("player")
E.myrealm = GetRealmName()
E.dummy = function() return end
--_, class = UnitClass("player")
local kill = function() end
function E.Kill(object)
if object.UnregisterAllEvents then
object:UnregisterAllEvents()
end
object.Show = kill
object:Hide()
end
E.RAID_CLASS_COLORS = {
["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45 },
["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79 },
["PRIEST"] = { r = 0.83, g = 0.83, b = 0.83 },
["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73 },
["MAGE"] = { r = 0.41, g = 0.8, b = 0.94 },
["ROGUE"] = { r = 1.0, g = 0.96, b = 0.41 },
["DRUID"] = { r = 1.0, g = 0.49, b = 0.04 },
["SHAMAN"] = { r = 0.0, g = 0.44, b = 0.87 },
["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43 },
["DEATHKNIGHT"] = { r = 0.77, g = 0.12 , b = 0.23 },
}
 
---------------------------------------------------- Textures
 
E.normTex = [[Interface\AddOns\Eui\media\normTex]]
E.glowTex = [[Interface\AddOns\Eui\media\glowTex]]
E.blackTex = [[Interface\AddOns\Eui\media\blackTex]]
E.highlightTex = [[Interface\AddOns\Eui\media\highlightTex]]
E.borderTex = [[Interface\AddOns\Eui\media\border]]
E.blank = [[Interface\AddOns\Eui\media\blank]]
E.gray = [[Interface\AddOns\Eui\media\gray]]
 
E.backdrop = {
bgFile = E.normTex,
insets = {top = -1, left = -1, bottom = -1, right = -1},
}
 
E.utf8sub = function(string, i, dots)
if not string then return end
local bytes = string:len()
if (bytes <= i) then
return string
else
local len, pos = 0, 1
while(pos <= bytes) do
len = len + 1
local c = string:byte(pos)
if (c > 0 and c <= 127) then
pos = pos + 1
elseif (c >= 192 and c <= 223) then
pos = pos + 2
elseif (c >= 224 and c <= 239) then
pos = pos + 3
elseif (c >= 240 and c <= 247) then
pos = pos + 4
end
if (len == i) then break end
end
 
if (len == i and pos <= bytes) then
return string:sub(1, pos - 1)..(dots and '...' or '')
else
return string
end
end
end
 
---------------------------------------------------- Colors
 
E.EuiGradient = {.26,.26,.26,.14,.21,.21,.21,.5}
 
---------------------------------------------------- Fonts
 
E.font = STANDARD_TEXT_FONT
--fontc = [[Interface\AddOns\Eui\media\fontc.ttf]]
--fontn = [[Interface\AddOns\Eui\media\fontn.ttf]]
E.fontc = STANDARD_TEXT_FONT
E.fontn = STANDARD_TEXT_FONT
---------------------------------------------------- EuiSetFontn
 
E.EuiSetFontn = function(parent, fontName, fontHeight, fontStyle) -- ÐÅÏ¢¼°CoollineÊý×Ö×ÖÌå
fontName = fontName or E.fontn
fontHeight = fontHeight or 10
fontStyle = fontStyle or "LEFT"
local fs = parent:CreateFontString(nil, "OVERLAY")
fs:SetFont(fontName, fontHeight, "OUTLINE") -- À¨ºÅÄÚΪ(×ÖÌå,´óС,Ñùʽ),¿É×ÔÐÐÐÞ¸Ä
fs:SetJustifyH(fontStyle)
fs:SetShadowColor(0, 0, 0)
fs:SetShadowOffset(0, 0)
return fs
end
 
---------------------------------------------------- EuiCreateShadow
 
E.EuiCreateShadow = function(f)
local shadow = CreateFrame("Frame", nil, f)
shadow:SetFrameLevel(1)
shadow:SetFrameStrata(f:GetFrameStrata())
shadow:SetPoint("TOPLEFT", -3, 3)
shadow:SetPoint("BOTTOMLEFT", -3, -3)
shadow:SetPoint("TOPRIGHT", 3, 3)
shadow:SetPoint("BOTTOMRIGHT", 3, -3)
shadow:SetBackdrop( {
edgeFile = E.glowTex, edgeSize = 3,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
shadow:SetBackdropColor(0, 0, 0, 0)
shadow:SetBackdropBorderColor(0, 0, 0, 0.7)
--shadow:SetBackdropBorderColor(1, 1, 1, 1)
f.shadow = shadow
end
 
E.EuiStyleInnerBorder = function(f)
if f.iborder then return end
f.iborder = CreateFrame("Frame", nil, f)
f.iborder:SetPoint("TOPLEFT", E.mult, -E.mult)
f.iborder:SetPoint("BOTTOMRIGHT", -E.mult, E.mult)
f.iborder:SetBackdrop({
edgeFile = E.glowTex,
edgeSize = E.mult,
insets = { left = E.mult, right = E.mult, top = E.mult, bottom = E.mult }
})
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
f.iborder:SetBackdropBorderColor(r, g, b,1)
else
f.iborder:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
return f.iborder
end
 
E.EuiFadeIn = function(f)
UIFrameFadeIn(f, 0.3, f:GetAlpha(), 1)
end
 
E.EuiFadeOut = function(f)
UIFrameFadeOut(f, 0.3, f:GetAlpha(), 0)
end
 
E.EuiStyleOuterBorder = function(f)
if f.oborder then return end
f.oborder = CreateFrame("Frame", nil, f)
f.oborder:SetPoint("TOPLEFT", -E.mult, E.mult)
f.oborder:SetPoint("BOTTOMRIGHT", E.mult, -E.mult)
f.oborder:SetBackdrop({
edgeFile = E.glowTex,
edgeSize = E.mult,
insets = { left = E.mult, right = E.mult, top = E.mult, bottom = E.mult }
})
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
f.oborder:SetBackdropBorderColor(r, g, b,1)
else
f.oborder:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
return f.oborder
end
 
E.EuiSkinFadedPanel = function(f)
f:SetBackdrop(E.backdrop)
f:SetBackdropColor(0.1,0.1,0.1,1)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
f:SetBackdropBorderColor(r, g, b,1)
else
f:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
E.EuiStyleInnerBorder(f)
E.EuiStyleOuterBorder(f)
end
 
E.EuiCreateFadedPanel = function(f, w, h, a1, p, a2, x, y)
f:SetFrameLevel(1)
f:SetHeight(h)
f:SetWidth(w)
f:SetFrameStrata("BACKGROUND")
f:SetPoint(a1, p, a2, x, y)
E.EuiSkinFadedPanel(f)
end
 
-- Create overlay frame
E.EuiSetOverlay = function(f)
if f.bg then return end
f.bg = f:CreateTexture(f:GetName() and f:GetName().."_overlay" or nil, "BORDER", f)
f.bg:ClearAllPoints()
f.bg:SetPoint("TOPLEFT", f, "TOPLEFT", E.mult, -E.mult)
f.bg:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -E.mult, E.mult)
f.bg:SetTexture(gray)
f.bg:SetVertexColor(0.1, 0.1, 0.1, 1)
return f.bg
end
 
-- Skin panels
E.EuiSkinPanel = function(f)
f:SetBackdrop(E.backdrop)
f:SetBackdropColor(0.1,0.1,0.1,0.7)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
f:SetBackdropBorderColor(r, g, b,1)
else
f:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
E.EuiSetOverlay(f)
end
---------------------------------------------------- EuiCreatePanel
 
E.EuiCreatePanel = function(f, w, h, a1, p, a2, x, y)
f:SetFrameLevel(0)
f:SetHeight(h)
f:SetWidth(w)
f:SetFrameStrata("BACKGROUND")
f:SetPoint(a1, p, a2, x, y)
f:SetBackdrop({
bgFile = E.normTex,
edgeFile = E.normTex,
tile = false, tileSize = 0, edgeSize = 1,
insets = { left = -1, right = -1, top = -1, bottom = -1}
})
f:SetBackdropColor( 0, 0, 0,0)
f:SetBackdropBorderColor(0, 0, 0,0)
end
 
E.EuiSetTransparentTemplate = function(f)
f:SetFrameLevel(1)
f:SetFrameStrata("BACKGROUND")
f:SetBackdrop({
bgFile = E.blank,
edgeFile = E.blank,
tile = false, tileSize = 0, edgeSize = E.mult,
insets = { left = -E.mult, right = -E.mult, top = -E.mult, bottom = -E.mult}
})
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
f:SetBackdropColor(0.1,0.1,0.1,1)
f:SetBackdropBorderColor(r, g, b,1)
else
f:SetBackdropColor(0.1,0.1,0.1,1)
f:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
end
 
---------------------------------------------------- EuiSetTemplate
E.EuiSetTemplate = function(f,a)
local alpha = a or .7
f:SetBackdrop({
bgFile = E.normTex,
edgeFile = E.normTex,
tile = false, tileSize = 0, edgeSize = E.mult,
insets = { left = -E.mult, right = -E.mult, top = -E.mult, bottom = -E.mult}
})
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
f:SetBackdropColor(0.1,0.1,0.1,alpha)
f:SetBackdropBorderColor(r, g, b,1)
else
f:SetBackdropColor(0.1,0.1,0.1,alpha)
f:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
end
 
E.EuiSetTemplateB = function(f,x1,y1,x2,y2)
if f.GetBackdrop and f:GetBackdrop() then f:SetBackdrop(nil) end
local skinFrame = CreateFrame("Frame", nil, f)
skinFrame:ClearAllPoints()
skinFrame:SetFrameStrata("BACKGROUND")
if x1 == 0 and y1 == 0 and x2 == 0 and y2 == 0 then
skinFrame:SetAllPoints(f)
else
skinFrame:SetPoint("TOPLEFT", f, "TOPLEFT", x1, y1)
skinFrame:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", x2, y2)
end
skinFrame:SetBackdrop({
bgFile = E.normTex,
edgeFile = E.normTex,
tile = false, tileSize = 0, edgeSize = E.mult,
insets = { left = -E.mult, right = -E.mult, top = -E.mult, bottom = -E.mult}
})
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
skinFrame:SetBackdropColor(0.1,0.1,0.1,.7)
skinFrame:SetBackdropBorderColor(r, g, b,1)
else
skinFrame:SetBackdropColor(0.1,0.1,0.1,.7)
skinFrame:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
end
 
 
---------------------------------------------------- EuiCreateFrame
 
local function TempStyle(myframe,nobg,off)
local off = off or 2
if nobg ~= true then
myframe.bg = myframe:CreateTexture(nil,"BORDER")
myframe.bg:SetPoint("TOPLEFT",off+1,-off-1)
myframe.bg:SetPoint("BOTTOMRIGHT",-off-1,off+1)
myframe.bg:SetTexture(1,1,1,1)
myframe.bg:SetGradientAlpha("VERTICAL",unpack(E.EuiGradient))
myframe.bg:SetBlendMode("ADD")
end
 
myframe.left = myframe:CreateTexture(nil,"OVERLAY")
myframe.left:SetTexture(0,0,0)
myframe.left:SetPoint("TOPLEFT",off,-off)
myframe.left:SetPoint("BOTTOMLEFT",off,off)
myframe.left:SetWidth(1)
 
myframe.right = myframe:CreateTexture(nil,"OVERLAY")
myframe.right:SetTexture(0,0,0)
myframe.right:SetPoint("TOPRIGHT",-off,-off)
myframe.right:SetPoint("BOTTOMRIGHT",-off,off)
myframe.right:SetWidth(1)
 
myframe.bottom = myframe:CreateTexture(nil,"OVERLAY")
myframe.bottom:SetTexture(0,0,0)
myframe.bottom:SetPoint("BOTTOMLEFT",off,off)
myframe.bottom:SetPoint("BOTTOMRIGHT",-off,off)
myframe.bottom:SetHeight(1)
 
myframe.top = myframe:CreateTexture(nil,"OVERLAY")
myframe.top:SetTexture(0,0,0)
myframe.top:SetPoint("TOPLEFT",off,-off)
myframe.top:SetPoint("TOPRIGHT",-off,off)
myframe.top:SetHeight(1)
 
return myframe
end
 
local bg_ = {
bgFile = E.normTex,
edgeFile = E.glowTex,
edgeSize = 3, insets = { left = 2, right = 2, top = 2, bottom = 2}}
 
local TempSetBackdrop = function (self)
self:SetBackdrop(bg_)
self:SetBackdropBorderColor(0,0,0,0.7)
self:SetBackdropColor(0,0,0,1)
return self
end
 
E.EuiCreateFrame = function (parent,level,strata,nobg,nols,off)
local myframe = CreateFrame ("Frame",nil,parent)
if nols ~= true then
myframe:SetFrameLevel(level or 2)
myframe:SetFrameStrata(strata or "BACKGROUND")
end
TempSetBackdrop(myframe)
TempStyle(myframe,nobg,off)
return myframe
end
 
---------------------------------------------------- Animation
 
E.EuiSetAnim = function(f,k,x,y)
f.anim = f:CreateAnimationGroup("Move_In")
f.anim.in_a = f.anim:CreateAnimation("Translation")
f.anim.in_a:SetDuration(0)
f.anim.in_a:SetOrder(1)
f.anim.in_b = f.anim:CreateAnimation("Translation")
f.anim.in_b:SetDuration(.3)
f.anim.in_b:SetOrder(2)
f.anim.in_b:SetSmoothing("OUT")
f.anim_o = f:CreateAnimationGroup("Move_Out")
f.anim_o.b = f.anim_o:CreateAnimation("Translation")
f.anim_o.b:SetDuration(.3)
f.anim_o.b:SetOrder(1)
f.anim_o.b:SetSmoothing("IN")
f.anim.in_a:SetOffset(x,y)
f.anim.in_b:SetOffset(-x,-y)
f.anim_o.b:SetOffset(x,y)
if k then f.anim_o:SetScript("OnFinished",function() f:Hide() end) end
end
 
---------------------------------------------------- Alert Run
 
local GetNextChar = function(word,num)
local c = word:byte(num)
local shift
if not c then return "",num end
if (c > 0 and c <= 127) then
shift = 1
elseif (c >= 192 and c <= 223) then
shift = 2
elseif (c >= 224 and c <= 239) then
shift = 3
elseif (c >= 240 and c <= 247) then
shift = 4
end
return word:sub(num,num+shift-1),(num+shift)
end
 
local updaterun = CreateFrame("Frame")
 
local flowingframe = CreateFrame("Frame",nil,UIParent)
flowingframe:SetFrameStrata("HIGH")
flowingframe:SetPoint("CENTER",UIParent,0,136)
flowingframe:SetHeight(64)
flowingframe:SetScript("OnUpdate", FadingFrame_OnUpdate)
flowingframe:Hide()
flowingframe.fadeInTime = 0
flowingframe.holdTime = 1
flowingframe.fadeOutTime = .3
 
local flowingtext = flowingframe:CreateFontString(nil,"OVERLAY")
flowingtext:SetPoint("Left")
flowingtext:SetFont(E.font,20,"OUTLINE")
flowingtext:SetShadowOffset(0,0)
flowingtext:SetJustifyH("LEFT")
 
local rightchar = flowingframe:CreateFontString(nil,"OVERLAY")
rightchar:SetPoint("LEFT",flowingtext,"RIGHT")
rightchar:SetFont(E.font,50,"OUTLINE")
rightchar:SetShadowOffset(0,0)
rightchar:SetJustifyH("LEFT")
 
local count,len,step,word,stringE,a
 
local speed = .03333
 
local nextstep = function()
a,step = GetNextChar (word,step)
flowingtext:SetText(stringE)
stringE = stringE..a
a = string.upper(a)
rightchar:SetText(a)
end
 
local updatestring = function(self,t)
count = count - t
if count < 0 then
if step > len then
self:Hide()
flowingtext:SetText(stringE)
FadingFrame_Show(flowingframe)
rightchar:SetText("")
word = ""
else
nextstep()
FadingFrame_Show(flowingframe)
count = speed
end
end
end
 
updaterun:SetScript("OnUpdate",updatestring)
updaterun:Hide()
 
E.EuiAlertRun = function(f,r,g,b)
flowingframe:Hide()
updaterun:Hide()
 
flowingtext:SetText(f)
local l = flowingtext:GetWidth()
 
local color1 = r or 1
local color2 = g or 1
local color3 = b or 1
 
flowingtext:SetTextColor(color1*.95,color2*.95,color3*.95)
rightchar:SetTextColor(color1,color2,color3)
 
word = f
len = f:len()
step = 1
count = speed
stringE = ""
a = ""
 
flowingtext:SetText("")
flowingframe:SetWidth(l)
 
rightchar:SetText("")
FadingFrame_Show(flowingframe)
updaterun:Show()
end
 
 
local textureNormal = [[Interface\AddOns\Eui\media\textureNormal]]
local textureShadow = [[Interface\AddOns\Eui\media\textureShadow]]
 
E.CreateBorder = function(self, borderSize, R, G, B, ...)
local uL1, uL2, uR1, uR2, bL1, bL2, bR1, bR2 = ...
local Shadow = {}
if (not self.HasBorder) then
self.Border = {}
for i = 1, 8 do
self.Border[i] = self:CreateTexture(nil, 'OVERLAY')
self.Border[i]:SetParent(self)
self.Border[i]:SetTexture(textureNormal)
self.Border[i]:SetWidth(borderSize)
self.Border[i]:SetHeight(borderSize)
self.Border[i]:SetVertexColor(R or 1, G or 1, B or 1)
end
 
self.Border[1]:SetTexCoord(0, 1/3, 0, 1/3)
self.Border[1]:SetPoint('TOPLEFT', self, -(uL1 or 0), uL2 or 0)
 
self.Border[2]:SetTexCoord(2/3, 1, 0, 1/3)
self.Border[2]:SetPoint('TOPRIGHT', self, uR1 or 0, uR2 or 0)
 
self.Border[3]:SetTexCoord(0, 1/3, 2/3, 1)
self.Border[3]:SetPoint('BOTTOMLEFT', self, -(bL1 or 0), -(bL2 or 0))
 
self.Border[4]:SetTexCoord(2/3, 1, 2/3, 1)
self.Border[4]:SetPoint('BOTTOMRIGHT', self, bR1 or 0, -(bR2 or 0))
 
self.Border[5]:SetTexCoord(1/3, 2/3, 0, 1/3)
self.Border[5]:SetPoint('TOPLEFT', self.Border[1], 'TOPRIGHT')
self.Border[5]:SetPoint('TOPRIGHT', self.Border[2], 'TOPLEFT')
 
self.Border[6]:SetTexCoord(1/3, 2/3, 2/3, 1)
self.Border[6]:SetPoint('BOTTOMLEFT', self.Border[3], 'BOTTOMRIGHT')
self.Border[6]:SetPoint('BOTTOMRIGHT', self.Border[4], 'BOTTOMLEFT')
 
self.Border[7]:SetTexCoord(0, 1/3, 1/3, 2/3)
self.Border[7]:SetPoint('TOPLEFT', self.Border[1], 'BOTTOMLEFT')
self.Border[7]:SetPoint('BOTTOMLEFT', self.Border[3], 'TOPLEFT')
 
self.Border[8]:SetTexCoord(2/3, 1, 1/3, 2/3)
self.Border[8]:SetPoint('TOPRIGHT', self.Border[2], 'BOTTOMRIGHT')
self.Border[8]:SetPoint('BOTTOMRIGHT', self.Border[4], 'TOPRIGHT')
 
local space
if (borderSize >= 10) then
space = 3
else
space = borderSize/3.5
end
 
for i = 1, 8 do
Shadow[i] = self:CreateTexture(nil, 'BORDER')
Shadow[i]:SetParent(self)
Shadow[i]:SetTexture(textureShadow)
Shadow[i]:SetWidth(borderSize)
Shadow[i]:SetHeight(borderSize)
Shadow[i]:SetVertexColor(0, 0, 0, 1)
end
 
Shadow[1]:SetTexCoord(0, 1/3, 0, 1/3)
Shadow[1]:SetPoint('TOPLEFT', self, -(uL1 or 0)-space, (uL2 or 0)+space)
 
Shadow[2]:SetTexCoord(2/3, 1, 0, 1/3)
Shadow[2]:SetPoint('TOPRIGHT', self, (uR1 or 0)+space, (uR2 or 0)+space)
 
Shadow[3]:SetTexCoord(0, 1/3, 2/3, 1)
Shadow[3]:SetPoint('BOTTOMLEFT', self, -(bL1 or 0)-space, -(bL2 or 0)-space)
 
Shadow[4]:SetTexCoord(2/3, 1, 2/3, 1)
Shadow[4]:SetPoint('BOTTOMRIGHT', self, (bR1 or 0)+space, -(bR2 or 0)-space)
 
Shadow[5]:SetTexCoord(1/3, 2/3, 0, 1/3)
Shadow[5]:SetPoint('TOPLEFT', Shadow[1], 'TOPRIGHT')
Shadow[5]:SetPoint('TOPRIGHT', Shadow[2], 'TOPLEFT')
 
Shadow[6]:SetTexCoord(1/3, 2/3, 2/3, 1)
Shadow[6]:SetPoint('BOTTOMLEFT', Shadow[3], 'BOTTOMRIGHT')
Shadow[6]:SetPoint('BOTTOMRIGHT', Shadow[4], 'BOTTOMLEFT')
 
Shadow[7]:SetTexCoord(0, 1/3, 1/3, 2/3)
Shadow[7]:SetPoint('TOPLEFT', Shadow[1], 'BOTTOMLEFT')
Shadow[7]:SetPoint('BOTTOMLEFT', Shadow[3], 'TOPLEFT')
 
Shadow[8]:SetTexCoord(2/3, 1, 1/3, 2/3)
Shadow[8]:SetPoint('TOPRIGHT', Shadow[2], 'BOTTOMRIGHT')
Shadow[8]:SetPoint('BOTTOMRIGHT', Shadow[4], 'TOPRIGHT')
 
self.HasBorder = true
end
end
 
function E.StyleButton(b, c)
local name = b:GetName()
 
local button = _G[name]
local icon = _G[name.."Icon"]
local count = _G[name.."Count"]
local border = _G[name.."Border"]
local hotkey = _G[name.."HotKey"]
local cooldown = _G[name.."Cooldown"]
local nametext = _G[name.."Name"]
local flash = _G[name.."Flash"]
local normaltexture = _G[name.."NormalTexture"]
local icontexture = _G[name.."IconTexture"]
 
local hover = b:CreateTexture("frame", nil, self) -- hover
hover:SetTexture(1,1,1,0.3)
hover:SetHeight(button:GetHeight())
hover:SetWidth(button:GetWidth())
hover:SetPoint("TOPLEFT",button,E.Scale(2),-E.Scale(2))
hover:SetPoint("BOTTOMRIGHT",button,-E.Scale(2),E.Scale(2))
button:SetHighlightTexture(hover)
 
local pushed = b:CreateTexture("frame", nil, self) -- pushed
pushed:SetTexture(0.9,0.8,0.1,0.3)
pushed:SetHeight(button:GetHeight())
pushed:SetWidth(button:GetWidth())
pushed:SetPoint("TOPLEFT",button,E.Scale(2),-E.Scale(2))
pushed:SetPoint("BOTTOMRIGHT",button,-E.Scale(2),E.Scale(2))
button:SetPushedTexture(pushed)
 
if cooldown then
cooldown:ClearAllPoints()
cooldown:SetPoint("TOPLEFT",button,E.Scale(2),-E.Scale(2))
cooldown:SetPoint("BOTTOMRIGHT",button,-E.Scale(2),E.Scale(2))
end
 
if c then
local checked = b:CreateTexture("frame", nil, self) -- checked
checked:SetTexture(23/255,132/255,209/255)
checked:SetHeight(button:GetHeight())
checked:SetWidth(button:GetWidth())
checked:SetPoint("TOPLEFT",button,E.Scale(2),-E.Scale(2))
checked:SetPoint("BOTTOMRIGHT",button,-E.Scale(2),E.Scale(2))
checked:SetAlpha(0.3)
button:SetCheckedTexture(checked)
end
end
 
 
function E.UpdateHotkey(self, actionButtonType)
local hotkey = _G[self:GetName() .. 'HotKey']
local text = hotkey:GetText()
 
text = string.gsub(text, '(s%-)', 'S')
text = string.gsub(text, '(a%-)', 'A')
text = string.gsub(text, '(c%-)', 'C')
text = string.gsub(text, '(Mouse Button )', 'M')
text = string.gsub(text, KEY_BUTTON3, 'M3')
text = string.gsub(text, '(Num Pad )', 'N')
text = string.gsub(text, KEY_PAGEUP, 'PU')
text = string.gsub(text, KEY_PAGEDOWN, 'PD')
text = string.gsub(text, KEY_SPACE, 'SpB')
text = string.gsub(text, KEY_INSERT, 'Ins')
text = string.gsub(text, KEY_HOME, 'Hm')
text = string.gsub(text, KEY_DELETE, 'Del')
text = string.gsub(text, KEY_MOUSEWHEELUP, 'MwU')
text = string.gsub(text, KEY_MOUSEWHEELDOWN, 'MwD')
 
if hotkey:GetText() == _G['RANGE_INDICATOR'] then
hotkey:SetText('')
else
hotkey:SetText(text)
end
end
 
E.ColorBorder = function(self, R, G, B)
if (self.Border) then
for i = 1, 8 do
self.Border[i]:SetVertexColor(R, G, B)
end
else
local name
if (self:GetName()) then
name = self:GetName()
else
name = 'Unnamed'
end
print('|cff00FF00Beautycase:|r '..name..'|cffFF0000 has no border!|r')
end
end
 
E.EuiInfo = function(p, f)
local fbg = E.EuiCreateFrame(f,1,"BACKGROUND",true)
fbg:SetBackdropColor(.1,.1,.1)
fbg:SetPoint("TOPLEFT",-3,3)
fbg:SetPoint("BOTTOMRIGHT",3,-3)
 
local p2y = {
1,
-2,
2,
-3,
3,
-4,
4,
-5,
5,
-6,
6,
-7,
7,
-8,
8,
-9,
9,
}
y = p2y[p]
 
if(p%2==0) then
f:SetPoint("TOP",82*(y+1),-5)
else
f:SetPoint("TOP",82*(y-1),-5)
end
 
f:SetAlpha(0)
local r = abs(y)*.5 + 3
CreateFrame("Frame"):SetScript("OnUpdate",function(self,t)
r = r - t
if r < 0 then
self:Hide()
self = nil
UIFrameFadeIn(f,.5,0,1)
end
end)
end
\ No newline at end of file
Eui/lib/Eui/init.lua New file
0,0 → 1,1367
local E, C = unpack(select(2, ...))
local L = GetLocale()
if(L=="zhCN") then
L_COST = "修理花费: "
L_GOLD = "金"
L_TALENT = "改变"
L_TALENT_S = "天赋"
L_INVITE = "接受组队邀请: "
L_DUEL = "拒绝决斗: "
L_UI = "使用 |cff00ffff/eset ui|r 载入EUI设置"
L_BOOST = "使用 |cff00ffff/eset boost|r 优化系统"
L_MSBT = "使用 |cff00ffff/eset msbt|r 载入MSBT设置"
L_RECOUNT = "使用 |cff00ffff/eset recount|r 载入Recount设置"
L_DBM = "使用 |cff00ffff/eset boss|r 载入DBM设置"
L_ESET = "使用 |cff00ffff/eset all|r 载入所有设置"
L_RAID = "|cff00ffffEUI:|r 使用 |cff00ffff/ad raid|r 加载RAID插件"
L_SOLO = "|cff00ffffEUI:|r 使用 |cff00ffff/ad solo|r 加载任务插件"
L_PVP = "|cff00ffffEUI:|r 使用 |cff00ffff/ad pvp|r 加载PVP插件"
L_TRADE = "|cff00ffffEUI:|r 使用 |cff00ffff/ad trade|r 加载商业插件"
L_DISLOOT = "自动拾取关闭"
L_ENLOOT = "自动拾取开启"
L_DXE = "使用 |cff00ffff/eset dxe|r 载入DXE设置"
elseif (L=="zhTW") then
L_COST = "修理花費: "
L_GOLD = "金"
L_TALENT = "改變"
L_TALENT_S = "天賦"
L_INVITE = "接受組隊邀請: "
L_DUEL = "拒絕决鬥: "
L_UI = "使用 |cff00ffff/eset ui|r 載入EUI配置"
L_BOOST = "使用 |cff00ffff/eset boost|r 優化系統"
L_MSBT = "使用 |cff00ffff/eset msbt|r 載入MSBT配置"
L_RECOUNT = "使用 |cff00ffff/eset recount|r 載入Recount配置"
L_DBM = "使用 |cff00ffff/eset boss|r 載入DBM配置"
L_ESET = "使用 |cff00ffff/eset all|r 載入所有配置"
L_RAID = "|cff00ffffEUI:|r 使用 |cff00ffff/ad raid|r 加載RAID插件"
L_SOLO = "|cff00ffffEUI:|r 使用 |cff00ffff/ad solo|r 加載任務/solo插件"
L_PVP = "|cff00ffffEUI:|r 使用 |cff00ffff/ad pvp|r 加載PVP插件"
L_TRADE = "|cff00ffffEUI:|r 使用 |cff00ffff/ad trade|r 加載交易插件"
L_DISLOOT = "自動拾取關閉"
L_ENLOOT = "自動拾取開啟"
L_DXE = "使用 |cff00ffff/eset dxe|r 載入DXE配置"
else
L_COST = "Repair cost: "
L_GOLD = " gold"
L_TALENT = "Changed "
L_TALENT_S = " talents spec."
L_INVITE = "Accepted invite from: "
L_DUEL = "Declined duel request from: "
L_UI = "use |cff00ffff/eset ui|r to upload EUI settings."
L_BOOST = "use |cff00ffff/eset boost|r to boost your UI."
L_MSBT = "use |cff00ffff/eset msbt|r to upload MSBT settings."
L_RECOUNT = "use |cff00ffff/eset recount|r to upload Recount settings."
L_DBM = "use |cff00ffff/eset boss|r to upload DBM settings."
L_ESET = "use |cff00ffff/eset all|r to apply all settings at once."
L_RAID = "|cff00ffffEUI:|r use |cff00ffff/ad raid|r to load raid addons"
L_SOLO = "|cff00ffffEUI:|r use |cff00ffff/ad solo|r to load solo addons"
L_PVP = "|cff00ffffEUI:|r use |cff00ffff/ad pvp|r to load pvp addons"
L_TRADE = "|cff00ffffEUI:|r use |cff00ffff/ad trade|r to load trade addons"
L_DISLOOT = "AutoLoot deactivated"
L_ENLOOT "AutoLoot activated"
L_DXE = "use |cff00ffff/eset dxe|r to upload DXE settings."
end
 
---------------------------------------------------- UI Scale
VideoOptionsResolutionPanelUIScaleSlider:Hide()
VideoOptionsResolutionPanelUseUIScale:Hide()
 
Cresolution = GetCurrentResolution()
Cgetscreenresolution = select(Cresolution, GetScreenResolutions())
 
scalefix = CreateFrame("Frame")
scalefix:RegisterEvent("PLAYER_ENTERING_WORLD")
scalefix:SetScript("OnEvent", function(self, event)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
if Cgetscreenresolution == "800x600"
or Cgetscreenresolution == "1024x768"
or Cgetscreenresolution == "720x576"
or Cgetscreenresolution == "1024x600" -- eeepc reso
or Cgetscreenresolution == "1152x864" then
SetCVar("useUiScale", 0)
else
SetCVar("useUiScale", 1)
SetMultisampleFormat(1) -- 多重采样率,可以设置为1,2,4,8
if C["main"].uiscale > 1 then C["main"].uiscale = 1 end
if C["main"].uiscale < 0.64 then C["main"].uiscale = 0.64 end
SetCVar("uiScale", C["main"].uiscale)
end
 
end)
 
function E.EuiScale()
if not (Cgetscreenresolution == "1680x945"
or Cgetscreenresolution == "2560x1440"
or Cgetscreenresolution == "1680x1050"
or Cgetscreenresolution == "1920x1080"
or Cgetscreenresolution == "1920x1200"
or Cgetscreenresolution == "1600x900"
or Cgetscreenresolution == "2048x1152"
or Cgetscreenresolution == "1776x1000"
or Cgetscreenresolution == "2560x1600"
or Cgetscreenresolution == "1440x900"
or Cgetscreenresolution == "1366x768"
or Cgetscreenresolution == "1280x800"
or Cgetscreenresolution == "1600x1200") then
C["main"].autoscale = false
end
 
if C["main"].autoscale == true then
-- C["main"].uiscale = 768/string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")
C["main"].uiscale = min(2, max(.64, 768/string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")))
end
end
E.EuiScale()
 
E.mult = 768/string.match(GetCVar("gxResolution"), "%d+x(%d+)")/C["main"].uiscale
function E.Scale(x)
return E.mult*math.floor(x/E.mult+.5)
end
 
---------------------------------------------------- Questlog Position
if C["main"].lockquest == true then
hooksecurefunc(WatchFrame,"SetPoint",function(_,_,parent) -- 任务
if (parent == "MinimapCluster") or (parent == _G["MinimapCluster"]) then
WatchFrame:ClearAllPoints();
WatchFrame:SetPoint("TOPRIGHT","UIParent","TOPRIGHT",-50,-200);
WatchFrame:SetPoint("BOTTOMRIGHT","UIParent","BOTTOMRIGHT",-200,160);
end
end);
 
hooksecurefunc(DurabilityFrame,"SetPoint",function(self,_,parent) -- 耐久度
if (parent == "MinimapCluster") or (parent == _G["MinimapCluster"]) then
DurabilityFrame:ClearAllPoints();
DurabilityFrame:SetPoint("BOTTOMRIGHT",UIParent,"BOTTOMRIGHT",-100,60);
end
end);
 
hooksecurefunc(VehicleSeatIndicator,"SetPoint",function(_,_,parent) -- 载具
if (parent == "MinimapCluster") or (parent == _G["MinimapCluster"]) then
VehicleSeatIndicator:ClearAllPoints();
VehicleSeatIndicator:SetPoint("BOTTOMRIGHT",UIParent,"BOTTOMRIGHT", -100, 160);
end
end);
end
 
---------------------------------------------------- Auto Invite
if C["main"].autoinvite == true then
local abw = CreateFrame("frame")
abw:RegisterEvent("CHAT_MSG_WHISPER")
abw:SetScript("OnEvent", function(self,event,arg1,arg2)
if (not UnitExists("party1") or IsPartyLeader("player")) and arg1:lower():match(C["main"].invitetext) then
InviteUnit(arg2)
end
end)
end
 
---------------------------------------------------- Readycheck Warning
local ShowReadyCheckHook = function(self, initiator, timeLeft)
if initiator ~= "player" then
PlaySound("ReadyCheck")
end
end
hooksecurefunc("ShowReadyCheck", ShowReadyCheckHook)
 
---------------------------------------------------- No Errors
if C["main"].noerrors == true then
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
end
 
---------------------------------------------------- AutoLoot
if C["main"].autoloot == true then
function SimpleAutoLoot_OnEvent()
if(GetNumRaidMembers() > 0) then
if GetCVar("autoLootDefault") == "1" then
DEFAULT_CHAT_FRAME:AddMessage(L_DISLOOT, 0, 1, 1 )
SetCVar("autoLootDefault", "0")
end
else
if GetCVar("autoLootDefault") == "0" then
DEFAULT_CHAT_FRAME:AddMessage(L_ENLOOT, 0, 1, 1 )
SetCVar("autoLootDefault", "1")
end
end
end
 
local frame = CreateFrame("Frame", "SimpleAutoLootFrame")
 
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
 
frame:SetScript("OnEvent", SimpleAutoLoot_OnEvent)
end
 
---------------------------------------------------- Remove errors in combat
if C["main"].noerrorsincombat == true and C["main"].noerrors == false then
local neic = CreateFrame("Frame")
local OnEvent = function(self, event, ...) self[event](self, event, ...) end
neic:SetScript("OnEvent", OnEvent)
local function PLAYER_REGEN_DISABLED()
UIErrorsFrame:Hide()
end
local function PLAYER_REGEN_ENABLED()
UIErrorsFrame:Show()
end
neic:RegisterEvent("PLAYER_REGEN_DISABLED")
neic["PLAYER_REGEN_DISABLED"] = PLAYER_REGEN_DISABLED
neic:RegisterEvent("PLAYER_REGEN_ENABLED")
neic["PLAYER_REGEN_ENABLED"] = PLAYER_REGEN_ENABLED
end
 
---------------------------------------------------- Move UIErrors frame
if C["main"].moveuierrors == true then
UIErrorsFrame:ClearAllPoints()
UIErrorsFrame:SetPoint("TOP", UIParent, "TOP", 0, -20)
UIErrorsFrame.SetPoint = dummy
end
 
 
---------------------------------------------------- Ignore Duel
if C["main"].ignoreduel == true then
local dd = CreateFrame("Frame")
dd:RegisterEvent("DUEL_REQUESTED")
dd:SetScript("OnEvent", function(self, event, name)
HideUIPanel(StaticPopup1)
CancelDuel()
E.EuiAlertRun(L_DUEL..name,0,1,1) -- new info text
end)
end
 
---------------------------------------------------- Auto resurection
if C["main"].autorez == true then
local ar = CreateFrame("Frame")
local OnEvent = function(self, event, ...) self[event](self, event, ...) end
ar:SetScript("OnEvent", OnEvent)
local function PLAYER_DEAD()
if MiniMapBattlefieldFrame.status and MiniMapBattlefieldFrame.status=="active" then
RepopMe()
end
end
ar:RegisterEvent("PLAYER_DEAD")
ar["PLAYER_DEAD"] = PLAYER_DEAD
end
 
---------------------------------------------------- Auto Roll
if E.MyLevel == MAX_PLAYER_LEVEL and C["main"].autoroll == true then
local agog = CreateFrame("Frame", nil, UIParent)
agog:RegisterEvent("START_LOOT_ROLL")
agog:SetScript("OnEvent", function(_, _, id)
if not id then return end
if select(2,GetLootRollItemInfo(id)) == select(1, GetItemInfo(43297)) or select(2,GetLootRollItemInfo(id)) == select(1, GetItemInfo(45912)) then return end
if(id and select(4, GetLootRollItemInfo(id))==2 and not (select(5, GetLootRollItemInfo(id)))) then
if RollOnLoot(id, 3) then
RollOnLoot(id, 3)
else
RollOnLoot(id, 2)
end
end
end)
end
 
if C["main"].disableconfirm == true then
local acd = CreateFrame("Frame")
acd:RegisterEvent("CONFIRM_DISENCHANT_ROLL")
acd:RegisterEvent("CONFIRM_LOOT_ROLL")
acd:RegisterEvent("LOOT_BIND_CONFIRM")
acd:SetScript("OnEvent", function(self, event, ...)
for i = 1, STATICPOPUP_NUMDIALOGS do
local frame = _G["StaticPopup"..i]
if (frame.which == "CONFIRM_LOOT_ROLL" or frame.which == "LOOT_BIND" or frame.which == "LOOT_BIND_CONFIRM") and frame:IsVisible() then StaticPopup_OnClick(frame, 1) end
end
end)
end
 
---------------------------------------------------- Auto repair & sell crap
local arsc = CreateFrame("Frame")
arsc:RegisterEvent("MERCHANT_SHOW")
arsc:SetScript("OnEvent", function()
if(C["main"].autorepair == true and CanMerchantRepair()) then
local cost = GetRepairAllCost()
if(not cost or cost==0) then return end
 
local CanGuildRepair = C["main"].autorepairguild == true and IsInGuild() and CanGuildBankRepair() and GetGuildBankWithdrawMoney()>cost and GetGuildBankMoney()>cost
if(CanGuildRepair) then
RepairAllItems(1)
E.EuiAlertRun(format(L_COST.."%.1f"..L_GOLD, cost * 0.0001),0,1,1)
print(format("|cff00ffff"..L_COST.."%.1f"..L_GOLD.."|r", cost * 0.0001))
elseif(GetMoney()>cost) then
RepairAllItems()
E.EuiAlertRun(format(L_COST.."%.1f"..L_GOLD, cost * 0.0001),0,1,1)
print(format("|cff00ffff"..L_COST.."%.1f"..L_GOLD.."|r", cost * 0.0001))
end
end
 
if C["main"].sellgreycrap == true then
local bag, slot
for bag = 0, 4 do
for slot = 0, GetContainerNumSlots(bag) do
local link = GetContainerItemLink(bag, slot)
if link and (select(3, GetItemInfo(link))==0) then
UseContainerItem(bag, slot)
end
end
end
end
end)
 
---------------------------------------------------- Accept Invites
if C["main"].acceptinvites == true then
local IsFriend = function(name)
for i=1, GetNumFriends() do if(GetFriendInfo(i)==name) then return true end end
if(IsInGuild()) then for i=1, GetNumGuildMembers() do if(GetGuildRosterInfo(i)==name) then return true end end end
end
 
local ai = CreateFrame("Frame")
ai:RegisterEvent("PARTY_INVITE_REQUEST")
ai:SetScript("OnEvent", function(frame, event, name)
if(IsFriend(name)) then
E.EuiAlertRun(L_INVITE..name,0,1,1)
print(format("|cff00ffff"..L_INVITE..name))
AcceptGroup()
for i = 1, 4 do
local frame = _G["StaticPopup"..i]
if(frame:IsVisible() and frame.which=="PARTY_INVITE") then
frame.inviteAccepted = 1
StaticPopup_Hide("PARTY_INVITE")
return
end
end
else
SendWho(name)
end
end)
end
 
---------------------------------------------------- ALT+Click to buy a stack
if C["main"].bugstack == true then
local savedMerchantItemButton_OnModifiedClick = MerchantItemButton_OnModifiedClick;
function MerchantItemButton_OnModifiedClick(self, ...)
if ( IsAltKeyDown() ) then
local maxStack = select(8, GetItemInfo(GetMerchantItemLink(this:GetID())));
local name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(this:GetID());
if ( maxStack and maxStack > 1 ) then
BuyMerchantItem(this:GetID(), floor(maxStack / quantity));
end;
end;
savedMerchantItemButton_OnModifiedClick(self, ...);
end;
end
 
---------------------------------------------------- Some slash commands
SlashCmdList["FRAME"] = function() print(GetMouseFocus():GetName()) end
SLASH_FRAME1 = "/gn"
 
SlashCmdList["GETPARENT"] = function() print(GetMouseFocus():GetParent():GetName()) end
SLASH_GETPARENT1 = "/gp"
 
SlashCmdList["RELOADUI"] = function() ReloadUI() end
SLASH_RELOADUI1 = "/rl"
 
SlashCmdList["RCSLASH"] = function() DoReadyCheck() end
SLASH_RCSLASH1 = "/rc"
 
SlashCmdList["TICKET"] = function() ToggleHelpFrame() end
SLASH_TICKET1 = "/ticket"
SLASH_TICKET2 = "/gm"
 
SlashCmdList["DISABLE_ADDON"] = function(s) DisableAddOn(s) end
SLASH_DISABLE_ADDON1 = "/dis"
 
SlashCmdList["ENABLE_ADDON"] = function(s) EnableAddOn(s) end
SLASH_ENABLE_ADDON1 = "/en"
 
---------------------------------------------------- Addon's Group
local raidaddons = { -- Raid时使用的插件
"sThreatMeter2",
"Engravings",
"Skada",
"SkadaDamage",
"SkadaHealing",
"SkadaFailbot",
"RatingBuster",
"DBM-Core",
"BigWigs",
"CheckForConsumables",
"AntiSlack",
"BigBrother",
"Omen",
"Recount",
}
 
local pvpaddons = { -- PVP时使用的插件
"Gladius",
"Engravings",
"ArenaHistorian",
"SpellAlerter",
"PreformAVEnabler",
"DRTracker",
"RatingBuster",
"SSArena",
"ArenaCountDown",
"Capping",
"BattleInfo",
}
 
local soloaddons = { -- Solo时使用的插件
"QuestHelper",
"LightHeaded",
"Cartographer",
"QuestLibrary",
"MapNotes",
"Carbonite",
}
 
local tradeaddons = { -- 商业活动时使用的插件
"BaudAuction",
}
 
SlashCmdList["CHANGEADDONS"] = function(s)
if(s and s=="raid") then
for i in pairs(pvpaddons) do
DisableAddOn(pvpaddons[i])
end
for i in pairs(soloaddons) do
DisableAddOn(soloaddons[i])
end
for i in pairs(tradeaddons) do
DisableAddOn(tradeaddons[i])
end
for i in pairs(raidaddons) do
EnableAddOn(raidaddons[i])
end
ReloadUI()
elseif(s and s=="pvp") then
for i in pairs(raidaddons) do
DisableAddOn(raidaddons[i])
end
for i in pairs(soloaddons) do
DisableAddOn(soloaddons[i])
end
for i in pairs(tradeaddons) do
DisableAddOn(tradeaddons[i])
end
for i in pairs(pvpaddons) do
EnableAddOn(pvpaddons[i])
end
ReloadUI()
elseif(s and s=="solo") then
for i in pairs(raidaddons) do
DisableAddOn(raidaddons[i])
end
for i in pairs(pvpaddons) do
DisableAddOn(pvpaddons[i])
end
for i in pairs(tradeaddons) do
DisableAddOn(tradeaddons[i])
end
for i in pairs(soloaddons) do
EnableAddOn(soloaddons[i])
end
ReloadUI()
elseif(s and s=="trade") then
for i in pairs(raidaddons) do
DisableAddOn(raidaddons[i])
end
for i in pairs(pvpaddons) do
DisableAddOn(pvpaddons[i])
end
for i in pairs(tradeaddons) do
DisableAddOn(tradeaddons[i])
end
for i in pairs(soloaddons) do
DisableAddOn(soloaddons[i])
end
for i in pairs(tradeaddons) do
EnableAddOn(tradeaddons[i])
end
ReloadUI()
else
print(L_RAID)
print(L_SOLO)
print(L_PVP)
print(L_TRADE)
end
end
SLASH_CHANGEADDONS1 = "/ad"
 
---------------------------------------------------- Alt Click To Add Item Trade
if C["main"].alttotrade == true then
if IS_WRATH_BUILD == nil then IS_WRATH_BUILD = (select(4, GetBuildInfo()) >= 30000) end
 
local targ, bag, slot
 
local orig1 = ContainerFrameItemButton_OnModifiedClick
ContainerFrameItemButton_OnModifiedClick = function(...)
local self, button
if IS_WRATH_BUILD then self, button = ... else button = ... end
if button == "LeftButton" and IsAltKeyDown() and not CursorHasItem() then
bag, slot = this:GetParent():GetID(), this:GetID()
if TradeFrame:IsVisible() then
for i=1,6 do
if not GetTradePlayerItemLink(i) then
PickupContainerItem(bag, slot)
ClickTradeButton(i)
bag, slot = nil, nil
return
end
end
elseif not CursorHasItem() and UnitExists("target") and UnitIsFriend("player", "target") and UnitIsPlayer("target") and CheckInteractDistance("target", 2) then
targ = UnitName("target")
InitiateTrade("target")
return
end
end
orig1(...)
end
local function posthook(...)
if targ and not CursorHasItem() and UnitName("target") == targ then
PickupContainerItem(bag, slot)
ClickTradeButton(1)
end
targ, bag, slot = nil, nil, nil
 
return ...
end
local orig2 = TradeFrame:GetScript("OnShow")
TradeFrame:SetScript("OnShow", function(...)
if orig2 then return posthook(orig2(...))
else posthook() end
end)
end
 
---------------------------------------------------- Hide spam from talent respec
if C["main"].talentspam == true then
local spamFilterMatch1 = string.gsub(ERR_LEARN_ABILITY_S:gsub('%.', '%.'), '%%s', '(.*)')
local spamFilterMatch2 = string.gsub(ERR_LEARN_SPELL_S:gsub('%.', '%.'), '%%s', '(.*)')
local spamFilterMatch3 = string.gsub(ERR_SPELL_UNLEARNED_S:gsub('%.', '%.'), '%%s', '(.*)')
local primarySpecSpellName = GetSpellInfo(63645)
local secondarySpecSpellName = GetSpellInfo(63644)
 
local groupNamesCaps = {
"Primary",
"Secondary"
}
 
specCache = {}
 
HideSpam = CreateFrame("Frame");
HideSpam:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED");
HideSpam:RegisterEvent("UNIT_SPELLCAST_START");
HideSpam:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED");
 
HideSpam.filter = function(self, event, msg, ...)
if strfind(msg, spamFilterMatch1) then
return true
elseif strfind(msg, spamFilterMatch2) then
return true
elseif strfind(msg, spamFilterMatch3) then
return true
end
return false, msg, ...
end
 
HideSpam:SetScript("OnEvent", function( self, event, ...)
 
local unit, spellName = ...
 
if(event == "UNIT_SPELLCAST_START") then
if unit == "player" and (spellName == primarySpecSpellName or spellName == secondarySpecSpellName) then
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", self.filter)
end
 
elseif(event == "UNIT_SPELLCAST_INTERRUPTED") then
if unit == "player" and (spellName == primarySpecSpellName or spellName == secondarySpecSpellName) then
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", self.filter)
end
 
elseif(event == "ACTIVE_TALENT_GROUP_CHANGED") then
for i = 1, GetNumTalentGroups() do
specCache[i] = specCache[i] or {}
local thisCache = specCache[i]
TalentFrame_UpdateSpecInfoCache(thisCache, false, false, i)
if thisCache.primaryTabIndex and thisCache.primaryTabIndex ~= 0 then
thisCache.specName = thisCache[thisCache.primaryTabIndex].name
thisCache.mainTabIcon = thisCache[thisCache.primaryTabIndex].icon
elseif thisCache.secondaryTabIndex and thisCache.secondaryTabIndex ~= 0 then
thisCache.specName = thisCache[thisCache.secondaryTabIndex].name
thisCache.mainTabIcon = thisCache[thisCache.secondaryTabIndex].icon
else
thisCache.specName = "|cffff0000Talents undefined!|r"
thisCache.mainTabIcon = "Interface\\Icons\\Ability_Seal"
end
thisCache.specGroupName = groupNamesCaps[i]
end
 
local activeGroupNum = GetActiveTalentGroup()
if specCache[activeGroupNum].totalPointsSpent > 1 then
local s = specCache[activeGroupNum];
print(L_TALENT.."|cff6adb54".. s.specName .." ("..
s[1].pointsSpent .."/"..
s[2].pointsSpent .."/"..
s[3].pointsSpent ..")|r"..L_TALENT_S)
end
 
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", self.filter)
 
end
 
end);
end
 
 
---------------------------------------------------- Quest Automation
if C["main"].questauto == true then
local qauto = CreateFrame('Frame')
qauto.completed_quests = {}
qauto.uncompleted_quests = {}
 
function qauto:canAutomate ()
if IsShiftKeyDown() then
return false
else
return true
end
end
 
function qauto:strip_text (text)
if not text then return end
text = text:gsub('%[.*%]%s*','')
text = text:gsub('|c%x%x%x%x%x%x%x%x(.+)|r','%1')
text = text:gsub('(.+) %(.+%)', '%1')
text = text:trim()
return text
end
 
function qauto:QUEST_PROGRESS ()
if not self:canAutomate() then return end
if IsQuestCompletable() then
CompleteQuest()
end
end
 
function qauto:QUEST_LOG_UPDATE ()
if not self:canAutomate() then return end
local start_entry = GetQuestLogSelection()
local num_entries = GetNumQuestLogEntries()
local title
local is_complete
local no_objectives
 
self.completed_quests = {}
self.uncompleted_quests = {}
 
if num_entries > 0 then
for i = 1, num_entries do
SelectQuestLogEntry(i)
title, _, _, _, _, _, is_complete = GetQuestLogTitle(i)
no_objectives = GetNumQuestLeaderBoards(i) == 0
if title and (is_complete or no_objectives) then
self.completed_quests[title] = true
else
self.uncompleted_quests[title] = true
end
end
end
 
SelectQuestLogEntry(start_entry)
end
 
function qauto:GOSSIP_SHOW ()
if not self:canAutomate() then return end
 
local button
local text
 
for i = 1, 32 do
button = _G['GossipTitleButton' .. i]
if button:IsVisible() then
text = self:strip_text(button:GetText())
if button.type == 'Available' then
button:Click()
elseif button.type == 'Active' then
if self.completed_quests[text] then
button:Click()
end
end
end
end
end
 
function qauto:QUEST_GREETING (...)
if not self:canAutomate() then return end
 
local button
local text
 
for i = 1, 32 do
button = _G['QuestTitleButton' .. i]
if button:IsVisible() then
text = self:strip_text(button:GetText())
if self.completed_quests[text] then
button:Click()
elseif not self.uncompleted_quests[text] then
button:Click()
end
end
end
end
 
function qauto:QUEST_DETAIL ()
if not self:canAutomate() then return end
AcceptQuest()
end
 
function qauto:QUEST_COMPLETE (event)
if not self:canAutomate() then return end
if GetNumQuestChoices() <= 1 then
GetQuestReward(QuestFrameRewardPanel.itemChoice)
end
end
 
function qauto.onevent (self, event, ...)
if self[event] then
self[event](self, ...)
end
end
 
qauto:SetScript('OnEvent', qauto.onevent)
qauto:RegisterEvent('GOSSIP_SHOW')
qauto:RegisterEvent('QUEST_COMPLETE')
qauto:RegisterEvent('QUEST_DETAIL')
qauto:RegisterEvent('QUEST_FINISHED')
qauto:RegisterEvent('QUEST_GREETING')
qauto:RegisterEvent('QUEST_LOG_UPDATE')
qauto:RegisterEvent('QUEST_PROGRESS')
 
_G.idQuestAutomation = qauto
end
 
 
---------------------------------------------------- Quest Icons
if C["main"].questicons == true then
local _G = getfenv(0)
 
-- Tries to deal with incompatabilities that other mods cause
local function stripStupid(text)
if( not text ) then
return nil
end
 
-- Strip [<level crap>] <quest title>
text = string.gsub(text, "%[(.+)%]", "")
-- Strip color codes
text = string.gsub(text, "|c%x%x%x%x%x%x%x%x(.+)|r", "%1")
-- Strip (low level) at the end of a quest
text = string.gsub(text, "(.+) %((.+)%)", "%1")
 
text = string.trim(text)
text = string.lower(text)
return text
end
 
function checkQuestText(buttonText, texture)
buttonText = stripStupid(buttonText)
 
for i=1, GetNumQuestLogEntries() do
local questName, _, _, _, _, _, isComplete = GetQuestLogTitle(i)
 
if( buttonText == stripStupid(questName) ) then
if( ( isComplete and isComplete > 0 ) or GetNumQuestLeaderBoards(i) == 0 ) then
SetDesaturation(texture, nil)
return
end
break
end
end
 
SetDesaturation(texture, true)
end
 
local function updateGossipIcons()
if( not GossipFrame:IsVisible() ) then
return
end
 
for i=1, GossipFrame.buttonIndex do
local button = _G["GossipTitleButton" .. i]
if( button:IsVisible() ) then
if( button.type == "Active" ) then
checkQuestText(button:GetText(), _G[button:GetName() .. "GossipIcon"])
else
SetDesaturation(_G[button:GetName() .. "GossipIcon"], nil)
end
end
end
end
 
local function updateQuestIcons()
if( not QuestFrameGreetingPanel:IsVisible() ) then
return
end
 
for i=1, (GetNumActiveQuests() + GetNumAvailableQuests()) do
local button = _G["QuestTitleButton" .. i]
if( button:IsVisible() ) then
if( button.isActive == 1 ) then
checkQuestText(button:GetText(), (button:GetRegions()))
else
SetDesaturation((button:GetRegions()), nil)
end
end
end
end
 
local frame = CreateFrame("Frame")
frame:RegisterEvent("QUEST_GREETING")
frame:RegisterEvent("GOSSIP_SHOW")
frame:RegisterEvent("QUEST_LOG_UPDATE")
frame:SetScript("OnEvent", function(self, event)
updateQuestIcons()
updateGossipIcons()
end)
end
 
---------------------------------------------------- Addons settings
--[[ General settings config ]]
eSetUI = function()
SetCVar("buffDurations", 1)
SetCVar("lootUnderMouse", 1)
SetCVar("autoSelfCast", 1)
SetCVar("showItemLevel", 1)
SetCVar("equipmentManager", 1)
--SetCVar("mapQuestDifficulty", 1)
SetCVar("previewTalents", 1)
SetCVar("scriptErrors", 0)
SetCVar("alwaysShowActionBars",0)
--SetCVar("nameplateShowFriends", 0)
--SetCVar("nameplateShowFriendlyPets", 0)
--SetCVar("nameplateShowFriendlyGuardians", 0)
--SetCVar("nameplateShowFriendlyTotems", 0)
--SetCVar("nameplateShowEnemies", 1)
--SetCVar("nameplateShowEnemyPets", 1)
--SetCVar("nameplateShowEnemyGuardians", 1)
--SetCVar("nameplateShowEnemyTotems", 1)
SetCVar("ShowClassColorInNameplate", 1)
SetCVar("screenshotFormat", "JPG") -- 截屏图像格式,"TGA" 或 "JPG"
SetCVar("screenshotQuality", 10) -- 截屏时JPEG的图像质量,需要截屏图像格式为JPG
SetCVar("cameraDistanceMax", 50)
SetCVar("cameraDistanceMaxFactor", 3.4)
SetCVar("showClock", 0) -- 显示游戏自带时钟
--SetCVar("nameplateAllowOverlap", 1)
SetCVar("chatMouseScroll", 1)
SetCVar("chatStyle", "classic")
SetCVar("WholeChatWindowClickable", 0)
--SetCVar("ConversationMode", "inline")
SetCVar("CombatDamage", 0)
SetCVar("CombatHealing", 0)
--SetCVar("showTutorials", 0)
SetCVar("showNewbieTips", 0)
SetCVar("hidePartyInRaid", 1)
SetCVar("Maxfps", 120)
SetCVar("autoDismountFlying", 1)
--SetCVar("autoQuestWatch", 1)
--SetCVar("autoQuestProgress", 1)
--SetCVar("showLootSpam", 1)
SetCVar("guildMemberNotify", 1)
SetCVar("chatBubblesParty", 0)
SetCVar("chatBubbles", 0)
SetCVar("spamFilter", 0)
SetCVar("questFadingDisable", 1)
SetCVar("advancedWatchFrame", 0)
SetCVar("ShowAllSpellRanks", 0)
SetCVar("lockActionBars", 1)
--SetCVar("UnitNameOwn", 0)
--SetCVar("UnitNameNPC", 0)
--SetCVar("UnitNameNonCombatCreatureName", 0)
--SetCVar("UnitNamePlayerGuild", 1)
--SetCVar("UnitNamePlayerPVPTitle", 1)
--SetCVar("UnitNameFriendlyPlayerName", 0)
--SetCVar("UnitNameFriendlyPetName", 0)
--SetCVar("UnitNameFriendlyGuardianName", 0)
--SetCVar("UnitNameFriendlyTotemName", 0)
--SetCVar("UnitNameEnemyPlayerName", 0)
--SetCVar("UnitNameEnemyPetName", 0)
--SetCVar("UnitNameEnemyGuardianName", 0)
--SetCVar("UnitNameEnemyTotemName", 0)
SetCVar("UberTooltips", 1)
SetCVar("removeChatDelay", 1)
--WorldMap_ToggleSizeDown()
 
 
end
 
local Boost = function()
SetCVar("ffx", 0)
SetCVar("hwPCF", 1)
SetCVar("shadowLOD", 0)
SetCVar("timingmethod", 1)
--SetCVar("showshadow", 0)
SetCVar("showfootprints", 0)
SetCVar("showfootprintparticles", 0)
--SetCVar("overridefarclip", 0)
SetCVar("farclip", 600)
--SetCVar("horizonfarclip", 1305)
--SetCVar("detailDoodadAlpha", 0)
SetCVar("groundeffectdensity", 16)
SetCVar("groundeffectdist", 1)
--SetCVar("smallcull", 0)
SetCVar("skycloudlod", 1)
--SetCVar("characterAmbient", 1)
SetCVar("extshadowquality", 0)
SetCVar("environmentDetail", 0.5)
SetCVar("m2Faster", 1)
end
 
--[[ DBM settings ]]
local _, class = UnitClass("player")
local t = E.RAID_CLASS_COLORS[class]
local r, g, b = t.r, t.g, t.b
--[[
local UploadBoss = function()
if(DBM_SavedOptions) then table.wipe(DBM_SavedOptions) end
 
DBM_SavedOptions = {
["ShowMinimapButton"] = true,
["ShowWarningsInChat"] = true,
["RangeFramePoint"] = "TOPRIGHT",
["RaidWarningSound"] = "Sound\\Doodad\\BellTollNightElf.wav",
["SpecialWarningSound"] = "Sound\\Spells\\PVPFlagTaken.wav",
["AutoRespond"] = false,
["StatusEnabled"] = false,
["RaidWarningPosition"] = {["Y"] = -150, ["X"] = 0, ["Point"] = "TOP"},
["Enabled"] = true,
["RangeFrameX"] = -270,
["RangeFrameY"] = -250,
["WarningIconLeft"] = true,
["WarningColors"] = {{["b"] = b, ["g"] = g, ["r"] = r,},
{["b"] = b, ["g"] = g, ["r"] = r,},
{["b"] = b, ["g"] = g, ["r"] = r,},
{["b"] = b, ["g"] = g, ["r"] = r,},},
["WarningIconRight"] = true,
["ShowFakedRaidWarnings"] = true,
["ShowMinimapButton"] = true,
["HPFramePoint"] = "TOPLEFT",
["HPFrameX"] = 240,
["HPFrameY"] = -240,
["SpamBlockRaidWarning"] = true,
["SpamBlockBossWhispers"] = false,
["HideBossEmoteFrame"] = false,
}
 
if(DBT_SavedOptions) then table.wipe(DBT_SavedOptions) end
 
DBT_SavedOptions = {
["DBM"] = {
["StartColorR"] = r,
["StartColorG"] = g,
["StartColorB"] = b,
["EndColorR"] = r,
["EndColorG"] = g,
["EndColorB"] = b,
["Scale"] = 1,
["Width"] = 250,
["TimerX"] = -143,
["TimerY"] = -250,
["BarXOffset"] = 0,
["BarYOffset"] = 2,
["IconLeft"] = false,
["IconRight"] = false,
["ExpandUpwards"] = false,
["Texture"] = "Interface\\AddOns\\Eui\\media\\normTex",
["HugeBarsEnabled"] = false,
["HugeBarXOffset"] = 0,
["HugeBarYOffset"] = 0,
["HugeWidth"] = 200,
["HugeTimerY"] = -190,
["HugeTimerPoint"] = "TOPLEFT",
["HugeTimerX"] = 150,
["HugeScale"] = 1.05,
["TimerPoint"] = "TOPRIGHT",
},
}
DBM_SavedOptions["ep_settings"] = true
DBM_SavedOptions["ShowMinimapButton"] = false
end
]]
--[[ Recount Settings ]]
local recount = function()
if RecountDB or RecountPerCharDB then
table.wipe(RecountDB)
table.wipe(RecountPerCharDB)
end
RecountDB = {
["ep_setiings"] = true,
["profileKeys"] = {
[""] = "Default",
},
["profiles"] = {
["Default"] = {
["GraphWindowY"] = 0,
["MainWindow"] = {
["ShowScrollbar"] = false,
["Position"] = {
["y"] = -10.40647875656032,
["x"] = -20,
["w"] = 300,
["h"] = 200,
},
["BarText"] = {
["NumFormat"] = 3,
},
["RowHeight"] = 16,
["RowSpacing"] = 1,
},
["Colors"] = {
["Window"] = {
["Background"] = {
["a"] = 0,
["r"] = 0.0392156862745098,
["g"] = 0.06666666666666667,
},
["Title"] = {
["a"] = 0,
["r"] = 0.8313725490196078,
["g"] = 0.7176470588235294,
["b"] = 1,
},
["Title Text"] = {
["r"] = 1,
["g"] = 1,
["b"] = 1,
},
},
["Bar"] = {
["Bar Text"] = {
["a"] = 1,
["b"] = 0.592156862745098,
["g"] = 0.592156862745098,
["r"] = 0.592156862745098,
},
["Total Bar"] = {
["a"] = 1,
["r"] = 0.2,
["g"] = 0.2,
["b"] = 0.2,
},
},
},
["DetailWindowY"] = 104.0000005623091,
["DetailWindowX"] = -20,
["BarTextColorSwap"] = true,
["GraphWindowX"] = 0,
--["Locked"] = true,
["BarTexture"] = "Flat",
["CurDataSet"] = "CurrentFightData",
["ClampToScreen"] = true,
["GraphWindowX"] = 0,
["MainWindowWidth"] = 300,
["MainWindowHeight"] = 200,
},
},
}
--RecountPerCharDB = { },
RecountDB["ep_setiings"] = true
--RecountPerCharDB["ep_setiings"] = true
end
 
--[[ MSBT Settings ]]
local msbt = function()
MSBTProfiles_SavedVars = {
["profiles"] = {
["Default"] = {
["scrollAreas"] = {
["Static"] = {
["disabled"] = true,
},
["Outgoing"] = {
["direction"] = "Up",
["behavior"] = "MSBT_NORMAL",
["stickyDirection"] = "Up",
["stickyBehavior"] = "MSBT_NORMAL",
["offsetX"] = 300,
["offsetY"] = -140,
["animationStyle"] = "Straight",
["stickyAnimationStyle"] = "Static",
},
["Incoming"] = {
["direction"] = "Up",
["behavior"] = "MSBT_NORMAL",
["stickyDirection"] = "Up",
["stickyBehavior"] = "MSBT_NORMAL",
["offsetX"] = -300,
["offsetY"] = -140,
["animationStyle"] = "Straight",
["stickyAnimationStyle"] = "Static",
},
},
["creationVersion"] = "5.4.78",
},
},
["profileKeys"] = {
[""] = "Default",
},
["ep_setiings"] = true,
}
end
 
local dxe = function()
if(DXEDB) then table.wipe(DXEDB) end
if(DXEIconDB) then table.wipe(DXEIconDB) end
DXEDB = {
["profiles"] = {
["Default"] = {
["Positions"] = {
["DXEPane"] = {
["yOfs"] = -20,
["xOfs"] = 20,
["point"] = "TOPLEFT",
["relativePoint"] = "TOPLEFT",
},
["DXEAlertsTopStackAnchor"] = {
["point"] = "BOTTOMLEFT",
["relativePoint"] = "BOTTOMLEFT",
["yOfs"] = 185,
["xOfs"] = 21,
},
["DXEArrowsAnchor2"] = {
["yOfs"] = -34,
["xOfs"] = -111,
},
["DXEAlertsCenterStackAnchor"] = {
["yOfs"] = 25,
["xOfs"] = 3,
},
["DXEArrowsAnchor1"] = {
["yOfs"] = -34,
["xOfs"] = -4,
},
["DXEArrowsAnchor3"] = {
["yOfs"] = -34,
["xOfs"] = 98,
},
},
["Pane"] = {
["Show"] = false,
},
},
},
}
DXEIconDB = {
["hide"] = true,
}
end
 
--[[ Slash commands handling ]]
local pr = function(msg)
print("|cff00ffffEUI:|r", tostring(msg))
end
 
SLASH_eset1 = "/eset"
SlashCmdList["eset"] = function(msg)
if(msg=="msbt") then
msbt()
ReloadUI()
elseif(msg=="ui") then
eSetUI()
ReloadUI()
elseif(msg=="recount") then
recount()
ReloadUI()
elseif(msg=="boss") then
UploadBoss()
ReloadUI()
elseif(msg=="boost") then
Boost()
ReloadUI()
elseif(msg=="dxe") then
dxe()
ReloadUI()
elseif(msg=="all") then
eSetUI()
msbt()
recount()
UploadBoss()
Boost()
dxe()
ReloadUI()
else
pr(L_UI)
pr(L_BOOST)
pr(L_RECOUNT)
pr(L_MSBT)
pr(L_DBM)
pr(L_ESET)
pr(L_DXE)
end
end
 
---------------------------------------------------- Quest Level
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)
 
---------------------------------------------------- Combat Notification
if C["main"].combatnoti == true then
local CombatNotification = CreateFrame ("Frame")
CombatNotification:RegisterEvent("PLAYER_REGEN_ENABLED")
CombatNotification:RegisterEvent("PLAYER_REGEN_DISABLED")
CombatNotification:SetScript("OnEvent", function (self,event)
if (UnitIsDead("player")) then return end
if event == "PLAYER_REGEN_ENABLED" then
E.EuiAlertRun("LEAVING COMBAT",0.1,1,0.1)
else
E.EuiAlertRun("ENTERING COMBAT",1,0.1,0.1)
end
end)
end
 
---------------------------------------------------- Disband Party/Raid
SlashCmdList["GROUPDISBAND"] = function()
local pName = UnitName("player")
SendChatMessage("Disbanding group.", "RAID" or "PARTY")
if UnitInRaid("player") then
for i = 1, GetNumRaidMembers() do
local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
if online and name ~= pName then
UninviteUnit(name)
end
end
else
for i = MAX_PARTY_MEMBERS, 1, -1 do
if GetPartyMember(i) then
UninviteUnit(UnitName("party"..i))
end
end
end
LeaveParty()
end
SLASH_GROUPDISBAND1 = '/rd'
 
----------------------------------------------------------------------------------------
-- capture bar update position
----------------------------------------------------------------------------------------
 
local function captureupdate()
local nexty = 0
for i = 1, NUM_EXTENDED_UI_FRAMES do
local cb = _G["WorldStateCaptureBar"..i]
if cb and cb:IsShown() then
cb:ClearAllPoints()
cb:SetPoint("TOP", UIParent, "TOP", 0, -120)
nexty = nexty + cb:GetHeight()
end
end
end
 
hooksecurefunc("WorldStateAlwaysUpFrame_Update", captureupdate)
 
 
--创建两个用于解DBUFF的宏,并绑定到鼠标滚轮上
local Debuffmw = CreateFrame("Frame")
Debuffmw:RegisterEvent("PLAYER_ENTERING_WORLD")
Debuffmw:SetScript("OnEvent", function(self, event)
if C["clickset"].aamouse ~= true then
if GetMacroInfo("epDebuffa") then DeleteMacro("epDebuffa") end
if GetMacroInfo("epDebuffb") then DeleteMacro("epDebuffb") end
return
end
local _, class = UnitClass("player")
local CanDispel = {
PRIEST = { 527, 552, },
SHAMAN = { 526, 51886, },
PALADIN = { 4987, },
MAGE = { 475, },
DRUID = { 2782, 2893, },
ROGUE = {},
HUNTER = {},
WARRIOR = {},
WARLOCK = {},
DEATHKNIGHT = {},
}
if select(2, GetNumMacros()) == MAX_CHARACTER_MACROS then
print("你的宏已经满了,请删除两个宏后才能启用鼠标滚轮解dEBUFF功能!")
return
end
--local index_a = CreateMacro("Debuff_1", _, "/cast [target=mouseover] 清洁术;",1)
if GetMacroInfo("epDebuffa") then DeleteMacro("epDebuffa") end
if GetMacroInfo("epDebuffb") then DeleteMacro("epDebuffb") end
local macroa, macrob
local indexa, indexb
if CanDispel[class][1] then
macroa = GetSpellInfo(CanDispel[class][1])
index_a = CreateMacro("epDebuffa", 1, "/cast [target=mouseover] "..macroa..";", 1)
local a=SetBinding("ALT-MOUSEWHEELUP", "CAMERAZOOMIN")
local b=SetBinding("ALT-MOUSEWHEELDOWN", "CAMERAZOOMOUT")
if a and b then
SaveBindings(2)
print("鼠标滚轮上下被绑定到鼠标指向解DEBUFF上")
print("原视野放大缩小变更为Alt+鼠标滚轮")
print("不需此功能请至点击施法设置中关闭")
end
end
if CanDispel[class][2] then
macrob = GetSpellInfo(CanDispel[class][2])
index_b = CreateMacro("epDebuffb", 1, "/cast [target=mouseover] "..macrob..";", 1)
end
if index_a then SetBindingMacro("MOUSEWHEELUP", index_a) end
if index_b then SetBindingMacro("MOUSEWHEELDOWN", index_b) end
 
end)
 
StaticPopupDialogs["INSTALL_UI"] = {
text = "本角色首次使用此EUI,将进行初始化设置并重置界面!",
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function()
eSetUI()
msbt()
SetChat()
recount()
-- UploadBoss()
Boost()
dxe()
LjxxuiInstallV335 = true
ReloadUI()
end,
OnCancel = function() LjxxuiInstallV335 = false end,
timeout = 0,
whileDead = 1,
}
 
 
local LjxxuiOnLogon = CreateFrame("Frame")
LjxxuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
LjxxuiOnLogon:SetScript("OnEvent", function(self, event)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
if LjxxuiInstallV335 ~= true then
E.EuiSetTemplate(StaticPopup_Show("INSTALL_UI"))
end
end)
 
 
 
 
 
 
 
 
 
Eui/lib/Eui/anim.lua New file
0,0 → 1,70
------------------------------------------------------------------------
-- Animation Functions (Credit AlleyCat, Hydra)
------------------------------------------------------------------------
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
E.SetUpAnimGroup = function(self)
self.anim = self:CreateAnimationGroup("Flash")
self.anim.fadein = self.anim:CreateAnimation("ALPHA", "FadeIn")
self.anim.fadein:SetChange(1)
self.anim.fadein:SetOrder(2)
 
self.anim.fadeout = self.anim:CreateAnimation("ALPHA", "FadeOut")
self.anim.fadeout:SetChange(-1)
self.anim.fadeout:SetOrder(1)
end
 
E.Flash = function(self, duration)
if not self.anim then
E.SetUpAnimGroup(self)
end
 
self.anim.fadein:SetDuration(duration)
self.anim.fadeout:SetDuration(duration)
self.anim:Play()
end
 
E.StopFlash = function(self)
if self.anim then
self.anim:Finish()
end
end
 
E.AnimGroup = function (self,x,y,duration)
self.anim = self:CreateAnimationGroup("Move_In")
self.anim.in1 = self.anim:CreateAnimation("Translation")
self.anim.in1:SetDuration(0)
self.anim.in1:SetOrder(1)
self.anim.in2 = self.anim:CreateAnimation("Translation")
self.anim.in2:SetDuration(duration)
self.anim.in2:SetOrder(2)
self.anim.in2:SetSmoothing("OUT")
self.anim_o = self:CreateAnimationGroup("Move_Out")
self.anim_out2 = self.anim_o:CreateAnimation("Translation")
self.anim_out2:SetDuration(duration)
self.anim_out2:SetOrder(1)
self.anim_out2:SetSmoothing("IN")
self.anim.in1:SetOffset(x,y)
self.anim.in2:SetOffset(-x,-y)
self.anim_out2:SetOffset(x,y)
self.anim_o:SetScript("OnFinished",function() self:Hide() end)
end
 
E.SlideIn = function(self)
if not self.anim then
E.AnimGroup(self)
end
 
self.anim_o:Stop()
self:Show()
self.anim:Play()
end
 
E.SlideOut = function(self)
if self.anim then
self.anim:Finish()
end
 
self.anim:Stop()
self.anim_o:Play()
end
\ No newline at end of file
Eui/lib/Eui/gui.lua New file
0,0 → 1,24
----------------------------------------------------------------------------------------
-- This Module loads new user settings if !aSettings_GUI is loaded
----------------------------------------------------------------------------------------
if not IsAddOnLoaded("EuiSet") or EuiSettings == nil then return end
local E,C = unpack(select(2, ...))
 
for group, options in pairs(EuiSettings) do
if C[group] then
local count = 0
for option, value in pairs(options) do
if C[group][option] ~= nil then
if C[group][option] == value then
EuiSettings[group][option] = nil
else
count = count + 1
C[group][option] = value
end
end
end
if count == 0 then EuiSettings[group] = nil end
else
EuiSettings[group] = nil
end
end
Eui/lib/Eui/move.lua New file
0,0 → 1,314
--Create a Mover frame
 
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
E.CreatedMovers = {}
 
local print = function(...)
return print('|cff1784d1EUI:|r', ...)
end
 
local function CreateMover(parent, name, text, overlay, postdrag)
if not parent then return end --If for some reason the parent isnt loaded yet
 
if overlay == nil then overlay = true end
 
if EuiData == nil then EuiData = {} end
if EuiData[E.myrealm] == nil then EuiData[E.myrealm] = {} end
if EuiData[E.myrealm][E.MyName] == nil then EuiData[E.myrealm][E.MyName] = {} end
if EuiData[E.myrealm][E.MyName]["movers"] == nil then EuiData[E.myrealm][E.MyName]["movers"] = {} end
if EuiData[E.myrealm][E.MyName]["movers"][name] == nil then EuiData[E.myrealm][E.MyName]["movers"][name] = {} end
 
E.Movers = EuiData[E.myrealm][E.MyName]["movers"]
 
local p, p2, p3, p4, p5 = parent:GetPoint()
 
if E.Movers[name]["moved"] == nil then
E.Movers[name]["moved"] = false
 
E.Movers[name]["p"] = nil
E.Movers[name]["p2"] = nil
E.Movers[name]["p3"] = nil
E.Movers[name]["p4"] = nil
end
 
local f = CreateFrame("Frame", nil, UIParent)
f:SetPoint(p, p2, p3, p4, p5)
f:SetWidth(parent:GetWidth())
f:SetHeight(parent:GetHeight())
 
local f2 = CreateFrame("Button", name, UIParent)
f2:SetFrameLevel(parent:GetFrameLevel() + 1)
f2:SetWidth(parent:GetWidth())
f2:SetHeight(parent:GetHeight())
if overlay == true then
f2:SetFrameStrata("DIALOG")
else
f2:SetFrameStrata("BACKGROUND")
end
f2:SetPoint("CENTER", f, "CENTER")
-- f2:SetTemplate("Default", true)
E.EuiSetTemplate(f2)
f2:RegisterForDrag("LeftButton", "RightButton")
f2:SetScript("OnDragStart", function(self)
if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end
self:StartMoving()
end)
 
f2:SetScript("OnDragStop", function(self)
if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end
self:StopMovingOrSizing()
 
E.Movers[name]["moved"] = true
local p, _, p2, p3, p4 = self:GetPoint()
E.Movers[name]["p"] = p
E.Movers[name]["p2"] = p2
E.Movers[name]["p3"] = p3
E.Movers[name]["p4"] = p4
 
if postdrag ~= nil and type(postdrag) == 'function' then
postdrag(self)
end
end)
 
parent:ClearAllPoints()
parent:SetPoint(p3, f2, p3, 0, 0)
parent.ClearAllPoints = E.dummy
parent.SetAllPoints = E.dummy
parent.SetPoint = E.dummy
 
if E.Movers[name]["moved"] == true then
f:ClearAllPoints()
f:SetPoint(E.Movers[name]["p"], UIParent, E.Movers[name]["p3"], E.Movers[name]["p4"], E.Movers[name]["p5"])
end
 
local fs = f2:CreateFontString(nil, "OVERLAY")
fs:SetFont(E.font, 11, "THINOUTLINE")
fs:SetShadowOffset(E.mult*1.2, -E.mult*1.2)
fs:SetJustifyH("CENTER")
fs:SetPoint("CENTER")
fs:SetText(text or name)
fs:SetTextColor(23/255,132/255,209/255)
f2:SetFontString(fs)
f2.text = fs
 
f2:SetScript("OnEnter", function(self)
self.text:SetTextColor(1, 1, 1)
self:SetBackdropBorderColor(23/255,132/255,209/255)
end)
f2:SetScript("OnLeave", function(self)
self.text:SetTextColor(23/255,132/255,209/255)
-- self:SetTemplate("Default", true)
E.EuiSetTemplate(self)
end)
 
f2:SetMovable(true)
f2:Hide()
 
if postdrag ~= nil and type(postdrag) == 'function' then
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event)
postdrag(f2)
self:UnregisterAllEvents()
end)
end
end
 
function E.CreateMover(parent, name, text, overlay, postdrag)
local p, p2, p3, p4, p5 = parent:GetPoint()
 
if E.CreatedMovers[name] == nil then
E.CreatedMovers[name] = {}
E.CreatedMovers[name]["parent"] = parent
E.CreatedMovers[name]["text"] = text
E.CreatedMovers[name]["overlay"] = overlay
E.CreatedMovers[name]["postdrag"] = postdrag
E.CreatedMovers[name]["p"] = p
E.CreatedMovers[name]["p2"] = p2 or "UIParent"
E.CreatedMovers[name]["p3"] = p3
E.CreatedMovers[name]["p4"] = p4
E.CreatedMovers[name]["p5"] = p5
end
 
--Post Variables Loaded..
if EuiData ~= nil then
CreateMover(parent, name, text, overlay, postdrag)
end
end
 
function E.ToggleMovers()
if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end
 
for name, _ in pairs(E.CreatedMovers) do
if _G[name]:IsShown() then
_G[name]:Hide()
else
_G[name]:Show()
end
end
end
 
function E.ResetMovers(arg)
if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end
if arg == "" then
for name, _ in pairs(E.CreatedMovers) do
local n = _G[name]
_G[name]:ClearAllPoints()
_G[name]:SetPoint(E.CreatedMovers[name]["p"], E.CreatedMovers[name]["p2"], E.CreatedMovers[name]["p3"], E.CreatedMovers[name]["p4"], E.CreatedMovers[name]["p5"])
 
E.Movers[name]["moved"] = false
 
E.Movers[name]["p"] = nil
E.Movers[name]["p2"] = nil
E.Movers[name]["p3"] = nil
E.Movers[name]["p4"] = nil
 
for key, value in pairs(E.CreatedMovers[name]) do
if key == "postdrag" and type(value) == 'function' then
value(n)
end
end
end
else
for name, _ in pairs(E.CreatedMovers) do
for key, value in pairs(E.CreatedMovers[name]) do
local mover
if key == "text" then
if arg == value then
_G[name]:ClearAllPoints()
_G[name]:SetPoint(E.CreatedMovers[name]["p"], E.CreatedMovers[name]["p2"], E.CreatedMovers[name]["p3"], E.CreatedMovers[name]["p4"], E.CreatedMovers[name]["p5"])
 
E.Movers[name]["moved"] = false
 
E.Movers[name]["p"] = nil
E.Movers[name]["p2"] = nil
E.Movers[name]["p3"] = nil
E.Movers[name]["p4"] = nil
 
if E.CreatedMovers[name]["postdrag"] ~= nil and type(E.CreatedMovers[name]["postdrag"]) == 'function' then
E.CreatedMovers[name]["postdrag"](_G[name])
end
end
end
end
end
end
end
 
local function SetMoverButtonScript()
--Toggle UI lock button
EuiInfoLeftRButton:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
 
E.ToggleMovers()
 
if C["actionbar"].enable == true then
E.ToggleABLock()
end
 
if oUF then
E.MoveUF()
end
 
if C["threat"].enable == true then
E.ThreatShow()
end
 
if C["info"].apsp ~= 0 then
E.EuiInfoDPSShow()
end
 
if C["info"].dps ~= 0 then
E.EuiInfoAPSPShow()
end
 
if EuiInfoLeftRButton.hovered == true then
local locked = false
GameTooltip:ClearLines()
for name, _ in pairs(E.CreatedMovers) do
if _G[name]:IsShown() then
locked = true
else
locked = false
end
end
 
if locked ~= true then
--GameTooltip:AddLine(UNLOCK.." "..BUG_CATEGORY5,1,1,1)
--else
--GameTooltip:AddLine(LOCK.." "..BUG_CATEGORY5,23/255,132/255,209/255)
end
end
GameTooltip:Show()
end)
 
EuiInfoLeftRButton:SetScript("OnEnter", function(self)
EuiInfoLeftRButton.hovered = true
if InCombatLockdown() then return end
GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, E.Scale(6));
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("BOTTOM", self, "TOP", 0, E.mult)
GameTooltip:ClearLines()
 
local locked = false
for name, _ in pairs(E.CreatedMovers) do
if _G[name]:IsShown() then
locked = true
break
else
locked = false
end
end
 
if locked ~= true then
--GameTooltip:AddLine(UNLOCK.." "..BUG_CATEGORY5,1,1,1)
--else
--GameTooltip:AddLine(LOCK.." "..BUG_CATEGORY5,23/255,132/255,209/255)
end
GameTooltip:Show()
end)
 
EuiInfoLeftRButton:SetScript("OnLeave", function(self)
EuiInfoLeftRButton.hovered = false
GameTooltip:Hide()
end)
end
 
local loadmovers = CreateFrame("Frame")
loadmovers:RegisterEvent("ADDON_LOADED")
loadmovers:RegisterEvent("PLAYER_REGEN_DISABLED")
loadmovers:SetScript("OnEvent", function(self, event, addon)
if event == "ADDON_LOADED" then
if addon ~= "Eui" then return end
for name, _ in pairs(E.CreatedMovers) do
local n = name
local p, t, o, pd
for key, value in pairs(E.CreatedMovers[name]) do
if key == "parent" then
p = value
elseif key == "text" then
t = value
elseif key == "overlay" then
o = value
elseif key == "postdrag" then
pd = value
end
end
CreateMover(p, n, t, o, pd)
end
 
SetMoverButtonScript()
self:UnregisterEvent("ADDON_LOADED")
else
local err = false
for name, _ in pairs(E.CreatedMovers) do
if _G[name]:IsShown() then
err = true
_G[name]:Hide()
end
end
if err == true then
print(ERR_NOT_IN_COMBAT)
end
end
end)
\ No newline at end of file
Eui/lib/tek/tekKonfigScroll.lua New file
0,0 → 1,80
 
local lib, oldminor = LibStub:NewLibrary("tekKonfig-Scroll", 2)
if not lib then return end
 
lib.bg = {
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 12,
insets = { left = 0, right = 0, top = 5, bottom = 5 }
}
 
-- Creates a scrollbar
-- Parent is required, offset and step are optional
function lib.new(parent, offset, step)
local f = CreateFrame("Slider", nil, parent)
f:SetWidth(16)
 
f:SetPoint("TOPRIGHT", 0 - (offset or 0), -16 - (offset or 0))
f:SetPoint("BOTTOMRIGHT", 0 - (offset or 0), 16 + (offset or 0))
 
local up = CreateFrame("Button", nil, f)
up:SetPoint("BOTTOM", f, "TOP")
up:SetWidth(16) up:SetHeight(16)
up:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Up")
up:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Down")
up:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Disabled")
up:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Highlight")
 
up:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
up:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
up:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
up:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
up:GetHighlightTexture():SetBlendMode("ADD")
 
up:SetScript("OnClick", function(self)
local parent = self:GetParent()
parent:SetValue(parent:GetValue() - (step or parent:GetHeight()/2))
PlaySound("UChatScrollButton")
end)
 
local down = CreateFrame("Button", nil, f)
down:SetPoint("TOP", f, "BOTTOM")
down:SetWidth(16) down:SetHeight(16)
down:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up")
down:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down")
down:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Disabled")
down:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Highlight")
 
down:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
down:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
down:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
down:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
down:GetHighlightTexture():SetBlendMode("ADD")
 
down:SetScript("OnClick", function(self)
local parent = self:GetParent()
parent:SetValue(parent:GetValue() + (step or parent:GetHeight()/2))
PlaySound("UChatScrollButton")
end)
 
f:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
local thumb = f:GetThumbTexture()
thumb:SetWidth(16) thumb:SetHeight(24)
thumb:SetTexCoord(1/4, 3/4, 1/8, 7/8)
 
f:SetScript("OnValueChanged", function(self, value)
local min, max = self:GetMinMaxValues()
if value == min then up:Disable() else up:Enable() end
if value == max then down:Disable() else down:Enable() end
end)
 
local border = CreateFrame("Frame", nil, f)
border:SetPoint("TOPLEFT", up, -5, 5)
border:SetPoint("BOTTOMRIGHT", down, 5, -3)
border:SetBackdrop(lib.bg)
border:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 0.5)
 
return f, up, down, border
end
Eui/lib/tek/tek.xml New file
0,0 → 1,7
<Ui xmlns="http://www.blizzard.com/wow/ui/">
 
<Script file='LibStub.lua' />
<Script file='tekShiner.lua' />
<Script file='tekKonfigScroll.lua' />
 
</Ui>
Eui/lib/tek/LibStub.lua New file
0,0 → 1,30
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
 
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
 
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
 
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
 
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
 
function LibStub:IterateLibraries() return pairs(self.libs) end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
Eui/lib/tek/tekShiner.lua New file
0,0 → 1,69
 
local lib = LibStub:NewLibrary("tekShiner", 1)
if not lib then return end
 
 
local R, G, B = .95, .95, .32
local SPEEDS, TIMERS, SHINES, SPACING = {2, 4, 6, 8}, {0, 0, 0, 0}, {}, 6
 
 
function lib.new(parent, r, g, b)
local f = CreateFrame("Frame", nil, parent or UIParent)
f.sparkles, f.timers = {}, {0, 0, 0, 0}
 
for i=1,16 do
local tex = f:CreateTexture(nil, "BACKGROUND")
tex:SetTexture([[Interface\ItemSocketingFrame\UI-ItemSockets]])
tex:SetTexCoord(0.3984375, 0.4453125, 0.40234375, 0.44921875)
tex:SetBlendMode("ADD")
tex:SetWidth(13) tex:SetHeight(13)
tex:SetVertexColor(r or R, g or G, b or B)
f.sparkles[i] = tex
end
 
f:SetScript("OnUpdate", lib.OnUpdate)
 
return f
end
 
 
function lib:OnUpdate(elapsed)
for i,timer in pairs(self.timers) do
self.timers[i] = timer + elapsed
if self.timers[i] > SPEEDS[i]*4 then self.timers[i] = 0 end
end
 
local parent, distance = self, self:GetWidth()
 
for i=1,4 do
local timer, speed = self.timers[i], SPEEDS[i]
 
if timer <= speed then
local basePosition = timer/speed*distance
self.sparkles[0+i]:SetPoint("CENTER", self, "TOPLEFT", basePosition, 0)
self.sparkles[4+i]:SetPoint("CENTER", self, "BOTTOMRIGHT", -basePosition, 0)
self.sparkles[8+i]:SetPoint("CENTER", self, "TOPRIGHT", 0, -basePosition)
self.sparkles[12+i]:SetPoint("CENTER", self, "BOTTOMLEFT", 0, basePosition)
elseif timer <= speed*2 then
local basePosition = (timer-speed)/speed*distance
self.sparkles[0+i]:SetPoint("CENTER", self, "TOPRIGHT", 0, -basePosition)
self.sparkles[4+i]:SetPoint("CENTER", self, "BOTTOMLEFT", 0, basePosition)
self.sparkles[8+i]:SetPoint("CENTER", self, "BOTTOMRIGHT", -basePosition, 0)
self.sparkles[12+i]:SetPoint("CENTER", self, "TOPLEFT", basePosition, 0)
elseif timer <= speed*3 then
local basePosition = (timer-speed*2)/speed*distance
self.sparkles[0+i]:SetPoint("CENTER", self, "BOTTOMRIGHT", -basePosition, 0)
self.sparkles[4+i]:SetPoint("CENTER", self, "TOPLEFT", basePosition, 0)
self.sparkles[8+i]:SetPoint("CENTER", self, "BOTTOMLEFT", 0, basePosition)
self.sparkles[12+i]:SetPoint("CENTER", self, "TOPRIGHT", 0, -basePosition)
else
local basePosition = (timer-speed*3)/speed*distance
self.sparkles[0+i]:SetPoint("CENTER", self, "BOTTOMLEFT", 0, basePosition)
self.sparkles[4+i]:SetPoint("CENTER", self, "TOPRIGHT", 0, -basePosition)
self.sparkles[8+i]:SetPoint("CENTER", self, "TOPLEFT", basePosition, 0)
self.sparkles[12+i]:SetPoint("CENTER", self, "BOTTOMRIGHT", -basePosition, 0)
end
end
end
 
 
Eui/lib/lib.xml New file
0,0 → 1,10
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file='Eui\Eui.lua' />
<Include file="Eui\Eui.xml"/>
<Include file="Eui\gui.lua"/>
<Script file="Eui\init.lua"/>
<Include file="Eui\move.lua"/>
<Script file="Eui\anim.lua"/>
<Include file="oUF\Ouf.xml"/>
<Include file="tek\tek.xml"/>
</Ui>
\ No newline at end of file
Eui/lib/oUF/oUF.xml New file
0,0 → 1,43
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file='ouf.lua' />
 
<Script file='elements\power.lua' />
<Script file='elements\aura.lua' />
<Script file='elements\health.lua' />
<Script file='elements\cpoints.lua' />
<Script file='elements\ricons.lua' />
<Script file='elements\leader.lua' />
<Script file='elements\combat.lua' />
<Script file='elements\resting.lua' />
<Script file='elements\pvp.lua' />
<Script file='elements\portraits.lua' />
<Script file='elements\range.lua' />
<Script file='elements\happiness.lua' />
<Script file='elements\castbar.lua' />
<Script file='elements\threat.lua' />
<Script file='elements\tags.lua' />
<Script file='elements\vehicle.lua' />
<Script file='elements\masterlooter.lua' />
<Script file='elements\assistant.lua' />
<Script file='elements\runebar.lua' />
<Script file='elements\lfdrole.lua' />
 
<!--
This template requires the layout to set the anchoring positions from the
sub-frame(s). These are feed to the layouts style functions as any other unit
spawned by a header. The main difference is that they have the unitsuffix
attribute set (and they are parented to their respective owener).
<Button name="oUF_HeaderTargetTemplate" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
-->
</Ui>
Eui/lib/oUF/ouf.lua New file
0,0 → 1,743
local parent, ns = ...
local global = GetAddOnMetadata(parent, 'X-oUF')
local _VERSION = GetAddOnMetadata(parent, 'version')
 
local function argcheck(value, num, ...)
assert(type(num) == 'number', "Bad argument #2 to 'argcheck' (number expected, got "..type(num)..")")
 
for i=1,select("#", ...) do
if type(value) == select(i, ...) then return end
end
 
local types = strjoin(", ", ...)
local name = string.match(debugstack(2,2,0), ": in function [`<](.-)['>]")
error(("Bad argument #%d to '%s' (%s expected, got %s"):format(num, name, types, type(value)), 3)
end
 
local print = function(...) print("|cff33ff99oUF:|r", ...) end
local error = function(...) print("|cffff0000Error:|r "..string.format(...)) end
local dummy = function() end
 
-- Colors
local colors = {
happiness = {
[1] = {1, 0, 0}, -- need.... | unhappy
[2] = {1, 1, 0}, -- new..... | content
[3] = {0, 1, 0}, -- colors.. | happy
},
smooth = {
1, 0, 0,
1, 1, 0,
0, 1, 0
},
disconnected = {.6, .6, .6},
tapped = {.6,.6,.6},
class = {},
reaction = {},
}
 
-- We do this because people edit the vars directly, and changing the default
-- globals makes SPICE FLOW!
if(IsAddOnLoaded'!ClassColors' and CUSTOM_CLASS_COLORS) then
local updateColors = function()
for eclass, color in next, CUSTOM_CLASS_COLORS do
colors.class[eclass] = {color.r, color.g, color.b}
end
 
local oUF = ns.oUF or _G[parent]
if(oUF) then
for _, obj in next, oUF.objects do
obj:UpdateAllElements("CUSTOM_CLASS_COLORS")
end
end
end
 
updateColors()
CUSTOM_CLASS_COLORS:RegisterCallback(updateColors)
else
for eclass, color in next, RAID_CLASS_COLORS do
colors.class[eclass] = {color.r, color.g, color.b}
end
end
 
for eclass, color in next, FACTION_BAR_COLORS do
colors.reaction[eclass] = {color.r, color.g, color.b}
end
 
-- add-on object
local oUF = {}
local event_metatable = {
__call = function(funcs, self, ...)
for _, func in next, funcs do
func(self, ...)
end
end,
}
 
local styles, style = {}
local callback, units, objects = {}, {}, {}
 
local select = select
local UnitExists = UnitExists
 
local conv = {
['playerpet'] = 'pet',
['playertarget'] = 'target',
}
local elements = {}
 
local enableTargetUpdate = function(object)
-- updating of "invalid" units.
local OnTargetUpdate
do
local timer = 0
OnTargetUpdate = function(self, elapsed)
if(not self.unit) then
return
elseif(timer >= .5) then
self:UpdateAllElements'OnTargetUpdate'
timer = 0
end
 
timer = timer + elapsed
end
end
 
object:SetScript("OnUpdate", OnTargetUpdate)
end
 
-- Events
local OnEvent = function(self, event, ...)
if(not self:IsShown()) then return end
return self[event](self, event, ...)
end
 
local iterateChildren = function(...)
for l = 1, select("#", ...) do
local obj = select(l, ...)
 
if(type(obj) == 'table' and obj.isChild) then
local unit = SecureButton_GetModifiedUnit(obj)
local subUnit = conv[unit] or unit
units[subUnit] = obj
obj.unit = subUnit
obj:UpdateAllElements"PLAYER_ENTERING_WORLD"
end
end
end
 
local OnAttributeChanged = function(self, name, value)
if(name == "unit" and value) then
units[value] = self
 
if(self.unit and self.unit == value) then
return
else
if(self.hasChildren) then
iterateChildren(self:GetChildren())
end
 
self.unit = SecureButton_GetModifiedUnit(self)
self.id = value:match"^.-(%d+)"
self:UpdateAllElements"PLAYER_ENTERING_WORLD"
end
end
end
 
do
local HandleFrame = function(baseName)
local frame
if(type(baseName) == 'string') then
frame = _G[baseName]
else
frame = baseName
end
 
if(frame) then
frame:UnregisterAllEvents()
frame.Show = dummy
frame:Hide()
 
local health = frame.healthbar
if(health) then
health:UnregisterAllEvents()
end
 
local power = frame.manabar
if(power) then
power:UnregisterAllEvents()
end
 
local spell = frame.spellbar
if(spell) then
spell:UnregisterAllEvents()
end
end
end
 
function oUF:DisableBlizzard(unit, object)
if(not unit) then return end
 
local baseName
if(unit == 'player') then
HandleFrame(PlayerFrame)
 
-- For the damn vehicle support:
PlayerFrame:RegisterEvent('UNIT_ENTERING_VEHICLE')
PlayerFrame:RegisterEvent('UNIT_ENTERED_VEHICLE')
PlayerFrame:RegisterEvent('UNIT_EXITING_VEHICLE')
PlayerFrame:RegisterEvent('UNIT_EXITED_VEHICLE')
elseif(unit == 'pet') then
baseName = PetFrame
elseif(unit == 'target') then
if(object) then
object:RegisterEvent('PLAYER_TARGET_CHANGED', object.UpdateAllElements)
end
 
HandleFrame(TargetFrame)
return HandleFrame(ComboFrame)
elseif(unit == 'mouseover') then
if(object) then
return object:RegisterEvent('UPDATE_MOUSEOVER_UNIT', object.UpdateAllElements)
end
elseif(unit == 'focus') then
if(object) then
object:RegisterEvent('PLAYER_FOCUS_CHANGED', object.UpdateAllElements)
end
 
baseName = FocusFrame
elseif(unit:match'%w+target') then
if(unit == 'targettarget') then
baseName = TargetFrameToT
end
 
enableTargetUpdate(object)
elseif(unit:match'(boss)%d?$' == 'boss') then
enableTargetUpdate(object)
 
local id = unit:match'boss(%d)'
if(id) then
baseName = 'Boss' .. id .. 'TargetFrame'
else
for i=1, 3 do
HandleFrame(('Boss%dTargetFrame'):format(i))
end
end
elseif(unit:match'(party)%d?$' == 'party') then
local id = unit:match'party(%d)'
if(id) then
baseName = 'PartyMemberFrame' .. id
else
for i=1, 4 do
HandleFrame(('PartyMemberFrame%d'):format(i))
end
end
end
 
if(baseName) then
return HandleFrame(baseName)
end
end
end
 
local frame_metatable = {
__index = CreateFrame"Button"
}
 
for k, v in pairs{
colors = colors;
 
EnableElement = function(self, name, unit)
argcheck(name, 2, 'string')
argcheck(unit, 3, 'string', 'nil')
 
local element = elements[name]
if(not element) then return end
 
local updateFunc = element.update
local elementTable = self[name]
if(type(elementTable) == 'table' and elementTable.Update) then
updateFunc = elementTable.Update
end
 
if(element.enable(self, unit or self.unit)) then
table.insert(self.__elements, updateFunc)
end
end,
 
DisableElement = function(self, name)
argcheck(name, 2, 'string')
local element = elements[name]
if(not element) then return end
 
local updateFunc = element.update
local elementTable = self[name]
if(type(elementTable) == 'table' and elementTable.Update) then
updateFunc = elementTable.Update
end
 
for k, update in next, self.__elements do
if(update == updateFunc) then
table.remove(self.__elements, k)
 
-- We need to run a new update cycle incase we knocked ourself out of sync.
-- The main reason we do this is to make sure the full update is completed
-- if an element for some reason removes itself _during_ the update
-- progress.
self:UpdateAllElements('DisableElement', name)
break
end
end
 
return element.disable(self)
end,
 
UpdateElement = function(self, name)
argcheck(name, 2, 'string')
local element = elements[name]
if(not element) then return end
 
local updateFunc = element.update
local elementTable = self[name]
if(type(elementTable) == 'table' and elementTable.Update) then
updateFunc = elementTable.Update
end
 
updateFunc(self, 'UpdateElement', self.unit)
end,
 
Enable = RegisterUnitWatch,
Disable = function(self)
UnregisterUnitWatch(self)
self:Hide()
end,
 
UpdateAllElements = function(self, event)
local unit = self.unit
if(not UnitExists(unit)) then return end
 
for _, func in next, self.__elements do
func(self, event, unit)
end
end,
} do
frame_metatable.__index[k] = v
end
 
do
local RegisterEvent = frame_metatable.__index.RegisterEvent
function frame_metatable.__index:RegisterEvent(event, func)
argcheck(event, 2, 'string')
 
if(type(func) == 'string' and type(self[func]) == 'function') then
func = self[func]
end
 
local curev = self[event]
if(curev and func) then
if(type(curev) == 'function') then
self[event] = setmetatable({curev, func}, event_metatable)
else
for _, infunc in next, curev do
if(infunc == func) then return end
end
 
table.insert(curev, func)
end
elseif(self:IsEventRegistered(event)) then
return
else
if(func) then
self[event] = func
elseif(not self[event]) then
return error("Handler for event [%s] on unit [%s] does not exist.", event, self.unit or 'unknown')
end
 
RegisterEvent(self, event)
end
end
end
 
do
local UnregisterEvent = frame_metatable.__index.UnregisterEvent
function frame_metatable.__index:UnregisterEvent(event, func)
argcheck(event, 2, 'string')
 
local curev = self[event]
if(type(curev) == 'table' and func) then
for k, infunc in next, curev do
if(infunc == func) then
curev[k] = nil
 
if(#curev == 0) then
table.remove(curev, k)
UnregisterEvent(self, event)
end
 
break
end
end
else
self[event] = nil
UnregisterEvent(self, event)
end
end
end
 
local ColorGradient
do
local inf = math.huge
-- http://www.wowwiki.com/ColorGradient
function ColorGradient(perc, ...)
-- Translate divison by zeros into 0, so we don't blow select.
-- We check perc against itself because we rely on the fact that NaN can't equal NaN.
if(perc ~= perc or perc == inf) then perc = 0 end
 
if perc >= 1 then
local r, g, b = select(select('#', ...) - 2, ...)
return r, g, b
elseif perc <= 0 then
local r, g, b = ...
return r, g, b
end
 
local num = select('#', ...) / 3
local segment, relperc = math.modf(perc*(num-1))
local r1, g1, b1, r2, g2, b2 = select((segment*3)+1, ...)
 
return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc
end
end
frame_metatable.__index.ColorGradient = ColorGradient
oUF.ColorGradient = ColorGradient
 
local initObject = function(unit, style, styleFunc, ...)
local num = select('#', ...)
for i=1, num do
local object = select(i, ...)
 
object.__elements = {}
object = setmetatable(object, frame_metatable)
 
-- Attempt to guess what the header is set to spawn.
local parent = object:GetParent()
if(not unit) then
if(parent:GetAttribute'showRaid') then
unit = 'raid'
elseif(parent:GetAttribute'showParty') then
unit = 'party'
end
end
 
-- Run it before the style function so they can override it.
object:SetAttribute("*type1", "target")
object.style = style
 
if(num > 1) then
if(i == 1) then
object.hasChildren = true
else
object.isChild = true
end
end
 
-- Register it early so it won't be executed after the layouts PEW, if they
-- have one.
object:RegisterEvent("PLAYER_ENTERING_WORLD", object.UpdateAllElements)
 
styleFunc(object, unit)
 
local height = object:GetAttribute'initial-height'
local width = object:GetAttribute'initial-width'
local scale = object:GetAttribute'initial-scale'
local suffix = object:GetAttribute'unitsuffix'
local combat = InCombatLockdown()
 
if(height) then
object:SetAttribute('initial-height', height)
if(not combat) then object:SetHeight(height) end
end
 
if(width) then
object:SetAttribute("initial-width", width)
if(not combat) then object:SetWidth(width) end
end
 
if(scale) then
object:SetAttribute("initial-scale", scale)
if(not combat) then object:SetScale(scale) end
end
 
local showPlayer
if(i == 1) then
showPlayer = parent:GetAttribute'showPlayer' or parent:GetAttribute'showSolo'
end
 
if(suffix and suffix:match'target' and (i ~= 1 and not showPlayer)) then
enableTargetUpdate(object)
else
object:SetScript("OnEvent", OnEvent)
end
 
object:SetScript("OnAttributeChanged", OnAttributeChanged)
object:SetScript("OnShow", object.UpdateAllElements)
 
for element in next, elements do
object:EnableElement(element, unit)
end
 
for _, func in next, callback do
func(object)
end
 
-- We could use ClickCastFrames only, but it will probably contain frames that
-- we don't care about.
table.insert(objects, object)
_G.ClickCastFrames = ClickCastFrames or {}
ClickCastFrames[object] = true
end
end
 
local walkObject = function(object, unit)
local style = object:GetParent().style or style
local styleFunc = styles[style]
 
return initObject(unit, style, styleFunc, object, object:GetChildren())
end
 
function oUF:RegisterInitCallback(func)
table.insert(callback, func)
end
 
function oUF:RegisterMetaFunction(name, func)
argcheck(name, 2, 'string')
argcheck(func, 3, 'function', 'table')
 
if(frame_metatable.__index[name]) then
return
end
 
frame_metatable.__index[name] = func
end
 
function oUF:RegisterStyle(name, func)
argcheck(name, 2, 'string')
argcheck(func, 3, 'function', 'table')
 
if(styles[name]) then return error("Style [%s] already registered.", name) end
if(not style) then style = name end
 
styles[name] = func
end
 
function oUF:SetActiveStyle(name)
argcheck(name, 2, 'string')
if(not styles[name]) then return error("Style [%s] does not exist.", name) end
 
style = name
end
 
do
local function iter(_, n)
-- don't expose the style functions.
return (next(styles, n))
end
 
function oUF.IterateStyles()
return iter, nil, nil
end
end
 
local getCondition
do
local conditions = {
raid40 = '[@raid26,exists] show;',
raid25 = '[@raid11,exists] show;',
raid10 = '[@raid6,exists] show;',
raid = '[group:raid] show;',
party = '[group:party,nogroup:raid] show;',
solo = '[@player,exists,nogroup:party] show;',
}
 
function getCondition(...)
local cond = ''
 
for i=1, select('#', ...) do
local short = select(i, ...)
 
local condition = conditions[short]
if(condition) then
cond = cond .. condition
end
end
 
return cond .. 'hide'
end
end
 
local generateName = function(unit, ...)
local name = 'oUF_' .. style:gsub('[^%a%d_]+', '')
 
local raid, party, groupFilter
for i=1, select('#', ...), 2 do
local att, val = select(i, ...)
if(att == 'showRaid') then
raid = true
elseif(att == 'showParty') then
party = true
elseif(att == 'groupFilter') then
groupFilter = val
end
end
 
local append
if(raid) then
if(groupFilter) then
if(groupFilter:match'TANK') then
append = 'MainTank'
elseif(groupFilter:match'ASSIST') then
append = 'MainAssist'
else
local _, count = groupFilter:gsub(',', '')
if(count == 0) then
append = groupFilter
else
append = 'Raid'
end
end
else
append = 'Raid'
end
elseif(party) then
append = 'Party'
elseif(unit) then
append = unit:gsub("^%l", string.upper)
end
 
if(append) then
name = name .. append
end
 
local base = name
local i = 2
while(_G[name]) do
name = base .. i
i = i + 1
end
 
return name
end
 
function oUF:SpawnHeader(overrideName, template, visibility, ...)
if(not style) then return error("Unable to create frame. No styles have been registered.") end
 
local name = overrideName or generateName(nil, ...)
local header = CreateFrame('Frame', name, UIParent, template or 'SecureGroupHeaderTemplate')
header.initialConfigFunction = walkObject
header.style = style
 
header:SetAttribute("template", "SecureUnitButtonTemplate")
for i=1, select("#", ...), 2 do
local att, val = select(i, ...)
if(not att) then break end
header:SetAttribute(att, val)
end
 
if(header:GetAttribute'showParty') then
self:DisableBlizzard'party'
end
 
if(visibility) then
local type, list = string.split(' ', visibility, 2)
if(list and type == 'custom') then
RegisterStateDriver(header, 'visibility', list)
else
local condition = getCondition(string.split(',', visibility))
RegisterStateDriver(header, 'visibility', condition)
end
end
 
return header
end
 
function oUF:Spawn(unit, overrideName)
argcheck(unit, 2, 'string')
if(not style) then return error("Unable to create frame. No styles have been registered.") end
 
unit = unit:lower()
 
local name = overrideName or generateName(unit)
local object = CreateFrame("Button", name, UIParent, "SecureUnitButtonTemplate")
object.unit = unit
object.id = unit:match"^.-(%d+)"
 
units[unit] = object
walkObject(object, unit)
 
object:SetAttribute("unit", unit)
RegisterUnitWatch(object)
 
self:DisableBlizzard(unit, object)
 
return object
end
 
do
local _QUEUE = {}
local _FACTORY = CreateFrame'Frame'
_FACTORY:SetScript('OnEvent', OnEvent)
_FACTORY:RegisterEvent'PLAYER_LOGIN'
_FACTORY.active = true
 
function _FACTORY:PLAYER_LOGIN()
if(not self.active) then return end
 
for _, func in next, _QUEUE do
func(oUF)
end
end
 
function oUF:Factory(func)
argcheck(func, 2, 'function')
 
table.insert(_QUEUE, func)
end
 
function oUF:EnableFactory()
_FACTORY.active = true
end
 
function oUF:DisableFactory()
_FACTORY.active = nil
end
end
 
function oUF:AddElement(name, update, enable, disable)
argcheck(name, 2, 'string')
argcheck(update, 3, 'function', 'nil')
argcheck(enable, 4, 'function', 'nil')
argcheck(disable, 5, 'function', 'nil')
 
if(elements[name]) then return error('Element [%s] is already registered.', name) end
elements[name] = {
update = update;
enable = enable;
disable = disable;
}
end
 
oUF.version = _VERSION
oUF.units = units
oUF.objects = objects
oUF.colors = colors
 
oUF.error = error
 
if(global) then
if(parent ~= 'oUF' and global == 'oUF' and IsAddOnLoaded'oUF') then
error("%s attempted to override oUF's default global with its internal oUF.", parent)
else
_G[global] = oUF
end
end
ns.oUF = oUF
Eui/lib/oUF/elements/pvp.lua New file
0,0 → 1,37
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event, unit)
if(unit ~= self.unit) then return end
 
if(self.PvP) then
local factionGroup = UnitFactionGroup(unit)
if(UnitIsPVPFreeForAll(unit)) then
self.PvP:SetTexture[[Interface\TargetingFrame\UI-PVP-FFA]]
self.PvP:Show()
elseif(factionGroup and UnitIsPVP(unit)) then
self.PvP:SetTexture([[Interface\TargetingFrame\UI-PVP-]]..factionGroup)
self.PvP:Show()
else
self.PvP:Hide()
end
end
end
 
local Enable = function(self)
local pvp = self.PvP
if(pvp) then
self:RegisterEvent("UNIT_FACTION", pvp.Update or Update)
 
return true
end
end
 
local Disable = function(self)
local pvp = self.PvP
if(pvp) then
self:UnregisterEvent("UNIT_FACTION", pvp.Update or Update)
end
end
 
oUF:AddElement('PvP', Update, Enable, Disable)
Eui/lib/oUF/elements/health.lua New file
0,0 → 1,127
local parent, ns = ...
local oUF = ns.oUF
 
oUF.colors.health = {49/255, 207/255, 37/255}
 
local Update = function(self, event, unit)
if(self.unit ~= unit) then return end
local health = self.Health
 
if(health.PreUpdate) then health:PreUpdate(unit) end
 
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local disconnected = not UnitIsConnected(unit)
health:SetMinMaxValues(0, max)
 
if(disconnected) then
health:SetValue(max)
else
health:SetValue(min)
end
 
health.disconnected = disconnected
health.unit = unit
 
local r, g, b, t
if(health.colorTapping and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
t = self.colors.tapped
elseif(health.colorDisconnected and not UnitIsConnected(unit)) then
t = self.colors.disconnected
elseif(health.colorHappiness and UnitIsUnit(unit, "pet") and GetPetHappiness()) then
t = self.colors.happiness[GetPetHappiness()]
elseif(health.colorClass and UnitIsPlayer(unit)) or
(health.colorClassNPC and not UnitIsPlayer(unit)) or
(health.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then
local _, class = UnitClass(unit)
t = self.colors.class[class]
elseif(health.colorReaction and UnitReaction(unit, 'player')) then
t = self.colors.reaction[UnitReaction(unit, "player")]
elseif(health.colorSmooth) then
r, g, b = self.ColorGradient(min / max, unpack(health.smoothGradient or self.colors.smooth))
elseif(health.colorHealth) then
t = self.colors.health
end
 
if(t) then
r, g, b = t[1], t[2], t[3]
end
 
if(b) then
health:SetStatusBarColor(r, g, b)
 
local bg = health.bg
if(bg) then
local mu = bg.multiplier or 1
bg:SetVertexColor(r * mu, g * mu, b * mu)
end
end
 
if(health.PostUpdate) then
return health:PostUpdate(unit, min, max)
end
end
 
local OnHealthUpdate
do
local UnitHealth = UnitHealth
OnHealthUpdate = function(self)
if(self.disconnected) then return end
local health = UnitHealth(self.unit)
 
if(health ~= self.min) then
self.min = health
 
return (self.Update or Update) (self:GetParent(), "OnHealthUpdate", self.unit)
end
end
end
 
local Enable = function(self, unit)
local health = self.Health
if(health) then
local Update = health.Update or Update
if(health.frequentUpdates and (unit and not unit:match'%w+target$')) then
-- TODO 1.5: We should do this regardless of frequentUpdates.
if(health:GetParent() ~= self) then
return oUF.error('Element [%s] is incorrectly parented on [%s]. Expected self, got something else.', 'Health', unit)
end
 
health:SetScript('OnUpdate', OnHealthUpdate)
 
-- The party frames need this to handle disconnect states correctly.
if(unit == 'party') then
self:RegisterEvent("UNIT_HEALTH", Update)
end
else
self:RegisterEvent("UNIT_HEALTH", Update)
end
 
self:RegisterEvent("UNIT_MAXHEALTH", Update)
self:RegisterEvent('UNIT_HAPPINESS', Update)
-- For tapping.
self:RegisterEvent('UNIT_FACTION', Update)
 
if(not health:GetStatusBarTexture()) then
health:SetStatusBarTexture[[Interface\TargetingFrame\UI-StatusBar]]
end
 
return true
end
end
 
local Disable = function(self)
local health = self.Health
if(health) then
local Update = health.Update or Update
if(health:GetScript'OnUpdate') then
health:SetScript('OnUpdate', nil)
end
 
self:UnregisterEvent('UNIT_HEALTH', Update)
self:UnregisterEvent('UNIT_MAXHEALTH', Update)
self:UnregisterEvent('UNIT_HAPPINESS', Update)
self:UnregisterEvent('UNIT_FACTION', Update)
end
end
 
oUF:AddElement('Health', Update, Enable, Disable)
Eui/lib/oUF/elements/combat.lua New file
0,0 → 1,37
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event)
if(UnitAffectingCombat"player") then
self.Combat:Show()
else
self.Combat:Hide()
end
end
 
local Enable = function(self, unit)
local combat = self.Combat
if(combat and unit == 'player') then
local Update = combat.Update or Update
self:RegisterEvent("PLAYER_REGEN_DISABLED", Update)
self:RegisterEvent("PLAYER_REGEN_ENABLED", Update)
 
if(self.Combat:IsObjectType"Texture" and not self.Combat:GetTexture()) then
self.Combat:SetTexture[[Interface\CharacterFrame\UI-StateIcon]]
self.Combat:SetTexCoord(.5, 1, 0, .49)
end
 
return true
end
end
 
local Disable = function(self)
local combat = self.Combat
if(combat) then
local Update = combat.Update or Update
self:UnregisterEvent("PLAYER_REGEN_DISABLED", Update)
self:UnregisterEvent("PLAYER_REGEN_ENABLED", Update)
end
end
 
oUF:AddElement('Combat', Update, Enable, Disable)
Eui/lib/oUF/elements/assistant.lua New file
0,0 → 1,33
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event)
local unit = self.unit
if(UnitInRaid(unit) and UnitIsRaidOfficer(unit) and not UnitIsPartyLeader(unit)) then
self.Assistant:Show()
else
self.Assistant:Hide()
end
end
 
local Enable = function(self)
local assistant = self.Assistant
if(assistant) then
self:RegisterEvent("PARTY_MEMBERS_CHANGED", assistant.Update or Update)
 
if(assistant:IsObjectType"Texture" and not assistant:GetTexture()) then
assistant:SetTexture[[Interface\GroupFrame\UI-Group-AssistantIcon]]
end
 
return true
end
end
 
local Disable = function(self)
local assistant = self.Assistant
if(assistant) then
self:UnregisterEvent("PARTY_MEMBERS_CHANGED", assistant.Update or Update)
end
end
 
oUF:AddElement('Assistant', Update, Enable, Disable)
Eui/lib/oUF/elements/resting.lua New file
0,0 → 1,33
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event)
if(IsResting()) then
self.Resting:Show()
else
self.Resting:Hide()
end
end
 
local Enable = function(self, unit)
local resting = self.Resting
if(resting and unit == 'player') then
self:RegisterEvent("PLAYER_UPDATE_RESTING", resting.Update or Update)
 
if(resting:IsObjectType"Texture" and not resting:GetTexture()) then
resting:SetTexture[[Interface\CharacterFrame\UI-StateIcon]]
resting:SetTexCoord(0, .5, 0, .421875)
end
 
return true
end
end
 
local Disable = function(self)
local resting = self.Resting
if(resting) then
self:UnregisterEvent("PLAYER_UPDATE_RESTING", resting.Update or Update)
end
end
 
oUF:AddElement('Resting', Update, Enable, Disable)
Eui/lib/oUF/elements/vehicle.lua New file
0,0 → 1,56
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event, unit)
if(event == 'VehicleSwitch') then return end
 
-- Calculate units to work with
local realUnit, modUnit = SecureButton_GetUnit(self), SecureButton_GetModifiedUnit(self)
 
-- _GetUnit() doesn't rewrite playerpet -> pet like _GetModifiedUnit does.
if(realUnit == 'playerpet') then
realUnit = 'pet'
end
 
if(modUnit == "pet" and realUnit ~= "pet") then
modUnit = "vehicle"
end
 
-- Do not update if this frame is not concerned
if(unit ~= modUnit and unit ~= realUnit and unit ~= self.unit) then return end
 
-- Update the frame unit properties
self.unit = modUnit
if(modUnit ~= realUnit) then
self.realUnit = realUnit
else
self.realUnit = nil
end
 
-- Refresh the frame
return self:UpdateAllElements('VehicleSwitch')
end
 
local Enable = function(self, unit)
if(
self.disallowVehicleSwap or
(unit and unit:match'target') or
self:GetAttribute'unitsuffix' == 'target'
) then return end
 
self:RegisterEvent('UNIT_ENTERED_VEHICLE', Update)
self:RegisterEvent('UNIT_EXITED_VEHICLE', Update)
 
self:SetAttribute('toggleForVehicle', true)
 
return true
end
 
local Disable = function(self)
self:UnregisterEvent('UNIT_ENTERED_VEHICLE', Update)
self:UnregisterEvent('UNIT_EXITED_VEHICLE', Update)
 
self:SetAttribute('toggleForVehicle', nil)
end
 
oUF:AddElement("VehicleSwitch", Update, Enable, Disable)
Eui/lib/oUF/elements/castbar.lua New file
0,0 → 1,423
--[[
Original codebase:
oUF_Castbar by starlon.
http://svn.wowace.com/wowace/trunk/oUF_Castbar/
--]]
local parent, ns = ...
local oUF = ns.oUF
 
local noop = function() end
local UnitName = UnitName
local GetTime = GetTime
local UnitCastingInfo = UnitCastingInfo
local UnitChannelInfo = UnitChannelInfo
 
local UNIT_SPELLCAST_START = function(self, event, unit, spell, spellrank)
if(self.unit ~= unit) then return end
 
local castbar = self.Castbar
local name, rank, text, texture, startTime, endTime, _, castid, interrupt = UnitCastingInfo(unit)
if(not name) then
castbar:Hide()
return
end
 
endTime = endTime / 1e3
startTime = startTime / 1e3
local max = endTime - startTime
 
castbar.castid = castid
castbar.duration = GetTime() - startTime
castbar.max = max
castbar.delay = 0
castbar.casting = true
castbar.interrupt = interrupt
 
castbar:SetMinMaxValues(0, max)
castbar:SetValue(0)
 
if(castbar.Text) then castbar.Text:SetText(text) end
if(castbar.Icon) then castbar.Icon:SetTexture(texture) end
if(castbar.Time) then castbar.Time:SetText() end
 
local shield = castbar.Shield
if(shield and interrupt) then
shield:Show()
elseif(shield) then
shield:Hide()
end
 
local sf = castbar.SafeZone
if(sf) then
sf:ClearAllPoints()
sf:SetPoint'RIGHT'
sf:SetPoint'TOP'
sf:SetPoint'BOTTOM'
end
 
if(castbar.PostCastStart) then
castbar:PostCastStart(unit, name, rank, castid)
end
castbar:Show()
end
 
local UNIT_SPELLCAST_FAILED = function(self, event, unit, spellname, spellrank, castid)
if(self.unit ~= unit) then return end
 
local castbar = self.Castbar
if(castbar.castid ~= castid) then
return
end
 
castbar.casting = nil
castbar.interrupt = nil
castbar:SetValue(0)
castbar:Hide()
 
if(castbar.PostCastFailed) then
return castbar:PostCastFailed(unit, spellname, spellrank, castid)
end
end
 
local UNIT_SPELLCAST_INTERRUPTED = function(self, event, unit, spellname, spellrank, castid)
if(self.unit ~= unit) then return end
 
local castbar = self.Castbar
if(castbar.castid ~= castid) then
return
end
castbar.casting = nil
castbar.channeling = nil
 
castbar:SetValue(0)
castbar:Hide()
 
if(castbar.PostCastInterrupted) then
return castbar:PostCastInterrupted(unit, spellname, spellrank, castid)
end
end
 
local UNIT_SPELLCAST_INTERRUPTIBLE = function(self, event, unit)
if(self.unit ~= unit) then return end
 
local shield = self.Castbar.Shield
if(shield) then
shield:Hide()
end
 
local castbar = self.Castbar
if(castbar.PostCastInterruptible) then
return castbar:PostCastInterruptible(unit)
end
end
 
local UNIT_SPELLCAST_NOT_INTERRUPTIBLE = function(self, event, unit)
if(self.unit ~= unit) then return end
 
local shield = self.Castbar.Shield
if(shield) then
shield:Show()
end
 
local castbar = self.Castbar
if(castbar.PostCastNotInterruptible) then
return castbar:PostCastNotInterruptible(unit)
end
end
 
local UNIT_SPELLCAST_DELAYED = function(self, event, unit, spellname, spellrank, castid)
if(self.unit ~= unit) then return end
 
local name, rank, text, texture, startTime, endTime = UnitCastingInfo(unit)
if(not startTime) then return end
 
local castbar = self.Castbar
local duration = GetTime() - (startTime / 1000)
if(duration < 0) then duration = 0 end
 
castbar.delay = castbar.delay + castbar.duration - duration
castbar.duration = duration
 
castbar:SetValue(duration)
 
if(castbar.PostCastDelayed) then
return castbar:PostCastDelayed(unit, name, rank, castid)
end
end
 
local UNIT_SPELLCAST_STOP = function(self, event, unit, spellname, spellrank, castid)
if(self.unit ~= unit) then return end
 
local castbar = self.Castbar
if(castbar.castid ~= castid) then
return
end
 
castbar.casting = nil
castbar.interrupt = nil
castbar:SetValue(0)
castbar:Hide()
 
if(castbar.PostCastStop) then
return castbar:PostCastStop(unit, spellname, spellrank, castid)
end
end
 
local UNIT_SPELLCAST_CHANNEL_START = function(self, event, unit, spellname, spellrank)
if(self.unit ~= unit) then return end
 
local castbar = self.Castbar
local name, rank, text, texture, startTime, endTime, isTrade, interrupt = UnitChannelInfo(unit)
if(not name) then
return
end
 
endTime = endTime / 1e3
startTime = startTime / 1e3
local max = (endTime - startTime)
local duration = endTime - GetTime()
 
castbar.duration = duration
castbar.max = max
castbar.delay = 0
castbar.channeling = true
castbar.interrupt = interrupt
 
castbar:SetMinMaxValues(0, max)
castbar:SetValue(duration)
 
if(castbar.Text) then castbar.Text:SetText(name) end
if(castbar.Icon) then castbar.Icon:SetTexture(texture) end
if(castbar.Time) then castbar.Time:SetText() end
 
local shield = castbar.Shield
if(shield and interrupt) then
shield:Show()
elseif(shield) then
shield:Hide()
end
 
local sf = castbar.SafeZone
if(sf) then
sf:ClearAllPoints()
sf:SetPoint'LEFT'
sf:SetPoint'TOP'
sf:SetPoint'BOTTOM'
end
 
if(castbar.PostChannelStart) then castbar:PostChannelStart(unit, name, rank) end
castbar:Show()
end
 
local UNIT_SPELLCAST_CHANNEL_UPDATE = function(self, event, unit, spellname, spellrank)
if(self.unit ~= unit) then return end
 
local name, rank, text, texture, startTime, endTime, oldStart = UnitChannelInfo(unit)
if(not name) then
return
end
 
local castbar = self.Castbar
local duration = (endTime / 1000) - GetTime()
 
castbar.delay = castbar.delay + castbar.duration - duration
castbar.duration = duration
castbar.max = (endTime - startTime) / 1000
 
castbar:SetMinMaxValues(0, castbar.max)
castbar:SetValue(duration)
 
if(castbar.PostChannelUpdate) then
return castbar:PostChannelUpdate(unit, name, rank)
end
end
 
local UNIT_SPELLCAST_CHANNEL_STOP = function(self, event, unit, spellname, spellrank)
if(self.unit ~= unit) then return end
 
local castbar = self.Castbar
if(castbar:IsShown()) then
castbar.channeling = nil
castbar.interrupt = nil
 
castbar:SetValue(castbar.max)
castbar:Hide()
 
if(castbar.PostChannelStop) then
return castbar:PostChannelStop(unit, spellname, spellrank)
end
end
end
 
local onUpdate = function(self, elapsed)
if(self.casting) then
local duration = self.duration + elapsed
if(duration >= self.max) then
self.casting = nil
self:Hide()
 
if(self.PostCastStop) then self:PostCastStop(self:GetParent().unit) end
return
end
 
if(self.SafeZone) then
local width = self:GetWidth()
local _, _, ms = GetNetStats()
-- MADNESS!
local safeZonePercent = (width / self.max) * (ms / 1e5)
if(safeZonePercent > 1) then safeZonePercent = 1 end
if(safeZonePercent == 0) then safeZonePercent = 0.01 end
self.SafeZone:SetWidth(width * safeZonePercent)
end
 
if(self.Time) then
if(self.delay ~= 0) then
if(self.CustomDelayText) then
self:CustomDelayText(duration)
else
self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay)
end
else
if(self.CustomTimeText) then
self:CustomTimeText(duration)
else
self.Time:SetFormattedText("%.1f", duration)
end
end
end
 
self.duration = duration
self:SetValue(duration)
 
if(self.Spark) then
self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0)
end
elseif(self.channeling) then
local duration = self.duration - elapsed
 
if(duration <= 0) then
self.channeling = nil
self:Hide()
 
if(self.PostChannelStop) then self:PostChannelStop(self:GetParent().unit) end
return
end
 
if(self.SafeZone) then
local width = self:GetWidth()
local _, _, ms = GetNetStats()
-- MADNESS!
local safeZonePercent = (width / self.max) * (ms / 1e5)
if(safeZonePercent > 1) then safeZonePercent = 1 end
self.SafeZone:SetWidth(width * safeZonePercent)
end
 
if(self.Time) then
if(self.delay ~= 0) then
if(self.CustomDelayText) then
self:CustomDelayText(duration)
else
self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay)
end
else
if(self.CustomTimeText) then
self:CustomTimeText(duration)
else
self.Time:SetFormattedText("%.1f", duration)
end
end
end
 
self.duration = duration
self:SetValue(duration)
if(self.Spark) then
self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0)
end
else
self.unitName = nil
self.channeling = nil
self:SetValue(1)
self:Hide()
end
end
 
local Enable = function(object, unit)
local castbar = object.Castbar
 
if(castbar) then
if(not (unit and unit:match'%wtarget$')) then
object:RegisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START)
object:RegisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED)
object:RegisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP)
object:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED)
object:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", UNIT_SPELLCAST_INTERRUPTIBLE)
object:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", UNIT_SPELLCAST_NOT_INTERRUPTIBLE)
object:RegisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED)
object:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", UNIT_SPELLCAST_CHANNEL_START)
object:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE)
object:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP)
end
 
castbar:SetScript("OnUpdate", castbar.OnUpdate or onUpdate)
 
if(object.unit == "player") then
CastingBarFrame:UnregisterAllEvents()
CastingBarFrame.Show = noop
CastingBarFrame:Hide()
PetCastingBarFrame:UnregisterAllEvents()
PetCastingBarFrame.Show = noop
PetCastingBarFrame:Hide()
elseif(object.unit == 'pet') then
PetCastingBarFrame:UnregisterAllEvents()
PetCastingBarFrame.Show = noop
PetCastingBarFrame:Hide()
end
 
if(not castbar:GetStatusBarTexture()) then
castbar:SetStatusBarTexture[[Interface\TargetingFrame\UI-StatusBar]]
end
 
local spark = castbar.Spark
if(spark and spark:IsObjectType'Texture' and not spark:GetTexture()) then
spark:SetTexture[[Interface\CastingBar\UI-CastingBar-Spark]]
end
 
local shield = castbar.Shield
if(shield and shield:IsObjectType'Texture' and not shield:GetTexture()) then
shield:SetTexture[[Interface\CastingBar\UI-CastingBar-Small-Shield]]
end
 
local sz = castbar.SafeZone
if(sz and sz:IsObjectType'Texture' and not sz:GetTexture()) then
sz:SetTexture(1, 0, 0)
end
 
castbar:Hide()
 
return true
end
end
 
local Disable = function(object, unit)
local castbar = object.Castbar
 
if(castbar) then
object:UnregisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START)
object:UnregisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED)
object:UnregisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP)
object:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED)
object:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", UNIT_SPELLCAST_INTERRUPTIBLE)
object:UnregisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", UNIT_SPELLCAST_NOT_INTERRUPTIBLE)
object:UnregisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED)
object:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START", UNIT_SPELLCAST_CHANNEL_START)
object:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE)
object:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP)
 
castbar:SetScript("OnUpdate", nil)
end
end
 
oUF:AddElement('Castbar', function(...)
UNIT_SPELLCAST_START(...)
return UNIT_SPELLCAST_CHANNEL_START(...)
end, Enable, Disable)
Eui/lib/oUF/elements/cpoints.lua New file
0,0 → 1,55
local parent, ns = ...
local oUF = ns.oUF
 
local GetComboPoints = GetComboPoints
local MAX_COMBO_POINTS = MAX_COMBO_POINTS
 
local Update = function(self, event, unit)
if(unit == 'pet') then return end
 
local cp
if(UnitExists'vehicle') then
cp = GetComboPoints('vehicle', 'target')
else
cp = GetComboPoints('player', 'target')
end
 
local cpoints = self.CPoints
for i=1, MAX_COMBO_POINTS do
if(i <= cp) then
cpoints[i]:Show()
else
cpoints[i]:Hide()
end
end
end
 
local Enable = function(self)
local cpoints = self.CPoints
if(cpoints) then
local Update = cpoints.Update or Update
self:RegisterEvent('UNIT_COMBO_POINTS', Update)
self:RegisterEvent('PLAYER_TARGET_CHANGED', Update)
 
for index = 1, MAX_COMBO_POINTS do
local cpoint = cpoints[index]
if(cpoint:IsObjectType'Texture' and not cpoint:GetTexture()) then
cpoint:SetTexture[[Interface\ComboFrame\ComboPoint]]
cpoint:SetTexCoord(0, 0.375, 0, 1)
end
end
 
return true
end
end
 
local Disable = function(self)
local cpoints = self.CPoints
if(cpoints) then
local Update = cpoints.Update or Update
self:UnregisterEvent('UNIT_COMBO_POINTS', Update)
self:UnregisterEvent('PLAYER_TARGET_CHANGED', Update)
end
end
 
oUF:AddElement('CPoints', Update, Enable, Disable)
Eui/lib/oUF/elements/masterlooter.lua New file
0,0 → 1,53
local parent, ns = ...
local oUF = ns.oUF
 
local function Update(self, event)
local unit
local method, pid, rid = GetLootMethod()
if(method == 'master') then
if(pid) then
if(pid == 0) then
unit = 'player'
else
unit = 'party'..pid
end
elseif(rid) then
unit = 'raid'..rid
else
return
end
 
if(UnitIsUnit(unit, self.unit)) then
self.MasterLooter:Show()
elseif(self.MasterLooter:IsShown()) then
self.MasterLooter:Hide()
end
elseif(self.MasterLooter:IsShown()) then
self.MasterLooter:Hide()
end
end
 
local function Enable(self, unit)
local masterlooter = self.MasterLooter
if(masterlooter) then
local Update = masterlooter.Update or Update
self:RegisterEvent('PARTY_LOOT_METHOD_CHANGED', Update)
self:RegisterEvent('PARTY_MEMBERS_CHANGED', Update)
 
if(masterlooter:IsObjectType('Texture') and not masterlooter:GetTexture()) then
masterlooter:SetTexture([[Interface\GroupFrame\UI-Group-MasterLooter]])
end
 
return true
end
end
 
local function Disable(self)
if(self.MasterLooter) then
local Update = masterlooter.Update or Update
self:UnregisterEvent('PARTY_LOOT_METHOD_CHANGED', Update)
self:UnregisterEvent('PARTY_MEMBERS_CHANGED', Update)
end
end
 
oUF:AddElement('MasterLooter', Update, Enable, Disable)
Eui/lib/oUF/elements/threat.lua New file
0,0 → 1,48
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event, unit)
if(unit ~= self.unit) then return end
 
local threat = self.Threat
if(threat.PreUpdate) then threat:PreUpdate(unit) end
 
unit = unit or self.unit
local status = UnitThreatSituation(unit)
 
if(status and status > 0) then
local r, g, b = GetThreatStatusColor(status)
threat:SetVertexColor(r, g, b)
threat:Show()
else
threat:Hide()
end
 
if(threat.PostUpdate) then
return threat:PostUpdate(unit, status)
end
end
 
local Enable = function(self)
local threat = self.Threat
if(threat) then
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", threat.Update or Update)
threat:Hide()
 
if(threat:IsObjectType"Texture" and not threat:GetTexture()) then
threat:SetTexture[[Interface\Minimap\ObjectIcons]]
threat:SetTexCoord(6/8, 7/8, 1/2, 1)
end
 
return true
end
end
 
local Disable = function(self)
local threat = self.Threat
if(threat) then
self:UnregisterEvent("UNIT_THREAT_SITUATION_UPDATE", threat.Update or Update)
end
end
 
oUF:AddElement('Threat', Update, Enable, Disable)
Eui/lib/oUF/elements/lfdrole.lua New file
0,0 → 1,49
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event)
local lfdrole = self.LFDRole
local isTank, isHealer, isDamage = UnitGroupRolesAssigned(self.unit)
 
if(isTank) then
lfdrole:SetTexCoord(0, 19/64, 22/64, 41/64)
lfdrole:Show()
elseif(isHealer) then
lfdrole:SetTexCoord(20/64, 39/64, 1/64, 20/64)
lfdrole:Show()
elseif(isDamage) then
lfdrole:SetTexCoord(20/64, 39/64, 22/64, 41/64)
lfdrole:Show()
else
lfdrole:Hide()
end
end
 
local Enable = function(self)
local lfdrole = self.LFDRole
if(lfdrole) then
local Update = lfdrole.Update or Update
if(self.unit == "player") then
self:RegisterEvent("PLAYER_ROLES_ASSIGNED", Update)
else
self:RegisterEvent("PARTY_MEMBERS_CHANGED", Update)
end
 
if(lfdrole:IsObjectType"Texture" and not lfdrole:GetTexture()) then
lfdrole:SetTexture[[Interface\LFGFrame\UI-LFG-ICON-PORTRAITROLES]]
end
 
return true
end
end
 
local Disable = function(self)
local lfdrole = self.LFDRole
if(lfdrole) then
local Update = lfdrole.Update or Update
self:UnregisterEvent("PLAYER_ROLES_ASSIGNED", Update)
self:UnregisterEvent("PARTY_MEMBERS_CHANGED", Update)
end
end
 
oUF:AddElement('LFDRole', Update, Enable, Disable)
Eui/lib/oUF/elements/portraits.lua New file
0,0 → 1,64
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event, unit)
if(not unit or not UnitIsUnit(self.unit, unit)) then return end
 
local portrait = self.Portrait
if(portrait.PreUpdate) then portrait:PreUpdate(unit) end
 
if(portrait:IsObjectType'Model') then
local guid = UnitGUID(unit)
if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then
portrait:SetModelScale(4.25)
portrait:SetPosition(0, 0, -1.5)
portrait:SetModel"Interface\\Buttons\\talktomequestionmark.mdx"
elseif(portrait.guid ~= guid or event == 'UNIT_MODEL_CHANGED') then
portrait:SetUnit(unit)
portrait:SetCamera(0)
 
portrait.guid = guid
else
portrait:SetCamera(0)
end
else
SetPortraitTexture(portrait, unit)
end
 
if(portrait.PostUpdate) then
return portrait:PostUpdate(unit)
end
end
 
local Enable = function(self, unit)
local portrait = self.Portrait
if(portrait) then
local Update = portrait.Update or Update
self:RegisterEvent("UNIT_PORTRAIT_UPDATE", Update)
self:RegisterEvent("UNIT_MODEL_CHANGED", Update)
 
-- The quest log uses PARTY_MEMBER_{ENABLE,DISABLE} to handle updating of
-- party members overlapping quests. This will probably be enough to handle
-- model updating.
--
-- DISABLE isn't used as it fires when we most likely don't have the
-- information we want.
if(unit == 'party') then
self:RegisterEvent('PARTY_MEMBER_ENABLE', Update)
end
 
return true
end
end
 
local Disable = function(self)
local portrait = self.Portrait
if(portrait) then
local Update = portrait.Update or Update
self:UnregisterEvent("UNIT_PORTRAIT_UPDATE", Update)
self:UnregisterEvent("UNIT_MODEL_CHANGED", Update)
self:UnregisterEvent('PARTY_MEMBER_ENABLE', Update)
end
end
 
oUF:AddElement('Portrait', Update, Enable, Disable)
Eui/lib/oUF/elements/aura.lua New file
0,0 → 1,285
local parent, ns = ...
local oUF = ns.oUF
 
local VISIBLE = 1
local HIDDEN = 0
 
local UpdateTooltip = function(self)
GameTooltip:SetUnitAura(self.parent:GetParent().unit, self:GetID(), self.filter)
end
 
local OnEnter = function(self)
if(not self:IsVisible()) then return end
 
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
self:UpdateTooltip()
end
 
local OnLeave = function()
GameTooltip:Hide()
end
 
-- We don't really need to validate much here as the filter should prevent us
-- from doing something we shouldn't.
local OnClick = function(self)
CancelUnitBuff(self.parent:GetParent().unit, self:GetID(), self.filter)
end
 
local createAuraIcon = function(icons, index)
local button = CreateFrame("Button", nil, icons)
button:EnableMouse(true)
button:RegisterForClicks'RightButtonUp'
 
button:SetWidth(icons.size or 16)
button:SetHeight(icons.size or 16)
 
local cd = CreateFrame("Cooldown", nil, button)
cd:SetAllPoints(button)
 
local icon = button:CreateTexture(nil, "BACKGROUND")
icon:SetAllPoints(button)
 
local count = button:CreateFontString(nil, "OVERLAY")
count:SetFontObject(NumberFontNormal)
count:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 0)
 
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetTexture"Interface\\Buttons\\UI-Debuff-Overlays"
overlay:SetAllPoints(button)
overlay:SetTexCoord(.296875, .5703125, 0, .515625)
button.overlay = overlay
 
local stealable = button:CreateTexture(nil, 'OVERLAY')
stealable:SetTexture[[Interface\TargetingFrame\UI-TargetingFrame-Stealable]]
stealable:SetPoint('TOPLEFT', -3, 3)
stealable:SetPoint('BOTTOMRIGHT', 3, -3)
stealable:SetBlendMode'ADD'
button.stealable = stealable
 
button.UpdateTooltip= UpdateTooltip
button:SetScript("OnEnter", OnEnter)
button:SetScript("OnLeave", OnLeave)
 
local unit = icons:GetParent().unit
if(unit == 'player') then
button:SetScript('OnClick', OnClick)
end
 
table.insert(icons, button)
 
button.parent = icons
button.icon = icon
button.count = count
button.cd = cd
 
if(icons.PostCreateIcon) then icons:PostCreateIcon(button) end
 
return button
end
 
local customFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster)
local isPlayer
 
if(caster == 'player' or caster == 'vehicle') then
isPlayer = true
end
 
if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
icon.isPlayer = isPlayer
icon.owner = caster
return true
end
end
 
local updateIcon = function(unit, icons, index, offset, filter, isDebuff, max)
local name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, filter)
if(name) then
local icon = icons[index + offset]
if(not icon) then
icon = (icons.CreateIcon or createAuraIcon) (icons, index)
end
 
local show = (icons.CustomFilter or customFilter) (icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
if(show) then
-- We might want to consider delaying the creation of an actual cooldown
-- object to this point, but I think that will just make things needlessly
-- complicated.
local cd = icon.cd
if(cd and not icons.disableCooldown) then
if(duration and duration > 0) then
cd:SetCooldown(timeLeft - duration, duration)
cd:Show()
else
cd:Hide()
end
end
 
if((isDebuff and icons.showDebuffType) or (not isDebuff and icons.showBuffType) or icons.showType) then
local color = DebuffTypeColor[dtype] or DebuffTypeColor.none
 
icon.overlay:SetVertexColor(color.r, color.g, color.b)
icon.overlay:Show()
else
icon.overlay:Hide()
end
 
-- XXX: Avoid popping errors on layouts without icon.stealable.
if(icon.stealable) then
local stealable = not isDebuff and isStealable
if(stealable and icons.showStealableBuffs and not UnitIsUnit('player', unit)) then
icon.stealable:Show()
else
icon.stealable:Hide()
end
end
 
icon.icon:SetTexture(texture)
icon.count:SetText((count > 1 and count))
 
icon.filter = filter
icon.debuff = isDebuff
 
icon:SetID(index)
icon:Show()
 
if(icons.PostUpdateIcon) then
icons:PostUpdateIcon(unit, icon, index, offset)
end
 
return VISIBLE
else
-- Hide the icon in-case we are in the middle of the stack.
icon:Hide()
 
return HIDDEN
end
end
end
 
local SetPosition = function(icons, x)
if(icons and x > 0) then
local col = 0
local row = 0
local gap = icons.gap
local sizex = (icons.size or 16) + (icons['spacing-x'] or icons.spacing or 0)
local sizey = (icons.size or 16) + (icons['spacing-y'] or icons.spacing or 0)
local anchor = icons.initialAnchor or "BOTTOMLEFT"
local growthx = (icons["growth-x"] == "LEFT" and -1) or 1
local growthy = (icons["growth-y"] == "DOWN" and -1) or 1
local cols = math.floor(icons:GetWidth() / sizex + .5)
local rows = math.floor(icons:GetHeight() / sizey + .5)
 
for i = 1, #icons do
local button = icons[i]
if(button and button:IsShown()) then
if(gap and button.debuff) then
if(col > 0) then
col = col + 1
end
 
gap = false
end
 
if(col >= cols) then
col = 0
row = row + 1
end
button:ClearAllPoints()
button:SetPoint(anchor, icons, anchor, col * sizex * growthx, row * sizey * growthy)
 
col = col + 1
elseif(not button) then
break
end
end
end
end
 
local filterIcons = function(unit, icons, filter, limit, isDebuff, offset, dontHide)
if(not offset) then offset = 0 end
local index = 1
local visible = 0
while(visible < limit) do
local result = updateIcon(unit, icons, index, offset, filter, isDebuff)
if(not result) then
break
elseif(result == VISIBLE) then
visible = visible + 1
end
index = index + 1
end
 
if(not dontHide) then
for i = offset + index, #icons do
icons[i]:Hide()
end
end
 
return visible, index - 1
end
 
local Update = function(self, event, unit)
if(self.unit ~= unit) then return end
 
local auras = self.Auras
if(auras) then
if(auras.PreUpdate) then auras:PreUpdate(unit) end
 
local numBuffs = auras.numBuffs or 32
local numDebuffs = auras.numDebuffs or 40
local max = numBuffs + numDebuffs
 
local visibleBuffs, offset = filterIcons(unit, auras, auras.buffFilter or auras.filter or 'HELPFUL', numBuffs, nil, 0, true)
auras.visibleBuffs = visibleBuffs
 
auras.visibleDebuffs = filterIcons(unit, auras, auras.debuffFilter or auras.filter or 'HARMFUL', numDebuffs,true, offset)
auras.visibleAuras = auras.visibleBuffs + auras.visibleDebuffs
 
if(auras.PreSetPosition) then auras:PreSetPosition(max) end
(auras.SetPosition or SetPosition) (auras, max)
 
if(auras.PostUpdate) then auras:PostUpdate(unit) end
end
 
local buffs = self.Buffs
if(buffs) then
if(buffs.PreUpdate) then buffs:PreUpdate(unit) end
 
local numBuffs = buffs.num or 32
buffs.visibleBuffs = filterIcons(unit, buffs, buffs.filter or 'HELPFUL', numBuffs)
 
if(buffs.PreSetPosition) then buffs:PreSetPosition(numBuffs) end
(buffs.SetPosition or SetPosition) (buffs, numBuffs)
 
if(buffs.PostUpdate) then buffs:PostUpdate(unit) end
end
 
local debuffs = self.Debuffs
if(debuffs) then
if(debuffs.PreUpdate) then debuffs:PreUpdate(unit) end
 
local numDebuffs = debuffs.num or 40
debuffs.visibleDebuffs = filterIcons(unit, debuffs, debuffs.filter or 'HARMFUL', numDebuffs, true)
 
if(debuffs.PreSetPosition) then debuffs:PreSetPosition(numDebuffs) end
(debuffs.SetPosition or SetPosition) (debuffs, numDebuffs)
 
if(debuffs.PostUpdate) then debuffs:PostUpdate(unit) end
end
end
 
local Enable = function(self)
if(self.Buffs or self.Debuffs or self.Auras) then
self:RegisterEvent("UNIT_AURA", Update)
 
return true
end
end
 
local Disable = function(self)
if(self.Buffs or self.Debuffs or self.Auras) then
self:UnregisterEvent("UNIT_AURA", Update)
end
end
 
oUF:AddElement('Aura', Update, Enable, Disable)
Eui/lib/oUF/elements/happiness.lua New file
0,0 → 1,51
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event, unit)
if(self.unit ~= unit) then return end
 
local happ = self.Happiness
if(happ) then
local happiness = GetPetHappiness()
local _, hunterPet = HasPetUI()
 
if(not (happiness or hunterPet)) then
return happ:Hide()
end
 
happ:Show()
if(happiness == 1) then
happ:SetTexCoord(0.375, 0.5625, 0, 0.359375)
elseif(happiness == 2) then
happ:SetTexCoord(0.1875, 0.375, 0, 0.359375)
elseif(happiness == 3) then
happ:SetTexCoord(0, 0.1875, 0, 0.359375)
end
 
if(happ.PostUpdate) then
return happ:PostUpdate(unit, happiness)
end
end
end
 
local Enable = function(self)
local happiness = self.Happiness
if(happiness) then
self:RegisterEvent("UNIT_HAPPINESS", happiness.Update or Update)
 
if(happiness:IsObjectType"Texture" and not happiness:GetTexture()) then
happiness:SetTexture[[Interface\PetPaperDollFrame\UI-PetHappiness]]
end
 
return true
end
end
 
local Disable = function(self)
local happiness = self.Happiness
if(happiness) then
self:UnregisterEvent("UNIT_HAPPINESS", happiness.Update or Update)
end
end
 
oUF:AddElement('Happiness', Update, Enable, Disable)
Eui/lib/oUF/elements/leader.lua New file
0,0 → 1,37
local parent, ns = ...
local oUF = ns.oUF
 
local Update = function(self, event)
local unit = self.unit
if((UnitInParty(unit) or UnitInRaid(unit)) and UnitIsPartyLeader(unit)) then
self.Leader:Show()
else
self.Leader:Hide()
end
end
 
local Enable = function(self)
local leader = self.Leader
if(leader) then
local Update = leader.Update or Update
self:RegisterEvent("PARTY_LEADER_CHANGED", Update)
self:RegisterEvent("PARTY_MEMBERS_CHANGED", Update)
 
if(leader:IsObjectType"Texture" and not leader:GetTexture()) then
leader:SetTexture[[Interface\GroupFrame\UI-Group-LeaderIcon]]
end
 
return true
end
end
 
local Disable = function(self)
local leader = self.Leader
if(leader) then
local Update = leader.Update or Update
self:UnregisterEvent("PARTY_LEADER_CHANGED", Update)
self:UnregisterEvent("PARTY_MEMBERS_CHANGED", Update)
end
end
 
oUF:AddElement('Leader', Update, Enable, Disable)
Eui/lib/oUF/elements/power.lua New file
0,0 → 1,151
local parent, ns = ...
local oUF = ns.oUF
 
oUF.colors.power = {}
for power, color in next, PowerBarColor do
if(type(power) == 'string') then
oUF.colors.power[power] = {color.r, color.g, color.b}
end
end
 
local Update = function(self, event, unit)
if(self.unit ~= unit) then return end
local power = self.Power
 
if(power.PreUpdate) then power:PreUpdate(unit) end
 
local min, max = UnitPower(unit), UnitPowerMax(unit)
local disconnected = not UnitIsConnected(unit)
power:SetMinMaxValues(0, max)
 
if(disconnected) then
power:SetValue(max)
else
power:SetValue(min)
end
 
power.disconnected = disconnected
power.unit = unit
 
local r, g, b, t
if(power.colorTapping and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
t = self.colors.tapped
elseif(power.colorDisconnected and not UnitIsConnected(unit)) then
t = self.colors.disconnected
elseif(power.colorHappiness and UnitIsUnit(unit, "pet") and GetPetHappiness()) then
t = self.colors.happiness[GetPetHappiness()]
elseif(power.colorPower) then
local ptype, ptoken, altR, altG, altB = UnitPowerType(unit)
 
t = self.colors.power[ptoken]
if(not t and altR) then
r, g, b = altR, altG, altB
end
elseif(power.colorClass and UnitIsPlayer(unit)) or
(power.colorClassNPC and not UnitIsPlayer(unit)) or
(power.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then
local _, class = UnitClass(unit)
t = self.colors.class[class]
elseif(power.colorReaction and UnitReaction(unit, 'player')) then
t = self.colors.reaction[UnitReaction(unit, "player")]
elseif(power.colorSmooth) then
r, g, b = self.ColorGradient(min / max, unpack(power.smoothGradient or self.colors.smooth))
end
 
if(t) then
r, g, b = t[1], t[2], t[3]
end
 
if(b) then
power:SetStatusBarColor(r, g, b)
 
local bg = power.bg
if(bg) then
local mu = bg.multiplier or 1
bg:SetVertexColor(r * mu, g * mu, b * mu)
end
end
 
if(power.PostUpdate) then
return power:PostUpdate(unit, min, max)
end
end
 
local OnPowerUpdate
do
local UnitPower = UnitPower
OnPowerUpdate = function(self)
if(self.disconnected) then return end
local power = UnitPower(self.unit)
 
if(power ~= self.min) then
self.min = power
 
return (self.Update or Update) (self:GetParent(), 'OnPowerUpdate', self.unit)
end
end
end
 
local Enable = function(self, unit)
local power = self.Power
if(power) then
local Update = power.Update or Update
if(power.frequentUpdates and (unit == 'player' or unit == 'pet')) then
-- TODO 1.5: We should do this regardless of frequentUpdates.
if(power:GetParent() ~= self) then
return oUF.error('Element [%s] is incorrectly parented on [%s]. Expected self, got something else.', 'Power', unit)
end
 
power:SetScript("OnUpdate", OnPowerUpdate)
else
self:RegisterEvent("UNIT_MANA", Update)
self:RegisterEvent("UNIT_RAGE", Update)
self:RegisterEvent("UNIT_FOCUS", Update)
self:RegisterEvent("UNIT_ENERGY", Update)
self:RegisterEvent("UNIT_RUNIC_POWER", Update)
end
self:RegisterEvent("UNIT_MAXMANA", Update)
self:RegisterEvent("UNIT_MAXRAGE", Update)
self:RegisterEvent("UNIT_MAXFOCUS", Update)
self:RegisterEvent("UNIT_MAXENERGY", Update)
self:RegisterEvent("UNIT_DISPLAYPOWER", Update)
self:RegisterEvent("UNIT_MAXRUNIC_POWER", Update)
 
self:RegisterEvent('UNIT_HAPPINESS', Update)
-- For tapping.
self:RegisterEvent('UNIT_FACTION', Update)
 
if(not power:GetStatusBarTexture()) then
power:SetStatusBarTexture[[Interface\TargetingFrame\UI-StatusBar]]
end
 
return true
end
end
 
local Disable = function(self)
local power = self.Power
if(power) then
local Update = power.Update or Update
if(power:GetScript'OnUpdate') then
power:SetScript("OnUpdate", nil)
else
self:UnregisterEvent("UNIT_MANA", Update)
self:UnregisterEvent("UNIT_RAGE", Update)
self:UnregisterEvent("UNIT_FOCUS", Update)
self:UnregisterEvent("UNIT_ENERGY", Update)
self:UnregisterEvent("UNIT_RUNIC_POWER", Update)
end
self:UnregisterEvent("UNIT_MAXMANA", Update)
self:UnregisterEvent("UNIT_MAXRAGE", Update)
self:UnregisterEvent("UNIT_MAXFOCUS", Update)
self:UnregisterEvent("UNIT_MAXENERGY", Update)
self:UnregisterEvent("UNIT_DISPLAYPOWER", Update)
self:UnregisterEvent("UNIT_MAXRUNIC_POWER", Update)
 
self:UnregisterEvent('UNIT_HAPPINESS', Update)
self:UnregisterEvent('UNIT_FACTION', Update)
end
end
 
oUF:AddElement('Power', Update, Enable, Disable)
Eui/lib/oUF/elements/range.lua New file
0,0 → 1,62
local parent, ns = ...
local oUF = ns.oUF
 
local _FRAMES = {}
local OnRangeFrame
 
local UnitInRange, UnitIsConnected = UnitInRange, UnitIsConnected
 
-- updating of range.
local timer = 0
local OnRangeUpdate = function(self, elapsed)
timer = timer + elapsed
 
if(timer >= .20) then
for _, object in next, _FRAMES do
if(object:IsShown()) then
local range = object.Range
if(UnitIsConnected(object.unit) and not UnitInRange(object.unit)) then
if(object:GetAlpha() == range.insideAlpha) then
object:SetAlpha(range.outsideAlpha)
end
elseif(object:GetAlpha() ~= range.insideAlpha) then
object:SetAlpha(range.insideAlpha)
end
end
end
 
timer = 0
end
end
 
local Enable = function(self)
local range = self.Range
if(range and range.insideAlpha and range.outsideAlpha) then
table.insert(_FRAMES, self)
 
if(not OnRangeFrame) then
OnRangeFrame = CreateFrame"Frame"
OnRangeFrame:SetScript("OnUpdate", OnRangeUpdate)
end
 
OnRangeFrame:Show()
end
end
 
local Disable = function(self)
local range = self.Range
if(range) then
for k, frame in next, _FRAMES do
if(frame == self) then
table.remove(_FRAMES, k)
break
end
end
 
if(#_FRAMES == 0) then
OnRangeFrame:Hide()
end
end
end
 
oUF:AddElement('Range', nil, Enable, Disable)
Eui/lib/oUF/elements/ricons.lua New file
0,0 → 1,39
local parent, ns = ...
local oUF = ns.oUF
 
local GetRaidTargetIndex = GetRaidTargetIndex
local SetRaidTargetIconTexture = SetRaidTargetIconTexture
 
local Update = function(self, event)
local index = GetRaidTargetIndex(self.unit)
local icon = self.RaidIcon
 
if(index) then
SetRaidTargetIconTexture(icon, index)
icon:Show()
else
icon:Hide()
end
end
 
local Enable = function(self)
local ricon = self.RaidIcon
if(ricon) then
self:RegisterEvent("RAID_TARGET_UPDATE", ricon.Update or Update)
 
if(ricon:IsObjectType"Texture" and not ricon:GetTexture()) then
ricon:SetTexture[[Interface\TargetingFrame\UI-RaidTargetingIcons]]
end
 
return true
end
end
 
local Disable = function(self)
local ricon = self.RaidIcon
if(ricon) then
self:UnregisterEvent("RAID_TARGET_UPDATE", ricon.Update or Update)
end
end
 
oUF:AddElement('RaidIcon', Update, Enable, Disable)
Eui/lib/oUF/elements/tags.lua New file
0,0 → 1,589
--[[
-- Credits: Vika, Cladhaire, Tekkub
]]
 
local parent, ns = ...
local oUF = ns.oUF
 
local _PATTERN = '%[..-%]+'
 
local _ENV = {
Hex = function(r, g, b)
if type(r) == "table" then
if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
end
return string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
end,
ColorGradient = oUF.ColorGradient,
}
local _PROXY = setmetatable(_ENV, {__index = _G})
 
local tagStrings = {
["creature"] = [[function(u)
return UnitCreatureFamily(u) or UnitCreatureType(u)
end]],
 
["dead"] = [[function(u)
if(UnitIsDead(u)) then
return 'Dead'
elseif(UnitIsGhost(u)) then
return 'Ghost'
end
end]],
 
["difficulty"] = [[function(u)
if UnitCanAttack("player", u) then
local l = UnitLevel(u)
return Hex(GetQuestDifficultyColor((l > 0) and l or 99))
end
end]],
 
["leader"] = [[function(u)
if(UnitIsPartyLeader(u)) then
return 'L'
end
end]],
 
["leaderlong"] = [[function(u)
if(UnitIsPartyLeader(u)) then
return 'Leader'
end
end]],
 
["level"] = [[function(u)
local l = UnitLevel(u)
if(l > 0) then
return l
else
return '??'
end
end]],
 
["missinghp"] = [[function(u)
local current = UnitHealthMax(u) - UnitHealth(u)
if(current > 0) then
return current
end
end]],
 
["missingpp"] = [[function(u)
local current = UnitPowerMax(u) - UnitPower(u)
if(current > 0) then
return current
end
end]],
 
["name"] = [[function(u, r)
return UnitName(r or u)
end]],
 
["offline"] = [[function(u)
if(not UnitIsConnected(u)) then
return 'Offline'
end
end]],
 
["perhp"] = [[function(u)
local m = UnitHealthMax(u)
if(m == 0) then
return 0
else
return math.floor(UnitHealth(u)/m*100+.5)
end
end]],
 
["perpp"] = [[function(u)
local m = UnitPowerMax(u)
if(m == 0) then
return 0
else
return math.floor(UnitPower(u)/m*100+.5)
end
end]],
 
["plus"] = [[function(u)
local c = UnitClassification(u)
if(c == 'elite' or c == 'rareelite') then
return '+'
end
end]],
 
["pvp"] = [[function(u)
if(UnitIsPVP(u)) then
return 'PvP'
end
end]],
 
["raidcolor"] = [[function(u)
local _, x = UnitClass(u)
if(x) then
return Hex(_COLORS.class[x])
end
end]],
 
["rare"] = [[function(u)
local c = UnitClassification(u)
if(c == 'rare' or c == 'rareelite') then
return 'Rare'
end
end]],
 
["resting"] = [[function(u)
if(u == 'player' and IsResting()) then
return 'zzz'
end
end]],
 
["sex"] = [[function(u)
local s = UnitSex(u)
if(s == 2) then
return 'Male'
elseif(s == 3) then
return 'Female'
end
end]],
 
["smartclass"] = [[function(u)
if(UnitIsPlayer(u)) then
return _TAGS['class'](u)
end
 
return _TAGS['creature'](u)
end]],
 
["status"] = [[function(u)
if(UnitIsDead(u)) then
return 'Dead'
elseif(UnitIsGhost(u)) then
return 'Ghost'
elseif(not UnitIsConnected(u)) then
return 'Offline'
else
return _TAGS['resting'](u)
end
end]],
 
["threat"] = [[function(u)
local s = UnitThreatSituation(u)
if(s == 1) then
return '++'
elseif(s == 2) then
return '--'
elseif(s == 3) then
return 'Aggro'
end
end]],
 
["threatcolor"] = [[function(u)
return Hex(GetThreatStatusColor(UnitThreatSituation(u)))
end]],
 
["cpoints"] = [[function(u)
local cp
if(UnitExists'vehicle') then
cp = GetComboPoints('vehicle', 'target')
else
cp = GetComboPoints('player', 'target')
end
 
if(cp > 0) then
return cp
end
end]],
 
['smartlevel'] = [[function(u)
local c = UnitClassification(u)
if(c == 'worldboss') then
return 'Boss'
else
local plus = _TAGS['plus'](u)
local level = _TAGS['level'](u)
if(plus) then
return level .. plus
else
return level
end
end
end]],
 
["classification"] = [[function(u)
local c = UnitClassification(u)
if(c == 'rare') then
return 'Rare'
elseif(c == 'eliterare') then
return 'Rare Elite'
elseif(c == 'elite') then
return 'Elite'
elseif(c == 'worldboss') then
return 'Boss'
end
end]],
 
["shortclassification"] = [[function(u)
local c = UnitClassification(u)
if(c == 'rare') then
return 'R'
elseif(c == 'eliterare') then
return 'R+'
elseif(c == 'elite') then
return '+'
elseif(c == 'worldboss') then
return 'B'
end
end]],
 
["group"] = [[function(unit)
local name, server = UnitName(unit)
if(server and server ~= "") then
name = string.format("%s-%s", name, server)
end
 
for i=1, GetNumRaidMembers() do
local raidName, _, group = GetRaidRosterInfo(i)
if( raidName == name ) then
return group
end
end
end]],
 
["defict:name"] = [[function(u)
local missinghp = _TAGS['missinghp'](u)
if(missinghp) then
return '-' .. missinghp
else
return _TAGS['name'](u)
end
end]],
 
['happiness'] = [[function(u)
if(UnitIsUnit(u, 'pet')) then
local happiness = GetPetHappiness()
if(happiness == 1) then
return ":<"
elseif(happiness == 2) then
return ":|"
elseif(happiness == 3) then
return ":D"
end
end
end]],
}
 
local tags = setmetatable(
{
curhp = UnitHealth,
curpp = UnitPower,
maxhp = UnitHealthMax,
maxpp = UnitPowerMax,
class = UnitClass,
faction = UnitFactionGroup,
race = UnitRace,
},
 
{
__index = function(self, key)
local tagFunc = tagStrings[key]
if(tagFunc) then
local func, err = loadstring('return ' .. tagFunc)
if(func) then
func = func()
 
-- Want to trigger __newindex, so no rawset.
self[key] = func
tagStrings[key] = nil
 
return func
else
error(err, 3)
end
end
end,
__newindex = function(self, key, val)
if(type(val) == 'string') then
tagStrings[key] = val
elseif(type(val) == 'function') then
-- So we don't clash with any custom envs.
if(getfenv(val) == _G) then
setfenv(val, _PROXY)
end
 
rawset(self, key, val)
end
end,
})
 
_ENV._TAGS = tags
 
local tagEvents = {
["curhp"] = "UNIT_HEALTH",
["curpp"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER",
["dead"] = "UNIT_HEALTH",
["leader"] = "PARTY_LEADER_CHANGED",
["leaderlong"] = "PARTY_LEADER_CHANGED",
["level"] = "UNIT_LEVEL PLAYER_LEVEL_UP",
["maxhp"] = "UNIT_MAXHEALTH",
["maxpp"] = "UNIT_MAXENERGY UNIT_MAXFOCUS UNIT_MAXMANA UNIT_MAXRAGE UNIT_MAXRUNIC_POWER",
["missinghp"] = "UNIT_HEALTH UNIT_MAXHEALTH",
["missingpp"] = "UNIT_MAXENERGY UNIT_MAXFOCUS UNIT_MAXMANA UNIT_MAXRAGE UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_MAXRUNIC_POWER UNIT_RUNIC_POWER",
["name"] = "UNIT_NAME_UPDATE",
["offline"] = "UNIT_HEALTH",
["perhp"] = "UNIT_HEALTH UNIT_MAXHEALTH",
["perpp"] = "UNIT_MAXENERGY UNIT_MAXFOCUS UNIT_MAXMANA UNIT_MAXRAGE UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_MAXRUNIC_POWER UNIT_RUNIC_POWER",
["pvp"] = "UNIT_FACTION",
["resting"] = "PLAYER_UPDATE_RESTING",
["status"] = "UNIT_HEALTH PLAYER_UPDATE_RESTING",
["smartlevel"] = "UNIT_LEVEL PLAYER_LEVEL_UP UNIT_CLASSIFICATION_CHANGED",
["threat"] = "UNIT_THREAT_SITUATION_UPDATE",
["threatcolor"] = "UNIT_THREAT_SITUATION_UPDATE",
['cpoints'] = 'UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED',
['rare'] = 'UNIT_CLASSIFICATION_CHANGED',
['classification'] = 'UNIT_CLASSIFICATION_CHANGED',
['shortclassification'] = 'UNIT_CLASSIFICATION_CHANGED',
["group"] = "RAID_ROSTER_UPDATE",
['happiness'] = 'UNIT_HAPPINESS',
}
 
local unitlessEvents = {
PLAYER_LEVEL_UP = true,
PLAYER_UPDATE_RESTING = true,
PLAYER_TARGET_CHANGED = true,
 
PARTY_LEADER_CHANGED = true,
 
RAID_ROSTER_UPDATE = true,
 
UNIT_COMBO_POINTS = true
}
 
local events = {}
local frame = CreateFrame"Frame"
frame:SetScript('OnEvent', function(self, event, unit)
local strings = events[event]
if(strings) then
for k, fontstring in next, strings do
if(fontstring:IsVisible() and (unitlessEvents[event] or fontstring.parent.unit == unit)) then
fontstring:UpdateTag()
end
end
end
end)
 
local OnUpdates = {}
local eventlessUnits = {}
 
local createOnUpdate = function(timer)
local OnUpdate = OnUpdates[timer]
 
if(not OnUpdate) then
local total = timer
local frame = CreateFrame'Frame'
local strings = eventlessUnits[timer]
 
frame:SetScript('OnUpdate', function(self, elapsed)
if(total >= timer) then
for k, fs in next, strings do
if(fs.parent:IsShown() and UnitExists(fs.parent.unit)) then
fs:UpdateTag()
end
end
 
total = 0
end
 
total = total + elapsed
end)
 
OnUpdates[timer] = frame
end
end
 
local OnShow = function(self)
for _, fs in next, self.__tags do
fs:UpdateTag()
end
end
 
local getTagName = function(tag)
local s = (tag:match('>+()') or 2)
local e = tag:match('.*()<+')
e = (e and e - 1) or -2
 
return tag:sub(s, e), s, e
end
 
local RegisterEvent = function(fontstr, event)
if(not events[event]) then events[event] = {} end
 
frame:RegisterEvent(event)
table.insert(events[event], fontstr)
end
 
local RegisterEvents = function(fontstr, tagstr)
for tag in tagstr:gmatch(_PATTERN) do
tag = getTagName(tag)
local tagevents = tagEvents[tag]
if(tagevents) then
for event in tagevents:gmatch'%S+' do
RegisterEvent(fontstr, event)
end
end
end
end
 
local UnregisterEvents = function(fontstr)
for event, data in pairs(events) do
for k, tagfsstr in pairs(data) do
if(tagfsstr == fontstr) then
if(#data == 1) then
frame:UnregisterEvent(event)
end
 
table.remove(data, k)
end
end
end
end
 
local tagPool = {}
local funcPool = {}
local tmp = {}
 
local Tag = function(self, fs, tagstr)
if(not fs or not tagstr) then return end
 
if(not self.__tags) then
self.__tags = {}
table.insert(self.__elements, OnShow)
else
-- Since people ignore everything that's good practice - unregister the tag
-- if it already exists.
for _, tag in pairs(self.__tags) do
if(fs == tag) then
-- We don't need to remove it from the __tags table as Untag handles
-- that for us.
self:Untag(fs)
end
end
end
 
fs.parent = self
 
local func = tagPool[tagstr]
if(not func) then
local format = tagstr:gsub('%%', '%%%%'):gsub(_PATTERN, '%%s')
local args = {}
 
for bracket in tagstr:gmatch(_PATTERN) do
local tagFunc = funcPool[bracket] or tags[bracket:sub(2, -2)]
if(not tagFunc) then
local tagName, s, e = getTagName(bracket)
 
local tag = tags[tagName]
if(tag) then
s = s - 2
e = e + 2
 
if(s ~= 0 and e ~= 0) then
local pre = bracket:sub(2, s)
local ap = bracket:sub(e, -2)
 
tagFunc = function(u,r)
local str = tag(u,r)
if(str) then
return pre..str..ap
end
end
elseif(s ~= 0) then
local pre = bracket:sub(2, s)
 
tagFunc = function(u,r)
local str = tag(u,r)
if(str) then
return pre..str
end
end
elseif(e ~= 0) then
local ap = bracket:sub(e, -2)
 
tagFunc = function(u,r)
local str = tag(u,r)
if(str) then
return str..ap
end
end
end
 
funcPool[bracket] = tagFunc
end
end
 
if(tagFunc) then
table.insert(args, tagFunc)
else
return error(('Attempted to use invalid tag %s.'):format(bracket), 3)
end
end
 
func = function(self)
local unit = self.parent.unit
local __unit = self.parent.realUnit
 
_ENV._COLORS = self.parent.colors
for i, func in next, args do
tmp[i] = func(unit, __unit) or ''
end
 
self:SetFormattedText(format, unpack(tmp))
end
 
tagPool[tagstr] = func
end
fs.UpdateTag = func
 
local unit = self.unit
if((unit and unit:match'%w+target') or fs.frequentUpdates) then
local timer
if(type(fs.frequentUpdates) == 'number') then
timer = fs.frequentUpdates
else
timer = .5
end
 
if(not eventlessUnits[timer]) then eventlessUnits[timer] = {} end
table.insert(eventlessUnits[timer], fs)
 
createOnUpdate(timer)
else
RegisterEvents(fs, tagstr)
end
 
table.insert(self.__tags, fs)
end
 
local Untag = function(self, fs)
if(not fs) then return end
 
UnregisterEvents(fs)
for _, timers in next, eventlessUnits do
for k, fontstr in next, timers do
if(fs == fontstr) then
table.remove(timers, k)
end
end
end
 
for k, fontstr in next, self.__tags do
if(fontstr == fs) then
table.remove(self.__tags, k)
end
end
 
fs.UpdateTag = nil
end
 
oUF.Tags = tags
oUF.TagEvents = tagEvents
oUF.UnitlessTagEvents = unitlessEvents
 
oUF:RegisterMetaFunction('Tag', Tag)
oUF:RegisterMetaFunction('Untag', Untag)
Eui/lib/oUF/elements/runebar.lua New file
0,0 → 1,119
--[[ Runebar:
Authors: Zariel, Haste
]]
 
if select(2, UnitClass("player")) ~= "DEATHKNIGHT" then return end
 
local parent, ns = ...
local oUF = ns.oUF
 
oUF.colors.runes = {
{1, 0, 0};
{0, .5, 0};
{0, 1, 1};
{.9, .1, 1};
}
 
local OnUpdate = function(self, elapsed)
local duration = self.duration + elapsed
if(duration >= self.max) then
return self:SetScript("OnUpdate", nil)
else
self.duration = duration
return self:SetValue(duration)
end
end
 
local UpdateType = function(self, event, rune, alt)
local colors = self.colors.runes[GetRuneType(rune) or alt]
local rune = self.Runes[rune]
local r, g, b = colors[1], colors[2], colors[3]
 
rune:SetStatusBarColor(r, g, b)
 
if(rune.bg) then
local mu = rune.bg.multiplier or 1
rune.bg:SetVertexColor(r * mu, g * mu, b * mu)
end
end
 
local UpdateRune = function(self, event, rid)
local rune = self.Runes[rid]
if(rune) then
local start, duration, runeReady = GetRuneCooldown(rune:GetID())
if(start) then
if(runeReady) then
rune:SetMinMaxValues(0, 1)
rune:SetValue(1)
rune:SetScript("OnUpdate", nil)
else
rune.duration = GetTime() - start
rune.max = duration
rune:SetMinMaxValues(1, duration)
rune:SetScript("OnUpdate", OnUpdate)
end
end
end
end
 
local Update = function(self, event)
for i=1, 6 do
UpdateRune(self, event, i)
end
end
 
local Enable = function(self, unit)
local runes = self.Runes
if(runes and unit == 'player') then
for i=1, 6 do
local rune = runes[i]
rune:SetID(i)
-- From my minor testing this is a okey solution. A full login always remove
-- the death runes, or at least the clients knowledge about them.
UpdateType(self, nil, i, math.floor((i+1)/2))
 
if(not rune:GetStatusBarTexture()) then
rune:SetStatusBarTexture[[Interface\TargetingFrame\UI-StatusBar]]
end
end
 
self:RegisterEvent("RUNE_POWER_UPDATE", UpdateRune)
self:RegisterEvent("RUNE_TYPE_UPDATE", UpdateType)
 
runes:Show()
RuneFrame:Hide()
 
-- さあ兄様、どうぞ姉様に
local runeMap = runes.runeMap
if(runeMap) then
for f, t in pairs(runeMap) do
runes[f], runes[t] = runes[t], runes[f]
end
else
runes[3], runes[5] = runes[5], runes[3]
runes[4], runes[6] = runes[6], runes[4]
end
 
-- ええ、兄様。
if(runeMap) then
for f, t in pairs(runeMap) do
runes[f], runes[t] = runes[t], runes[f]
end
else
runes[3], runes[5] = runes[5], runes[3]
runes[4], runes[6] = runes[6], runes[4]
end
 
return true
end
end
 
local Disable = function(self)
self.Runes:Hide()
RuneFrame:Show()
 
self:UnregisterEvent("RUNE_POWER_UPDATE", UpdateRune)
self:UnregisterEvent("RUNE_TYPE_UPDATE", UpdateType)
end
 
oUF:AddElement("Runes", Update, Enable, Disable)
Eui/skins/skins.xml New file
0,0 → 1,5
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file='skins.lua' />
<Script file='skins\DBM.lua' />
<Script file='skins\Skada.lua' />
</Ui>
\ No newline at end of file
Eui/skins/skins/Recount.lua New file
0,0 → 1,17
 
--[[ function RecountSkin(self)
print("RecountSkin")
print("Recount loaded")
self.SecureHook(Recount, "AddWindow", function(this, window)
EuiSetTemplate(windows)
print("Recount AddWindows")
end)
 
end
local RecountSki = CreateFrame("Frame")
RecountSki:RegisterEvent("PLAYER_LOGIN")
RecountSki:SetScript("OnEvent", function(self, event, addon)
if IsAddOnLoaded("Recount") then
RecountSkin(self)
end
end) ]]
\ No newline at end of file
Eui/skins/skins/DBM.lua New file
0,0 → 1,358
local E, C = unpack(select(2, ...))
if C["skins"].dbm ~= true then return end
 
local forcebosshealthclasscolor = false -- Forces BossHealth to be classcolored. Not recommended.
local croprwicons = true -- Crops blizz shitty borders from icons in RaidWarning messages
local rwiconsize = 12 -- RaidWarning icon size. Works only if croprwicons = true
local backdrop = {
bgFile = E.normTex,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
local _, class = UnitClass("player")
local t = E.RAID_CLASS_COLORS[class]
local r, g, b = t.r, t.g, t.b
 
local DBMSkin = CreateFrame("Frame")
DBMSkin:RegisterEvent("PLAYER_LOGIN")
DBMSkin:SetScript("OnEvent", function(self, event, addon)
if IsAddOnLoaded("DBM-Core") then
local function SkinBars(self)
for bar in self:GetBarIterator() do
if not bar.injected then
bar.ApplyStyle = function()
local frame = bar.frame
local tbar = _G[frame:GetName().."Bar"]
local spark = _G[frame:GetName().."BarSpark"]
local texture = _G[frame:GetName().."BarTexture"]
local icon1 = _G[frame:GetName().."BarIcon1"]
local icon2 = _G[frame:GetName().."BarIcon2"]
local name = _G[frame:GetName().."BarName"]
local timer = _G[frame:GetName().."BarTimer"]
 
if (icon1.overlay) then
icon1.overlay = _G[icon1.overlay:GetName()]
else
icon1.overlay = CreateFrame("Frame", "$parentIcon1Overlay", tbar)
icon1.overlay:SetWidth(25)
icon1.overlay:SetHeight(25)
icon1.overlay:SetFrameStrata("BACKGROUND")
icon1.overlay:SetPoint("BOTTOMRIGHT", tbar, "BOTTOMLEFT", -5, -2)
E.EuiSkinFadedPanel(icon1.overlay)
end
 
if (icon2.overlay) then
icon2.overlay = _G[icon2.overlay:GetName()]
else
icon2.overlay = CreateFrame("Frame", "$parentIcon2Overlay", tbar)
icon2.overlay:SetWidth(25)
icon2.overlay:SetHeight(25)
icon2.overlay:SetFrameStrata("BACKGROUND")
icon2.overlay:SetPoint("BOTTOMLEFT", tbar, "BOTTOMRIGHT", 5, -2)
E.EuiSkinFadedPanel(icon2.overlay)
end
 
if bar.color then
tbar:SetStatusBarColor(bar.color.r, bar.color.g, bar.color.b)
tbar:SetBackdrop(backdrop)
tbar:SetBackdropColor(bar.color.r, bar.color.g, bar.color.b, 0.15)
else
tbar:SetStatusBarColor(bar.owner.options.StartColorR, bar.owner.options.StartColorG, bar.owner.options.StartColorB)
tbar:SetBackdrop(backdrop)
tbar:SetBackdropColor(bar.owner.options.StartColorR, bar.owner.options.StartColorG, bar.owner.options.StartColorB, 0.15)
end
 
if bar.enlarged then frame:SetWidth(bar.owner.options.HugeWidth) else frame:SetWidth(bar.owner.options.Width) end
if bar.enlarged then tbar:SetWidth(bar.owner.options.HugeWidth) else tbar:SetWidth(bar.owner.options.Width) end
 
frame:SetScale(1)
if not frame.styled then
frame:SetHeight(8)
E.EuiSetTemplate(frame)
frame.styled = true
end
 
if not spark.killed then
spark:SetAlpha(0)
spark:SetTexture(nil)
spark.killed = true
end
 
if not icon1.styled then
icon1:SetTexCoord(0.1, 0.9, 0.1, 0.9)
icon1:ClearAllPoints()
icon1:SetPoint("TOPLEFT", icon1.overlay, 2, -2)
icon1:SetPoint("BOTTOMRIGHT", icon1.overlay, -2, 2)
icon1.styled = true
end
 
if not icon2.styled then
icon2:SetTexCoord(0.1, 0.9, 0.1, 0.9)
icon2:ClearAllPoints()
icon2:SetPoint("TOPLEFT", icon2.overlay, 2, -2)
icon2:SetPoint("BOTTOMRIGHT", icon2.overlay, -2, 2)
icon2.styled = true
end
 
if not texture.styled then
texture:SetTexture("Interface\\AddOns\\Eui\\media\\normTex")
texture.styled = true
end
 
if not tbar.styled then
tbar:SetPoint("TOPLEFT", frame, "TOPLEFT", 2, -2)
tbar:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 2)
tbar.styled = true
end
 
if not name.styled then
name:ClearAllPoints()
name:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 4, 2)
name:SetWidth(165)
name:SetHeight(11)
name:SetFont(E.font, 11, "OUTLINE")
-- name:SetShadowOffset(false and 1 or 0, false and -1 or 0)
name:SetShadowOffset(1, -1)
name:SetJustifyH("LEFT")
name.SetFont = kill
name.styled = true
end
name:SetShadowOffset(1, -1)
timer:SetShadowOffset(1, -1)
if not timer.styled then
timer:ClearAllPoints()
timer:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -1, 2)
timer:SetFont(E.font, 11, "OUTLINE")
-- timer:SetShadowOffset(false and 1 or 0, false and -1 or 0)
timer:SetShadowOffset(1, -1)
timer:SetJustifyH("RIGHT")
timer.SetFont = function() return end
timer.styled = true
end
 
if bar.owner.options.IconLeft then icon1:Show() icon1.overlay:Show() else icon1:Hide() icon1.overlay:Hide() end
if bar.owner.options.IconRight then icon2:Show() icon2.overlay:Show() else icon2:Hide() icon2.overlay:Hide() end
tbar:SetAlpha(1)
frame:SetAlpha(1)
texture:SetAlpha(1)
frame:Show()
bar:Update(0)
bar.injected = true
end
bar:ApplyStyle()
end
end
end
 
local SkinBossTitle = function()
local anchor = DBMBossHealthDropdown:GetParent()
if not anchor.styled then
local header = {anchor:GetRegions()}
if header[1]:IsObjectType("FontString") then
header[1]:SetFont(E.font, 11, "OUTLINE")
header[1]:SetShadowOffset(false and 1 or 0, false and -1 or 0)
header[1]:SetTextColor(1, 1, 1, 1)
anchor.styled = true
end
header = nil
end
anchor = nil
end
 
local SkinBoss = function()
local count = 1
while (_G[format("DBM_BossHealth_Bar_%d", count)]) do
local bar = _G[format("DBM_BossHealth_Bar_%d", count)]
local background = _G[bar:GetName().."BarBorder"]
local progress = _G[bar:GetName().."Bar"]
local name = _G[bar:GetName().."BarName"]
local timer = _G[bar:GetName().."BarTimer"]
local prev = _G[format("DBM_BossHealth_Bar_%d", count-1)]
 
if (count == 1) then
local _, anch, _ , _, _ = bar:GetPoint()
bar:ClearAllPoints()
if DBM_SavedOptions.HealthFrameGrowUp then
bar:SetPoint("BOTTOM", anch, "TOP", 0, 3)
else
bar:SetPoint("TOP", anch, "BOTTOM", 0, -3)
end
else
bar:ClearAllPoints()
if DBM_SavedOptions.HealthFrameGrowUp then
bar:SetPoint("BOTTOMLEFT", prev, "TOPLEFT", 0, 3)
else
bar:SetPoint("TOPLEFT", prev, "BOTTOMLEFT", 0, -3)
end
end
 
if not bar.styled then
bar:SetScale(1)
bar:SetHeight(19)
E.EuiSetTemplate(bar)
background:SetNormalTexture(nil)
bar.styled = true
end
 
if not progress.styled then
progress:SetStatusBarTexture("Interface\\AddOns\\Eui\\media\\normTex")
progress:SetBackdrop(backdrop)
progress:SetBackdropColor(r, g, b, 0.15)
if forcebosshealthclasscolor then
local tslu = 0
progress:SetStatusBarColor(r, g, b, 1)
progress:HookScript("OnUpdate", function(self, elapsed)
tslu = tslu+ elapsed
if tslu > 0.025 then
self:SetStatusBarColor(r, g, b, 1)
tslu = 0
end
end)
end
progress.styled = true
end
progress:ClearAllPoints()
progress:SetPoint("TOPLEFT", bar, "TOPLEFT", 2, -2)
progress:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -2, 2)
 
if not name.styled then
name:ClearAllPoints()
name:SetPoint("LEFT", bar, "LEFT", 4, 0)
name:SetFont(E.font, 11, "OUTLINEMONOCHROME")
name:SetShadowOffset(false and 1 or 0, false and -1 or 0)
name:SetJustifyH("LEFT")
name.styled = true
end
 
if not timer.styled then
timer:ClearAllPoints()
timer:SetPoint("RIGHT", bar, "RIGHT", -1, 0)
timer:SetFont(E.font, 11, "OUTLINEMONOCHROME")
timer:SetShadowOffset(false and 1 or 0, false and -1 or 0)
timer:SetJustifyH("RIGHT")
timer.styled = true
end
count = count + 1
end
end
 
hooksecurefunc(DBT, "CreateBar", SkinBars)
hooksecurefunc(DBM.BossHealth, "Show", SkinBossTitle)
hooksecurefunc(DBM.BossHealth, "AddBoss", SkinBoss)
 
DBM.RangeCheck:Show()
DBM.RangeCheck:Hide()
 
DBMRangeCheck:HookScript("OnShow", function(self)
E.EuiSkinFadedPanel(self)
end)
 
if croprwicons then
local replace = string.gsub
local old = RaidNotice_AddMessage
RaidNotice_AddMessage = function(noticeFrame, textString, colorInfo)
if textString:find(" |T") then
textString=replace(textString,"(:12:12)",":"..rwiconsize..":"..rwiconsize..":0:0:64:64:5:59:5:59")
end
return old(noticeFrame, textString, colorInfo)
end
end
end
end)
 
----------------------------------------------------------------------------------------
-- DBM settings(by ALZA and help from Affli)
----------------------------------------------------------------------------------------
local function EuiUploadDBM()
--if(DBM_SavedOptions) then table.wipe(DBM_SavedOptions) end
DBM_SavedOptions.Enabled = true
DBM_SavedOptions.ShowMinimapButton = true
DBM_SavedOptions.WarningIconLeft = false
DBM_SavedOptions.WarningIconRight = false
DBM_SavedOptions["WarningColors"] = {
{["b"] = b, ["g"] = g, ["r"] = r,},
{["b"] = b, ["g"] = g, ["r"] = r,},
{["b"] = b, ["g"] = g, ["r"] = r,},
{["b"] = b, ["g"] = g, ["r"] = r,},
}
DBM_SavedOptions.HealthFrameGrowUp = false
DBM_SavedOptions.HealthFrameWidth = 218
DBM_SavedOptions.HPFrameX = 100
DBM_SavedOptions.HPFramePoint = "LEFT"
DBM_SavedOptions.RangeFrameX = 244
DBM_SavedOptions.RangeFramePoint = "LEFT"
DBM_SavedOptions.ShowSpecialWarnings = true
DBM_SavedOptions.SpecialWarningFont = E.fontn
DBM_SavedOptions.SpecialWarningFontSize = 50
DBM_SavedOptions.SpecialWarningX = 0
DBM_SavedOptions.SpecialWarningY = 75
 
DBT_SavedOptions["DBM"].StartColorR = r
DBT_SavedOptions["DBM"].StartColorG = g
DBT_SavedOptions["DBM"].StartColorB = b
DBT_SavedOptions["DBM"].EndColorR = r
DBT_SavedOptions["DBM"].EndColorG = g
DBT_SavedOptions["DBM"].EndColorB = b
DBT_SavedOptions["DBM"].Scale = 1
DBT_SavedOptions["DBM"].HugeScale = 1
DBT_SavedOptions["DBM"].BarXOffset = 0
DBT_SavedOptions["DBM"].BarYOffset = 7
DBT_SavedOptions["DBM"].Font = E.fontn
DBT_SavedOptions["DBM"].FontSize = 11
DBT_SavedOptions["DBM"].Width = 189
DBT_SavedOptions["DBM"].TimerX = 143
DBT_SavedOptions["DBM"].TimerPoint = "BOTTOMLEFT"
DBT_SavedOptions["DBM"].FillUpBars = true
DBT_SavedOptions["DBM"].IconLeft = true
DBT_SavedOptions["DBM"].ExpandUpwards = true
DBT_SavedOptions["DBM"].Texture = E.normTex
DBT_SavedOptions["DBM"].IconRight = false
DBT_SavedOptions["DBM"].HugeBarXOffset = 0
DBT_SavedOptions["DBM"].HugeBarsEnabled = false
DBT_SavedOptions["DBM"].HugeWidth = 189
DBT_SavedOptions["DBM"].HugeTimerX = 7
DBT_SavedOptions["DBM"].HugeTimerPoint = "CENTER"
DBT_SavedOptions["DBM"].HugeBarYOffset = 7
 
--[[ if C["actionbar"].actionbarrows == 1 then
DBM_SavedOptions.HPFrameY = 126
DBM_SavedOptions.RangeFrameY = 101
DBT_SavedOptions["DBM"].TimerY = 139
DBT_SavedOptions["DBM"].HugeTimerY = -136
elseif C["actionbar"].actionbarrows == 2 then
DBM_SavedOptions.HPFrameY = 154
DBM_SavedOptions.RangeFrameY = 129
DBT_SavedOptions["DBM"].TimerY = 167
DBT_SavedOptions["DBM"].HugeTimerY = -108
elseif C["actionbar"].actionbarrows == 3 then ]]
DBM_SavedOptions.HPFrameY = 182
DBM_SavedOptions.RangeFrameY = 157
DBT_SavedOptions["DBM"].TimerY = 195
DBT_SavedOptions["DBM"].HugeTimerY = -80
-- end
DBM_SavedOptions.InstalledBars = LjxxuiInstallV335
end
 
StaticPopupDialogs["SETTINGS_DBM"] = {
text = "设置DBM皮肤",
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function() EuiUploadDBM() ReloadUI() end,
timeout = 0,
whileDead = 1,
hideOnEscape = true,
}
 
----------------------------------------------------------------------------------------
-- On logon function
----------------------------------------------------------------------------------------
local OnLogon = CreateFrame("Frame")
OnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
OnLogon:SetScript("OnEvent", function(self, event)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
 
if IsAddOnLoaded("DBM-Core") then
if DBM_SavedOptions.InstalledBars ~= LjxxuiInstallV335 then
StaticPopup_Show("SETTINGS_DBM")
end
end
end)
\ No newline at end of file
Eui/skins/skins/Skada.lua New file
0,0 → 1,150
local E,C = unpack(select(2, ...))
if C["skins"].skada ~= true then return end
 
local SkadaSkin = CreateFrame("Frame")
SkadaSkin:RegisterEvent("PLAYER_LOGIN")
SkadaSkin:SetScript("OnEvent", function(self, event, addon)
if IsAddOnLoaded("Skada") then
local function StripOptions(options)
options.baroptions.args.bartexture = options.windowoptions.args.height
options.baroptions.args.bartexture.order = 12
options.baroptions.args.bartexture.max = 1
options.baroptions.args.barspacing = nil
options.titleoptions.args.texture = nil
options.titleoptions.args.bordertexture = nil
options.titleoptions.args.thickness = nil
options.titleoptions.args.margin = nil
options.titleoptions.args.color = nil
options.windowoptions = nil
options.baroptions.args.barfont = nil
options.titleoptions.args.font = nil
end
 
-- Hook the bar mod
local barmod = Skada.displays["bar"]
-- Strip options
barmod.AddDisplayOptions_ = barmod.AddDisplayOptions
barmod.AddDisplayOptions = function(self, win, options)
self:AddDisplayOptions_(win, options)
StripOptions(options)
end
for k, options in pairs(Skada.options.args.windows.args) do
if options.type == "group" then
StripOptions(options.args)
end
end
 
-- Override settings from in-game GUI
barmod.ApplySettings_ = barmod.ApplySettings
barmod.ApplySettings = function(self, win)
barmod:ApplySettings_(win)
win.bargroup:SetTexture(gray)
-- SettingsDB.CreateTemplate_Broder(win.bargroup)
win.bargroup:SortBars()
end
 
-- Override bar style
barmod.Update_ = barmod.Update
barmod.Update = function(self, win)
barmod:Update_(win)
local nr = 1
for i, data in ipairs(win.dataset) do
if data.id then
local barid = data.id
local barlabel = data.label
local bar = win.bargroup:GetBar(barid)
if bar then
E.EuiSetTemplate(bar)
end
end
end
end
 
-- Update pre-existing displays
for k, window in ipairs(Skada:GetWindows()) do
window:UpdateDisplay()
end
 
end
end)
 
local xpoint
--if C["actionbar"].longstyle == true then
xpoint = (C["actionbar"].buttonsize * 9) + (C["actionbar"].buttonspacing * 12)
--else
-- xpoint = (C["actionbar"].buttonsize * 6) + (C["actionbar"].buttonspacing * 9)
--end
 
----------------------------------------------------------------------------------------
-- Skada settings(by Spark)
----------------------------------------------------------------------------------------
local function EuiUploadSkada()
if (SkadaDB) then table.wipe(SkadaDB) end
SkadaDB = {
["profiles"] = {
["Default"] = {
["modules"] = {
["notankwarnings"] = true,
},
["hidepvp"] = true,
["onlykeepbosses"] = true,
["windows"] = {
{
["point"] = "BOTTOM",
["barmax"] = 6,
["scale"] = 1,
["x"] = xpoint+108,
["y"] = 96,
["title"] = {
["fontsize"] = 11,
["borderthickness"] = 2,
["texture"] = "Armory",
["bordertexture"] = "Armory",
},
["barheight"] = 16,
["spark"] = false,
["enabletitle"] = true,
["barwidth"] = 200,
["barspacing"] = 3,
["barfontsize"] = 11,
["bartexture"] = "",
}, -- [1]
},
["tooltippos"] = "topright",
["icon"] = {
["hide"] = true,
},
["showranks"] = false,
},
},
}
 
if LjxxuiInstallV335 == true then
end
SkadaDB.InstalledBars = LjxxuiInstallV335
end
 
StaticPopupDialogs["SETTINGS_SKADA"] = {
text = "设置Skada皮肤",
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function() EuiUploadSkada() ReloadUI() end,
timeout = 0,
whileDead = 1,
hideOnEscape = true,
}
 
----------------------------------------------------------------------------------------
-- On logon function
----------------------------------------------------------------------------------------
local OnLogon = CreateFrame("Frame")
OnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
OnLogon:SetScript("OnEvent", function(self, event)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
 
if IsAddOnLoaded("Skada") then
if SkadaDB.InstalledBars ~= LjxxuiInstallV335 then
StaticPopup_Show("SETTINGS_SKADA")
end
end
end)
Eui/skins/skins.lua New file
0,0 → 1,221
local E,C = unpack(select(2, ...))
if C["skins"].askins ~= true then return end
 
local function SetModifiedBackdrop(self)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
self:SetBackdropBorderColor(r, g, b,1)
else
self:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
end
 
local function SetOriginalBackdrop(self)
self:SetBackdropColor(.1,.1,.1,1)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
self:SetBackdropBorderColor(r, g, b,1)
else
self:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
end
 
local function SkinButton(f)
if f:GetName() then
local l = _G[f:GetName().."Left"]
local m = _G[f:GetName().."Middle"]
local r = _G[f:GetName().."Right"]
 
 
if l then l:SetAlpha(0) end
if m then m:SetAlpha(0) end
if r then r:SetAlpha(0) end
end
 
if f.SetNormalTexture then
f:SetNormalTexture("")
end
 
if f.SetHighlightTexture then
f:SetHighlightTexture("")
end
 
if f.SetPushedTexture then
f:SetPushedTexture("")
end
 
if f.SetDisabledTexture then
f:SetDisabledTexture("")
end
E.EuiSetTemplate(f)
f:HookScript("OnEnter", SetModifiedBackdrop)
f:HookScript("OnLeave", SetOriginalBackdrop)
end
 
local ePuiSkin = CreateFrame("Frame")
ePuiSkin:RegisterEvent("ADDON_LOADED")
ePuiSkin:SetScript("OnEvent", function(self, event, addon)
if IsAddOnLoaded("Skinner") or IsAddOnLoaded("Aurora") then return end
 
-- stuff not in Blizzard load-on-demand
-- Blizzard frame we want to reskin
local skins = {
"StaticPopup1",
"StaticPopup2",
"GameMenuFrame",
"InterfaceOptionsFrame",
"VideoOptionsFrame",
"AudioOptionsFrame",
"LFDDungeonReadyStatus",
"BNToastFrame",
"TicketStatusFrameButton",
"DropDownList1MenuBackdrop",
"DropDownList2MenuBackdrop",
"DropDownList1Backdrop",
"DropDownList2Backdrop",
"LFDSearchStatus",
"AutoCompleteBox",
"ColorPickerFrame",
"ConsolidatedBuffsTooltip",
"ReadyCheckFrame",
}
 
for i = 1, getn(skins) do
E.EuiSetTemplate(_G[skins[i]])
if _G[skins[i]] ~= _G["GhostFrameContentsFrame"] or _G[skins[i]] ~= _G["AutoCompleteBox"] then -- frame to blacklist from create shadow function
E.EuiCreateShadow(_G[skins[i]])
end
_G[skins[i]]:SetBackdropColor(.1,.1,.1,0.8)
end
 
local ChatMenus = {
"ChatMenu",
"EmoteMenu",
"LanguageMenu",
"VoiceMacroMenu",
}
--
for i = 1, getn(ChatMenus) do
if _G[ChatMenus[i]] == _G["ChatMenu"] then
_G[ChatMenus[i]]:HookScript("OnShow", function(self) E.EuiSetTemplate(self) self:SetBackdropColor(.1,.1,.1,0.8) self:ClearAllPoints() self:SetPoint("BOTTOMLEFT", ChatFrame1, "TOPLEFT", 0, 30) end)
else
_G[ChatMenus[i]]:HookScript("OnShow", function(self) E.EuiSetTemplate(self) self:SetBackdropColor(.1,.1,.1,0.8) end)
end
end
 
-- reskin popup buttons
for i = 1, 2 do
for j = 1, 3 do
SkinButton(_G["StaticPopup"..i.."Button"..j])
end
end
 
-- reskin all esc/menu buttons
local BlizzardMenuButtons = {
"Options",
"SoundOptions",
"UIOptions",
"Keybindings",
"Macros",
"Ratings",
"AddOns",
"Logout",
"Quit",
"Continue",
"MacOptions"
}
 
for i = 1, getn(BlizzardMenuButtons) do
local ePuiMenuButtons = _G["GameMenuButton"..BlizzardMenuButtons[i]]
if ePuiMenuButtons then
SkinButton(ePuiMenuButtons)
end
end
 
if IsAddOnLoaded("OptionHouse") then
SkinButton(GameMenuButtonOptionHouse)
end
 
-- skin return to graveyard button
 
-- hide header textures and move text/buttons.
local BlizzardHeader = {
"GameMenuFrame",
"InterfaceOptionsFrame",
"AudioOptionsFrame",
"VideoOptionsFrame",
"ColorPickerFrame"
}
 
for i = 1, getn(BlizzardHeader) do
local title = _G[BlizzardHeader[i].."Header"]
if title then
title:SetTexture("")
title:ClearAllPoints()
if title == _G["GameMenuFrameHeader"] then
title:SetPoint("TOP", GameMenuFrame, 0, 7)
else
title:SetPoint("TOP", BlizzardHeader[i], 0, 0)
end
end
end
 
-- here we reskin all "normal" buttons
local BlizzardButtons = {
"VideoOptionsFrameOkay",
"VideoOptionsFrameCancel",
"VideoOptionsFrameDefaults",
"VideoOptionsFrameApply",
"AudioOptionsFrameOkay",
"AudioOptionsFrameCancel",
"AudioOptionsFrameDefaults",
"InterfaceOptionsFrameDefaults",
"InterfaceOptionsFrameOkay",
"InterfaceOptionsFrameCancel",
"ColorPickerOkayButton",
"ColorPickerCancelButton",
"ReadyCheckFrameYesButton",
"ReadyCheckFrameNoButton",
}
 
for i = 1, getn(BlizzardButtons) do
local ePuiButtons = _G[BlizzardButtons[i]]
if ePuiButtons then
SkinButton(ePuiButtons)
end
end
 
-- if a button position is not really where we want, we move it here
_G["VideoOptionsFrameCancel"]:ClearAllPoints()
_G["VideoOptionsFrameCancel"]:SetPoint("RIGHT",_G["VideoOptionsFrameApply"],"LEFT",-4,0)
_G["VideoOptionsFrameOkay"]:ClearAllPoints()
_G["VideoOptionsFrameOkay"]:SetPoint("RIGHT",_G["VideoOptionsFrameCancel"],"LEFT",-4,0)
_G["AudioOptionsFrameOkay"]:ClearAllPoints()
_G["AudioOptionsFrameOkay"]:SetPoint("RIGHT",_G["AudioOptionsFrameCancel"],"LEFT",-4,0)
_G["InterfaceOptionsFrameOkay"]:ClearAllPoints()
_G["InterfaceOptionsFrameOkay"]:SetPoint("RIGHT",_G["InterfaceOptionsFrameCancel"],"LEFT", -4,0)
_G["ColorPickerCancelButton"]:ClearAllPoints()
_G["ColorPickerOkayButton"]:ClearAllPoints()
_G["ColorPickerCancelButton"]:SetPoint("BOTTOMRIGHT", ColorPickerFrame, "BOTTOMRIGHT", -6, 6)
_G["ColorPickerOkayButton"]:SetPoint("RIGHT",_G["ColorPickerCancelButton"],"LEFT", -4,0)
_G["ReadyCheckFrameYesButton"]:SetParent(_G["ReadyCheckFrame"])
_G["ReadyCheckFrameNoButton"]:SetParent(_G["ReadyCheckFrame"])
_G["ReadyCheckFrameYesButton"]:SetPoint("RIGHT", _G["ReadyCheckFrame"], "CENTER", -1, 0)
_G["ReadyCheckFrameNoButton"]:SetPoint("LEFT", _G["ReadyCheckFrameYesButton"], "RIGHT", 3, 0)
_G["ReadyCheckFrameText"]:SetParent(_G["ReadyCheckFrame"])
_G["ReadyCheckFrameText"]:ClearAllPoints()
_G["ReadyCheckFrameText"]:SetPoint("TOP", 0, -12)
 
-- others
_G["ReadyCheckListenerFrame"]:SetAlpha(0)
_G["ReadyCheckFrame"]:HookScript("OnShow", function(self) if self.initiator then if UnitIsUnit("player", self.initiator) then self:Hide() end end end) -- bug fix, don't show it if initiator
 
E.EuiSetTemplate(LFDDungeonReadyDialog)
-- ElvDB.SetTransparentTemplate(LFDDungeonReadyDialog)
E.EuiCreateShadow(LFDDungeonReadyDialog)
-- ElvDB.CreateShadow(LFDDungeonReadyDialog)
SkinButton(LFDDungeonReadyDialogEnterDungeonButton)
SkinButton(LFDDungeonReadyDialogLeaveQueueButton)
SkinButton(ColorPickerOkayButton)
SkinButton(ColorPickerCancelButton)
end)
\ No newline at end of file
Eui/element/compare.lua New file
0,0 → 1,66
local E,C = unpack(select(2, ...))
CURRENTLY_EQUIPPED = LIGHTYELLOW_FONT_COLOR_CODE.."["..CURRENTLY_EQUIPPED.."]".. FONT_COLOR_CODE_CLOSE
 
local orig1 = GameTooltip:GetScript("OnTooltipSetItem")
GameTooltip:SetScript("OnTooltipSetItem", function(self, ...)
local f = GetMouseFocus() and GetMouseFocus():GetName() or ""
if not _G[f.."HotKey"] and not ShoppingTooltip1:IsVisible() and not self:IsEquippedItem() then GameTooltip_ShowCompareItem(self, 1) end
if orig1 then return orig1(self, ...) end
end)
 
 
local orig2 = ItemRefTooltip:GetScript("OnTooltipSetItem")
ItemRefTooltip:SetScript("OnTooltipSetItem", function(self, ...)
GameTooltip_ShowCompareItem(self, 1)
self.comparing = true
if orig2 then return orig2(self, ...) end
end)
 
 
-- Don't let ItemRefTooltip fuck with the compare tips
ItemRefTooltip:SetScript("OnEnter", nil)
ItemRefTooltip:SetScript("OnLeave", nil)
ItemRefTooltip:SetScript("OnDragStart", function(self)
ItemRefShoppingTooltip1:Hide(); ItemRefShoppingTooltip2:Hide(); ItemRefShoppingTooltip3:Hide()
self:StartMoving()
end)
ItemRefTooltip:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
ValidateFramePosition(self)
GameTooltip_ShowCompareItem(self, 1)
end)
 
if C["tooltip"].hovertip == true then
local orig1, orig2 = {}, {}
local GameTooltip = GameTooltip
 
local linktypes = {item = true, enchant = true, spell = true, quest = true, unit = true, talent = true, achievement = true, glyph = true}
 
 
local function OnHyperlinkEnter(frame, link, ...)
local linktype = link:match("^([^:]+)")
if linktype and linktypes[linktype] then
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
GameTooltip:SetHyperlink(link)
GameTooltip:Show()
end
 
if orig1[frame] then return orig1[frame](frame, link, ...) end
end
 
local function OnHyperlinkLeave(frame, ...)
GameTooltip:Hide()
if orig2[frame] then return orig2[frame](frame, ...) end
end
 
 
local _G = getfenv(0)
for i=1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
orig1[frame] = frame:GetScript("OnHyperlinkEnter")
frame:SetScript("OnHyperlinkEnter", OnHyperlinkEnter)
 
orig2[frame] = frame:GetScript("OnHyperlinkLeave")
frame:SetScript("OnHyperlinkLeave", OnHyperlinkLeave)
end
end
\ No newline at end of file
Eui/element/threat.lua New file
0,0 → 1,306
local E,C = unpack(select(2, ...))
if not C["threat"].enable == true then return end
local direction = "down"
local threatguid, threatunit, threatlist, threatbars = "", "target", {}, {};
 
local euithreatframe = CreateFrame("Frame", "EuiThreatFrame", UIParent);
E.EuiCreatePanel(euithreatframe, 1, 1, "TOPLEFT", UIParent, "TOPLEFT", 10, -60)
euithreatframe:SetWidth(C["threat"].width+ E.Scale(4))
euithreatframe:SetHeight(C["threat"].height * C["threat"].bars + (C["threat"].spacing*(C["threat"].bars-1)) + E.Scale(4))
E.EuiSetTemplate(euithreatframe)
E.EuiCreateShadow(euithreatframe)
EuiThreatFrame:Hide()
local euithreatframetop = CreateFrame("Frame",nil, EuiThreatFrame)
E.EuiCreatePanel(euithreatframetop, 1, 1, "BOTTOM", EuiThreatFrame, "TOP", 0, C["threat"].spacing)
euithreatframetop:SetWidth(C["threat"].width+ E.Scale(4))
euithreatframetop:SetHeight(C["threat"].height+ E.Scale(4))
E.EuiSetTemplate(euithreatframetop,1)
euithreatframetop.text = euithreatframetop:CreateFontString(nil,"OVERLAY")
euithreatframetop.text:SetFont(E.fontn,12,"OUTLINE")
euithreatframetop.text:SetPoint("LEFT", euithreatframetop, "LEFT", 2, 0)
euithreatframetop.text:SetText("仇 恨")
euithreatframetop.text:SetShadowOffset(1,-1)
--[[ local ebarbg={}
for i=1,C["threat"].bars do
ebarbg[i] = CreateFrame("Frame", nil, EuiThreatFrame)
ebarbg[i]:SetWidth(C["threat"].width)
ebarbg[i]:SetHeight(C["threat"].height)
if i == 1 then
ebarbg[i]:SetPoint("TOPLEFT", EuiThreatFrame, "TOPLEFT", E.Scale(2), -E.Scale(2))
ebarbg[i]:SetPoint("TOPRIGHT", EuiThreatFrame, "TOPRIGHT", -E.Scale(2), -E.Scale(2))
else
ebarbg[i]:SetPoint("TOP", ebarbg[i-1], "BOTTOM", 0, -C["threat"].spacing)
end
E.EuiSetTemplate(ebarbg[i])
end ]]
 
 
local function comma_value(n)
local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
 
local function short_value(value)
local strLen = strlen(value);
local retString = value;
if ( strLen > 6 ) then
retString = string.sub(value, 1, -7)..SECOND_NUMBER_CAP;
elseif ( strLen > 3 ) then
retString = string.sub(value, 1, -4)..FIRST_NUMBER_CAP;
end
return retString;
end
 
local function ColorGradient(perc, ...)
if perc >= 1 then
local r, g, b = select(select('#', ...) - 2, ...)
return r, g, b
elseif perc <= 0 then
local r, g, b = ...
return r, g, b
end
 
local num = select('#', ...) / 3
 
local segment, relperc = math.modf(perc*(num-1))
local r1, g1, b1, r2, g2, b2 = select((segment*3)+1, ...)
 
return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc
end
 
local function GetThreat(unit, pet)
if ( UnitName(pet or unit) == UNKNOWN or not UnitIsVisible(pet or unit) ) then
return;
end
 
local tperc, _, tvalue = select(3, UnitDetailedThreatSituation(pet or unit, threatunit));
local name = pet and UnitName(unit) .. ": " .. UnitName(pet) or UnitName(unit);
 
for index, value in ipairs(threatlist) do
if ( value.name == name ) then
tremove(threatlist, index);
break;
end
end
if tvalue and tvalue < 0 then
tvalue = tvalue + 410065408;
end
table.insert(threatlist, {
name = name,
class = select(2, UnitClass(unit)),
tperc = tperc or 0,
tvalue = tvalue or 0,
});
end
 
local function AddThreat(unit, pet)
if ( UnitExists(pet) ) then
GetThreat(unit);
GetThreat(unit, pet);
else
if ( GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 ) then
GetThreat(unit);
end
end
end
 
local function SortThreat(a, b)
if direction == "down" then
return a.tperc > b.tperc;
end
return a.tperc < b.tperc;
end
 
local function OnUpdateBar(self, elpased)
if ( self.moveTo == self.value ) then
self:SetScript("OnUpdate", nil);
else
if ( self.moveTo > self.value ) then
self.value = self.value+1;
elseif ( self.moveTo < self.value ) then
self.value = self.value-1;
end
self:SetValue(self.value);
end
end
 
local function UpdateThreatBars()
for index, value in ipairs(threatbars) do
value:Hide();
end
table.sort(threatlist, SortThreat);
local bar, class, r, g, b, text;
for index, value in ipairs(threatlist) do
if ( index > C["threat"].bars ) then
return;
end
bar = threatbars[index];
if ( not bar ) then
bar = CreateFrame("StatusBar", "eThreatBar"..index, UIParent);
bar:SetWidth(C["threat"].width);
bar:SetHeight(C["threat"].height);
bar:SetStatusBarTexture(E.normTex);
bar:SetMinMaxValues(0, 100);
bar:SetValue(0);
if ( index == 1 ) then
bar:SetPoint("TOPLEFT", EuiThreatFrame, "TOPLEFT", E.Scale(2), -E.Scale(2));
bar:SetPoint("TOPRIGHT", EuiThreatFrame, "TOPRIGHT", -E.Scale(2), -E.Scale(2));
else
bar:SetPoint("TOP", threatbars[index-1], "BOTTOM", 0, -C["threat"].spacing);
end
 
bar:SetBackdropColor(0, 0, 0, 1)
bar:SetBackdropBorderColor(0, 0, 0, 1)
 
bar.bg = bar:CreateTexture(nil, "BORDER")
bar.bg:SetAllPoints(bar)
bar.bg:SetTexture(E.normTex)
bar.bg:SetVertexColor(0.15, 0.15, 0.15)
 
local panel = CreateFrame("Frame", nil, bar)
E.EuiCreatePanel(panel, C["threat"].width, C["threat"].height, "CENTER", bar, "CENTER", 0, 0)
panel:SetBackdropColor(0, 0, 0)
panel:SetBackdropBorderColor(0, 0, 0)
E.EuiCreateShadow(panel)
E.EuiSetTemplate(panel)
 
bar.textright = bar:CreateFontString("$parentTextRight", "ARTWORK");
bar.textright:SetFont(E.fontn, 10, "OUTLINE");
bar.textright:SetShadowOffset(0, 0);
bar.textright:SetShadowColor(0, 0, 0, 0.8);
bar.textright:SetJustifyH("RIGHT");
bar.textright:SetPoint("RIGHT", -1, 1);
bar.textright:SetTextColor(1, 1, 1, 1);
 
bar.textleft = bar:CreateFontString("$parentTextLeft", "ARTWORK");
bar.textleft:SetFont(E.font, 11);
bar.textleft:SetShadowOffset(1, -1);
bar.textleft:SetShadowColor(0, 0, 0, 0.8);
bar.textleft:SetJustifyH("LEFT");
bar.textleft:SetPoint("LEFT", 1, 1);
bar.textleft:SetPoint("RIGHT", bar.textright, "LEFT", -1, 1);
 
tinsert(threatbars, bar);
end
 
 
bar.moveTo = tonumber(format("%d", value.tperc));
bar.value = tonumber(format("%d", bar:GetValue()));
if ( bar.value > 100 ) then
bar.value = 100;
elseif ( bar.value < 0 ) then
bar.value = 0;
end
bar:SetScript("OnUpdate", OnUpdateBar);
 
if ( value.name == UnitName("player") ) then
bar.textleft:SetTextColor(1, 1, 1, 1);
bar:SetStatusBarColor(0.8, 0, 0, 0.8);
else
class = E.RAID_CLASS_COLORS[value.class];
bar.textleft:SetTextColor(class.r, class.g, class.b, 1);
bar:SetStatusBarColor(0.31, 0.45, 0.63, 0.5);
end
 
r, g, b = ColorGradient(((value.tperc > 100 and 100 or value.tperc)/100), 0, 1, 0, 1, 1, 0, 1, 0, 0);
text = string.gsub("$value [$perc%]", "$value", comma_value(tonumber(format("%d", value.tvalue/100))));
text = string.gsub(text, "$shortvalue", short_value(tonumber(format("%d", value.tvalue/100))));
text = string.gsub(text, "$perc", string.format("|cff%02x%02x%02x%d|r", r*255, g*255, b*255, value.tperc));
text = string.gsub(text, "$name", value.name);
bar.textright:SetText(text);
 
text = string.gsub("$name", "$value", comma_value(tonumber(format("%d", value.tvalue/100))));
text = string.gsub(text, "$shortvalue", short_value(tonumber(format("%d", value.tvalue/100))));
text = string.gsub(text, "$perc", string.format("|cff%02x%02x%02x%d|r", r*255, g*255, b*255, value.tperc));
text = string.gsub(text, "$name", value.name);
bar.textleft:SetText(text);
 
bar:Show();
end
end
 
local function OnEvent(self, event, ...)
local unit = ...;
if ( event == "ADDON_LOADED" ) then
self:SetPoint("TOPLEFT", EuiThreatFrame, "TOPLEFT", E.Scale(2), -E.Scale(2));
self:SetPoint("TOPRIGHT", EuiThreatFrame, "TOPRIGHT", -E.Scale(2), -E.Scale(2));
direction = "down"
self:SetWidth(C["threat"].width);
self:SetHeight(C["threat"].height);
self:UnregisterEvent(event);
end
if ( event == "UNIT_THREAT_LIST_UPDATE" ) then
if UnitIsPlayer("target") and UnitCanAttack("player", "focus") then
threatunit = "focus"
elseif UnitCanAttack("player", "target") then
threatunit = "target"
end
if ( unit and UnitExists(unit) and UnitGUID(unit) == threatguid and UnitCanAttack("player", threatunit) ) then
if ( GetNumRaidMembers() > 0 ) then
for i=1, GetNumRaidMembers(), 1 do
AddThreat("raid"..i, "raid"..i.."pet");
end
EuiThreatFrame:Show();
elseif ( GetNumPartyMembers() > 0 ) then
AddThreat("player", "pet");
for i=1, GetNumPartyMembers(), 1 do
AddThreat("party"..i, "party"..i.."pet");
end
EuiThreatFrame:Show();
else
AddThreat("player", "pet");
end
UpdateThreatBars();
end
elseif ( event == "PLAYER_TARGET_CHANGED" ) then
if ( UnitExists("target") and not UnitIsDead("target") and not UnitIsPlayer("target") ) then
threatguid = UnitGUID("target");
elseif UnitIsPlayer("target") and UnitCanAttack("player", "focus") then
threatguid = UnitGUID("focus"); --如果目标是友方单位,焦点是敌对单位的话,显示焦点仇恨.
else
threatguid = "";
end
wipe(threatlist);
UpdateThreatBars();
elseif ( event == "PLAYER_REGEN_ENABLED" ) then
EuiThreatFrame:Hide();
wipe(threatlist);
UpdateThreatBars();
end
end
 
local eThreatFrame = CreateFrame("Frame", "eThreat", EuiThreatFrame);
eThreatFrame:SetClampedToScreen(true);
eThreatFrame:RegisterEvent("UNIT_THREAT_LIST_UPDATE");
eThreatFrame:RegisterEvent("PLAYER_TARGET_CHANGED");
eThreatFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
eThreatFrame:RegisterEvent("PLAYER_REGEN_DISABLED");
eThreatFrame:RegisterEvent("ADDON_LOADED");
eThreatFrame:SetScript("OnEvent", OnEvent);
 
function E.ThreatPoint(frame)
if E.Movers["ThreatMover"]["moved"] ~= true then
ThreatMover:ClearAllPoints()
ThreatMover:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 10, -60)
end
end
 
E.CreateMover(EuiThreatFrame, "ThreatMover", "仇恨框架", false, E.ThreatPoint)
 
function E.ThreatShow()
if EuiThreatFrame:IsShown() then EuiThreatFrame:Hide() end
end
 
function E.ThreatTest()
table.insert(threatlist, { name = PLAYER.." 1", class = "WARRIOR", tperc = 100, tvalue = 100*1000*1000 });
table.insert(threatlist, { name = PLAYER.." 2", class = "ROGUE", tperc = 90, tvalue = 90*1000*1000 });
table.insert(threatlist, { name = PLAYER.." 3", class = "HUNTER", tperc = 80, tvalue = 80*1000*1000 });
table.insert(threatlist, { name = PLAYER.." 4", class = "PRIEST", tperc = 70, tvalue = 70*1000*1000 });
table.insert(threatlist, { name = PLAYER.." 5", class = "DRUID", tperc = 60, tvalue = 60*1000*1000 });
table.insert(threatlist, { name = PLAYER.." 6", class = "WARLOCK", tperc = 50, tvalue = 50*1000*1000 });
table.insert(threatlist, { name = PLAYER.." 7", class = "MAGE", tperc = 40, tvalue = 40*1000*1000 });
UpdateThreatBars();
end
if C["threat"].test == true then
E.ThreatTest()
end
\ No newline at end of file
Eui/element/bag.lua New file
0,0 → 1,1910
local E,C = unpack(select(2, ...))
if not C["bag"].enable == true then
function BaudBagContainerDropDown_OnLoad() end
function BaudBagSubBag_OnLoad() end
function BaudBagSubBag_OnEvent() end
function BaudBagContainerDropDown_Show() end
function BaudBagContainer_OnLoad() end
function BaudBagContainer_OnShow() end
function BaudBagContainer_OnHide() end
function BaudBagContainer_OnUpdate() end
function BaudBagContainer_OnDragStart() end
function BaudBagContainer_OnDragStop() end
function BaudBagBagsFrame_OnShow() end
function BaudBagBagsButton_OnClick() end
function BaudBagKeyRing_OnLoad() end
function BaudBag_OnLoad() end
function BaudBag_OnEvent() end
function BaudBagCheckButton_OnClick() end
function BaudBagOptionsJoinCheck_OnClick() end
function BaudBagSlider_OnValueChanged() end
function BaudBagOptionsBag_OnClick() end
function BaudBagEnabledCheck_OnClick() end
function BaudBagNameEditBox_OnTextChanged() end
function BaudBagOptions_Defaults() end
function BaudBagOptionsFrame_OnLoad() end
function BaudBagOptionsFrame_OnEvent() end
function BaudBagOptionsFrame_OnShow() end
function BaudBagOptionsFrame_OnHide() end
return
end
--[[To do list:
Slash commands
Multi character viewing
Option for disabling fading
Update offline bank even when it's disabled
Vertex color for backgrounds
]]
local Locale = GetLocale();
if(Locale=="zhCN")then
BaudBagLocalized = {
StandardBag = "容器",
LockPosition = "锁定窗口",
UnlockPosition = "解锁窗口",
ShowBank = "显示银行",
Options = "选项",
Free = " 剩余",
Offline = " (离线银行)",
AutoOpen = "自动开启",
AutoOpenTooltip = "勾选后,在交易,使用邮箱和银行时自动打开背包(如果可用)",
BlankOnTop = "顶部留空",
BlankOnTopTooltip = "勾选后,剩余的未使用空间上升到整合背包顶部(开启背包整合后生效)",
RarityColoring = "质量边框",
RarityColoringTooltip = "勾选后,物品图标的边框按品质着色(开启背包整合后生效)",
Columns = "每行列数 - %d",
ColumnsTooltip = "每行显示的背包格数.",
Scale = "缩放 - %d%%",
ScaleTooltip = "缩放整合背包.",
AddMessage = "Baud Bag: 已载入. 输入 /baudbag 打开设置窗口.",
CheckTooltip = "启用的背包",
Enabled = "启用整合功能",
EnabledTooltip = "启用或禁用整合功能",
KeyRing = "钥匙链",
Of = " 的",
Inventory = "背包",
BankBox = "银行",
BlizInventory = "暴雪背包风格",
BlizBank = "暴雪银行风格",
BlizKeyring = "暴雪钥匙链风格",
Transparent = "水晶风格",
Solid = "Solid风格",
BagSet = "背包设定",
ContainerName = "背包名称:",
Background = "风格设定",
FeatureFrameName = "背包设定",
FeatureFrameTooltip = "设定背包整合的各种参数",
};
end
 
local Localized = BaudBagLocalized;
local CheckButtons = {
{Text=Localized.AutoOpen,SavedVar="AutoOpen",Default=false,
TooltipText=Localized.AutoOpenTooltip},
{Text=Localized.BlankOnTop,SavedVar="BlankTop",Default=false,
TooltipText=Localized.BlankOnTopTooltip},
{Text=Localized.RarityColoring,SavedVar="RarityColor",Default=true,
TooltipText=Localized.RarityColoringTooltip}
};
 
local SliderBars = {
{Text=Localized.Columns,Low="2",High="20",SavedVar="Columns", Default={8,12},
TooltipText = Localized.ColumnsTooltip},
{Text=Localized.Scale,Low="50%",High="200%",SavedVar="Scale", Default={100,100},
TooltipText = Localized.ScaleTooltip}
};
 
local Prefix = "BaudBag";
local SelectedBags = 1;
local SelectedContainer = 1;
local MaxBags = NUM_BANKBAGSLOTS + 1;
local Updating, CfgBackup;
local LastBagID = NUM_BANKBAGSLOTS + 4;
local SetSize = {6,NUM_BANKBAGSLOTS + 1};
local MaxCont = {1,1};
local NumCont = {};
local BankOpen = false;
local FadeTime = 0.2;
local BagsReady;
local Config;
 
BaudBagIcons = {
[0] = "Interface\\Buttons\\Button-Backpack-Up",
[-1] = "Interface\\Icons\\INV_Box_02",
[-2] = "Interface\\ContainerFrame\\KeyRing-Bag-Icon"
};
 
BaudBag_Debug = false;
 
if not BaudBag_Cache then
BaudBag_Cache={}
end
 
if not BaudBag_Cfg then
BaudBag_Cfg = {}
end
 
local function DebugMsg(msg)
if BaudBag_Debug then
DEFAULT_CHAT_FRAME:AddMessage(msg);
end
end
 
 
local function UseCache(Bag)
return (((Bag==-1)or(Bag >= 5))and not BankOpen);
end
 
local function ShowHyperlink(Owner, Link)
local ItemString = strmatch(Link or "","(item[%d:%-]+)");
if not ItemString then
return;
end
if(Owner:GetRight() >= (GetScreenWidth() / 2))then
GameTooltip:SetOwner(Owner, "ANCHOR_LEFT");
else
GameTooltip:SetOwner(Owner, "ANCHOR_RIGHT");
end
GameTooltip:SetHyperlink(ItemString);
return true;
end
 
 
function BaudBagForEachBag(BagSet,Func)
if(BagSet==1)then
for Bag = 1, 5 do
Func(Bag - 1, Bag);
end
Func(-2, 6);
else
Func(-1, 1);
for Bag = 1, NUM_BANKBAGSLOTS do
Func(Bag + 4, Bag + 1);
end
end
end
 
 
local function ShowCachedTooltip(self)
if Config and(Config[2].Enabled==false)and not(self and(strsub(self:GetName(), 1, 9)=="BaudBBank"))then
return;
end
local Bag, Slot;
if self.isBag then
Bag = self:GetID();
if UseCache(Bag)then
if not GameTooltip:GetItem()then
ShowHyperlink(self, BaudBag_Cache[Bag].BagLink);
end
BaudBagModifyBagTooltip(Bag);
end
return;
end
Bag, Slot = self:GetParent():GetID(), self:GetID();
if not UseCache(Bag)or GameTooltip:IsShown()or not BaudBag_Cache[Bag][Slot]then
return;
end
ShowHyperlink(self, BaudBag_Cache[Bag][Slot].Link);
end
 
 
hooksecurefunc("ContainerFrameItemButton_OnEnter", ShowCachedTooltip);
hooksecurefunc("BankFrameItemButton_OnEnter", ShowCachedTooltip);
 
--Adds container name when mousing over bags, aswell as simulating offline bank item mouse over
hooksecurefunc(GameTooltip,"SetInventoryItem",function(Data, Unit, InvID)
if(Unit~="player")then
return;
end
if(InvID >= 20)and(InvID <= 23)then
if Config and(Config[1].Enabled==false)then
return;
end
BaudBagModifyBagTooltip(InvID - 19);
 
elseif(InvID >= 68)and(InvID < 68 + NUM_BANKBAGSLOTS)then
if Config and(Config[2].Enabled==false)then
return;
end
BaudBagModifyBagTooltip(4 + InvID - 67);
end
end);
 
 
MainMenuBarBackpackButton:HookScript("OnEnter",function(...)
if Config and(Config[1].Enabled~=false)then
BaudBagModifyBagTooltip(0);
end
end);
 
 
function BaudBagModifyBagTooltip(BagID)
--[[ if not GameTooltip:IsShown()then
return;
end
local Container = getglobal("BaudBagSubBag"..BagID):GetParent();
Container = Config[Container.BagSet][Container:GetID()].Name;
if not Container or not strfind(Container,"%S")then
return;
end
GameTooltip:AddLine(Container);
local Current, Next;
for Line = GameTooltip:NumLines(), 3, -1 do
Current, Next = getglobal("GameTooltipTextLeft"..Line),getglobal("GameTooltipTextLeft"..(Line - 1));
Current:SetTextColor(Next:GetTextColor());
Current:SetText(Next:GetText());
end
if Next then
Next:SetText(Container);
Next:SetTextColor(1,0.82,0);
end
GameTooltip:Show(); ]]
end
 
 
local EventFuncs = {
VARIABLES_LOADED = function()
--BaudBagVersionText:SetText("Version "..GetAddOnMetadata("BaudBag","Version"));
 
if ( EarthFeature_AddButton ) then --add by Isler
EarthFeature_AddButton(
{
id= "BaudBag";
name= Localized.FeatureFrameName;
subtext= "BaudBag";
tooltip = Localized.FeatureFrameTooltip;
icon= "Interface\\Icons\\Spell_Fire_SunKey";
callback= function() BaudBagOptionsFrame:Show();end;
}
);
end
 
if(type(BaudBag_Cache)~="table")then
BaudBag_Cache = {};
end
if(type(BaudBag_Cache[-1])~="table")then
BaudBag_Cache[-1] = {Size = NUM_BANKGENERIC_SLOTS};
end
--The rest of the bank slots are cleared in the next event
BaudBagBankSlotPurchaseButton:Disable();
end,
 
PLAYER_LOGIN = function()
DebugMsg("Creating bag slot buttons.");
--Generate bank bag buttons for each bag slot
local BagSlot, Texture;
for Bag = 1, 4 do
--Bag name length is restricted. for this one, the ID is set automatically.
BagSlot = CreateFrame("CheckButton","BaudBInveBag"..(Bag - 1).."Slot",BBCont1_1BagsFrame,"BagSlotButtonTemplate");
BagSlot:SetPoint("TOPLEFT",8,-8 - (Bag - 1) * 39);
getglobal(BagSlot:GetName().."ItemAnim"):UnregisterAllEvents();
end
BBCont1_1BagsFrame:SetWidth(13 + 39);
BBCont1_1BagsFrame:SetHeight(13 + 4 * 39 + 20);
 
for Bag = 1, NUM_BANKBAGSLOTS do
--Bag name length is restricted
BagSlot = CreateFrame("Button","BaudBBankBag"..Bag,BBCont2_1BagsFrame,"BankItemButtonBagTemplate");
BagSlot:SetID(Bag + 4);
BagSlot:SetPoint("TOPLEFT",8 + mod(Bag - 1, 2) * 39,-8 - floor((Bag - 1) / 2) * 39);
if(type(BaudBag_Cache[Bag + 4])~="table")then
BaudBag_Cache[Bag + 4] = {Size = 0};
end
if(BaudBag_Cache[Bag + 4].BagLink)then
Texture = GetItemIcon(BaudBag_Cache[Bag + 4].BagLink);
SetItemButtonCount(BagSlot,BaudBag_Cache[Bag + 4].BagCount or 0);
else
Texture = select(2,GetInventorySlotInfo("Bag"..Bag));
end
SetItemButtonTexture(BagSlot,Texture);
end
BBCont2_1BagsFrame:SetWidth(91);
--Height changes depending if there is a purchase button
BBCont2_1BagsFrame.Height = 13 + ceil(NUM_BANKBAGSLOTS / 2) * 39;
BaudBagBankBags_Update();
BaudBagRestoreCfg();
if Config and (Config[2].Enabled == true) then
BankFrame:UnregisterEvent("BANKFRAME_OPENED");
end
end,
 
BANKFRAME_CLOSED = function()
BankOpen = false;
BaudBagBankSlotPurchaseButton:Disable();
if BBCont2_1.AutoOpened then
BBCont2_1:Hide();
else
--Add offline again to bag name
for ContNum = 1, NumCont[2]do
BaudBagUpdateName(getglobal("BBCont2_"..ContNum));
end
end
BaudBagAutoOpenSet(1, true);
end,
 
PLAYER_MONEY = function()
BaudBagBankBags_Update();
end,
 
ITEM_LOCK_CHANGED = function()
local Bag, Slot = arg1, arg2;
if(Bag == BANK_CONTAINER)then
if(Slot <= NUM_BANKGENERIC_SLOTS)then
BankFrameItemButton_UpdateLocked(getglobal("BaudBagSubBag-1Item"..Slot));
else
BankFrameItemButton_UpdateLocked(getglobal("BaudBBankBag"..(Slot-NUM_BANKGENERIC_SLOTS)));
end
end
end
};
 
local Func = function()
if(event=="BANKFRAME_OPENED")then
BankOpen = true;
end
BaudBagBankSlotPurchaseButton:Enable();
for Index = 1, NUM_BANKGENERIC_SLOTS do
BankFrameItemButton_Update(getglobal("BaudBagSubBag-1Item"..Index));
end
for Index = 1, NUM_BANKBAGSLOTS do
BankFrameItemButton_Update(getglobal("BaudBBankBag"..Index));
end
BaudBagBankBags_Update();
DebugMsg("Recording bank bag info.");
for Bag = 1, NUM_BANKBAGSLOTS do
BaudBag_Cache[Bag + 4].BagLink = GetInventoryItemLink("player",67 + Bag);
BaudBag_Cache[Bag + 4].BagCount = GetInventoryItemCount("player",67 + Bag);
end
 
if(Config[2].Enabled == false)or(event~="BANKFRAME_OPENED")then
return;
end
if BBCont2_1:IsShown()then
BaudBagUpdateContainer(BBCont2_1);
BaudBagUpdateFreeSlots(BBCont2_1);
else
BBCont2_1.AutoOpened = true;
BBCont2_1:Show();
end
BaudBagAutoOpenSet(1);
BaudBagAutoOpenSet(2);
end
EventFuncs.BANKFRAME_OPENED = Func;
EventFuncs.PLAYERBANKBAGSLOTS_CHANGED = Func;
 
Func = function()
BaudBagAutoOpenSet(1);
end
EventFuncs.MERCHANT_SHOW = Func;
EventFuncs.MAIL_SHOW = Func;
EventFuncs.AUCTION_HOUSE_SHOW = Func;
 
Func = function()
BaudBagAutoOpenSet(1,true);
end
EventFuncs.MERCHANT_CLOSED = Func;
EventFuncs.MAIL_CLOSED = Func;
EventFuncs.AUCTION_HOUSE_CLOSED = Func;
 
Func = function()
if(event=="PLAYERBANKSLOTS_CHANGED")then
if(arg1 > NUM_BANKGENERIC_SLOTS)then
BankFrameItemButton_Update(getglobal("BaudBBankBag"..(arg1-NUM_BANKGENERIC_SLOTS)));
return;
end
local BankBag = getglobal("BaudBagSubBag-1");
if BankBag:GetParent():IsShown()then
BaudBagUpdateSubBag(BankBag);
end
BankFrameItemButton_Update(getglobal(BankBag:GetName().."Item"..arg1));
BagSet = 2;
else
BagSet = (arg1 ~= -1)and(arg1 <= 4)and 1 or 2;
end
local Container = getglobal("BBCont"..BagSet.."_1");
if not Container:IsShown()then
return;
end
Container.UpdateSlots = true;
end
EventFuncs.BAG_UPDATE = Func;
EventFuncs.BAG_CLOSED = Func;
EventFuncs.PLAYERBANKSLOTS_CHANGED = Func;
 
function BaudBag_OnLoad(self)
BINDING_HEADER_BaudBag = "Baud Bag";
BINDING_NAME_BaudBagToggleBank = "Toggle Bank";
 
for Key, Value in pairs(EventFuncs)do
self:RegisterEvent(Key);
end
 
local SubBag, Container;
for BagSet = 1, 2 do
--The first container from each set is different and is created in the XML
Container = getglobal("BBCont"..BagSet.."_1");
Container.BagSet = BagSet;
Container:SetID(1);
getglobal(Container:GetName().."Slots"):SetPoint("RIGHT",Container:GetName().."MoneyFrame","LEFT");
end
 
--The first bag from the bank is unique and is created in the XML
DebugMsg("Creating sub bags.");
for Bag = -2, LastBagID do
if(Bag == -1)then
SubBag = getglobal("BaudBagSubBag"..Bag);
else
SubBag = CreateFrame("Frame","BaudBagSubBag"..Bag,nil,"BaudBagSubBagTemplate");
end
SubBag:SetID(Bag);
SubBag.BagSet = (Bag ~= -1)and(Bag < 5)and 1 or 2;
SubBag:SetParent("BBCont"..SubBag.BagSet.."_1");
end
end
 
 
function BaudBag_OnEvent(self, event)
local BagSet;
EventFuncs[event]();
end
 
 
function BaudBagBagsFrame_OnShow(self)
--Adjust frame level because of Blizzard's screw up
local Level = self:GetFrameLevel() + 1;
for Key, Value in pairs(self:GetChildren())do
if(type(Value)=="table")then
Value:SetFrameLevel(Level);
end
end
end
 
 
local DropDownContainer, DropDownBagSet;
 
function BaudBagContainerDropDown_Show(self)
local Container = self:GetParent();
DropDownContainer = Container:GetID();
DropDownBagSet = Container.BagSet;
ToggleDropDownMenu(1, nil, BaudBagContainerDropDown, self:GetName(), 0, 0);
end
 
 
function BaudBagContainerDropDown_OnLoad(self)
UIDropDownMenu_Initialize(self, BaudBagContainerDropDown_Initialize, "MENU");
end
 
 
local function ToggleContainerLock(self)
Config[DropDownBagSet][DropDownContainer].Locked = not Config[DropDownBagSet][DropDownContainer].Locked;
end
 
 
local function ShowContainerOptions(self)
BaudBagOptionsSelectContainer(DropDownBagSet,DropDownContainer);
BaudBagOptionsFrame:Show();
end
 
 
function BaudBagToggleBank(self)
if BBCont2_1:IsShown()then
BBCont2_1:Hide();
else
BBCont2_1:Show();
BaudBagAutoOpenSet(2);
end
end
 
 
function BaudBagContainerDropDown_Initialize()
local info = UIDropDownMenu_CreateInfo();
 
info.text = not(DropDownBagSet and Config[DropDownBagSet][DropDownContainer].Locked)and Localized.LockPosition or Localized.UnlockPosition;
info.func = ToggleContainerLock;
UIDropDownMenu_AddButton(info);
 
--The bank box won't exist yet when this is initialized atfirst
if(DropDownBagSet~=2)and BBCont2_1 and not BBCont2_1:IsShown()then
info.text = Localized.ShowBank;
info.func = BaudBagToggleBank;
UIDropDownMenu_AddButton(info);
end
 
info.text = Localized.Options;
info.func = ShowContainerOptions;
UIDropDownMenu_AddButton(info);
end
 
 
--This function updates misc. options for a bag
function BaudUpdateContainerData(BagSet, ContNum)
local Container = getglobal("BBCont"..BagSet.."_"..ContNum);
DebugMsg("Updating container data: "..Container:GetName());
getglobal(Container:GetName().."Name"):SetText(Config[BagSet][ContNum].Name or "");
local Scale = Config[BagSet][ContNum].Scale / 100;
Container:SetScale(Scale);
if not Config[BagSet][ContNum].Coords then
BaudBagContainerSaveCoords(Container);
end
Container:ClearAllPoints();
local X, Y = unpack(Config[BagSet][ContNum].Coords);
Container:SetPoint("CENTER",UIParent,"BOTTOMLEFT",(X / Scale), (Y / Scale));
end
 
 
local function HideObject(Object)
Object = getglobal(Object);
if not Object then
return;
end
Object:Hide();
end
 
local TextureFile, TextureWidth, TextureHeight, TextureParent;
 
local function GetTexturePiece(Name, MinX, MaxX, MinY, MaxY, Layer)
local Texture = getglobal(TextureParent:GetName()..Name);
if not Texture then
Texture = TextureParent:CreateTexture(TextureParent:GetName()..Name);
end
Texture:ClearAllPoints();
Texture:SetTexture(TextureFile);
Texture:SetTexCoord(MinX / TextureWidth, (MaxX + 1) / TextureWidth, MinY / TextureHeight, (MaxY + 1) / TextureHeight);
Texture:SetWidth(MaxX - MinX + 1);
Texture:SetHeight(MaxY - MinY + 1);
Texture:SetDrawLayer(Layer);
Texture:Show();
-- Texture:SetVertexColor(0.2,0.2,1);
return Texture;
end
 
 
function BaudBagUpdateBackground(Container)
local Background = Config[Container.BagSet][Container:GetID()].Background;
local Backdrop = getglobal(Container:GetName().."Backdrop");
Backdrop:SetFrameLevel(Container:GetFrameLevel());
local Left, Right, Top, Bottom;
--This shifts the name of the bank frame over to make room for the extra button
local ShiftName = (Container:GetID()==1)and 25 or 0;
 
if(Background <= 3)then
Left, Right, Top, Bottom = 10, 10, 25, 7;
local Cols = Config[Container.BagSet][Container:GetID()].Columns;
if(Container.Slots < Cols)then
Cols = Container.Slots;
end
local Col = 0;
local Blanks = Cols - mod(Container.Slots - 1, Cols) - 1;
local BlankTop = Config[Container.BagSet][Container:GetID()].BlankTop and(Blanks ~= 0);
 
if BlankTop then
Col = Blanks;
else
Top = Top + 18;
end
 
local Parent = Backdrop:GetName().."Textures";
TextureParent = getglobal(Parent);
TextureParent:SetFrameLevel(Container:GetFrameLevel());
local Texture;
 
TextureFile = "Interface\\ContainerFrame\\UI-Bag-Components";
if(Background==2)then
TextureFile = TextureFile.."-Bank";
elseif(Background==3)then
TextureFile = TextureFile.."-Keyring";
end
TextureWidth, TextureHeight = 256, 512;
 
Texture = GetTexturePiece("TopLeft", 65, 116, 1, 49,"ARTWORK");
Texture:SetPoint("TOPLEFT", -7, 4);
 
Texture = GetTexturePiece("TopRight", 223, 252, 5, BlankTop and 30 or 49,"ARTWORK");
Texture:SetPoint("TOPRIGHT");
 
Texture = GetTexturePiece("BottomLeft",72,79,169,177,"ARTWORK");
Texture:SetPoint("BOTTOMLEFT");
 
Texture = GetTexturePiece("BottomRight",247,252,172,177,"ARTWORK");
Texture:SetPoint("BOTTOMRIGHT");
 
Texture = GetTexturePiece("Top", 117, 222, 5, BlankTop and 30 or 49,"ARTWORK");
Texture:SetPoint("TOP");
Texture:SetPoint("RIGHT",Parent.."TopRight","LEFT");
Texture:SetPoint("LEFT",Parent.."TopLeft","RIGHT");
 
Texture = GetTexturePiece("Left",72,76,182,432,"ARTWORK");
Texture:SetPoint("LEFT");
Texture:SetPoint("BOTTOM",Parent.."BottomLeft","TOP");
Texture:SetPoint("TOP",Parent.."TopLeft","BOTTOM");
 
Texture = GetTexturePiece("Right",248,252,182,432,"ARTWORK");
Texture:SetPoint("RIGHT");
Texture:SetPoint("BOTTOM",Parent.."BottomRight","TOP");
Texture:SetPoint("TOP",Parent.."TopRight","BOTTOM");
 
Texture = GetTexturePiece("Bottom",80,246,173,177,"OVERLAY");
Texture:SetPoint("BOTTOM");
Texture:SetPoint("LEFT",Parent.."BottomLeft","RIGHT");
Texture:SetPoint("RIGHT",Parent.."BottomRight","LEFT");
 
if(Blanks > 0)then
local Width = Blanks * 42;
if BlankTop then
Texture = GetTexturePiece("BlankFillEdge", 116, 223, 31, 34,"ARTWORK");
Texture:SetPoint("TOPLEFT",Parent.."Top","BOTTOMLEFT");
Texture:SetPoint("RIGHT",Container,"LEFT",Width,0);
 
Texture = GetTexturePiece("BlankFillLeft", 72, 116, 142, 162,"ARTWORK");
Texture:SetPoint("TOPRIGHT",Parent.."TopLeft","BOTTOMRIGHT",0,3);
Texture:SetPoint("BOTTOM",Container,"TOP",0,-42);
 
--Since the texture in already stretched about double in height, try to keep the ratio
local TexWidth = (Width / 2 > 107)and 107 or (Width / 2);
Texture = GetTexturePiece("BlankFill", 223-TexWidth, 223, 35, 49,"ARTWORK");
Texture:SetPoint("TOPRIGHT",Parent.."BlankFillEdge","BOTTOMRIGHT");
Texture:SetPoint("BOTTOMLEFT",Parent.."BlankFillLeft","BOTTOMRIGHT");
else
Texture = GetTexturePiece("BlankFillEdge",245,248,30,49,"ARTWORK");
Texture:SetPoint("BOTTOM",Container,"BOTTOM",0,-5);
Texture:SetPoint("RIGHT",Parent.."Right","LEFT");
Texture:SetHeight(42);
--Avoids the texture becomming too compressed if the space is infact small
local TexWidth = (Width > 132)and 132 or Width;
Texture = GetTexturePiece("BlankFill",245-TexWidth,244,30,49,"ARTWORK");
Texture:SetPoint("BOTTOMRIGHT",Parent.."BlankFillEdge","BOTTOMLEFT");
Texture:SetPoint("TOPRIGHT",Parent.."BlankFillEdge","TOPLEFT");
Texture:SetPoint("LEFT",Container,"RIGHT",-Width,0);
HideObject(Parent.."BlankFillLeft");
end
else
HideObject(Parent.."BlankFill");
HideObject(Parent.."BlankFillEdge");
HideObject(Parent.."BlankFillLeft");
end
 
--Width is 42, Height is 41
local Row = 1;
local OffsetX, OffsetY;
for Slot = 1, Container.Slots do
Col = Col + 1;
if(Col > Cols)then
Col = 1;
Row = Row + 1;
end
Texture = GetTexturePiece("Slot"..Slot,118,164,213,258,"BORDER");
OffsetX, OffsetY = -2, -2;
Texture:SetPoint("TOPLEFT",Container,"TOPLEFT",(Col - 1) * 42 + OffsetX - 3, (Row - 1) * -41 + 2 - OffsetY);
end
if(Container.Slots > (TextureParent.Slots or -1))then
TextureParent.Slots = Container.Slots;
else
--Hide extra slot textures
for Slot = (Container.Slots + 1), TextureParent.Slots do
getglobal(TextureParent:GetName().."Slot"..Slot):Hide();
end
end
--Makes corner gap look better
HideObject(Parent.."Corner");
if(Blanks > 0)then
local Slot = BlankTop and (Cols + 1) or (Container.Slots - Cols);
if(Slot >= 1)or(Slot <= Container.Slots)then
if not BlankTop then
Texture = GetTexturePiece("Corner",154,164,248,258,"OVERLAY");
Texture:SetPoint("BOTTOMRIGHT",Parent.."Slot"..Slot);
else
Texture = GetTexturePiece("Corner",118,128,213,223,"OVERLAY");
Texture:SetPoint("TOPLEFT",Parent.."Slot"..Slot);
end
end
end
 
--Adds the box for the money/slot indicators
if(Container:GetID()==1)then
Bottom = Bottom + 20;
TextureFile = "Interface\\ContainerFrame\\UI-BackpackBackground.blp";
TextureWidth, TextureHeight = 256, 256;
 
Texture = GetTexturePiece("BottomFillLeft",80,84,213,231,"BACKGROUND");
Texture:SetPoint("LEFT",Parent.."Left","RIGHT");
Texture:SetPoint("BOTTOM",Parent.."Bottom","TOP",0,-2);
 
Texture = GetTexturePiece("BottomFillRight",240,244,213,231,"BACKGROUND");
Texture:SetPoint("RIGHT",Parent.."Right","LEFT");
Texture:SetPoint("BOTTOM",Parent.."Bottom","TOP",0,-2);
 
Texture = GetTexturePiece("BottomFillCenter",85,239,213,231,"BACKGROUND");
Texture:SetPoint("LEFT",Parent.."BottomFillLeft","RIGHT");
Texture:SetPoint("RIGHT",Parent.."BottomFillRight","LEFT");
end
 
--Add a picture of the bag in the circle
Texture = getglobal(Parent.."Bag");
if not Texture then
Texture = TextureParent:CreateTexture(Parent.."Bag");
Texture:SetWidth(40);
Texture:SetHeight(40);
Texture:ClearAllPoints();
Texture:SetPoint("TOPLEFT",Parent.."TopLeft","TOPLEFT",3,-3);
Texture:SetDrawLayer("BACKGROUND");
end
local Icon;
local BagID = Container.Bags[1]:GetID();
if(BagID <= 0)then
Icon = BaudBagIcons[BagID];
elseif(Container.BagSet==2)and not BankOpen and BaudBag_Cache[BagID].BagLink then
Icon = GetItemIcon(BaudBag_Cache[BagID].BagLink);
else
Icon = GetInventoryItemTexture("player",ContainerIDToInventoryID(BagID));
end
 
SetPortraitToTexture(Texture,Icon or "Interface\\Icons\\INV_Misc_QuestionMark");
 
Backdrop:SetBackdrop(nil);
 
--Adjust the positioning of several bag components
getglobal(Container:GetName().."Name"):SetPoint("TOPLEFT",Backdrop,"TOPLEFT",(45 + ShiftName),-7);
getglobal(Container:GetName().."CloseButton"):SetPoint("TOPRIGHT",Backdrop,"TOPRIGHT",3,3);
TextureParent:Show();
if(Container:GetID()==1)then
getglobal(Container:GetName().."Slots"):SetPoint("BOTTOMLEFT",Backdrop,"BOTTOMLEFT",12,7);
getglobal(Container:GetName().."MoneyFrame"):SetPoint("BOTTOMRIGHT",Backdrop,"BOTTOMRIGHT",0,6);
end
else
Left, Right, Top, Bottom = 8, 8, 28, 8;
getglobal(Backdrop:GetName().."Textures"):Hide();
 
getglobal(Container:GetName().."Name"):SetPoint("TOPLEFT",(2 + ShiftName),18);
getglobal(Container:GetName().."CloseButton"):SetPoint("TOPRIGHT",8,28);
if(Container:GetID()==1)then
getglobal(Container:GetName().."Slots"):SetPoint("BOTTOMLEFT",2,-17);
getglobal(Container:GetName().."MoneyFrame"):SetPoint("BOTTOMRIGHT",8,-18);
Bottom = Bottom + 18;
end
 
if(Background==5)then
Backdrop:SetBackdrop({
-- bgFile = "Interface\\Buttons\\WHITE8X8",
-- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
bgFile = E.normTex, edgeFile = E.glowTex,
tile = true, tileSize = 8, edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11 }
});
Left, Right, Top, Bottom = Left+8, Right+8, Top+8, Bottom+8;
Backdrop:SetBackdropColor(0.1,0.1,0.1,0.8);
else
Backdrop:SetBackdrop({
-- bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
-- edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
bgFile = E.normTex, edgeFile = E.normTex,
tile = false, tileSize = 0, edgeSize = 1,
insets = { left = -1, right = -1, top = -1, bottom = -1 }
});
-- Backdrop:SetBackdropColor(0,0,0,0.8);
Backdrop:SetBackdropColor(0.1,0.1,0.1,.7)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
Backdrop:SetBackdropBorderColor(r, g, b,1)
else
Backdrop:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
end
end
getglobal(Container:GetName().."Name"):SetPoint("RIGHT",Container:GetName().."MenuButton","LEFT");
 
Backdrop:ClearAllPoints();
Backdrop:SetPoint("TOPLEFT",-Left,Top);
Backdrop:SetPoint("BOTTOMRIGHT",Right,-Bottom);
 
Container:SetHitRectInsets(-Left,-Right,-Top,-Bottom);
 
end
 
 
--This function updates the parent containers for each bag, according to the options setup
function BaudUpdateJoinedBags()
DebugMsg("Updating joined bags...");
local OpenBags = {};
for Bag = -2, LastBagID do
OpenBags[Bag] = getglobal("BaudBagSubBag"..Bag):GetParent():IsShown();
if OpenBags[Bag]then
DebugMsg("Bag open: "..Bag);
end
end
local SubBag, Container, IsOpen, ContNum, BagID;
local function FinishContainer()
if IsOpen then
DebugMsg("Showing Container "..Container:GetName());
Container:Show();
else
DebugMsg("Hiding Container "..Container:GetName());
Container:Hide();
end
BaudBagUpdateContainer(Container);
end
 
for BagSet = 1, 2 do
ContNum = 0;
BaudBagForEachBag(BagSet,function(Bag, Index)
if(ContNum==0)or(Config[BagSet].Joined[Index]==false)then
if(ContNum~=0)then
FinishContainer();
end
IsOpen = false;
ContNum = ContNum + 1;
if(MaxCont[BagSet] < ContNum)then
Container = CreateFrame("Frame","BBCont"..BagSet.."_"..ContNum,UIParent,"BaudBagContainerTemplate");
Container:SetID(ContNum);
Container.BagSet = BagSet;
MaxCont[BagSet] = ContNum;
end
Container = getglobal("BBCont"..BagSet.."_"..ContNum);
Container.Bags = {};
BaudUpdateContainerData(BagSet,ContNum);
end
SubBag = getglobal("BaudBagSubBag"..Bag);
tinsert(Container.Bags,SubBag);
SubBag:SetParent(Container);
if OpenBags[Bag]then
IsOpen = true;
end
end);
FinishContainer();
 
NumCont[BagSet] = ContNum;
--Hide extra containers that were created before
for ContNum = (ContNum + 1), MaxCont[BagSet]do
getglobal("BBCont"..BagSet.."_"..ContNum):Hide();
end
end
BagsReady = true;
end
 
 
function BaudBagUpdateOpenBags()
local Open, Frame, Highlight, Highlight2;
--The bank bag(-1) has no open indicator
for Bag = -2, LastBagID do
Frame = getglobal("BaudBagSubBag"..Bag);
Open = Frame:IsShown()and Frame:GetParent():IsShown()and not Frame:GetParent().Closing;
if(Bag == -2)then
if Open then
BaudBagKeyRingButton:SetButtonState("PUSHED", 1);
KeyRingButton:SetButtonState("PUSHED", 1);
else
BaudBagKeyRingButton:SetButtonState("NORMAL");
KeyRingButton:SetButtonState("NORMAL");
end
elseif(Bag == 0)then
MainMenuBarBackpackButton:SetChecked(Open);
elseif(Bag > 4)then
Highlight = getglobal("BaudBBankBag"..(Bag-4).."HighlightFrameTexture");
Highlight2 = getglobal("BankFrameBag"..(Bag-4).."HighlightFrameTexture");
if Open then
Highlight:Show();
Highlight2:Show();
else
Highlight:Hide();
Highlight2:Hide();
end
elseif(Bag > 0)then
getglobal("CharacterBag"..(Bag-1).."Slot"):SetChecked(Open);
getglobal("BaudBInveBag"..(Bag-1).."Slot"):SetChecked(Open);
end
end
end
 
 
function BaudBagAutoOpenSet(BagSet, Close)
--Set 2 doesn't need container 1 to be shown because that's a given
local Container;
for ContNum = BagSet, NumCont[BagSet]do
if Config[BagSet][ContNum].AutoOpen then
Container = getglobal("BBCont"..BagSet.."_"..ContNum);
if not Close then
if not Container:IsShown()then
Container.AutoOpened = true;
Container:Show();
end
 
elseif Container.AutoOpened then
Container:Hide();
end
end
end
end
 
 
function BaudBagCloseBagSet(BagSet)
for ContNum = 1, MaxCont[BagSet]do
getglobal("BBCont"..BagSet.."_"..ContNum):Hide();
end
end
 
 
local pre_ToggleBag = ToggleBag;
ToggleBag = function(id)
local self = this;
if(id > 4)then
if Config and(Config[2].Enabled == false)then
return pre_ToggleBag(id);
end
if not BagsReady then
return;
end
--The close button thing allows the original blizzard bags to be closed if they're still open
elseif(Config[1].Enabled == false)or self and(strsub(self:GetName(),-11)=="CloseButton")then
return pre_ToggleBag(id);
end
--Blizzard's stuff will automaticaly try open the bags at the mailbox and vendor. Baud Bag will be in charge of that.
if not BagsReady or(self==MailFrame)or(self==MerchantFrame)then
return;
end
DebugMsg("Toggling bag: "..id.."("..(self and self:GetName() or "nil")..")");
local Container = getglobal("BaudBagSubBag"..id);
if not Container then
return pre_ToggleBag(id);
end
Container = Container:GetParent();
--if the bag to open is inside the main bank container, don't toggle it
if self and((Container == BBCont2_1)and(strsub(self:GetName(),1,9)=="BaudBBank")or
(Container == BBCont1_1)and((strsub(self:GetName(),1,9)=="BaudBInve")or(self==BaudBagKeyRingButton)))then
return;
end
--ChatFrame1:AddMessage("Toggling "..Container:GetName()..", Trigger "..self:GetName());
 
if Container:IsShown() then
Container:Hide();
else
Container:Show();
end
end
 
 
local pre_OpenAllBags = OpenAllBags;
OpenAllBags = function(forceOpen)
if Config and(Config[1].Enabled == false)then
return pre_OpenAllBags(forceOpen);
end
if not BagsReady then
return;
end
local Container, AnyShown;
for Bag = 0, 4 do
Container = getglobal("BaudBagSubBag"..Bag):GetParent();
if(GetContainerNumSlots(Bag) > 0)and not Container:IsShown()then
Container:Show();
AnyShown = true;
end
end
if not AnyShown then
BaudBagCloseBagSet(1);
end
end
 
 
local pre_BagSlotButton_OnClick = BagSlotButton_OnClick;
BagSlotButton_OnClick = function(self)
if Config and(Config[1].Enabled == false)then
return pre_BagSlotButton_OnClick(self);
end
if not PutItemInBag(self:GetID())then
ToggleBag(self:GetID() - CharacterBag0Slot:GetID() + 1);
end
end
 
 
local pre_ToggleBackpack = ToggleBackpack;
ToggleBackpack = function()
if Config and(Config[1].Enabled == false)then
return pre_ToggleBackpack();
end
if not BagsReady then
return;
end
if this and(this==FuBarPluginBagFuFrame)then
OpenAllBags();
else
ToggleBag(0);
end
end
 
 
local pre_ToggleKeyRing = ToggleKeyRing;
ToggleKeyRing = function()
if Config and(Config[1].Enabled == false)then
return pre_ToggleKeyRing();
end
if not BagsReady then
return;
end
ToggleBag(-2);
end
 
 
local function IsBagShown(BagID)
local SubBag = getglobal("BaudBagSubBag"..BagID);
return SubBag:IsShown()and SubBag:GetParent():IsShown()and not SubBag:GetParent().Closing;
end
 
 
local function UpdateThisHighlight(self)
if Config and(Config[1].Enabled == false)then
return;
end
self:SetChecked(IsBagShown(self:GetID() - CharacterBag0Slot:GetID() + 1));
end
 
--These function hooks override the bag button highlight changes that Blizzard does
hooksecurefunc("BagSlotButton_OnClick",UpdateThisHighlight);
hooksecurefunc("BagSlotButton_OnDrag",UpdateThisHighlight);
hooksecurefunc("BagSlotButton_OnModifiedClick",UpdateThisHighlight);
hooksecurefunc("BackpackButton_OnClick",function(self)
if Config and(Config[1].Enabled == false)then
return;
end
self:SetChecked(IsBagShown(0));
end);
hooksecurefunc("UpdateMicroButtons",function()
if Config and(Config[1].Enabled == false)then
return;
end
if IsBagShown(KEYRING_CONTAINER)then
KeyRingButton:SetButtonState("PUSHED", 1);
else
KeyRingButton:SetButtonState("NORMAL");
end
end);
 
 
--self is hooked to be able to replace the original bank box with this one
local pre_BankFrame_OnEvent = BankFrame_OnEvent;
BankFrame_OnEvent = function(self, event, ...)
if Config and(Config[2].Enabled == false)then
return pre_BankFrame_OnEvent(self, event, ...);
end
end
 
 
local SubBagEvents = {
BAG_UPDATE = function(self)
if(self:GetID()~=arg1)then
return;
end
--BAG_UPDATE is the only event called when a bag is added, so if no bag existed before, refresh
if(self.size > 0)then
ContainerFrame_Update(self);
BaudBagUpdateSubBag(self);
else
self:GetParent().Refresh = true;
end
end,
 
BAG_CLOSED = function(self)
if(self:GetID()~=arg1)then
return;
end
--self event occurs when bags are swapped too, but updated information is not immediately
--available to the addon, so the bag must be updated later.
self:GetParent().Refresh = true;
end
};
 
local Func = function(self)
ContainerFrame_Update(self);
end
SubBagEvents.ITEM_LOCK_CHANGED = Func;
SubBagEvents.BAG_UPDATE_COOLDOWN = Func;
SubBagEvents.UPDATE_INVENTORY_ALERTS = Func;
 
 
function BaudBagSubBag_OnLoad(self)
for Key, Value in pairs(SubBagEvents)do
self:RegisterEvent(Key);
end
end
 
 
function BaudBagUpdateSubBag(SubBag)
local Link, Quality, Texture, ItemButton;
local ShowColor = Config[SubBag.BagSet][SubBag:GetParent():GetID()].RarityColor;
SubBag.FreeSlots = 0;
for Slot = 1, SubBag.size do
Quality = nil;
ItemButton = getglobal(SubBag:GetName().."Item"..Slot);
if(SubBag.BagSet~=2)or BankOpen then
Link = GetContainerItemLink(SubBag:GetID(),Slot);
if(SubBag.BagSet==2)then
if not Link then
BaudBag_Cache[SubBag:GetID()][Slot] = nil;
else
BaudBag_Cache[SubBag:GetID()][Slot] = {Link = Link, Count = select(2,GetContainerItemInfo(SubBag:GetID(),Slot))};
end
end
if Link then
Quality = select(3,GetItemInfo(Link));
end
elseif BaudBag_Cache[SubBag:GetID()][Slot]then
Link = BaudBag_Cache[SubBag:GetID()][Slot].Link;
SetItemButtonCount(ItemButton, BaudBag_Cache[SubBag:GetID()][Slot].Count or 0);
if Link then
_, _, Quality, _, _, _, _, _, _, Texture = GetItemInfo(Link);
else
Texture = nil;
end
SetItemButtonTexture(ItemButton,Texture);
end
if not Link then
SubBag.FreeSlots = SubBag.FreeSlots + 1;
end
Texture = getglobal(ItemButton:GetName().."Border");
if Quality and(Quality > 1)and ShowColor then
Texture:SetVertexColor(GetItemQualityColor(Quality));
Texture:Show();
--[[ getglobal(ItemButton:GetName().."Border"):SetVertexColor(GetItemQualityColor(Quality));
getglobal(ItemButton:GetName().."Border"):Show();]]
else
--[[ getglobal(ItemButton:GetName().."NormalTexture"):SetTexture("Interface\\Buttons\\UI-Quickslot2");
SetItemButtonNormalTextureVertexColor(ItemButton,1,1,1);]]
Texture:Hide();
end
end
end
 
 
function BaudBagSubBag_OnEvent(self, event)
if not self:GetParent():IsShown()or(self:GetID() >= 5)and not BankOpen then
return;
end
SubBagEvents[event](self);
end
 
 
function BaudBagContainer_OnLoad(self)
tinsert(UISpecialFrames, self:GetName());
self:RegisterForDrag("LeftButton");
end
 
 
function BaudBagContainer_OnUpdate(self)
if self.Refresh then
BaudBagUpdateContainer(self);
BaudBagUpdateOpenBags();
end
if self.UpdateSlots then
BaudBagUpdateFreeSlots(self);
end
if self.FadeStart then
local Alpha = (GetTime() - self.FadeStart) / FadeTime;
if self.Closing then
Alpha = 1 - Alpha;
if(Alpha < 0)then
self.FadeStart = nil;
self:Hide();
self.Closing = nil;
return;
end
elseif(Alpha > 1)then
self:SetAlpha(1);
self.FadeStart = nil;
return;
end
self:SetAlpha(Alpha);
end
end
 
 
function BaudBagContainer_OnShow(self)
if self.FadeStart then
return;
end
self.FadeStart = GetTime();
PlaySound("igBackPackOpen");
BaudBagUpdateContainer(self);
BaudBagUpdateOpenBags();
if(self:GetID()==1)then
BaudBagUpdateFreeSlots(self);
end
end
 
 
function BaudBagContainer_OnHide(self)
if self.Closing then
if self.FadeStart then
self:Show();
end
return;
end
self.FadeStart = GetTime();
self.Closing = true;
PlaySound("igBackPackClose");
self.AutoOpened = false;
BaudBagUpdateOpenBags();
if(self.BagSet==2)and(self:GetID()==1)then
if BankOpen and(Config[2].Enabled==true)then
CloseBankFrame();
end
BaudBagCloseBagSet(2);
end
self:Show();
end
 
 
function BaudBagContainer_OnDragStart(self)
if not Config[self.BagSet][self:GetID()].Locked then
self:StartMoving();
end
end
 
 
function BaudBagContainer_OnDragStop(self)
self:StopMovingOrSizing();
BaudBagContainerSaveCoords(self);
end
 
 
function BaudBagContainerSaveCoords(Frame)
DebugMsg("Saving container coords: "..Frame:GetName());
local Scale = Frame:GetScale();
local X, Y = Frame:GetCenter();
X = X * Scale;
Y = Y * Scale;
Config[Frame.BagSet][Frame:GetID()].Coords = {X, Y};
end
 
 
local TotalFree, TotalSlots;
 
local function AddFreeSlots(Bag)
if(Bag<=-2)then
return;
end
local Cache = UseCache(Bag);
local NumSlots;
if not Cache then
local Free, Family = GetContainerNumFreeSlots(Bag);
if(Family~=0)then
return;
end
TotalFree = TotalFree + Free;
NumSlots = GetContainerNumSlots(Bag);
else
if(Bag > 0)then
local Link = BaudBag_Cache[Bag].BagLink;
if not Link or(GetItemFamily(Link)~=0)then
return;
end
end
NumSlots = BaudBag_Cache[Bag].Size;
for Slot = 1, NumSlots do
if not BaudBag_Cache[Bag][Slot]then
TotalFree = TotalFree + 1;
end
end
end
TotalSlots = TotalSlots + NumSlots;
end
 
 
function BaudBagUpdateFreeSlots(Frame)
Frame.UpdateSlots = nil;
DebugMsg("Counting free slots for set "..Frame.BagSet);
TotalFree, TotalSlots = 0, 0;
if(Frame.BagSet==1)then
for Bag = 0, 4 do
AddFreeSlots(Bag);
end
else
AddFreeSlots(-1);
for Bag = 5, LastBagID do
AddFreeSlots(Bag);
end
end
getglobal(Frame:GetName().."Slots"):SetText(TotalFree.."/"..TotalSlots..Localized.Free);
end
 
 
function BaudBagBankBags_Update()
local Purchase = BaudBagBankSlotPurchaseFrame;
local Slots, Full = GetNumBankSlots();
local BagSlot;
 
for Bag = 1, NUM_BANKBAGSLOTS do
BagSlot = getglobal("BaudBBankBag"..Bag);
 
if(Bag <= Slots)then
SetItemButtonTextureVertexColor(BagSlot, 1.0, 1.0, 1.0);
BagSlot.tooltipText = BANK_BAG;
else
SetItemButtonTextureVertexColor(BagSlot, 1.0, 0.1, 0.1);
BagSlot.tooltipText = BANK_BAG_PURCHASE;
end
end
 
if Full then
Purchase:Hide();
BBCont2_1BagsFrame:SetHeight(BBCont2_1BagsFrame.Height);
return;
end
 
local Cost = GetBankSlotCost(Slots);
 
--This line allows the confirmation box to show the cost
BankFrame.nextSlotCost = Cost;
 
if( GetMoney() >= Cost ) then
SetMoneyFrameColor(Purchase:GetName().."MoneyFrame", 1.0, 1.0, 1.0);
else
SetMoneyFrameColor(Purchase:GetName().."MoneyFrame", 1.0, 0.1, 0.1);
end
MoneyFrame_Update(Purchase:GetName().."MoneyFrame", Cost);
 
Purchase:Show();
BBCont2_1BagsFrame:SetHeight(BBCont2_1BagsFrame.Height + 40);
end
 
 
--This is for the button that toggles the bank bag display
function BaudBagBagsButton_OnClick(self)
local Set = self:GetParent().BagSet;
--Bank set is automaticaly shown, and main bags are not
Config[Set].ShowBags = (Config[Set].ShowBags==false);
BaudBagUpdateBagFrames();
end
 
 
function BaudBagUpdateBagFrames()
local Shown, BagFrame;
for BagSet = 1, 2 do
Shown = (Config[BagSet].ShowBags ~= false);
getglobal("BBCont"..BagSet.."_1BagsButton"):SetChecked(Shown);
BagFrame = getglobal("BBCont"..BagSet.."_1BagsFrame");
E.EuiSetTemplateB(BagFrame,0,0,-1.5,0)
if Shown then
BagFrame:Show();
else
BagFrame:Hide();
end
end
end
 
 
function BaudBagUpdateName(Container)
local Name = getglobal(Container:GetName().."Name");
if(Container.BagSet~=2)or BankOpen then
Name:SetText(Config[Container.BagSet][Container:GetID()].Name or "");
Name:SetTextColor(NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b);
else
Name:SetText(Config[Container.BagSet][Container:GetID()].Name..Localized.Offline);
Name:SetTextColor(RED_FONT_COLOR.r,RED_FONT_COLOR.g,RED_FONT_COLOR.b);
end
end
 
 
function BaudBagUpdateContainer(Container)
DebugMsg("Updating Container: "..Container:GetName());
Container.Refresh = false;
BaudBagUpdateName(Container);
local SlotLevel = Container:GetFrameLevel() + 1;
local ContCfg = Config[Container.BagSet][Container:GetID()];
local Background = ContCfg.Background;
local MaxCols = ContCfg.Columns;
local Size, KeyRing;
Container.Slots = 0;
for _, SubBag in ipairs(Container.Bags)do
if(Container.BagSet~=2)or BankOpen then
Size = GetContainerNumSlots(SubBag:GetID());
if(SubBag:GetID()==-2)then
local LastUsed = 0;
local FirstEmpty;
for Slot = 1, Size do
if GetContainerItemLink(-2, Slot)then
LastUsed = Slot;
elseif not FirstEmpty then
FirstEmpty = Slot;
end
end
if FirstEmpty and(LastUsed < Size)then
KeyRing = SubBag;
local Max = Size;
Size = max(FirstEmpty, LastUsed);
KeyRing.Expandable = Max - Size;
end
end
if(Container.BagSet==2)then
--Clear out excess information if the size of a bag decreases
if(BaudBag_Cache[SubBag:GetID()].Size > Size)then
for Slot = Size, BaudBag_Cache[SubBag:GetID()].Size do
if BaudBag_Cache[SubBag:GetID()][Slot]then
BaudBag_Cache[SubBag:GetID()][Slot] = nil;
end
end
end
BaudBag_Cache[SubBag:GetID()].Size = Size;
end
else
Size = BaudBag_Cache[SubBag:GetID()]and BaudBag_Cache[SubBag:GetID()].Size or 0;
end
SubBag.size = Size;
Container.Slots = Container.Slots + Size;
end
if(Container.Slots <= 0)then
if Container:IsShown()then
DEFAULT_CHAT_FRAME:AddMessage("Container \""..ContCfg.Name.."\" has no contents.",1,1,0);
Container:Hide();
end
return;
end
if(Container.Slots < MaxCols)then
MaxCols = Container.Slots;
elseif KeyRing and(Container.Slots % MaxCols ~= 0)then
local Increase = min(KeyRing.Expandable, MaxCols - Container.Slots % MaxCols);
KeyRing.size = KeyRing.size + Increase;
Container.Slots = Container.Slots + Increase;
end
 
local Col, Row = 0, 1;
--The textured background puts its empty space on the upper left
if ContCfg.BlankTop then
Col = MaxCols - mod(Container.Slots - 1,MaxCols) - 1;
end
 
local Slots, SubBag, ItemButton;
for _, SubBag in pairs(Container.Bags)do
if(SubBag.size <= 0)then
SubBag:Hide();
else
DebugMsg("Adding "..SubBag:GetName());
--Create extra slots if needed
if(SubBag.size > (SubBag.maxSlots or 0))then
for Slot = (SubBag.maxSlots or 0) + 1, SubBag.size do
local Button = CreateFrame("Button",SubBag:GetName().."Item"..Slot,SubBag,(SubBag:GetID() ~= -1)and "ContainerFrameItemButtonTemplate" or "BankItemButtonGenericTemplate");
Button:SetID(Slot);
local Texture = Button:CreateTexture(Button:GetName().."Border","OVERLAY");
Texture:Hide();
Texture:SetTexture("Interface\\Buttons\\UI-ActionButton-Border");
Texture:SetPoint("CENTER");
Texture:SetBlendMode("ADD");
Texture:SetAlpha(0.8);
Texture:SetHeight(70);
Texture:SetWidth(70);
end
SubBag.maxSlots = SubBag.size;
end
if(SubBag:GetID()~=-1)and(BankOpen or(SubBag:GetID() < 5))then
ContainerFrame_Update(SubBag);
end
BaudBagUpdateSubBag(SubBag);
for Slot = 1, SubBag.maxSlots do
ItemButton = getglobal(SubBag:GetName().."Item"..Slot);
if(Slot <= SubBag.size)then
Col = Col + 1;
if(Col > MaxCols)then
Col = 1;
Row = Row + 1;
end
ItemButton:ClearAllPoints();
--Slot spacing is different for the blizzard textured background
if(Background<=3)then
ItemButton:SetPoint("TOPLEFT",Container,"TOPLEFT",(Col-1)*42,(Row-1)*-41);
else
ItemButton:SetPoint("TOPLEFT",Container,"TOPLEFT",(Col-1)*39,(Row-1)*-39);
end
ItemButton:SetFrameLevel(SlotLevel);
ItemButton:Show();
else
ItemButton:Hide();
end
end
SubBag:Show();
end
end
if(Background<=3)then
Container:SetWidth(MaxCols * 42 - 5);
Container:SetHeight(Row * 41 - 4);
else
Container:SetWidth(MaxCols * 39 - 2);
Container:SetHeight(Row * 39 - 2);
end
BaudBagUpdateBackground(Container);
DebugMsg("Finished Arranging Container.");
end
 
 
function BaudBag_OnModifiedClick(self, button)
if not UseCache(self:GetParent():GetID())then
return;
end
if IsModifiedClick("SPLITSTACK")then
StackSplitFrame:Hide();
end
if BaudBag_Cache[self:GetParent():GetID()][self:GetID()]then
HandleModifiedItemClick(BaudBag_Cache[self:GetParent():GetID()][self:GetID()].Link);
end
end
 
 
hooksecurefunc("ContainerFrameItemButton_OnModifiedClick", BaudBag_OnModifiedClick);
hooksecurefunc("BankFrameItemButtonGeneric_OnModifiedClick", BaudBag_OnModifiedClick);
 
 
function BaudBagKeyRing_OnLoad(self)
local Clone = KeyRingButton;
Clone:GetScript("OnLoad")(self);
self:SetScript("OnClick", Clone:GetScript("OnClick"));
self:SetScript("OnReceiveDrag", Clone:GetScript("OnReceiveDrag"));
self:SetScript("OnEnter", Clone:GetScript("OnEnter"));
self:SetScript("OnLeave", Clone:GetScript("OnLeave"));
self:GetNormalTexture():SetTexCoord(0.5625,0,0,0,0.5625,0.60937,0,0.60937);
self:GetHighlightTexture():SetTexCoord(0.5625,0,0,0,0.5625,0.60937,0,0.60937);
self:GetPushedTexture():SetTexCoord(0.5625,0,0,0,0.5625,0.60937,0,0.60937);
end
 
 
local function CopyTable(Value)
if(type(Value)~="table")then
return Value;
end
local Table = {};
table.foreach(Value, function(k,v) Table[k]=CopyTable(v) end);
return Table;
end
 
 
function BaudBagOptionsFrame_OnLoad(self)
BaudBagNameEditBoxText:SetText(Localized.ContainerName);
BaudBagOptionsSetDropDownLabel:SetText(Localized.BagSet);
BaudBagOptionsBackgroundDropDownLabel:SetText(Localized.Background);
BaudBagOptionsFrameTitle:SetText("Baud Bag "..Localized.Options);
 
self:RegisterEvent("PLAYER_LOGIN");
self:RegisterForDrag("LeftButton");
tinsert(UIMenus, self:GetName());
SlashCmdList[Prefix.."_Options"] = function() BaudBagOptionsFrame:Show();end
SLASH_BaudBag_Options1 = "/baudbag";
SLASH_BaudBag_OptionsMenuName = "Baud Bag"; --Baud Menu Info
DEFAULT_CHAT_FRAME:AddMessage(Localized.AddMessage);
 
BaudBagOptionsFrame:SetWidth(43 * MaxBags + 70);
local Button, Check;
for Bag = 1, MaxBags do
Button = CreateFrame("CheckButton","BaudBagOptionsBag"..Bag,BaudBagOptionsFrame,"BaudBagOptionsBagTemplate");
CreateFrame("Frame","BaudBagOptionsContainer"..Bag,BaudBagOptionsFrame,"BaudBagOptionsContainerTemplate");
if(Bag == 1)then
BaudBagOptionsContainer1:SetPoint("LEFT",BaudBagOptionsBag1,"LEFT",-6,0);
else
Button:SetPoint("LEFT","BaudBagOptionsBag"..(Bag-1),"RIGHT",8,0);
Check = CreateFrame("CheckButton","BaudBagOptionsJoinCheck"..Bag,Button,"BaudBagOptionsJoinCheckTemplate");
Check:SetPoint("BOTTOM",Button,"TOPLEFT",-4,4);
Check:SetID(Bag);
Check.tooltipText = Localized.CheckTooltip;
end
end
 
BaudBagEnabledCheckText:SetText(Localized.Enabled);
BaudBagEnabledCheck.tooltipText = Localized.EnabledTooltip;
 
for Key, Value in ipairs(SliderBars)do
getglobal(Prefix.."Slider"..Key.."Low"):SetText(Value.Low);
getglobal(Prefix.."Slider"..Key.."High"):SetText(Value.High);
getglobal(Prefix.."Slider"..Key).tooltipText = Value.TooltipText;
end
for Key, Value in ipairs(CheckButtons)do
getglobal(Prefix.."CheckButton"..Key.."Text"):SetText(Value.Text);
getglobal(Prefix.."CheckButton"..Key).tooltipText = Value.TooltipText;
end
end
 
 
function BaudBagOptionsFrame_OnEvent(self)
--Restoring the config also updates the bags, which requires the info available at login
if(event=="PLAYER_LOGIN")then
UIDropDownMenu_SetWidth(BaudBagOptionsSetDropDown, 90);
UIDropDownMenu_SetWidth(BaudBagOptionsBackgroundDropDown, 90);
end
end
 
 
function BaudBagOptionsFrame_OnShow(self)
CfgBackup = CopyTable(Config);
self.SaveChanges = false;
self:ClearAllPoints();
self:SetPoint("CENTER");
BaudBagOptionsUpdate();
end
 
 
function BaudBagOptionsFrame_OnHide(self)
if(self.SaveChanges==false)and CfgBackup then
DebugMsg("Restoring config from backup.");
self.SaveChanges = true;
BaudBag_Cfg = CfgBackup;
BaudBagRestoreCfg();
end
CfgBackup = nil;
end
 
 
function BaudBagRestoreCfg()
DebugMsg("Restoring config structure.");
if(type(BaudBag_Cfg)~="table")then
BaudBag_Cfg = {};
end
Config = BaudBag_Cfg;
for BagSet = 1, 2 do
if(type(Config[BagSet])~="table")then
Config[BagSet] = {};
end
if(type(Config[BagSet].Enabled)~="boolean")then
Config[BagSet].Enabled = true;
end
if(type(Config[BagSet].Joined)~="table")then
Config[BagSet].Joined = {};
end
if(type(Config[BagSet].ShowBags)~="boolean")then
Config[BagSet].ShowBags = (BagSet==2)and true or false;
end
local Container = 0;
BaudBagForEachBag(BagSet,function(Bag, Index)
if(Bag==-2)and(Config[BagSet].Joined[Index]==nil)then
Config[BagSet].Joined[Index] = false;
end
if(Container == 0)or(Config[BagSet].Joined[Index]==false)then
Container = Container + 1;
if(type(Config[BagSet][Container])~="table")then
if(Container == 1)or(Bag==-2)then
Config[BagSet][Container] = {};
else
Config[BagSet][Container] = CopyTable(Config[BagSet][Container-1]);
end
end
if not Config[BagSet][Container].Name then
--With the key ring, there isn't enough room for the player name aswell
Config[BagSet][Container].Name = (Bag==-2)and Localized.KeyRing or UnitName("player")..Localized.Of..((BagSet==1)and Localized.Inventory or Localized.BankBox);
end
if(type(Config[BagSet][Container].Background)~="number")then
Config[BagSet][Container].Background = (Bag==-2)and 3 or 4;
end
for Key, Value in ipairs(SliderBars)do
if(type(Config[BagSet][Container][Value.SavedVar])~="number")then
Config[BagSet][Container][Value.SavedVar] = (Bag==-2)and(Value.SavedVar=="Columns")and 4 or Value.Default[BagSet];
end
end
for Key, Value in ipairs(CheckButtons)do
if(type(Config[BagSet][Container][Value.SavedVar])~="boolean")then
Config[BagSet][Container][Value.SavedVar] = Value.Default;
end
end
end
end);
end
 
BaudUpdateJoinedBags();
BaudBagUpdateBagFrames();
BaudBagOptionsUpdate();
end
 
 
--This function is used by the drop down menu on containers
function BaudBagOptionsSelectContainer(BagSet, Container)
SelectedBags = BagSet;
SelectedContainer = Container;
BaudBagOptionsUpdate();
end
 
 
function BaudBagOptionsUpdate()
local Button, Check, Container, Texture;
local ContNum = 1;
local Bags = SetSize[SelectedBags];
Updating = true;
 
UIDropDownMenu_Initialize(BaudBagOptionsSetDropDown, BaudBagOptionsSetDropDown_Initialize);
UIDropDownMenu_SetSelectedValue(BaudBagOptionsSetDropDown, SelectedBags);
BaudBagEnabledCheck:SetChecked(Config[SelectedBags].Enabled~=false);
 
BaudBagForEachBag(SelectedBags,function(Bag,Index)
Button = getglobal("BaudBagOptionsBag"..Index);
Check = getglobal("BaudBagOptionsJoinCheck"..Index);
 
if(Index == 1)then
--Only the first bag needs its position set, since the others are anchored to it always
Button:SetPoint("LEFT",BaudBagOptionsFrame,"TOP",(Bags / 2) * -44,-120);
else
Check:SetChecked(Config[SelectedBags].Joined[Index]~=false);
if not Check:GetChecked()then
getglobal("BaudBagOptionsContainer"..ContNum):SetPoint("RIGHT","BaudBagOptionsBag"..(Index - 1),"RIGHT",6,0);
ContNum = ContNum + 1;
getglobal("BaudBagOptionsContainer"..ContNum):SetPoint("LEFT","BaudBagOptionsBag"..Index,"LEFT",-6,0);
end
end
if BaudBagIcons[Bag]then
Texture = BaudBagIcons[Bag];
elseif(SelectedBags == 1)then
Texture = GetInventoryItemTexture("player",ContainerIDToInventoryID(Bag));
elseif BaudBag_Cache[Bag] and BaudBag_Cache[Bag].BagLink then
Texture = GetItemIcon(BaudBag_Cache[Bag].BagLink);
else
Texture = nil;
end
getglobal(Button:GetName().."IconTexture"):SetTexture(Texture or select(2,GetInventorySlotInfo("Bag0Slot")));
Button:SetID(ContNum);
Button:Show();
end);
getglobal("BaudBagOptionsContainer"..ContNum):SetPoint("RIGHT","BaudBagOptionsBag"..Bags,"RIGHT",6,0);
 
for Index = Bags + 1, MaxBags do
getglobal("BaudBagOptionsBag"..Index):Hide();
end
 
if(SelectedContainer > ContNum)then
SelectedContainer = 1;
end
local R, G, B;
for Bag = 1, MaxBags do
Container = getglobal("BaudBagOptionsContainer"..Bag);
Button = getglobal("BaudBagOptionsBag"..Bag);
Button:SetChecked(Button:GetID()==SelectedContainer);
if(Bag <= ContNum)then
if(Bag==SelectedContainer)then
Container:SetBackdropColor(1,1,0);
Container:SetBackdropBorderColor(1,1,0);
else
Container:SetBackdropColor(1,1,1);
Container:SetBackdropBorderColor(1,1,1);
end
Container:Show();
else
Container:Hide();
end
end
 
BaudBagNameEditBox:SetText(Config[SelectedBags][SelectedContainer].Name or "");
 
UIDropDownMenu_Initialize(BaudBagOptionsBackgroundDropDown, BaudBagOptionsBackgroundDropDown_Initialize);
UIDropDownMenu_SetSelectedValue(BaudBagOptionsBackgroundDropDown,Config[SelectedBags][SelectedContainer].Background);
 
for Key, Value in ipairs(SliderBars)do
local Slider = getglobal(Prefix.."Slider"..Key);
Slider:SetValue(Config[SelectedBags][SelectedContainer][Value.SavedVar]);
end
 
for Key, Value in ipairs(CheckButtons)do
local Button = getglobal(Prefix.."CheckButton"..Key);
Button:SetChecked(Config[SelectedBags][SelectedContainer][Value.SavedVar]);
end
Updating = false;
end
 
 
function BaudBagNameEditBox_OnTextChanged()
if Updating then
return;
end
Config[SelectedBags][SelectedContainer].Name = BaudBagNameEditBox:GetText();
BaudBagUpdateName(getglobal("BBCont"..SelectedBags.."_"..SelectedContainer));
end
 
 
function BaudBagOptionsSetDropDown_Initialize()
local info = UIDropDownMenu_CreateInfo();
info.func = BaudBagOptionsSetDropDown_OnClick;
 
info.text = Localized.Inventory;
info.value = 1;
info.checked = (info.value == SelectedBags)and 1 or nil;
UIDropDownMenu_AddButton(info);
 
info.text = Localized.BankBox;
info.value = 2;
info.checked = (info.value == SelectedBags)and 1 or nil;
UIDropDownMenu_AddButton(info);
end
 
 
function BaudBagOptionsSetDropDown_OnClick(self)
SelectedBags = self.value;
BaudBagOptionsUpdate();
end
 
 
local TextureNames = {Localized.BlizInventory,Localized.BlizBank,Localized.BlizKeyring,Localized.Transparent,Localized.Solid};
 
function BaudBagOptionsBackgroundDropDown_Initialize()
local info = UIDropDownMenu_CreateInfo();
info.func = BaudBagOptionsBackgroundDropDown_OnClick;
local Selected = Config[SelectedBags][SelectedContainer].Background;
 
for Key, Value in pairs(TextureNames)do
info.text = Value;
info.value = Key;
info.checked = (Key == Selected)and 1 or nil;
UIDropDownMenu_AddButton(info);
end
end
 
 
function BaudBagOptionsBackgroundDropDown_OnClick(self)
Config[SelectedBags][SelectedContainer].Background = self.value;
UIDropDownMenu_SetSelectedValue(BaudBagOptionsBackgroundDropDown, self.value);
BaudBagUpdateContainer(getglobal("BBCont"..SelectedBags.."_"..SelectedContainer));
end
 
 
function BaudBagEnabledCheck_OnClick(self)
if(self:GetChecked())then
PlaySound("igMainMenuOptionCheckBoxOff");
else
PlaySound("igMainMenuOptionCheckBoxOn");
BaudBagCloseBagSet(SelectedBags);
end
Config[SelectedBags].Enabled = (self:GetChecked()==1);
if Config and (Config[2].Enabled == true) then BankFrame:UnregisterEvent("BANKFRAME_OPENED") end
if Config and (Config[2].Enabled == false) then BankFrame:RegisterEvent("BANKFRAME_OPENED") end
end
 
 
function BaudBagOptionsBag_OnClick(self)
SelectedContainer = self:GetID();
BaudBagOptionsUpdate();
end
 
 
function BaudBagOptionsJoinCheck_OnClick(self)
if(self:GetChecked())then
PlaySound("igMainMenuOptionCheckBoxOff");
else
PlaySound("igMainMenuOptionCheckBoxOn");
end
Config[SelectedBags].Joined[self:GetID()] = self:GetChecked()and true or false;
local ContNum = 2;
for Bag = 2,(self:GetID()-1)do
if(Config[SelectedBags].Joined[Bag]==false)then
ContNum = ContNum + 1;
end
end
if self:GetChecked()then
tremove(Config[SelectedBags],ContNum);
else
tinsert(Config[SelectedBags],ContNum,CopyTable(Config[SelectedBags][ContNum-1]));
end
BaudBagOptionsUpdate();
BaudUpdateJoinedBags();
--Newly created bags could "Jump" infront of the options frame
BaudBagOptionsFrame:Raise();
end
 
 
function BaudBagOptions_Defaults()
DebugMsg("Setting default config.");
BaudBag_Cfg = nil;
BaudBagRestoreCfg();
end
 
 
function BaudBagCheckButton_OnClick(self)
if(self:GetChecked())then
PlaySound("igMainMenuOptionCheckBoxOff");
else
PlaySound("igMainMenuOptionCheckBoxOn");
end
local SavedVar = CheckButtons[self:GetID()].SavedVar;
Config[SelectedBags][SelectedContainer][SavedVar] = (self:GetChecked()==1);
if(SavedVar=="BlankTop")or(SavedVar=="RarityColor")then
BaudBagUpdateContainer(getglobal("BBCont"..SelectedBags.."_"..SelectedContainer));
end
end
 
 
function BaudBagSlider_OnValueChanged(self)
getglobal(self:GetName().."Text"):SetText(format(SliderBars[self:GetID()].Text,self:GetValue()));
if Updating then
return;
end
local SavedVar = SliderBars[self:GetID()].SavedVar;
Config[SelectedBags][SelectedContainer][SavedVar] = self:GetValue();
if(SavedVar=="Scale")then
BaudUpdateContainerData(SelectedBags,SelectedContainer);
elseif(SavedVar=="Columns")then
BaudBagUpdateContainer(getglobal("BBCont"..SelectedBags.."_"..SelectedContainer));
end
end
\ No newline at end of file
Eui/element/minimap.lua New file
0,0 → 1,242
local E, C = unpack(select(2, ...))
local mP = E.EuiCreateFrame(Minimap, 0, "BACKGROUND")
mP:SetPoint("TOPLEFT",-3,3)
mP:SetPoint("BOTTOMRIGHT",3,-3)
E.EuiSetTemplate(mP)
 
Minimap:SetScale(1)
Minimap:SetFrameStrata("BACKGROUND")
Minimap:ClearAllPoints()
Minimap:SetPoint('TOPRIGHT', UIParent, -10, -20)
 
function E.PostMinimapMove(frame)
 
if E.Movers[frame:GetName()]["moved"] ~= true then
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", E.Scale(-6), E.Scale(-6))
end
end
 
E.CreateMover(Minimap, "MinimapMover", "小地图", nil, E.PostMinimapMove)
 
Minimap:SetFrameLevel(2)
Minimap:SetMaskTexture('Interface\\ChatFrame\\ChatFrameBackground')
--MinimapToggleButton:Hide()
-- 隐藏边框
MinimapBorder:Hide()
MinimapBorderTop:Hide()
 
-- 隐藏放大/缩小按钮
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
 
-- 隐藏声音聊天框
MiniMapVoiceChatFrame:Hide()
 
-- Hide North texture at top
MinimapNorthTag:SetTexture(nil)
 
-- 隐藏游戏时间
GameTimeFrame:Hide()
 
-- 隐藏区域框
MinimapZoneTextButton:Hide()
 
-- 隐藏追踪按钮
MiniMapTracking:Hide()
 
-- 隐藏邮件按钮
MiniMapMailFrame:ClearAllPoints()
MiniMapMailFrame:SetPoint("TOPRIGHT", Minimap, 3, 4)
MiniMapMailIcon:SetTexture("Interface\\AddOns\\Eui\\media\\mail")
MiniMapMailBorder:Hide()
 
-- 移动战场图标
MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetPoint("BOTTOMRIGHT", Minimap, 3, 0)
MiniMapBattlefieldBorder:Hide()
 
-- 隐藏世界地图图标
MiniMapWorldMapButton:Hide()
 
-- 移动3.3旗帜
MiniMapInstanceDifficulty:ClearAllPoints()
MiniMapInstanceDifficulty:SetParent(Minimap)
MiniMapInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 0, 0)
 
local function UpdateLFG()
MiniMapLFGFrame:ClearAllPoints()
MiniMapLFGFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", E.Scale(2), E.Scale(1))
MiniMapLFGFrameBorder:Hide()
end
hooksecurefunc("MiniMapLFG_UpdateIsShown", UpdateLFG)
 
LFDSearchStatus:SetClampedToScreen(true)
LFDDungeonReadyStatus:SetClampedToScreen(true)
E.EuiSetTemplate(LFDSearchStatus)
 
Minimap:EnableMouseWheel(true)
Minimap:SetScript("OnMouseWheel", function(self, d)
if d > 0 then
_G.MinimapZoomIn:Click()
elseif d < 0 then
_G.MinimapZoomOut:Click()
end
end)
 
 
local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", UIParent, "UIDropDownMenuTemplate")
local menuList = {
{text = CHARACTER_BUTTON,
func = function() ToggleCharacter("PaperDollFrame") end},
{text = SPELLBOOK_ABILITIES_BUTTON,
func = function() ToggleSpellBook("spell") end},
{text = TALENTS_BUTTON,
func = function() ToggleTalentFrame() end},
{text = ACHIEVEMENT_BUTTON,
func = function() ToggleAchievementFrame() end},
{text = QUESTLOG_BUTTON,
func = function() ToggleFrame(QuestLogFrame) end},
{text = SOCIAL_BUTTON,
func = function() ToggleFriendsFrame(1) end},
{text = PLAYER_V_PLAYER,
func = function() ToggleFrame(PVPParentFrame) end},
{text = LFG_TITLE,
func = function() ToggleFrame(LFDParentFrame) end},
{text = L_LFRAID,
func = function() ToggleFrame(LFRParentFrame) end},
{text = "游戏选项",
func = function() ToggleFrame(GameMenuFrame) end},
{text = HELP_BUTTON,
func = function() ToggleHelpFrame() end},
{text = L_CALENDAR,
func = function()
if(not CalendarFrame) then LoadAddOn("Blizzard_Calendar") end
Calendar_Toggle()
end},}
E.EuiSetTemplate(menuFrame)
Minimap:SetScript("OnMouseUp", function(self, btn)
if btn == "RightButton" then
ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, self)
elseif btn == "MiddleButton" then
EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2)
else
Minimap_OnClick(self)
end
end)
 
function GetMinimapShape() return 'SQUARE' end
 
local m_zone = CreateFrame("Frame", m_zone, UIParent)
E.EuiSetTemplate(m_zone)
m_zone:SetHeight(20)
m_zone:SetFrameLevel(5)
m_zone:SetPoint("TOPLEFT",Minimap)
m_zone:SetPoint("TOPRIGHT",Minimap)
m_zone:SetFrameLevel(Minimap:GetFrameLevel()+1)
E.EuiSetAnim(m_zone,true,0,50)
m_zone:Hide()
 
local m_zone_text = m_zone:CreateFontString(nil,"Overlay")
m_zone_text:SetFont(E.font,13)
m_zone_text:SetShadowOffset(1,-1)
m_zone_text:SetPoint("LEFT",4.3,1.3)
m_zone_text:SetPoint("RIGHT",-4.7,1.3)
m_zone_text:SetJustifyH("CENTER")
m_zone_text:SetHeight(13)
 
 
local m_coord = CreateFrame("Frame", m_coord, UIParent)
E.EuiSetTemplate(m_coord)
m_coord:SetHeight(20)
m_coord:SetPoint("BOTTOMLEFT",Minimap)
m_coord:SetWidth(45)
m_coord:SetFrameLevel(Minimap:GetFrameLevel()+1)
E.EuiSetAnim(m_coord,true,-50,0)
m_coord:Hide()
 
local m_coord_text = m_coord:CreateFontString(nil,"Overlay")
m_coord_text:SetFont(E.fontn,10)
m_coord_text:SetShadowOffset(1,-1)
m_coord_text:SetPoint("Center",-.7,1.3)
m_coord_text:SetJustifyH("LEFT")
 
Minimap:SetScript("OnEnter",function()
m_zone.anim_o:Stop()
m_coord.anim_o:Stop()
m_zone:Show()
m_coord:Show()
m_coord.anim:Play()
m_zone.anim:Play()
end)
 
Minimap:SetScript("OnLeave",function()
m_coord.anim:Stop()
m_coord.anim_o:Play()
m_zone.anim:Stop()
m_zone.anim_o:Play()
end)
 
m_coord_text:SetText("00,00")
 
local ela,go = 0,false
 
m_coord.anim:SetScript("OnFinished",function() go = true end)
m_coord.anim_o:SetScript("OnPlay",function() go = false end)
 
local coord_Update = function(self,t)
ela = ela - t
if ela > 0 or not(go) then return end
local x,y = GetPlayerMapPosition("player")
local xt,yt
x = math.floor(100 * x)
y = math.floor(100 * y)
if x == 0 and y == 0 then
m_coord_text:SetText("X _ X")
else
if x < 10 then
xt = "0"..x
else
xt = x
end
if y < 10 then
yt = "0"..y
else
yt = y
end
m_coord_text:SetText(xt..","..yt)
end
ela = .2
end
 
m_coord:SetScript("OnUpdate",coord_Update)
 
local zone_Update = function()
local pvp = GetZonePVPInfo()
m_zone_text:SetText(GetMinimapZoneText())
if pvp == "friendly" then
m_zone_text:SetTextColor(0.1, 1.0, 0.1)
elseif pvp == "sanctuary" then
m_zone_text:SetTextColor(0.41, 0.8, 0.94)
elseif pvp == "arena" or pvp == "hostile" then
m_zone_text:SetTextColor(1.0, 0.1, 0.1)
elseif pvp == "contested" then
m_zone_text:SetTextColor(1.0, 0.7, 0.0)
else
m_zone_text:SetTextColor(1.0, 1.0, 1.0)
end
end
 
m_zone:RegisterEvent("PLAYER_ENTERING_WORLD")
m_zone:RegisterEvent("ZONE_CHANGED_NEW_AREA")
m_zone:RegisterEvent("ZONE_CHANGED")
m_zone:RegisterEvent("ZONE_CHANGED_INDOORS")
m_zone:SetScript("OnEvent",zone_Update)
 
local a,k = CreateFrame("Frame"),4
a:SetScript("OnUpdate",function(self,t)
k = k - t
if k > 0 then return end
self:Hide()
zone_Update()
end)
\ No newline at end of file
Eui/element/tooltip.lua New file
0,0 → 1,628
local E, C = unpack(select(2, ...))
if not C["tooltip"].enable then return end
 
local EuiTooltip = CreateFrame("Frame", nil, UIParent)
 
local _G = getfenv(0)
local inspectName
local inspectList = {}
local inspectTime = GetTime()
local GameTooltip, GameTooltipStatusBar = _G["GameTooltip"], _G["GameTooltipStatusBar"]
 
local TooltipHolder = CreateFrame("Frame", "TooltipHolder", UIParent)
TooltipHolder:SetWidth(130)
TooltipHolder:SetHeight(22)
TooltipHolder:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT")
 
E.CreateMover(TooltipHolder, "TooltipMover", "鼠标提示")
 
local gsub, find, format = string.gsub, string.find, string.format
 
local Tooltips = {GameTooltip,ItemRefTooltip,ShoppingTooltip1,ShoppingTooltip2,ShoppingTooltip3,WorldMapTooltip}
 
local linkTypes = {item = true, enchant = true, spell = true, quest = true, unit = true, talent = true, achievement = true, glyph = true}
 
local classification = {
worldboss = "|cffAF5050Boss|r",
rareelite = "|cffAF5050+ Rare|r",
elite = "|cffAF5050+|r",
rare = "|cffAF5050Rare|r",
}
 
local NeedBackdropBorderRefresh = false
 
--Check if our embed right addon is shown
--[[ local function CheckAddOnShown()
if E.ChatRightShown == true and E.RightChat and E.RightChat == true then
return true
elseif C["skin"].embedright == "Omen" and IsAddOnLoaded("Omen") and OmenAnchor then
if OmenAnchor:IsShown() then
return true
else
return false
end
elseif C["skin"].embedright == "Recount" and IsAddOnLoaded("Recount") and Recount_MainWindow then
if Recount_MainWindow:IsShown() then
return true
else
return false
end
elseif C["skin"].embedright == "Skada" and IsAddOnLoaded("Skada") and SkadaBarWindowSkada then
if SkadaBarWindowSkada:IsShown() then
return true
else
return false
end
else
return false
end
end ]]
 
hooksecurefunc("GameTooltip_SetDefaultAnchor", function(self, parent)
if C["tooltip"].cursor == true then
self:SetOwner(parent, "ANCHOR_CURSOR")
else
self:SetOwner(parent, "ANCHOR_NONE")
self:ClearAllPoints()
self:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", C["tooltip"].x, C["tooltip"].y)
end
self.default = 1
end)
 
local function SetRightTooltipPos(self)
self:ClearAllPoints()
self:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", C["tooltip"].x, C["tooltip"].y)
if InCombatLockdown() and C["tooltip"].hideincombat == true then
self:Hide()
else
if TooltipMover and E.Movers["TooltipMover"]["moved"] == true then
self:SetPoint("BOTTOMRIGHT", TooltipMover, "TOPRIGHT", -1, E.Scale(18))
else
self:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", C["tooltip"].x, C["tooltip"].y)
end
end
end
 
GameTooltip:HookScript("OnUpdate",function(self, ...)
-- local inInstance, instanceType = IsInInstance()
if self:GetAnchorType() == "ANCHOR_CURSOR" then
local x, y = GetCursorPosition();
local effScale = self:GetEffectiveScale();
self:ClearAllPoints();
self:SetPoint("BOTTOMLEFT","UIParent","BOTTOMLEFT",(x / effScale + (C["tooltip"].x)),(y / effScale + (C["tooltip"].x)))
end
 
if self:GetAnchorType() == "ANCHOR_CURSOR" and NeedBackdropBorderRefresh == true and C["tooltip"].cursor ~= true then
-- h4x for world object tooltip border showing last border color
-- or showing background sometime ~blue :x
NeedBackdropBorderRefresh = false
self:SetBackdropColor(.1,.1,.1,.6)
self:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
elseif self:GetAnchorType() == "ANCHOR_NONE" then
SetRightTooltipPos(self)
end
end)
 
local function Hex(color)
return string.format('|cff%02x%02x%02x', color.r * 255, color.g * 255, color.b * 255)
end
 
local function GetColor(unit)
if(UnitIsPlayer(unit) and not UnitHasVehicleUI(unit)) then
local _, class = UnitClass(unit)
local color = E.RAID_CLASS_COLORS[class]
if not color then return end -- sometime unit too far away return nil for color :(
local r,g,b = color.r, color.g, color.b
return Hex(color), r, g, b
else
local color = FACTION_BAR_COLORS[UnitReaction(unit, "player")]
if not color then return end -- sometime unit too far away return nil for color :(
local r,g,b = color.r, color.g, color.b
return Hex(color), r, g, b
end
end
 
local ShortValue = function(v)
if v <= 999 then return v end
if v >= 1000000 then
local value = string.format("%.1fm", v/1000000)
return value
elseif v >= 1000 then
local value = string.format("%.1fk", v/1000)
return value
end
end
 
-- update HP value on status bar
GameTooltipStatusBar:SetScript("OnValueChanged", function(self, value)
if not value then
return
end
local min, max = self:GetMinMaxValues()
 
if (value < min) or (value > max) then
return
end
local _, unit = GameTooltip:GetUnit()
 
-- fix target of target returning nil
if (not unit) then
local GMF = GetMouseFocus()
unit = GMF and GMF:GetAttribute("unit")
end
 
if not self.text then
self.text = self:CreateFontString(nil, "OVERLAY")
self.text:SetPoint("CENTER", GameTooltipStatusBar, 0, E.Scale(-3))
self.text:SetFont(E.font, 11, "THINOUTLINE")
self.text:Show()
if unit then
min, max = UnitHealth(unit), UnitHealthMax(unit)
local hp = ShortValue(min).." / "..ShortValue(max)
if UnitIsGhost(unit) then
self.text:SetText("鬼魂")
elseif min == 0 or UnitIsDead(unit) or UnitIsGhost(unit) then
self.text:SetText("死亡")
else
self.text:SetText(hp)
end
end
else
if unit then
min, max = UnitHealth(unit), UnitHealthMax(unit)
self.text:Show()
local hp = ShortValue(min).." / "..ShortValue(max)
if min == 0 or min == 1 then
self.text:SetText("死亡")
else
self.text:SetText(hp)
end
else
self.text:Hide()
end
end
end) +local healthBar = GameTooltipStatusBar
healthBar:ClearAllPoints()
healthBar:SetHeight(E.Scale(5))
healthBar:SetPoint("TOPLEFT", healthBar:GetParent(), "BOTTOMLEFT", E.Scale(2), E.Scale(-5))
healthBar:SetPoint("TOPRIGHT", healthBar:GetParent(), "BOTTOMRIGHT", -E.Scale(2), E.Scale(-5))
healthBar:SetStatusBarTexture(E.normTex)
 
 
local healthBarBG = CreateFrame("Frame", "StatusBarBG", healthBar)
healthBarBG:SetFrameLevel(healthBar:GetFrameLevel() - 1)
healthBarBG:SetPoint("TOPLEFT", -E.Scale(2), E.Scale(2))
healthBarBG:SetPoint("BOTTOMRIGHT", E.Scale(2), -E.Scale(2))
E.EuiSetTemplate(healthBarBG)
healthBarBG:SetBackdropColor(.1,.1,.1,.6)
 
-- Add "Targeted By" line
local targetedList = {}
local ClassColors = {};
local token
for class, color in next, E.RAID_CLASS_COLORS do
ClassColors[class] = ("|cff%.2x%.2x%.2x"):format(color.r*255,color.g*255,color.b*255);
end
 
local function AddTargetedBy()
local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers();
if (numParty > 0 or numRaid > 0) then
for i = 1, (numRaid > 0 and numRaid or numParty) do
local unit = (numRaid > 0 and "raid"..i or "party"..i);
if (UnitIsUnit(unit.."target",token)) and (not UnitIsUnit(unit,"player")) then
local _, class = UnitClass(unit);
targetedList[#targetedList + 1] = ClassColors[class];
targetedList[#targetedList + 1] = UnitName(unit);
targetedList[#targetedList + 1] = "|r, ";
end
end
if (#targetedList > 0) then
targetedList[#targetedList] = nil;
GameTooltip:AddLine(" ",nil,nil,nil,1);
local line = _G["GameTooltipTextLeft"..GameTooltip:NumLines()];
if not line then return end
line:SetFormattedText("被以下玩家选为目标".." (|cffffffff%d|r): %s",(#targetedList + 1) / 3,table.concat(targetedList));
wipe(targetedList);
end
end
end
 
GameTooltip:HookScript("OnTooltipSetUnit", function(self)
local lines = self:NumLines()
local GMF = GetMouseFocus()
local unit = (select(2, self:GetUnit())) or (GMF and GMF:GetAttribute("unit"))
 
-- A mage's mirror images sometimes doesn't return a unit, this would fix it
if (not unit) and (UnitExists("mouseover")) then
unit = "mouseover"
end
 
-- Sometimes when you move your mouse quicky over units in the worldframe, we can get here without a unit
if not unit then self:Hide() return end
 
-- for hiding tooltip on unitframes
-- if (self:GetOwner() ~= UIParent and C["tooltip"].hideuf) then self:Hide() return end
 
-- if self:GetOwner() ~= UIParent and unit then
-- SetRightTooltipPos(self)
-- end
 
-- A "mouseover" unit is better to have as we can then safely say the tip should no longer show when it becomes invalid.
if (UnitIsUnit(unit,"mouseover")) then
unit = "mouseover"
end
 
local race = UnitRace(unit)
local class = UnitClass(unit)
local level = UnitLevel(unit)
local guildName, guildRankName, guildRankIndex = GetGuildInfo(unit)
local name, realm = UnitName(unit)
local crtype = UnitCreatureType(unit)
local classif = UnitClassification(unit)
local title = UnitPVPName(unit)
local r, g, b = 23/255,132/255,209/255
local ValColor = ("|cff%.2x%.2x%.2x"):format(r * 255, g * 255, b * 255)
local r, g, b = GetQuestDifficultyColor(level).r, GetQuestDifficultyColor(level).g, GetQuestDifficultyColor(level).b
 
local color = GetColor(unit)
if not color then color = "|CFFFFFFFF" end -- just safe mode for when GetColor(unit) return nil for unit too far away
 
_G["GameTooltipTextLeft1"]:SetFormattedText("%s%s%s", color, title or name, realm and realm ~= "" and " - "..realm.."|r" or "|r")
 
 
if(UnitIsPlayer(unit)) then
if UnitIsAFK(unit) then
self:AppendText((" %s"):format(CHAT_FLAG_AFK))
elseif UnitIsDND(unit) then
self:AppendText((" %s"):format(CHAT_FLAG_DND))
end
 
local offset = 2
if guildName then
if UnitIsInMyGuild(unit) then
_G["GameTooltipTextLeft2"]:SetText("<"..ValColor..guildName.."|r> ["..ValColor..guildRankName.."|r]")
else
_G["GameTooltipTextLeft2"]:SetText("<|cff00ff10"..guildName.."|r> [|cff00ff10"..guildRankName.."|r]")
end
offset = offset + 1
end
 
for i= offset, lines do
if _G["GameTooltipTextLeft"..i] and _G["GameTooltipTextLeft"..i]:GetText() and (_G["GameTooltipTextLeft"..i]:GetText():find("^"..LEVEL)) then
_G["GameTooltipTextLeft"..i]:SetFormattedText("|cff%02x%02x%02x%s|r %s %s%s", r*255, g*255, b*255, level > 0 and level or "??", race, color, class.."|r")
break
end
end
else
for i = 2, lines do
if _G["GameTooltipTextLeft"..i] and _G["GameTooltipTextLeft"..i]:GetText() and ((_G["GameTooltipTextLeft"..i]:GetText():find("^"..LEVEL)) or (crtype and _G["GameTooltipTextLeft"..i]:GetText():find("^"..crtype))) then
_G["GameTooltipTextLeft"..i]:SetFormattedText("|cff%02x%02x%02x%s|r%s %s", r*255, g*255, b*255, classif ~= "worldboss" and level > 0 and level or "??", classification[classif] or "", crtype or "")
break
end
end
end
 
local pvpLine
for i = 1, lines do
if _G["GameTooltipTextLeft"..i] and _G["GameTooltipTextLeft"..i]:GetText() and _G["GameTooltipTextLeft"..i]:GetText() == PVP_ENABLED then
pvpLine = _G["GameTooltipTextLeft"..i]
pvpLine:SetText()
break
end
end
 
-- ToT line
if UnitExists(unit.."target") and unit~="player" then
local hex, r, g, b = GetColor(unit.."target")
if not r and not g and not b then r, g, b = 1, 1, 1 end
GameTooltip:AddLine("目标: "..UnitName(unit.."target"), r, g, b)
end
 
if C["tooltip"].TargetedBy == true then token = unit AddTargetedBy() end
 
-- insert talent line
if (C["tooltip"].ShowTalent and UnitIsPlayer(unit)) then
local InDistance = CheckInteractDistance(unit, 1)
local EnableNotifyInspect = (not InspectFrame or not InspectFrame:IsShown()) and (not Examiner or not Examiner:IsShown())
inspectList[name] = inspectList[name] or {}
if (inspectList[name].talent) then
local talentInfo = inspectList[name].talent
GameTooltip:AddLine("天赋:"..talentInfo)
--GameTooltip:Show()
else
if not EnableNotifyInspect then
GameTooltip:AddLine("天赋:"..format("|cFFAAAAAA%s|r", "观察时停止读取"))
else
if InDistance then
GameTooltip:AddLine("天赋:读取中")
else
GameTooltip:AddLine("天赋:距离过远")
end
end
end
if (not inspectName) and InDistance and EnableNotifyInspect then
inspectName = name
inspectTime = GetTime()
NotifyInspect(unit)
else
if ((GetTime() - inspectTime) > 2.0) then
inspectName = nil
end
end
end
 
-- Sometimes this wasn't getting reset, the fact a cleanup isn't performed at this point, now that it was moved to "OnTooltipCleared" is very bad, so this is a fix
self.fadeOut = nil
end)
 
local Colorize = function(self)
local GMF = GetMouseFocus()
local unit = (select(2, self:GetUnit())) or (GMF and GMF:GetAttribute("unit"))
 
local reaction = unit and UnitReaction(unit, "player")
local player = unit and UnitIsPlayer(unit)
local tapped = unit and UnitIsTapped(unit)
local tappedbyme = unit and UnitIsTappedByPlayer(unit)
local connected = unit and UnitIsConnected(unit)
local dead = unit and UnitIsDead(unit)
 
 
if (reaction) and (tapped and not tappedbyme or not connected or dead) then
r, g, b = 0.55, 0.57, 0.61
self:SetBackdropBorderColor(r, g, b)
healthBarBG:SetBackdropBorderColor(r, g, b)
healthBar:SetStatusBarColor(r, g, b)
elseif player then
local class = select(2, UnitClass(unit))
local c = oUF.colors.class[class]
if c then
r, g, b = c[1], c[2], c[3]
end
self:SetBackdropBorderColor(r, g, b)
healthBarBG:SetBackdropBorderColor(r, g, b)
healthBar:SetStatusBarColor(r, g, b)
elseif reaction then
local c = oUF.colors.reaction[reaction]
r, g, b = c[1], c[2], c[3]
self:SetBackdropBorderColor(r, g, b)
healthBarBG:SetBackdropBorderColor(r, g, b)
healthBar:SetStatusBarColor(r, g, b)
else
local _, link = self:GetItem()
local quality = link and select(3, GetItemInfo(link))
if quality and quality >= 2 then
local r, g, b = GetItemQualityColor(quality)
self:SetBackdropBorderColor(r, g, b)
else
self:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
healthBarBG:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
healthBar:SetStatusBarColor(0.31, 0.45, 0.63,1)
end
end
-- need this
NeedBackdropBorderRefresh = true
end
 
local SetStyle = function(self)
E.EuiSetTemplate(self)
Colorize(self)
end
 
local function getTalentSpecName(names, nums, colors)
if nums[1] == 0 and nums[2] == 0 and nums[3] == 0 then
return _G.NONE, _G.NONE
else
local first, second, third, name, text, point
if nums[1] >= nums[2] then
if nums[1] >= nums[3] then
first = 1
if nums[2] >= nums[3] then second = 2 third = 3 else second = 3 third = 2 end
else
first = 3 second = 1 third = 2
end
else
if nums[2] >= nums[3] then
first = 2
if nums[1] >= nums[3] then second = 1 third = 3 else second = 3 third = 1 end
else
first = 3 second = 2 third = 1
end
end
local first_num = nums[first]
local second_num = nums[second]
if first_num*3/4 <= second_num then
if first_num*3/4 <= nums[third] then
name = colors[first]:format(names[first]).."/"..colors[second]:format(names[second]).."/"..colors[third]:format(names[third])
text = names[first].."/"..names[second].."/"..names[third]
else
name = colors[first]:format(names[first]).."/"..colors[second]:format(names[second])
text = names[first].."/"..names[second]
end
else
name = colors[first]:format(names[first])
text = names[first]
end
point = (" |cc8c8c8c8(%s|cc8c8c8c8/%s|cc8c8c8c8/%s|cc8c8c8c8)"):format(colors[1]:format(nums[1]), colors[2]:format(nums[2]), colors[3]:format(nums[3]))
return name..point, text..(" (%s/%s/%s)"):format(nums[1], nums[2], nums[3])
end
end
 
local function talentColor(point, maxValue, order)
local r,g,b
local minp, maxp = 0, maxValue
point = max(0, min(point, maxValue))
if ( (maxp - minp) > 0 ) then
point = (point - minp) / (maxp - minp)
else
point = 0
end
if(point > 0.5) then
r = 0.1 + (((1-point) * 2)* (1-(0.1)))
g = 0.9
else
r = 1.0
g = (0.9) - (0.5 - point)* 2 * (0.9)
end
r = string.format("%x", (r * 100) * 2.55);
if ( #r == 1 ) then r = "0"..r; end
g = string.format("%x", (g * 100) * 2.55);
if ( #g == 1 ) then g = "0"..g; end
b = "18"
if order then
return "|cff"..r..g..b.."%s|r"
else
return "|cff"..g..r..b.."%s|r"
end
end
 
EuiTooltip:RegisterEvent("PLAYER_ENTERING_WORLD")
EuiTooltip:RegisterEvent("INSPECT_TALENT_READY")
EuiTooltip:SetScript("OnEvent", function(self,event,...)
if (event == "PLAYER_ENTERING_WORLD") then
for _, tt in pairs(Tooltips) do
tt:HookScript("OnShow", SetStyle)
end
 
E.EuiSetTemplate(FriendsTooltip)
E.EuiSetTemplate(BNToastFrame)
E.EuiSetTemplate(DropDownList1MenuBackdrop)
E.EuiSetTemplate(DropDownList2MenuBackdrop)
E.EuiSetTemplate(DropDownList1Backdrop)
E.EuiSetTemplate(DropDownList2Backdrop)
 
BNToastFrame:HookScript("OnShow", function(self)
self:ClearAllPoints()
self:SetPoint("TOPLEFT", UIParent, "TOPLEFT", E.Scale(5), E.Scale(-5))
end)
 
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
 
-- Hide tooltips in combat for actions, pet actions and shapeshift
if C["tooltip"].hidebuttonscombat == true then
local CombatHideActionButtonsTooltip = function(self)
if not IsShiftKeyDown() then
self:Hide()
end
end
 
hooksecurefunc(GameTooltip, "SetAction", CombatHideActionButtonsTooltip)
hooksecurefunc(GameTooltip, "SetPetAction", CombatHideActionButtonsTooltip)
hooksecurefunc(GameTooltip, "SetShapeshift", CombatHideActionButtonsTooltip)
end
end
 
if (event == "INSPECT_TALENT_READY") then
if (inspectName) then
local name = inspectName
inspectName = nil
local TalentNum = GetNumTalentGroups(true)
local activeTalent = GetActiveTalentGroup(true)
local inactiveTalent = 0
if TalentNum >= 2 then
if activeTalent == 1 then inactiveTalent = 2;end
if activeTalent == 2 then inactiveTalent = 1;end
end
 
local name1,_,point1 = GetTalentTabInfo(1,true,nil,activeTalent)
local name2,_,point2 = GetTalentTabInfo(2,true,nil,activeTalent)
local name3,_,point3 = GetTalentTabInfo(3,true,nil,activeTalent)
local color1, color2, color3 = talentColor(point1, 71),talentColor(point2,71),talentColor(point3,71)
local talent_name, talent_text = getTalentSpecName({name1,name2,name3}, {point1,point2,point3},{color1, color2, color3} )
 
local name01,point01
local name02,point02
local name03,point03
local color01, color02, color03
local talent0_name, talent0_text
if inactiveTalent ~=0 then
name01,_,point01 = GetTalentTabInfo(1,true,nil,inactiveTalent)
name02,_,point02 = GetTalentTabInfo(2,true,nil,inactiveTalent)
name03,_,point03 = GetTalentTabInfo(3,true,nil,inactiveTalent)
color01, color02, color03 = talentColor(point01, 71),talentColor(point02,71),talentColor(point03,71)
talent0_name, talent0_text = getTalentSpecName({name01,name02,name03}, {point01,point02,point03},{color01, color02, color03} )
end
 
 
if (talent_name and talent_text) then
local talent_name_show;
if inactiveTalent == 0 then
talent_name_show = talent_name
else
talent_name_show = talent_name.."\n"..format("|cFFAAAAAA%s|r", "备用:")..talent0_name
end
inspectList[name].talent = talent_name_show
--inspectList[name].text = talent_text
if (UnitExists("mouseover") and UnitName("mouseover") == name) then
for i = 3, GameTooltip:NumLines() do
if string.find((getglobal("GameTooltipTextLeft"..i):GetText() or ""), "天赋:") then
getglobal("GameTooltipTextLeft"..i):SetText("天赋:"..talent_name_show)
GameTooltip:AppendText("")
break
end
end
end
end
end
end
end)
 
 
EuiTooltip:SetScript("OnUpdate", function(self, elapsed)
if(self.elapsed and self.elapsed > 0.1) then
if FrameStackTooltip then
local noscalemult = E.mult * C["main"].uiscale
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
FrameStackTooltip:SetBackdrop({
bgFile = E.blank,
edgeFile = E.blank,
tile = false, tileSize = 0, edgeSize = noscalemult,
insets = { left = -noscalemult, right = -noscalemult, top = -noscalemult, bottom = -noscalemult}
})
FrameStackTooltip:SetBackdropColor(.1,.1,.1,.6)
if C["main"].classcolortheme == true then
FrameStackTooltip:SetBackdropBorderColor(r, g, b)
else
FrameStackTooltip:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
FrameStackTooltip.SetBackdropColor = dummy
FrameStackTooltip.SetBackdropBorderColor = dummy
self.elapsed = nil
self:SetScript("OnUpdate", nil)
end
self.elapsed = 0
else
self.elapsed = (self.elapsed or 0) + elapsed
end
end)
 
GameTooltip:HookScript("OnTooltipCleared", function(self) self.EuiItemTooltip=nil end)
GameTooltip:HookScript("OnTooltipSetItem", function(self)
if EuiItemTooltip and not self.EuiItemTooltip and (EuiItemTooltip.id or EuiItemTooltip.count) then
local item, link = self:GetItem()
local num = GetItemCount(link)
local left = ""
local right = ""
 
if EuiItemTooltip.id and link ~= nil then
left = "|cFFCA3C3C"..ID.."|r "..link:match(":(%w+)")
end
 
if EuiItemTooltip.count and num > 1 then
right = "|cFFCA3C3C".."数量:".."|r "..num
end
 
self:AddLine(" ")
self:AddDoubleLine(left, right)
self.EuiItemTooltip = 1
end
end)
 
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", function(_, _, name)
if name ~= "Eui" then return end
f:UnregisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", nil)
EuiItemTooltip = EuiItemTooltip or {count=true,id=true}
end)
\ No newline at end of file
Eui/element/coolline.lua New file
0,0 → 1,556
local E, C = unpack(select(2, ...))
if not C["filter"].coolline == true then return end
 
local CoolLine = CreateFrame("Frame", "CoolLine", UIParent)
local self = CoolLine
self:SetScript("OnEvent", function(this, event, ...)
this[event](this, ...)
end)
--local smed = LibStub("LibSharedMedia-3.0")
 
local _G = getfenv(0)
local pairs, ipairs = pairs, ipairs
local tinsert, tremove = tinsert, tremove
local GetTime = GetTime
local random = math.random
local strmatch = strmatch
local UnitExists, HasPetUI = UnitExists, HasPetUI
 
local db, block
local backdrop = { edgeSize=16, }
local section, iconsize = 0, 0
local tick0, tick1, tick10, tick30, tick60, tick120, tick300
local BOOKTYPE_SPELL, BOOKTYPE_PET = BOOKTYPE_SPELL, BOOKTYPE_PET
local spells = { [BOOKTYPE_SPELL] = { }, [BOOKTYPE_PET] = { }, }
local frames, cooldowns = { }, { }
 
local SetValue, updatelook, createfs, RuneCheck
--local ShowOptions
local function SetValueH(this, v, just)
this:SetPoint(just or "CENTER", self, "LEFT", v, 0)
end
local function SetValueHR(this, v, just)
this:SetPoint(just or "CENTER", self, "LEFT", db.w - v, 0)
end
local function SetValueV(this, v, just)
this:SetPoint(just or "CENTER", self, "BOTTOM", 0, v)
end
local function SetValueVR(this, v, just)
this:SetPoint(just or "CENTER", self, "BOTTOM", 0, db.h - v)
end
 
self:RegisterEvent("ADDON_LOADED")
function CoolLine:ADDON_LOADED(a1)
--if a1 ~= "CoolLine" then return end
self:UnregisterEvent("ADDON_LOADED")
self.ADDON_LOADED = nil
 
CoolLineDB = CoolLineDB or { }
if CoolLineDB.perchar then
CoolLineCharDB = CoolLineCharDB or CoolLineDB
db = CoolLineCharDB
else
CoolLineCharDB = nil
db = CoolLineDB
end
if db.dbinit ~= 1 then
db.dbinit = 1
for k, v in pairs({
w = 360, h = 18, x = 0, y = 8,
statusbar = "Blizzard",
bgcolor = { r = 0, g = 0, b = 0, a = 0.8, },
border = "Blizzard Dialog",
bordercolor = { r = 1, g = 1, b = 1, a = 1, },
font = "Friz Quadrata TT",
fontsize = 12,
fontcolor = { r = 1, g = 1, b = 1, a = 0.9, },
spellcolor = { r = 0.8, g = 0.4, b = 0, a = 1, },
nospellcolor = { r = 0, g = 0, b = 0, a = 1, },
inactivealpha = 0.5,
activealpha = 1.0,
block = { -- [spell or item name] = true,
[GetItemInfo(6948) or "Hearthstone"] = true, -- Hearthstone
},
}) do
db[k] = (db[k] ~= nil and db[k]) or v
end
end
block = db.block
 
if select(2, UnitClass("player")) == "DEATHKNIGHT" then
local runecd = { -- fix by NeoSyrex
[GetSpellInfo(50977) or "Death Gate"] = 11,
[GetSpellInfo(43265) or "Death and Decay"] = 11,
[GetSpellInfo(48263) or "Frost Presence"] = 1,
[GetSpellInfo(48266) or "Blood Presence"] = 1,
[GetSpellInfo(48265) or "Unholy Presence"] = 1,
[GetSpellInfo(42650) or "Army of the Dead"] = 11,
[GetSpellInfo(49222) or "Bone Shield"] = 11,
[GetSpellInfo(47476) or "Strangulate"] = 11,
[GetSpellInfo(51052) or "Anti-Magic Zone"] = 11,
[GetSpellInfo(63560) or "Ghoul Frenzy"] = 10,
[GetSpellInfo(49184) or "Howling Blast"] = 8,
[GetSpellInfo(51271) or "Unbreakable Armor"] = 11,
[GetSpellInfo(55233) or "Vampiric Blood"] = 11,
[GetSpellInfo(49005) or "Mark of Blood"] = 11,
[GetSpellInfo(48982) or "Rune Tap"] = 11,
}
RuneCheck = function(name, duration)
local rc = runecd[name]
if not rc or (rc <= duration and (rc > 10 or rc >= duration)) then
return true
end
end
end
 
createfs = function(f, text, offset, just)
local fs = f or self.overlay:CreateFontString(nil, "OVERLAY")
fs:SetFont(E.fontc, db.fontsize)
fs:SetTextColor(db.fontcolor.r, db.fontcolor.g, db.fontcolor.b, db.fontcolor.a)
fs:SetText(text)
fs:SetWidth(db.fontsize * 3)
fs:SetHeight(db.fontsize + 2)
fs:SetShadowColor(db.bgcolor.r, db.bgcolor.g, db.bgcolor.b, db.bgcolor.a)
fs:SetShadowOffset(1, -1)
if just then
fs:ClearAllPoints()
if db.vertical then
fs:SetJustifyH("CENTER")
just = db.reverse and ((just == "LEFT" and "TOP") or "BOTTOM") or ((just == "LEFT" and "BOTTOM") or "TOP")
elseif db.reverse then
just = (just == "LEFT" and "RIGHT") or "LEFT"
offset = offset + ((just == "LEFT" and 1) or -1)
fs:SetJustifyH(just)
else
offset = offset + ((just == "LEFT" and 1) or -1)
fs:SetJustifyH(just)
end
else
fs:SetJustifyH("CENTER")
end
SetValue(fs, offset, just)
return fs
end
updatelook = function()
-- self:SetWidth(db.w or 130)
-- self:SetHeight(db.h or 18)
-- self:SetPoint("CENTER", UIParent, "BOTTOM", db.x or 0, db.y or -240)
E.EuiCreatePanel(self, E.Scale((C["actionbar"].buttonsize * 12) + (C["actionbar"].buttonspacing * 13)), E.Scale(18), "BOTTOM", EuiActionBarBackground, "TOP", 0, E.Scale(4))
E.EuiSetTemplate(self)
self.bg = self.bg or self:CreateTexture(nil, "ARTWORK")
self.bg:SetTexture("statusbar", db.statusbar)
self.bg:SetVertexColor(db.bgcolor.r, db.bgcolor.g, db.bgcolor.b, db.bgcolor.a)
self.bg:SetAllPoints(self)
if db.vertical then
self.bg:SetTexCoord(1,0, 0,0, 1,1, 0,1)
else
self.bg:SetTexCoord(0,1, 0,1)
end
 
self.border = self.border or CreateFrame("Frame", nil, self)
self.border:SetPoint("TOPLEFT", -4, 4)
self.border:SetPoint("BOTTOMRIGHT", 4, -4)
backdrop.edgeFile = db.border
self.border:SetBackdrop(backdrop)
self.border:SetBackdropBorderColor(db.bordercolor.r, db.bordercolor.g, db.bordercolor.b, db.bordercolor.a)
 
self.overlay = self.overlay or CreateFrame("Frame", nil, self.border)
self.overlay:SetFrameLevel(11)
 
section = (db.vertical and db.h or db.w) / 6
iconsize = db.vertical and db.w or db.h
SetValue = (db.vertical and (db.reverse and SetValueVR or SetValueV)) or (db.reverse and SetValueHR or SetValueH)
 
tick0 = createfs(tick0, "0", 0, "LEFT")
tick1 = createfs(tick1, "1", section)
tick10 = createfs(tick10, "10", section * 2)
tick30 = createfs(tick30, "30", section * 3)
tick60 = createfs(tick60, "60", section * 4)
tick120 = createfs(tick120, "2m", section * 5)
tick300 = createfs(tick300, "6m", section * 6, "RIGHT")
 
if db.hidepet then
self:UnregisterEvent("UNIT_PET")
self:UnregisterEvent("PET_BAR_UPDATE_COOLDOWN")
else
self:RegisterEvent("UNIT_PET")
self:UNIT_PET("player")
end
if db.hidebag and db.hideinv then
self:UnregisterEvent("BAG_UPDATE_COOLDOWN")
else
self:RegisterEvent("BAG_UPDATE_COOLDOWN")
end
if db.hidefail then
self:UnregisterEvent("UNIT_SPELLCAST_FAILED")
else
self:RegisterEvent("UNIT_SPELLCAST_FAILED")
end
CoolLine:SetAlpha((CoolLine.unlock or #cooldowns > 0) and db.activealpha or db.inactivealpha)
for _, frame in ipairs(cooldowns) do
frame:SetWidth(iconsize)
frame:SetHeight(iconsize)
end
end
if IsLoggedIn() then
CoolLine:PLAYER_LOGIN()
else
self:RegisterEvent("PLAYER_LOGIN")
end
end
 
--------------------------------
function CoolLine:PLAYER_LOGIN()
--------------------------------
self.PLAYER_LOGIN = nil
self:RegisterEvent("SPELL_UPDATE_COOLDOWN")
self:RegisterEvent("SPELLS_CHANGED")
self:RegisterEvent("UNIT_ENTERED_VEHICLE")
if UnitHasVehicleUI("player") then
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
self:RegisterEvent("UNIT_EXITED_VEHICLE")
end
updatelook()
self:SPELLS_CHANGED()
self:SPELL_UPDATE_COOLDOWN()
self:BAG_UPDATE_COOLDOWN()
self:SetAlpha((#cooldowns == 0 and db.inactivealpha) or db.activealpha)
end
 
local iconback = { bgFile="Interface\\AddOns\\Eui\\media\\backdrop.tga" }
local elapsed, throt, ptime, isactive = 0, 1.5, 0, false
local function ClearCooldown(f, name)
name = name or (f and f.name)
for index, frame in ipairs(cooldowns) do
if frame.name == name then
frame:Hide()
frame.name = nil
frame.endtime = nil
tinsert(frames, tremove(cooldowns, index))
break
end
end
end
local function SetupIcon(frame, position, tthrot, active, fl)
throt = (throt < tthrot and throt) or tthrot
isactive = active or isactive
if fl then
frame:SetFrameLevel(random(1,4) * 2 + 2)
end
SetValue(frame, position)
end
local function OnUpdate(this, a1, ctime, dofl)
elapsed = elapsed + a1
if elapsed < throt then return end
elapsed = 0
 
if #cooldowns == 0 then
if not CoolLine.unlock then
self:SetScript("OnUpdate", nil)
self:SetAlpha(db.inactivealpha)
end
return
end
 
ctime = ctime or GetTime()
if ctime > ptime then
dofl, ptime = true, ctime + 0.4
end
isactive, throt = false, 1.5
for index, frame in pairs(cooldowns) do
local remain = frame.endtime - ctime
if remain < 10 then
if remain > 1 then
SetupIcon(frame, section * (remain + 8) * 0.111, 0.03, true, dofl) -- 1 + (remain - 1) / 9
elseif remain > 0.3 then
SetupIcon(frame, section * remain, 0, true, dofl)
elseif remain > 0 then
local size = iconsize * (0.5 - remain) * 8 -- iconsize + iconsize * (0.3 - remain) / 0.2
frame:SetWidth(size)
frame:SetHeight(size)
SetupIcon(frame, section * remain, 0, true, dofl)
elseif remain > -0.5 then
SetupIcon(frame, 0, 0, true, dofl)
frame:SetAlpha(1 + remain * 2) -- fades
else
throt = (throt < 0.2 and throt) or 0.2
isactive = true
ClearCooldown(frame)
end
elseif remain < 30 then
SetupIcon(frame, section * (remain + 30) * 0.05, remain > 11 and 0.06 or 0.02, true, dofl) -- 2 + (remain - 10) / 20
elseif remain < 60 then
SetupIcon(frame, section * (remain + 60) * 0.03333, 0.12, true, dofl) -- 3 + (remain - 30) / 30
elseif remain < 120 then
SetupIcon(frame, section * (remain + 180) * 0.01666, 0.25, true, dofl) -- 4 + (remain - 60) / 60
elseif remain < 360 then
SetupIcon(frame, section * (remain + 1080) * 0.004166, 1.2, true, dofl) -- 5 + (remain - 120) / 240
frame:SetAlpha(1)
else
SetupIcon(frame, 6 * section, 2, false, dofl)
end
end
if not isactive and not CoolLine.unlock then
self:SetAlpha(db.inactivealpha)
end
end
local function NewCooldown(name, icon, endtime, isplayer)
local f
for index, frame in pairs(cooldowns) do
if frame.name == name and frame.isplayer == isplayer then
f = frame
break
elseif frame.endtime == endtime then
return
end
end
if not f then
f = f or tremove(frames)
if not f then
f = CreateFrame("Frame", nil, CoolLine.border)
f:SetBackdrop(iconback)
f.icon = f:CreateTexture(nil, "ARTWORK")
f.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
f.icon:SetPoint("TOPLEFT", 1, -1)
f.icon:SetPoint("BOTTOMRIGHT", -1, 1)
end
tinsert(cooldowns, f)
end
local ctime = GetTime()
f:SetWidth(iconsize)
f:SetHeight(iconsize)
f:SetAlpha((endtime - ctime > 360) and 0.6 or 1)
f.name, f.endtime, f.isplayer = name, endtime, isplayer
f.icon:SetTexture(icon)
local c = db[isplayer and "spellcolor" or "nospellcolor"]
f:SetBackdropColor(c.r, c.g, c.b, c.a)
f:Show()
self:SetScript("OnUpdate", OnUpdate)
self:SetAlpha(db.activealpha)
OnUpdate(self, 2, ctime)
end
CoolLine.NewCooldown, CoolLine.ClearCooldown = NewCooldown, ClearCooldown
 
do -- cache spells that have a cooldown
local CLTip = CreateFrame("GameTooltip", "CLTip", CoolLine, "GameTooltipTemplate")
CLTip:SetOwner(CoolLine, "ANCHOR_NONE")
local GetSpellName = GetSpellName
local cooldown1 = gsub(SPELL_RECAST_TIME_MIN, "%%%.%d[fg]", "(.+)")
local cooldown2 = gsub(SPELL_RECAST_TIME_SEC, "%%%.%d[fg]", "(.+)")
local function CheckRight(rtext)
local text = rtext and rtext:GetText()
if text and (strmatch(text, cooldown1) or strmatch(text, cooldown2)) then
return true
end
end
local function CacheBook(btype)
local name, last
local sb = spells[btype]
for i = 1, 500, 1 do
name = GetSpellName(i, btype)
if not name then break end
if name ~= last then
last = name
if sb[name] then
sb[name] = i
else
CLTip:SetSpell(i, btype)
if CheckRight(CLTipTextRight2) or CheckRight(CLTipTextRight3) or CheckRight(CLTipTextRight4) then
sb[name] = i
end
end
end
end
end
----------------------------------
function CoolLine:SPELLS_CHANGED()
----------------------------------
CacheBook(BOOKTYPE_SPELL)
if not db.hidepet then
CacheBook(BOOKTYPE_PET)
end
end
end
 
do -- scans spellbook to update cooldowns, throttled since the event fires a lot
local selap = 0
local spellthrot = CreateFrame("Frame", nil, CoolLine)
local GetSpellCooldown, GetSpellTexture = GetSpellCooldown, GetSpellTexture
local function CheckSpellBook(btype)
for name, id in pairs(spells[btype]) do
local start, duration, enable = GetSpellCooldown(id, btype)
if enable == 1 and start > 0 and not block[name] and (not RuneCheck or RuneCheck(name, duration))then
if duration > 2.5 then
NewCooldown(name, GetSpellTexture(id, btype), start + duration, btype == BOOKTYPE_SPELL)
else
for index, frame in ipairs(cooldowns) do
if frame.name == name then
if frame.endtime > start + duration + 0.1 then
frame.endtime = start + duration
end
break
end
end
end
else
ClearCooldown(nil, name)
end
end
end
spellthrot:SetScript("OnUpdate", function(this, a1)
selap = selap + a1
if selap < 0.33 then return end
selap = 0
this:Hide()
CheckSpellBook(BOOKTYPE_SPELL)
if not db.hidepet and HasPetUI() then
CheckSpellBook(BOOKTYPE_PET)
end
end)
spellthrot:Hide()
-----------------------------------------
function CoolLine:SPELL_UPDATE_COOLDOWN()
-----------------------------------------
spellthrot:Show()
end
end
 
do -- scans equipments and bags for item cooldowns
local GetItemInfo = GetItemInfo
local GetInventoryItemCooldown, GetInventoryItemTexture = GetInventoryItemCooldown, GetInventoryItemTexture
local GetContainerItemCooldown, GetContainerItemInfo = GetContainerItemCooldown, GetContainerItemInfo
local GetContainerNumSlots = GetContainerNumSlots
---------------------------------------
function CoolLine:BAG_UPDATE_COOLDOWN()
---------------------------------------
for i = 1, (db.hideinv and 0) or 18, 1 do
local start, duration, enable = GetInventoryItemCooldown("player", i)
if enable == 1 then
local name = GetItemInfo(GetInventoryItemLink("player", i))
if start > 0 and not block[name] then
if duration > 3 and duration < 3601 then
NewCooldown(name, GetInventoryItemTexture("player", i), start + duration)
end
else
ClearCooldown(nil, name)
end
end
end
for i = 0, (db.hidebag and -1) or 4, 1 do
for j = 1, GetContainerNumSlots(i), 1 do
local start, duration, enable = GetContainerItemCooldown(i, j)
if enable == 1 then
local name = GetItemInfo(GetContainerItemLink(i, j))
if start > 0 and not block[name] then
if duration > 3 and duration < 3601 then
NewCooldown(name, GetContainerItemInfo(i, j), start + duration)
end
else
ClearCooldown(nil, name)
end
end
end
end
end
end
 
-------------------------------------------
function CoolLine:PET_BAR_UPDATE_COOLDOWN()
-------------------------------------------
for i = 1, 10, 1 do
local start, duration, enable = GetPetActionCooldown(i)
if enable == 1 then
local name, _, texture = GetPetActionInfo(i)
if name then
if start > 0 and not block[name] then
if duration > 3 then
NewCooldown(name, texture, start + duration)
end
else
ClearCooldown(nil, name)
end
end
end
end
end
------------------------------
function CoolLine:UNIT_PET(a1)
------------------------------
if a1 ~= "player" then return end
if UnitExists("pet") and not HasPetUI() then
self:RegisterEvent("PET_BAR_UPDATE_COOLDOWN")
else
self:UnregisterEvent("PET_BAR_UPDATE_COOLDOWN")
end
end
 
local GetActionCooldown, HasAction = GetActionCooldown, HasAction
---------------------------------------------
function CoolLine:ACTIONBAR_UPDATE_COOLDOWN() -- used only for vehicles
---------------------------------------------
for i = 1, 6, 1 do
local b = _G["VehicleMenuBarActionButton"..i]
if b and HasAction(b.action) then
local start, duration, enable = GetActionCooldown(b.action)
if enable == 1 then
if start > 0 and not block[GetActionInfo(b.action)] then
if duration > 3 then
NewCooldown("vhcle"..i, GetActionTexture(b.action), start + duration)
end
else
ClearCooldown(nil, "vhcle"..i)
end
end
end
end
end
------------------------------------------
function CoolLine:UNIT_ENTERED_VEHICLE(a1)
------------------------------------------
if a1 ~= "player" or not UnitHasVehicleUI("player") then return end
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
self:RegisterEvent("UNIT_EXITED_VEHICLE")
self:ACTIONBAR_UPDATE_COOLDOWN()
end
-----------------------------------------
function CoolLine:UNIT_EXITED_VEHICLE(a1)
-----------------------------------------
if a1 ~= "player" then return end
self:UnregisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
for index, frame in ipairs(cooldowns) do
if strmatch(frame.name, "vhcle") then
ClearCooldown(nil, frame.name)
end
end
end
 
local failborder
----------------------------------------------------
function CoolLine:UNIT_SPELLCAST_FAILED(unit, spell)
----------------------------------------------------
if unit ~= "player" or #cooldowns == 0 then return end
for index, frame in pairs(cooldowns) do
if frame.name == spell then
if frame.endtime - GetTime() > 1 then
if not failborder then
failborder = CreateFrame("Frame", nil, CoolLine.border)
failborder:SetBackdrop(iconback)
failborder:SetBackdropColor(1, 0, 0, 0.9)
failborder:Hide()
failborder:SetScript("OnUpdate", function(this, a1)
this.alp = this.alp - a1
if this.alp < 0 then return this:Hide() end
this:SetAlpha(this.alp > 1 and 1 or this.alp)
end)
end
failborder.alp = 1.2
failborder:SetPoint("TOPLEFT", frame, "TOPLEFT", -2, 2)
failborder:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 2, -2)
failborder:Show()
end
break
end
end
 
end
 
Eui/element/actionbars/cooldown.lua New file
0,0 → 1,158
--[[
An edited lightweight OmniCC for Eui
A featureless, 'pure' version of OmniCC.
This version should work on absolutely everything, but I've removed pretty much all of the options
--]]
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if C["cooldown"].enable ~= true or IsAddOnLoaded("OmniCC") or IsAddOnLoaded("ncCooldown") then return end
 
--constants!
OmniCC = true --hack to work around detection from other addons for OmniCC
local ICON_SIZE = 36 --the normal size for an icon (don't change this)
local DAY, HOUR, MINUTE = 86400, 3600, 60 --used for formatting text
local DAYISH, HOURISH, MINUTEISH = 3600 * 23.5, 60 * 59.5, 59.5 --used for formatting text at transition points
local HALFDAYISH, HALFHOURISH, HALFMINUTEISH = DAY/2 + 0.5, HOUR/2 + 0.5, MINUTE/2 + 0.5 --used for calculating next update times
 
--configuration settings
local FONT_FACE = E.font --what font to use
local FONT_SIZE = 20 --the base font size to use at a scale of 1
local MIN_SCALE = 0.5 --the minimum scale we want to show cooldown counts at, anything below this will be hidden
local MIN_DURATION = 2.5 --the minimum duration to show cooldown text for
local EXPIRING_DURATION = C["cooldown"].treshold --the minimum number of seconds a cooldown must be to use to display in the expiring format
 
local EXPIRING_FORMAT = E.RGBToHex(unpack(C["cooldown"].expiringcolor))..'%.1f|r' --format for timers that are soon to expire
local SECONDS_FORMAT = E.RGBToHex(unpack(C["cooldown"].secondscolor))..'%d|r' --format for timers that have seconds remaining
local MINUTES_FORMAT = E.RGBToHex(unpack(C["cooldown"].minutescolor))..'%dm|r' --format for timers that have minutes remaining
local HOURS_FORMAT = E.RGBToHex(unpack(C["cooldown"].hourscolor))..'%dh|r' --format for timers that have hours remaining
local DAYS_FORMAT = E.RGBToHex(unpack(C["cooldown"].dayscolor))..'%dh|r' --format for timers that have days remaining
 
--local bindings!
local floor = math.floor
local min = math.min
local GetTime = GetTime
 
--returns both what text to display, and how long until the next update
local function getTimeText(s)
--format text as seconds when below a minute
if s < MINUTEISH then
local seconds = tonumber(E.Round(s))
if seconds > EXPIRING_DURATION then
return SECONDS_FORMAT, seconds, s - (seconds - 0.51)
else
return EXPIRING_FORMAT, s, 0.051
end
--format text as minutes when below an hour
elseif s < HOURISH then
local minutes = tonumber(E.Round(s/MINUTE))
return MINUTES_FORMAT, minutes, minutes > 1 and (s - (minutes*MINUTE - HALFMINUTEISH)) or (s - MINUTEISH)
--format text as hours when below a day
elseif s < DAYISH then
local hours = tonumber(E.Round(s/HOUR))
return HOURS_FORMAT, hours, hours > 1 and (s - (hours*HOUR - HALFHOURISH)) or (s - HOURISH)
--format text as days
else
local days = tonumber(E.Round(s/DAY))
return DAYS_FORMAT, days, days > 1 and (s - (days*DAY - HALFDAYISH)) or (s - DAYISH)
end
end
 
--stops the timer
local function Timer_Stop(self)
self.enabled = nil
self:Hide()
end
 
--forces the given timer to update on the next frame
local function Timer_ForceUpdate(self)
self.nextUpdate = 0
self:Show()
end
 
--adjust font size whenever the timer's parent size changes
--hide if it gets too tiny
local function Timer_OnSizeChanged(self, width, height)
local fontScale = E.Round(width) / ICON_SIZE
if fontScale == self.fontScale then
return
end
 
self.fontScale = fontScale
if fontScale < MIN_SCALE then
self:Hide()
else
self.text:SetFont(FONT_FACE, fontScale * FONT_SIZE, 'OUTLINE')
self.text:SetShadowColor(0, 0, 0, 0.5)
self.text:SetShadowOffset(2, -2)
if self.enabled then
Timer_ForceUpdate(self)
end
end
end
 
--update timer text, if it needs to be
--hide the timer if done
local function Timer_OnUpdate(self, elapsed)
if self.nextUpdate > 0 then
self.nextUpdate = self.nextUpdate - elapsed
else
local remain = self.duration - (GetTime() - self.start)
if tonumber(E.Round(remain)) > 0 then
if (self.fontScale * self:GetEffectiveScale() / UIParent:GetScale()) < MIN_SCALE then
self.text:SetText('')
self.nextUpdate = 1
else
local formatStr, time, nextUpdate = getTimeText(remain)
self.text:SetFormattedText(formatStr, time)
self.nextUpdate = nextUpdate
end
else
Timer_Stop(self)
end
end
end
 
--returns a new timer object
local function Timer_Create(self)
--a frame to watch for OnSizeChanged events
--needed since OnSizeChanged has funny triggering if the frame with the handler is not shown
local scaler = CreateFrame('Frame', nil, self)
scaler:SetAllPoints(self)
 
local timer = CreateFrame('Frame', nil, scaler); timer:Hide()
timer:SetAllPoints(scaler)
timer:SetScript('OnUpdate', Timer_OnUpdate)
 
local text = timer:CreateFontString(nil, 'OVERLAY')
text:SetPoint('CENTER', E.Scale(1), E.Scale(1))
text:SetJustifyH("CENTER")
timer.text = text
 
Timer_OnSizeChanged(timer, scaler:GetSize())
scaler:SetScript('OnSizeChanged', function(self, ...) Timer_OnSizeChanged(timer, ...) end)
 
self.timer = timer
return timer
end
 
--hook the SetCooldown method of all cooldown frames
--ActionButton1Cooldown is used here since its likely to always exist
--and I'd rather not create my own cooldown frame to preserve a tiny bit of memory
hooksecurefunc(getmetatable(ActionButton1Cooldown).__index, 'SetCooldown', function(self, start, duration)
if self.noOCC then return end
--start timer
if start > 0 and duration > MIN_DURATION then
local timer = self.timer or Timer_Create(self)
timer.start = start
timer.duration = duration
timer.enabled = true
timer.nextUpdate = 0
if timer.fontScale >= MIN_SCALE then timer:Show() end
--stop timer
else
local timer = self.timer
if timer then
Timer_Stop(timer)
end
end
end)
\ No newline at end of file
Eui/element/actionbars/bar1.lua New file
0,0 → 1,109
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
---------------------------------------------------------------------------
-- Setup Main Action Bar.
-- Now used for stances, Bonus at the same time.
---------------------------------------------------------------------------
 
local bar = CreateFrame("Frame", "EuiMainMenuBar", EuiActionBarBackground, "SecureHandlerStateTemplate")
bar:ClearAllPoints()
bar:SetAllPoints(EuiActionBarBackground)
 
--[[
Bonus bar classes id
 
DRUID: Caster: 0, Cat: 1, Tree of Life: 0, Bear: 3, Moonkin: 4
WARRIOR: Battle Stance: 1, Defensive Stance: 2, Berserker Stance: 3
ROGUE: Normal: 0, Stealthed: 1
PRIEST: Normal: 0, Shadowform: 1
 
When Possessing a Target: 5
]]--
 
local Page = {
["DRUID"] = "[bonusbar:1,nostealth] 7; [bonusbar:1,stealth] 8; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10;",
["WARRIOR"] = "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9;",
["PRIEST"] = "[bonusbar:1] 7;",
["ROGUE"] = "[bonusbar:1] 7; [form:3] 7;",
["DEFAULT"] = "[bonusbar:5] 11; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6;",
}
 
local function GetBar()
local condition = Page["DEFAULT"]
local class = E.MyClass
local page = Page[class]
if page then
condition = condition.." "..page
end
condition = condition.." 1"
return condition
end
 
function E.PositionMainBar()
MainMenuBar_UpdateKeyRing()
local button
for i = 1, 12 do
button = _G["ActionButton"..i]
button:SetSize(E.buttonsize, E.buttonsize)
button:SetParent(EuiMainMenuBar)
button:ClearAllPoints()
 
if i == 1 then
if C["actionbar"].swaptopbottombar == true then
button:SetPoint("TOPLEFT", EuiMainMenuBar, E.buttonspacing, -E.buttonspacing)
else
button:SetPoint("BOTTOMLEFT", EuiMainMenuBar, E.buttonspacing, E.buttonspacing)
end
else
local previous = _G["ActionButton"..i-1]
button:SetPoint("LEFT", previous, "RIGHT", E.buttonspacing, 0)
end
end
end
 
bar:RegisterEvent("PLAYER_LOGIN")
bar:RegisterEvent("KNOWN_CURRENCY_TYPES_UPDATE")
bar:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
bar:RegisterEvent("BAG_UPDATE")
bar:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
bar:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
local button
for i = 1, NUM_ACTIONBAR_BUTTONS do
button = _G["ActionButton"..i]
self:SetFrameRef("ActionButton"..i, button)
end
 
self:Execute([[
buttons = table.new()
for i = 1, 12 do
table.insert(buttons, self:GetFrameRef("ActionButton"..i))
end
firedonce = false
]])
 
self:SetAttribute("_onstate-page", [[
for i, button in ipairs(buttons) do
button:SetAttribute("actionpage", tonumber(newstate))
end
]])
 
self:SetAttribute("_onstate-vehicleupdate", [[
if newstate == "s2" then
self:GetParent():Hide()
else
self:GetParent():Show()
end
]])
 
RegisterStateDriver(self, "page", GetBar())
RegisterStateDriver(self, "vehicleupdate", "[vehicleui] s2;s1")
elseif event == "ACTIVE_TALENT_GROUP_CHANGED" then
-- attempt to fix blocked glyph change after switching spec.
-- LoadAddOn("Blizzard_GlyphUI")
else
MainMenuBar_OnEvent(self, event, ...)
end
end)
\ No newline at end of file
Eui/element/actionbars/bar2.lua New file
0,0 → 1,34
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
---------------------------------------------------------------------------
-- setup MultiBarBottomLeft as bar #2
---------------------------------------------------------------------------
 
local EuiBar2 = CreateFrame("Frame","EuiBar2",EuiActionBarBackground)
EuiBar2:SetAllPoints(EuiActionBarBackground)
MultiBarBottomLeft:SetParent(EuiBar2)
 
function E.PositionBar2()
for i=1, 12 do
local b = _G["MultiBarBottomLeftButton"..i]
local b2 = _G["MultiBarBottomLeftButton"..i-1]
b:ClearAllPoints()
if i == 1 then
if C["actionbar"].swaptopbottombar == true then
b:SetPoint("TOP", ActionButton1, "BOTTOM", 0, -E.buttonspacing)
else
b:SetPoint("BOTTOM", ActionButton1, "TOP", 0, E.buttonspacing)
end
else
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
end
end
-- hide it if needed
if E.actionbar.bottomrows == 1 then
EuiBar2:Hide()
else
EuiBar2:Show()
end
end
Eui/element/actionbars/bar3.lua New file
0,0 → 1,106
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
 
---------------------------------------------------------------------------
-- setup MultiBarLeft as bar #3
---------------------------------------------------------------------------
 
local EuiBar3 = CreateFrame("Frame","EuiBar3",EuiActionBarBackground) -- bottomrightbar
EuiBar3:SetAllPoints(EuiActionBarBackground)
MultiBarLeft:SetParent(EuiBar3)
 
 
--Some event fires when sheathing/unsheathing weapon that forces a show on actionbuttons, setting the parent to this frame temporarily when splitbars is applied to fix
local EuiBar3Split = CreateFrame("Frame", "EuiBarSplit1", EuiBar3)
EuiBar3Split:SetAllPoints(EuiActionBarBackground)
 
 
function E.PositionBar3()
for i= 1, 12 do
local b = _G["MultiBarLeftButton"..i]
local b2 = _G["MultiBarLeftButton"..i-1]
b:ClearAllPoints()
b:SetParent(MultiBarLeft)
b:Show()
b:SetAlpha(1)
if E["actionbar"].splitbar ~= true then
if E["actionbar"].rightbars > 1 then
if i == 1 then
b:SetPoint("TOPRIGHT", EuiActionBarBackgroundRight, "TOPRIGHT", -E.buttonspacing, -E.buttonspacing)
else
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
end
else
if i == 1 then
b:SetPoint("TOP", EuiActionBarBackgroundRight, "TOP", 0, -E.buttonspacing)
else
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
end
end
else
if E.actionbar.bottomrows == 1 then
if i == 1 then
b:SetPoint("TOPLEFT", EuiSplitActionBarLeftBackground, "TOPLEFT", E.buttonspacing, -E.buttonspacing)
elseif i > 3 and i < 7 then
b:SetParent(EuiBar3Split)
elseif i == 7 then
b:SetPoint("TOPLEFT", EuiSplitActionBarRightBackground, "TOPLEFT", E.buttonspacing, -E.buttonspacing)
elseif i > 9 then
b:SetParent(EuiBar3Split)
EuiBar3Split:Hide()
else
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
end
elseif E.actionbar.bottomrows == 2 then
if i == 1 then
b:SetPoint("TOPLEFT", EuiSplitActionBarLeftBackground, "TOPLEFT", E.buttonspacing, -E.buttonspacing)
elseif i == 4 then
b:SetPoint("TOP", _G["MultiBarLeftButton"..i-3], "BOTTOM", 0, -E.buttonspacing)
elseif i == 7 then
b:SetPoint("TOPLEFT", EuiSplitActionBarRightBackground, "TOPLEFT", E.buttonspacing, -E.buttonspacing)
elseif i == 10 then
b:SetPoint("TOP", _G["MultiBarLeftButton"..i-3], "BOTTOM", 0, -E.buttonspacing)
else
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
end
else
if i == 1 then
b:SetPoint("TOPLEFT", EuiSplitActionBarLeftBackground, "TOPLEFT", (E.buttonsize * 1) + (E.buttonspacing * 2), -E.buttonspacing)
elseif i == 4 then
b:SetPoint("TOP", _G["MultiBarLeftButton"..i-3], "BOTTOM", 0, -E.buttonspacing)
elseif i == 7 then
b:SetPoint("TOPLEFT", EuiSplitActionBarRightBackground, "TOPLEFT", E.buttonspacing, -E.buttonspacing)
elseif i == 10 then
b:SetPoint("TOP", _G["MultiBarLeftButton"..i-3], "BOTTOM", 0, -E.buttonspacing)
else
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
end
end
end
--Setup Mouseover
if C["actionbar"].rightbarmouseover == true and not (E.actionbar.bottomrows == 3) and E["actionbar"].splitbar ~= true then
b:SetAlpha(0)
b:HookScript("OnEnter", function()
if not (E.actionbar.bottomrows == 3) and E["actionbar"].splitbar ~= true then
RightBarMouseOver(1)
end
end)
b:HookScript("OnLeave", function()
if not (E.actionbar.bottomrows == 3) and E["actionbar"].splitbar ~= true then
RightBarMouseOver(0)
end
end)
end
end
 
-- hide it if needed
if ((E.actionbar.rightbars < 3 and E["actionbar"].splitbar ~= true and E.actionbar.bottomrows ~= 3) and not
(E["actionbar"].splitbar ~= true and E["actionbar"].bottomrows == 2 and E["actionbar"].rightbars == 2)) or
(E["actionbar"].bottomrows == 3 and E["actionbar"].splitbar ~= true and E["actionbar"].rightbars == 0) then
EuiBar3:Hide()
else
EuiBar3:Show()
end
end
\ No newline at end of file
Eui/element/actionbars/bar4.lua New file
0,0 → 1,65
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
 
---------------------------------------------------------------------------
-- setup MultiBarRight as bar #4
---------------------------------------------------------------------------
 
local EuiBar4 = CreateFrame("Frame","EuiBar4",EuiActionBarBackground) -- bottomrightbar
EuiBar4:SetAllPoints(EuiActionBarBackground)
MultiBarRight:SetParent(EuiBar4)
 
function E.PositionBar4()
for i= 1, 12 do
local b = _G["MultiBarRightButton"..i]
local b2 = _G["MultiBarRightButton"..i-1]
b:ClearAllPoints()
b:SetAlpha(1)
b:Show()
EuiBar4:SetParent(EuiActionBarBackgroundRight)
if E.actionbar.bottomrows == 3 then
if i == 1 then
if C["actionbar"].swaptopbottombar == true then
b:SetPoint("TOP", MultiBarBottomLeftButton1, "BOTTOM", 0, -E.buttonspacing)
else
b:SetPoint("BOTTOM", MultiBarBottomLeftButton1, "TOP", 0, E.buttonspacing)
end
else
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
end
EuiBar4:SetParent(EuiActionBarBackground)
elseif E.actionbar.bottomrows ~= 3 and E.actionbar.rightbars > 1 then
if i == 1 then
if E.actionbar.rightbars == 2 then
b:SetPoint("TOPRIGHT", EuiActionBarBackgroundRight, "TOPRIGHT", -E.buttonspacing, -E.buttonspacing)
else
b:SetPoint("TOP", EuiActionBarBackgroundRight, "TOP", 0, -E.buttonspacing)
end
else
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
end
else
if i == 1 then
b:SetPoint("TOPRIGHT", EuiActionBarBackgroundRight, "TOPRIGHT", -E.buttonspacing, -E.buttonspacing)
else
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
end
end
 
--Setup Mouseover
if C["actionbar"].rightbarmouseover == true and not (E.actionbar.bottomrows == 3) then
b:SetAlpha(0)
b:HookScript("OnEnter", function() RightBarMouseOver(1) end)
b:HookScript("OnLeave", function() RightBarMouseOver(0) end)
end
end
 
-- hide it if needed
if E.actionbar.rightbars < 1 and not (((E.actionbar.bottomrows == 3) or (E.actionbar.bottomrows ~= 3 and E.actionbar.rightbars > 1)) or (E["actionbar"].bottomrows == 2 and E["actionbar"].rightbars == 2) or (C["actionbar"].rightbar == 2 and E["actionbar"].bottomrows > 1 and E["actionbar"].splitbar == true)) or (E["actionbar"].bottomrows == 2 and E["actionbar"].rightbars == 2 and E["actionbar"].splitbar ~= true) then
EuiBar4:Hide()
else
EuiBar4:Show()
end
end
Eui/element/actionbars/bar5.lua New file
0,0 → 1,64
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
 
---------------------------------------------------------------------------
-- setup MultiBarBottomRight as bar #5
---------------------------------------------------------------------------
 
local EuiBar5 = CreateFrame("Frame","EuiBar5",EuiActionBarBackground) -- MultiBarBottomRight
EuiBar5:SetAllPoints(EuiActionBarBackground)
MultiBarBottomRight:SetParent(EuiBar5)
 
function E.PositionBar5()
for i=1, 12 do
local b = _G["MultiBarBottomRightButton"..i]
local b2 = _G["MultiBarBottomRightButton"..i-1]
b:ClearAllPoints()
b:SetAlpha(1)
b:Show()
if E["actionbar"].rightbars > 1 then
if i == 1 then
b:SetPoint("TOPLEFT", EuiActionBarBackgroundRight, "TOPLEFT", E.buttonspacing, -E.buttonspacing)
else
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
end
elseif E["actionbar"].bottomrows == 3 and E["actionbar"].splitbar == true then
if i == 1 then
b:SetPoint("TOP", MultiBarLeftButton4, "BOTTOM", 0, -E.buttonspacing)
elseif i < 4 then
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
elseif i == 4 then
b:SetPoint("TOP", MultiBarLeftButton10, "BOTTOM", 0, -E.buttonspacing)
elseif i > 4 and i < 7 then
b:SetPoint("LEFT", b2, "RIGHT", E.buttonspacing, 0)
elseif i == 7 then
b:SetPoint("RIGHT", MultiBarLeftButton1, "LEFT", -E.buttonspacing, 0)
elseif i > 7 and i < 10 then
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
elseif i == 10 then
b:SetPoint("LEFT", MultiBarLeftButton9, "RIGHT", E.buttonspacing, 0)
elseif i > 10 then
b:SetPoint("TOP", b2, "BOTTOM", 0, -E.buttonspacing)
else
b:Hide()
end
end
--Setup Mouseover
if C["actionbar"].rightbarmouseover == true and not (E.actionbar.bottomrows == 3) then
b:SetAlpha(0)
b:HookScript("OnEnter", function() RightBarMouseOver(1) end)
b:HookScript("OnLeave", function() RightBarMouseOver(0) end)
end
end
 
-- hide it if needed
if not ((E["actionbar"].rightbars > 1) or (E["actionbar"].bottomrows == 3 and E["actionbar"].splitbar == true)) then
EuiBar5:Hide()
else
EuiBar5:Show()
end
end
 
 
Eui/element/actionbars/range.lua New file
0,0 → 1,14
hooksecurefunc("ActionButton_OnUpdate", function(self, elapsed)
if ( self.rangeTimer == TOOLTIP_UPDATE_TIME ) then
local range = false
if ( IsActionInRange(self.action) == 0 ) then
getglobal(self:GetName().."Icon"):SetVertexColor(0.2, 0.2, 0.2 )
getglobal(self:GetName().."NormalTexture"):SetVertexColor(0.8, 0, 0)
range = true
end;
if ( self.range ~= range and range == false ) then
ActionButton_UpdateUsable(self)
end;
self.range = range
end
end)
\ No newline at end of file
Eui/element/actionbars/microbar.lua New file
0,0 → 1,169
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
 
if C["actionbar"].enable ~= true or C["actionbar"].microbar ~= true then return end
function UpdateMicroButtonsParent(parent)
CharacterMicroButton:SetParent(parent);
SpellbookMicroButton:SetParent(parent);
TalentMicroButton:SetParent(parent);
QuestLogMicroButton:SetParent(parent);
MainMenuMicroButton:SetParent(parent);
PVPMicroButton:SetParent(parent);
SocialsMicroButton:SetParent(parent);
LFDMicroButton:SetParent(parent);
HelpMicroButton:SetParent(parent);
AchievementMicroButton:SetParent(parent);
end
 
local microbuttons = {
"CharacterMicroButton",
"SpellbookMicroButton",
"TalentMicroButton",
"QuestLogMicroButton",
"MainMenuMicroButton",
"PVPMicroButton",
"SocialsMicroButton",
"LFDMicroButton",
"HelpMicroButton",
"AchievementMicroButton"
}
 
local f = CreateFrame("Frame", "MicroParent", UIParent)
MicroParent.shown = false
if C["actionbar"].mousemicro == true then f:SetAlpha(0) end
 
UpdateMicroButtonsParent(f)
 
local function CheckFade(self, elapsed)
local mouseactive
for i, button in pairs(microbuttons) do
local b = _G[button]
if b.mouseover == true then
mouseactive = true
if GameTooltip:IsShown() then
GameTooltip:Hide()
end
end
end
 
if C["actionbar"].mousemicro ~= true then return end
 
if MicroPlaceHolder.mouseover == true then
mouseactive = true
if GameTooltip:IsShown() then
GameTooltip:Hide()
end
end
 
if mouseactive == true then
if MicroParent.shown ~= true then
UIFrameFadeIn(MicroParent, 0.2)
MicroParent.shown = true
end
else
if MicroParent.shown == true then
UIFrameFadeOut(MicroParent, 0.2)
MicroParent.shown = false
end
end
end
f:SetScript("OnUpdate", CheckFade)
 
for i, button in pairs(microbuttons) do
local m = _G[button]
local pushed = m:GetPushedTexture()
local normal = m:GetNormalTexture()
local disabled = m:GetDisabledTexture()
 
m.SetParent = E.dummy
--_G[button.."Flash"]:SetTexture("")
m:SetHighlightTexture("")
m.SetHighlightTexture = E.dummy
 
if i == 5 then
E.Kill(m)
elseif i == 9 then
m:ClearAllPoints()
m:SetPoint("LEFT", LFDMicroButton, "RIGHT", -3, 0)
end
 
local f = CreateFrame("Frame", nil, m)
f:SetFrameLevel(1)
f:SetFrameStrata("BACKGROUND")
f:SetPoint("BOTTOMLEFT", m, "BOTTOMLEFT", 2, 0)
f:SetPoint("TOPRIGHT", m, "TOPRIGHT", -2, -28)
E.EuiSetTemplate(f)
m.frame = f
 
pushed:SetTexCoord(0.17, 0.87, 0.5, 0.908)
pushed:ClearAllPoints()
pushed:SetPoint("TOPLEFT", m.frame, "TOPLEFT", E.Scale(2), E.Scale(-2))
pushed:SetPoint("BOTTOMRIGHT", m.frame, "BOTTOMRIGHT", E.Scale(-2), E.Scale(2))
 
normal:SetTexCoord(0.17, 0.87, 0.5, 0.908)
normal:ClearAllPoints()
normal:SetPoint("TOPLEFT", m.frame, "TOPLEFT", E.Scale(2), E.Scale(-2))
normal:SetPoint("BOTTOMRIGHT", m.frame, "BOTTOMRIGHT", E.Scale(-2), E.Scale(2))
 
if disabled then
disabled:SetTexCoord(0.17, 0.87, 0.5, 0.908)
disabled:ClearAllPoints()
disabled:SetPoint("TOPLEFT", m.frame, "TOPLEFT", E.Scale(2), E.Scale(-2))
disabled:SetPoint("BOTTOMRIGHT", m.frame, "BOTTOMRIGHT", E.Scale(-2), E.Scale(2))
end
 
 
m.mouseover = false
m:HookScript("OnEnter", function(self)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
self.frame:SetBackdropBorderColor(r, g, b,1)
else
self.frame:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
self.mouseover = true
end)
m:HookScript("OnLeave", function(self)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
self.frame:SetBackdropBorderColor(r, g, b,1)
else
self.frame:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
self.mouseover = false
end)
end
 
local x = CreateFrame("Frame", "MicroPlaceHolder", MicroParent)
x:SetPoint("TOPLEFT", CharacterMicroButton.frame, "TOPLEFT")
x:SetPoint("BOTTOMRIGHT", HelpMicroButton.frame, "BOTTOMRIGHT")
x:EnableMouse(true)
x.mouseover = false
E.EuiCreateShadow(x)
x:SetScript("OnEnter", function(self) self.mouseover = true end)
x:SetScript("OnLeave", function(self) self.mouseover = false end)
 
 
--Fix/Create textures for buttons
--do
--MicroButtonPortrait:ClearAllPoints()
--MicroButtonPortrait:SetPoint("TOPLEFT", CharacterMicroButton.frame, "TOPLEFT", E.Scale(2), E.Scale(-2))
--MicroButtonPortrait:SetPoint("BOTTOMRIGHT", CharacterMicroButton.frame, "BOTTOMRIGHT", E.Scale(-2), E.Scale(2))
 
--GuildMicroButtonTabard:ClearAllPoints()
--GuildMicroButtonTabard:SetPoint("TOP", GuildMicroButton.frame, "TOP", 0, 25)
--GuildMicroButtonTabard.SetPoint = E.dummy
--GuildMicroButtonTabard.ClearAllPoints = E.dummy
--end
 
MicroParent:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 2, -2) --Default microbar position
MicroParent:SetWidth(((CharacterMicroButton:GetWidth() + 4) * 7) + 2)
MicroParent:SetHeight(CharacterMicroButton:GetHeight() - 28)
 
CharacterMicroButton:ClearAllPoints()
CharacterMicroButton:SetPoint("BOTTOMLEFT", MicroParent, "BOTTOMLEFT", 0, 0)
CharacterMicroButton.SetPoint = E.dummy
CharacterMicroButton.ClearAllPoints = E.dummy
 
 
E.CreateMover(MicroParent, "MicroMover", "MicroBar")
\ No newline at end of file
Eui/element/actionbars/style.lua New file
0,0 → 1,504
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
local _G = _G
local securehandler = CreateFrame("Frame", nil, nil, "SecureHandlerBaseTemplate")
 
function Style(self, vehicle, totem)
local name = self:GetName()
 
if name:match("MultiCastActionButton") then return end
 
local action = self.action
local Button = self
local Icon = _G[name.."Icon"]
local Count = _G[name.."Count"]
local Flash = _G[name.."Flash"]
local HotKey = _G[name.."HotKey"]
local Border = _G[name.."Border"]
local Btname = _G[name.."Name"]
local normal = _G[name.."NormalTexture"]
 
if Flash then
Flash:SetTexture("")
end
Button:SetNormalTexture("")
 
if Border then
Border:Hide()
Border = E.dummy
end
 
if Count then
Count:ClearAllPoints()
Count:SetPoint("BOTTOMRIGHT", 0, E.Scale(2))
Count:SetFont(E.font, 12, "OUTLINE")
end
 
if Btname then
if C["actionbar"].macrotext ~= true then
Btname:SetText("")
Btname:Hide()
Btname.Show = E.dummy
end
end
 
if not _G[name.."Panel"] then
if not totem then
self:SetWidth(E.buttonsize)
self:SetHeight(E.buttonsize)
 
local panel = CreateFrame("Frame", name.."Panel", self)
if vehicle then
E.EuiCreatePanel(panel, E.buttonsize*1.2, E.buttonsize*1.2, "CENTER", self, "CENTER", 0, 0)
else
E.EuiCreatePanel(panel, E.buttonsize, E.buttonsize, "CENTER", self, "CENTER", 0, 0)
end
E.EuiSetTemplate(panel)
panel:SetFrameStrata(self:GetFrameStrata())
panel:SetFrameLevel(self:GetFrameLevel() - 1 or 0)
end
 
if Icon then
Icon:SetTexCoord(.08, .92, .08, .92)
Icon:SetPoint("TOPLEFT", Button, E.Scale(2), E.Scale(-2))
Icon:SetPoint("BOTTOMRIGHT", Button, E.Scale(-2), E.Scale(2))
end
end
 
if HotKey then
HotKey:ClearAllPoints()
HotKey:SetPoint("TOPRIGHT", 0, E.Scale(-3))
HotKey:SetFont(E.font, 12, "OUTLINE")
HotKey.ClearAllPoints = E.dummy
HotKey.SetPoint = E.dummy
if not C["actionbar"].hotkey == true then
HotKey:SetText("")
HotKey:Hide()
HotKey.Show = E.dummy
end
end
 
if normal then
normal:ClearAllPoints()
normal:SetPoint("TOPLEFT")
normal:SetPoint("BOTTOMRIGHT")
end
end
 
local function Stylesmallbutton(normal, button, icon, name, pet)
local Flash = _G[name.."Flash"]
button:SetNormalTexture("")
 
-- another bug fix reported by Affli in t12 beta
button.SetNormalTexture = E.dummy
 
Flash:SetTexture(1, 1, 1, 0.3)
 
if not _G[name.."Panel"] then
button:SetWidth(E.petbuttonsize)
button:SetHeight(E.petbuttonsize)
 
local panel = CreateFrame("Frame", name.."Panel", button)
E.EuiCreatePanel(panel, E.petbuttonsize, E.petbuttonsize, "CENTER", button, "CENTER", 0, 0)
E.EuiSetTemplate(panel)
panel:SetBackdropColor(.1,.1,.1,.8)
panel:SetFrameStrata(button:GetFrameStrata())
panel:SetFrameLevel(button:GetFrameLevel() - 1)
 
icon:SetTexCoord(.08, .92, .08, .92)
icon:ClearAllPoints()
if pet then
if E.petbuttonsize < 30 then
local autocast = _G[name.."AutoCastable"]
autocast:SetAlpha(0)
end
local shine = _G[name.."Shine"]
shine:SetSize(E.petbuttonsize, E.petbuttonsize)
shine:ClearAllPoints()
shine:SetPoint("CENTER", button, 0, 0)
icon:SetPoint("TOPLEFT", button, E.Scale(2), -E.Scale(2))
icon:SetPoint("BOTTOMRIGHT", button, -E.Scale(2), E.Scale(2))
else
icon:SetPoint("TOPLEFT", button, E.Scale(2), -E.Scale(2))
icon:SetPoint("BOTTOMRIGHT", button, -E.Scale(2), E.Scale(2))
end
end
 
if normal then
normal:ClearAllPoints()
normal:SetPoint("TOPLEFT")
normal:SetPoint("BOTTOMRIGHT")
end
end
 
function E.StyleShift()
for i=1, NUM_SHAPESHIFT_SLOTS do
local name = "ShapeshiftButton"..i
local button = _G[name]
local icon = _G[name.."Icon"]
local normal = _G[name.."NormalTexture"]
Stylesmallbutton(normal, button, icon, name)
end
end
 
function E.StylePet()
for i=1, NUM_PET_ACTION_SLOTS do
local name = "PetActionButton"..i
local button = _G[name]
local icon = _G[name.."Icon"]
local normal = _G[name.."NormalTexture2"]
Stylesmallbutton(normal, button, icon, name, true)
end
end
 
-- rescale cooldown spiral to fix texture.
local buttonNames = { "ActionButton", "MultiBarBottomLeftButton", "MultiBarBottomRightButton", "MultiBarLeftButton", "MultiBarRightButton", "ShapeshiftButton", "PetActionButton"}
for _, name in ipairs( buttonNames ) do
for index = 1, 12 do
local buttonName = name .. tostring(index)
local button = _G[buttonName]
local cooldown = _G[buttonName .. "Cooldown"]
 
if ( button == nil or cooldown == nil ) then
break
end
 
cooldown:ClearAllPoints()
cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2)
cooldown:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)
end
end
 
local buttons = 0
local function SetupFlyoutButton()
for i=1, buttons do
--prevent error if you don't have max ammount of buttons
if _G["SpellFlyoutButton"..i] then
Style(_G["SpellFlyoutButton"..i], false)
E.StyleButton(_G["SpellFlyoutButton"..i],true)
if C["actionbar"].rightbarmouseover == true then
SpellFlyout:HookScript("OnEnter", function(self) RightBarMouseOver(1) end)
SpellFlyout:HookScript("OnLeave", function(self) RightBarMouseOver(0) end)
_G["SpellFlyoutButton"..i]:HookScript("OnEnter", function(self) RightBarMouseOver(1) end)
_G["SpellFlyoutButton"..i]:HookScript("OnLeave", function(self) RightBarMouseOver(0) end)
end
end
end
end
--SpellFlyout:HookScript("OnShow", SetupFlyoutButton)
 
-- Reposition flyout buttons depending on what tukui bar the button is parented to
local function FlyoutButtonPos(self, buttons, direction)
for i=1, buttons do
local parent = SpellFlyout:GetParent()
if not _G["SpellFlyoutButton"..i] then return end
 
if InCombatLockdown() then return end
 
if direction == "LEFT" then
if i == 1 then
_G["SpellFlyoutButton"..i]:ClearAllPoints()
_G["SpellFlyoutButton"..i]:SetPoint("RIGHT", parent, "LEFT", -4, 0)
else
_G["SpellFlyoutButton"..i]:ClearAllPoints()
_G["SpellFlyoutButton"..i]:SetPoint("RIGHT", _G["SpellFlyoutButton"..i-1], "LEFT", -4, 0)
end
else
if i == 1 then
_G["SpellFlyoutButton"..i]:ClearAllPoints()
_G["SpellFlyoutButton"..i]:SetPoint("BOTTOM", parent, "TOP", 0, 4)
else
_G["SpellFlyoutButton"..i]:ClearAllPoints()
_G["SpellFlyoutButton"..i]:SetPoint("BOTTOM", _G["SpellFlyoutButton"..i-1], "TOP", 0, 4)
end
end
end
end
 
 
--Hide the Mouseover texture and attempt to find the ammount of buttons to be skinned
local function StyleFlyout(self)
self.FlyoutBorder:SetAlpha(0)
self.FlyoutBorderShadow:SetAlpha(0)
 
SpellFlyoutHorizontalBackground:SetAlpha(0)
SpellFlyoutVerticalBackground:SetAlpha(0)
SpellFlyoutBackgroundEnd:SetAlpha(0)
 
for i=1, GetNumFlyouts() do
local x = GetFlyoutID(i)
local _, _, numSlots, isKnown = GetFlyoutInfo(x)
if isKnown then
buttons = numSlots
break
end
end
 
--Change arrow direction depending on what bar the button is on
local arrowDistance
if ((SpellFlyout and SpellFlyout:IsShown() and SpellFlyout:GetParent() == self) or GetMouseFocus() == self) then
arrowDistance = 5
else
arrowDistance = 2
end
 
if self:GetParent():GetParent():GetName() == "SpellBookSpellIconsFrame" then return end
local point, _, _, _, _ = self:GetParent():GetParent():GetPoint()
 
if strfind(point, "BOTTOM") then
self.FlyoutArrow:ClearAllPoints()
self.FlyoutArrow:SetPoint("TOP", self, "TOP", 0, arrowDistance)
SetClampedTextureRotation(self.FlyoutArrow, 0)
FlyoutButtonPos(self,buttons,"UP")
else
self.FlyoutArrow:ClearAllPoints()
self.FlyoutArrow:SetPoint("LEFT", self, "LEFT", -arrowDistance, 0)
SetClampedTextureRotation(self.FlyoutArrow, 270)
FlyoutButtonPos(self,buttons,"LEFT")
end
end
 
do
for i = 1, 12 do
E.StyleButton(_G["MultiBarLeftButton"..i], true)
E.StyleButton(_G["MultiBarRightButton"..i], true)
E.StyleButton(_G["MultiBarBottomRightButton"..i], true)
E.StyleButton(_G["MultiBarBottomLeftButton"..i], true)
E.StyleButton(_G["ActionButton"..i], true)
end
 
for i=1, 10 do
E.StyleButton(_G["ShapeshiftButton"..i], true)
E.StyleButton(_G["PetActionButton"..i], true)
end
 
for i=1, 6 do
E.StyleButton(_G["VehicleMenuBarActionButton"..i], true)
Style(_G["VehicleMenuBarActionButton"..i], true)
end
end
 
hooksecurefunc("ActionButton_Update", Style)
hooksecurefunc("ActionButton_UpdateHotkeys", E.UpdateHotkey)
--hooksecurefunc("ActionButton_UpdateFlyout", StyleFlyout)
 
---------------------------------------------------------------
-- Totem Style, they need a lot more work than "normal" buttons
-- Because of this, we skin it via separate styling codes
-- Special thank's to DarthAndroid
---------------------------------------------------------------
 
-- don't continue executing code in this file is not playing a shaman.
if not E.MyClass == "SHAMAN" then return end
 
-- Tex Coords for empty buttons
SLOT_EMPTY_TCOORDS = {
[EARTH_TOTEM_SLOT] = {
left = 66 / 128,
right = 96 / 128,
top = 3 / 256,
bottom = 33 / 256,
},
[FIRE_TOTEM_SLOT] = {
left = 67 / 128,
right = 97 / 128,
top = 100 / 256,
bottom = 130 / 256,
},
[WATER_TOTEM_SLOT] = {
left = 39 / 128,
right = 69 / 128,
top = 209 / 256,
bottom = 239 / 256,
},
[AIR_TOTEM_SLOT] = {
left = 66 / 128,
right = 96 / 128,
top = 36 / 256,
bottom = 66 / 256,
},
}
 
local function StyleTotemFlyout(flyout)
-- remove blizzard flyout texture
flyout.top:SetTexture(nil)
flyout.middle:SetTexture(nil)
 
-- Skin buttons
local last = nil
 
for _,button in ipairs(flyout.buttons) do
E.EuiSetTemplate(button)
local icon = select(1,button:GetRegions())
icon:SetTexCoord(.09,.91,.09,.91)
icon:SetDrawLayer("ARTWORK")
icon:SetPoint("TOPLEFT",button,"TOPLEFT",E.Scale(2),-E.Scale(2))
icon:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",-E.Scale(2),E.Scale(2))
button:SetSize(C["actionbar"].petbuttonsize,C["actionbar"].petbuttonsize)
button:ClearAllPoints()
if E.TotemOrientationDown then
button:SetPoint("TOP",last,"BOTTOM",0,-E.Scale(4))
else
button:SetPoint("BOTTOM",last,"TOP",0,E.Scale(4))
end
if button:IsVisible() then last = button end
button:SetBackdropBorderColor(flyout.parent:GetBackdropBorderColor())
E.StyleButton(button)
 
if C["actionbar"].shapeshiftmouseover == true then
button:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
button:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
end
 
if E.TotemOrientationDown then
flyout.buttons[1]:SetPoint("TOP",flyout,"TOP")
else
flyout.buttons[1]:SetPoint("BOTTOM",flyout,"BOTTOM")
end
 
if flyout.type == "slot" then
local tcoords = SLOT_EMPTY_TCOORDS[flyout.parent:GetID()]
flyout.buttons[1].icon:SetTexCoord(tcoords.left,tcoords.right,tcoords.top,tcoords.bottom)
end
 
-- Skin Close button
local close = MultiCastFlyoutFrameCloseButton
E.EuiSetTemplate(close)
close:GetHighlightTexture():SetTexture([[Interface\Buttons\ButtonHilight-Square]])
close:GetHighlightTexture():SetPoint("TOPLEFT",close,"TOPLEFT",E.Scale(1),-E.Scale(1))
close:GetHighlightTexture():SetPoint("BOTTOMRIGHT",close,"BOTTOMRIGHT",-E.Scale(1),E.Scale(1))
close:GetNormalTexture():SetTexture(nil)
close:ClearAllPoints()
if E.TotemOrientationDown then
close:SetPoint("TOPLEFT",last,"BOTTOMLEFT",0,-E.Scale(4))
close:SetPoint("TOPRIGHT",last,"BOTTOMRIGHT",0,-E.Scale(4))
else
close:SetPoint("BOTTOMLEFT",last,"TOPLEFT",0,E.Scale(4))
close:SetPoint("BOTTOMRIGHT",last,"TOPRIGHT",0,E.Scale(4))
end
close:SetBackdropBorderColor(last:GetBackdropBorderColor())
close:Height(8)
 
flyout:ClearAllPoints()
if E.TotemOrientationDown then
flyout:SetPoint("TOP",flyout.parent,"BOTTOM",0,-E.Scale(4))
else
flyout:SetPoint("BOTTOM",flyout.parent,"TOP",0,E.Scale(4))
end
 
if C["actionbar"].shapeshiftmouseover == true then
flyout:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
flyout:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
close:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
close:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
end
--hooksecurefunc("MultiCastFlyoutFrame_ToggleFlyout",function(self) StyleTotemFlyout(self) end)
 
local function StyleTotemOpenButton(button, parent)
button:GetHighlightTexture():SetTexture(nil)
button:GetNormalTexture():SetTexture(nil)
button:Height(20)
button:ClearAllPoints()
if E.TotemOrientationDown then
button:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", 0, E.Scale(3))
button:SetPoint("TOPRIGHT", parent, "BOTTOMRIGHT", 0, E.Scale(3))
else
button:SetPoint("BOTTOMLEFT", parent, "TOPLEFT", 0, -E.Scale(3))
button:SetPoint("BOTTOMRIGHT", parent, "TOPRIGHT", 0, -E.Scale(3))
end
if not button.visibleBut then
button.visibleBut = CreateFrame("Frame",nil,button)
button.visibleBut:Height(8)
button.visibleBut:Width(C["actionbar"].petbuttonsize)
button.visibleBut:SetPoint("CENTER")
button.visibleBut.highlight = button.visibleBut:CreateTexture(nil,"HIGHLIGHT")
button.visibleBut.highlight:SetTexture([[Interface\Buttons\ButtonHilight-Square]])
button.visibleBut.highlight:SetPoint("TOPLEFT",button.visibleBut,"TOPLEFT",E.Scale(1),-E.Scale(1))
button.visibleBut.highlight:SetPoint("BOTTOMRIGHT",button.visibleBut,"BOTTOMRIGHT",-E.Scale(1),E.Scale(1))
E.EuiSetTemplate(button.visibleBut)
end
 
if C["actionbar"].shapeshiftmouseover == true then
button:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
button:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
button.visibleBut:SetBackdropBorderColor(parent:GetBackdropBorderColor())
end
--hooksecurefunc("MultiCastFlyoutFrameOpenButton_Show",function(button,_, parent) StyleTotemOpenButton(button, parent) end)
 
-- the color we use for border
local bordercolors = {
{.23,.45,.13}, -- Earth
{.58,.23,.10}, -- Fire
{.19,.48,.60}, -- Water
{.42,.18,.74}, -- Air
}
 
local function StyleTotemSlotButton(button, index)
E.EuiSetTemplate(button)
--button.overlayTex:SetTexture(nil)
button.background:SetDrawLayer("ARTWORK")
button.background:ClearAllPoints()
button.background:SetPoint("TOPLEFT",button,"TOPLEFT",E.Scale(2), -E.Scale(2))
button.background:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",-E.Scale(2), E.Scale(2))
button:SetSize(C["actionbar"].petbuttonsize,C["actionbar"].petbuttonsize)
button:SetBackdropBorderColor(unpack(bordercolors[((index-1) % 4) + 1]))
E.StyleButton(button)
if C["actionbar"].shapeshiftmouseover == true then
button:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
button:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
end
hooksecurefunc("MultiCastSlotButton_Update",function(self, slot) StyleTotemSlotButton(self,tonumber( string.match(self:GetName(),"MultiCastSlotButton(%d)"))) end)
 
-- Skin the actual totem buttons
local function StyleTotemActionButton(button, index)
local icon = select(1,button:GetRegions())
icon:SetTexCoord(.09,.91,.09,.91)
icon:SetDrawLayer("ARTWORK")
icon:SetPoint("TOPLEFT",button,"TOPLEFT",E.Scale(2),-E.Scale(2))
icon:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",-E.Scale(2),E.Scale(2))
--button.overlayTex:SetTexture(nil)
--button.overlayTex:Hide()
button:GetNormalTexture():SetTexture(nil)
button.SetNormalTexture = E.dummy
if button.slotButton then
button:ClearAllPoints()
button:SetAllPoints(button.slotButton)
button:SetFrameLevel(button.slotButton:GetFrameLevel()+1)
end
button:SetBackdropBorderColor(unpack(bordercolors[((index-1) % 4) + 1]))
button:SetBackdropColor(0,0,0,0)
E.StyleButton(button, true)
if C["actionbar"].shapeshiftmouseover == true then
button:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
button:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
end
hooksecurefunc("MultiCastActionButton_Update",function(actionButton, actionId, actionIndex, slot) StyleTotemActionButton(actionButton,actionIndex) end)
 
-- Skin the summon and recall buttons
local function StyleTotemSpellButton(button, index)
if not button then return end
local icon = select(1,button:GetRegions())
icon:SetTexCoord(.09,.91,.09,.91)
icon:SetDrawLayer("ARTWORK")
icon:SetPoint("TOPLEFT",button,"TOPLEFT",E.Scale(2),-E.Scale(2))
icon:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",-E.Scale(2),E.Scale(2))
E.EuiSetTemplate(button)
button:GetNormalTexture():SetTexture(nil)
button:SetSize(C["actionbar"].petbuttonsize,C["actionbar"].petbuttonsize)
_G[button:GetName().."Highlight"]:SetTexture(nil)
_G[button:GetName().."NormalTexture"]:SetTexture(nil)
E.StyleButton(button)
if C["actionbar"].shapeshiftmouseover == true then
button:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
button:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
end
hooksecurefunc("MultiCastSummonSpellButton_Update", function(self) StyleTotemSpellButton(self,0) end)
hooksecurefunc("MultiCastRecallSpellButton_Update", function(self) StyleTotemSpellButton(self,5) end)
\ No newline at end of file
Eui/element/actionbars/barshift.lua New file
0,0 → 1,128
local E, C = unpack(select(2, ...))
 
local EUICF = C
local EUIDB = E
local EUIL = L
 
if (not EUICF["actionbar"].enable == true) then return end
 
 
---------------------------------------------------------------------------
-- Setup Shapeshift Bar
---------------------------------------------------------------------------
local numshape = 0
for i = 1, NUM_SHAPESHIFT_SLOTS do
if _G["ShapeshiftButton"..i] and _G["ShapeshiftButton"..i]:IsShown() then numshape = numshape + 1 end
end
 
-- used for anchor totembar or shapeshiftbar
local EuiShift = CreateFrame("Frame","EuiShiftBar",EuiActionBarBackground)
if EUICF["actionbar"].microbar == true then
EuiShift:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 3, -38)
else
EuiShift:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 2, -2)
end
if EUICF["chat"].enable == true then
EuiShift:ClearAllPoints()
EuiShift:SetPoint("BOTTOMLEFT", EuiTopChatBackground, "TOPLEFT", 2, 2)
end
local w = numshape * (EUIDB.buttonspacing + EUIDB.petbuttonsize)
if w < 100 then w = 100 end
if EUICF["actionbar"].verticalstance ~= true then
EuiShift:SetWidth(w)
EuiShift:SetHeight(EUIDB.petbuttonsize)
else
EuiShift:SetWidth(EUIDB.petbuttonsize)
EuiShift:SetHeight(w)
end
 
if EUICF["actionbar"].hideshapeshift == true then
EuiShift:Hide()
end
 
EUIDB.CreateMover(EuiShift, "ShapeShiftMover", "Class Bar")
 
-- hide it if not needed and stop executing code
if EUICF.actionbar.hideshapeshift then EuiShift:Hide() return end
 
-- create the shapeshift bar if we enabled it
local bar = CreateFrame("Frame", "EuiShapeShift", EuiShift, "SecureHandlerStateTemplate")
bar:ClearAllPoints()
bar:SetAllPoints(EuiShift)
 
local States = {
["DRUID"] = "show",
["WARRIOR"] = "show",
["PALADIN"] = "show",
["DEATHKNIGHT"] = "show",
["ROGUE"] = "show,",
["PRIEST"] = "show,",
["HUNTER"] = "show,",
["WARLOCK"] = "show,",
}
 
bar:RegisterEvent("PLAYER_LOGIN")
bar:RegisterEvent("PLAYER_ENTERING_WORLD")
bar:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
bar:RegisterEvent("UPDATE_SHAPESHIFT_USABLE")
bar:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN")
bar:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
bar:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
bar:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
local button
for i = 1, NUM_SHAPESHIFT_SLOTS do
button = _G["ShapeshiftButton"..i]
button:ClearAllPoints()
button:SetParent(self)
if EUICF["actionbar"].verticalstance ~= true then
if i == 1 then
button:SetPoint("BOTTOMLEFT", EuiShift, 0, 0)
else
local previous = _G["ShapeshiftButton"..i-1]
button:SetPoint("LEFT", previous, "RIGHT", EUICF["actionbar"].petbuttonspacing, 0)
end
else
if i == 1 then
button:SetPoint("BOTTOMLEFT", EuiShift, 0, 0)
else
local previous = _G["ShapeshiftButton"..i-1]
button:SetPoint("TOP", previous, "BOTTOM", 0, -EUICF["actionbar"].petbuttonspacing)
end
end
local _, name = GetShapeshiftFormInfo(i)
if name then
button:Show()
end
end
RegisterStateDriver(self, "visibility", States[EUIDB.MyClass] or "hide")
elseif event == "UPDATE_SHAPESHIFT_FORMS" then
-- Update Shapeshift Bar Button Visibility
-- I seriously don't know if it's the best way to do it on spec changes or when we learn a new stance.
if InCombatLockdown() then return end -- > just to be safe ;p
local button
for i = 1, NUM_SHAPESHIFT_SLOTS do
button = _G["ShapeshiftButton"..i]
local _, name = GetShapeshiftFormInfo(i)
if name then
button:Show()
else
button:Hide()
end
end
EUIDB.EuiShiftBarUpdate()
elseif event == "PLAYER_ENTERING_WORLD" then
EUIDB.StyleShift()
else
EUIDB.EuiShiftBarUpdate()
end
end)
 
if EUICF["actionbar"].shapeshiftmouseover == true then
for i=1, NUM_SHAPESHIFT_SLOTS do
local b = _G["ShapeshiftButton"..i]
b:SetAlpha(0)
b:HookScript("OnEnter", function() ShapeShiftMouseOver(1) end)
b:HookScript("OnLeave", function() ShapeShiftMouseOver(0) end)
end
end
\ No newline at end of file
Eui/element/actionbars/others.lua New file
0,0 → 1,63
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
---------------------------------------------------------------------------
-- Manage all others stuff for actionbars
---------------------------------------------------------------------------
 
local EuiOnLogon = CreateFrame("Frame")
EuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
EuiOnLogon:SetScript("OnEvent", function(self, event)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
SetActionBarToggles(1, 1, 1, 1, 0)
SetCVar("alwaysShowActionBars", 0)
if C["actionbar"].rankwatch == true then
if not lasttime then lasttime =0 end
if (GetTime() - lasttime) > 300 then
for i=1,72 do
local a,_,c,d = GetActionInfo(i)
if a=="spell" and c=="spell" then
local name,rank=GetSpellInfo(d)
local _,maxrank = GetSpellInfo(name)
if rank~=maxrank then
print("警告:"..name.."不是最高等级")
print("将自动调整"..name.."为最高等级")
PickupSpell(name);
PlaceAction(i);
ClearCursor();
lasttime = GetTime()
end
end
end
end
end
if C["actionbar"].showgrid == true then
ActionButton_HideGrid = E.dummy
for i = 1, 12 do
local button = _G[format("ActionButton%d", i)]
button:SetAttribute("showgrid", 1)
ActionButton_ShowGrid(button)
 
button = _G[format("BonusActionButton%d", i)]
button:SetAttribute("showgrid", 1)
ActionButton_ShowGrid(button)
 
button = _G[format("MultiBarRightButton%d", i)]
button:SetAttribute("showgrid", 1)
ActionButton_ShowGrid(button)
 
button = _G[format("MultiBarBottomRightButton%d", i)]
button:SetAttribute("showgrid", 1)
ActionButton_ShowGrid(button)
 
button = _G[format("MultiBarLeftButton%d", i)]
button:SetAttribute("showgrid", 1)
ActionButton_ShowGrid(button)
 
button = _G[format("MultiBarBottomLeftButton%d", i)]
button:SetAttribute("showgrid", 1)
ActionButton_ShowGrid(button)
end
end
end)
\ No newline at end of file
Eui/element/actionbars/actionbars.xml New file
0,0 → 1,17
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="ab_functions.lua"/>
<Script file="hide.lua"/>
<Script file="bar1.lua"/>
<Script file="bar2.lua"/>
<Script file="bar3.lua"/>
<Script file="bar4.lua"/>
<Script file="bar5.lua"/>
<Script file="barpet.lua"/>
<Script file="barshift.lua"/>
<Script file="bartotem.lua"/>
<Script file="barvehicle.lua"/>
<Script file="style.lua"/>
<Script file="others.lua"/>
<Script file="movers.lua"/>
<Script file="microbar.lua"/>
</Ui>
\ No newline at end of file
Eui/element/actionbars/barvehicle.lua New file
0,0 → 1,111
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
 
---------------------------------------------------------------------------
-- Setup Vehicle Bar
---------------------------------------------------------------------------
 
local vbar = CreateFrame("Frame", "EuiVehicleBar", EuiVehicleBarBackground, "SecureHandlerStateTemplate")
vbar:ClearAllPoints()
vbar:SetAllPoints(EuiVehicleBarBackground)
 
vbar:RegisterEvent("UNIT_ENTERED_VEHICLE")
vbar:RegisterEvent("UNIT_DISPLAYPOWER")
vbar:RegisterEvent("PLAYER_LOGIN")
vbar:RegisterEvent("PLAYER_ENTERING_WORLD")
vbar:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
local button
for i = 1, VEHICLE_MAX_ACTIONBUTTONS do
button = _G["VehicleMenuBarActionButton"..i]
self:SetFrameRef("VehicleMenuBarActionButton"..i, button)
end
 
self:SetAttribute("_onstate-vehicleupdate", [[
if newstate == "s1" then
self:GetParent():Show()
else
self:GetParent():Hide()
end
]])
 
RegisterStateDriver(self, "vehicleupdate", "[vehicleui]s1;s2")
elseif event == "PLAYER_ENTERING_WORLD" then
local button
for i = 1, VEHICLE_MAX_ACTIONBUTTONS do
button = _G["VehicleMenuBarActionButton"..i]
button:SetSize(E.buttonsize*1.2, E.buttonsize*1.2)
button:ClearAllPoints()
button:SetParent(EuiVehicleBar)
if i == 1 then
button:SetPoint("BOTTOMLEFT", EuiVehicleBar, E.buttonspacing*1.2, E.buttonspacing*1.2)
else
local previous = _G["VehicleMenuBarActionButton"..i-1]
button:SetPoint("LEFT", previous, "RIGHT", E.buttonspacing*1.2, 0)
end
end
else
VehicleMenuBar_OnEvent(self, event, ...)
end
end)
 
--Create our custom Vehicle Button Hotkeys, because blizzard is fucking gay and won't let us reposition the default ones
do
for i=1, VEHICLE_MAX_ACTIONBUTTONS do
_G["EuiVehicleHotkey"..i] = _G["VehicleMenuBarActionButton"..i]:CreateFontString("EuiVehicleHotkey"..i, "OVERLAY", nil)
_G["EuiVehicleHotkey"..i]:ClearAllPoints()
_G["EuiVehicleHotkey"..i]:SetPoint("TOPRIGHT", 0, E.Scale(-3))
_G["EuiVehicleHotkey"..i]:SetFont(E.font, 14, "OUTLINE")
_G["EuiVehicleHotkey"..i].ClearAllPoints = E.dummy
_G["EuiVehicleHotkey"..i].SetPoint = E.dummy
 
if not C["actionbar"].hotkey == true then
_G["EuiVehicleHotkey"..i]:SetText("")
_G["EuiVehicleHotkey"..i]:Hide()
_G["EuiVehicleHotkey"..i].Show = E.dummy
else
_G["EuiVehicleHotkey"..i]:SetText(_G["VehicleMenuBarActionButton"..i.."HotKey"]:GetText())
end
end
end
 
local UpdateVehHotkeys = function()
if not UnitHasVehicleUI("player") then return end
if C["actionbar"].hotkey ~= true then return end
for i=1, VEHICLE_MAX_ACTIONBUTTONS do
_G["EuiVehicleHotkey"..i]:SetText(_G["VehicleMenuBarActionButton"..i.."HotKey"]:GetText())
_G["EuiVehicleHotkey"..i]:SetTextColor(_G["VehicleMenuBarActionButton"..i.."HotKey"]:GetTextColor())
end
end
 
local VehTextUpdate = CreateFrame("Frame")
VehTextUpdate:RegisterEvent("UNIT_ENTERING_VEHICLE")
VehTextUpdate:RegisterEvent("UNIT_ENTERED_VEHICLE")
VehTextUpdate:SetScript("OnEvent", UpdateVehHotkeys)
 
-- vehicle button under minimap
local vehicle = CreateFrame("Button", nil, UIParent, "SecureHandlerClickTemplate")
vehicle:SetWidth(E.Scale(26))
vehicle:SetHeight(E.Scale(26))
vehicle:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", -E.Scale(2), E.Scale(2))
vehicle:SetNormalTexture("Interface\\AddOns\\Eui\\media\\vehicleexit")
vehicle:SetPushedTexture("Interface\\AddOns\\Eui\\media\\vehicleexit")
vehicle:SetHighlightTexture("Interface\\AddOns\\Eui\\media\\vehicleexit")
E.EuiSetTemplate(vehicle)
vehicle:RegisterForClicks("AnyUp")
vehicle:SetScript("OnClick", function() VehicleExit() end)
RegisterStateDriver(vehicle, "visibility", "[vehicleui][target=vehicle,noexists] hide;show")
 
-- vehicle on vehicle bar, dont need to have a state driver.. its parented to vehicle bar
local vehicle2 = CreateFrame("BUTTON", nil, EuiVehicleBarBackground, "SecureActionButtonTemplate")
vehicle2:SetWidth(E.buttonsize*1.2)
vehicle2:SetHeight(E.buttonsize*1.2)
vehicle2:SetPoint("RIGHT", EuiVehicleBarBackground, "RIGHT", -E.buttonspacing*1.2, 0)
vehicle2:RegisterForClicks("AnyUp")
vehicle2:SetNormalTexture("Interface\\AddOns\\Eui\\media\\vehicleexit")
vehicle2:SetPushedTexture("Interface\\AddOns\\Eui\\media\\vehicleexit")
vehicle2:SetHighlightTexture("Interface\\AddOns\\Eui\\media\\vehicleexit")
E.EuiSetTemplate(vehicle2)
vehicle2:SetScript("OnClick", function() VehicleExit() end)
\ No newline at end of file
Eui/element/actionbars/hide.lua New file
0,0 → 1,113
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
---------------------------------------------------------------------------
-- Hide all Blizzard stuff that we don't need
---------------------------------------------------------------------------
 
do
MainMenuBar:SetScale(0.00001)
MainMenuBar:EnableMouse(false)
VehicleMenuBar:SetScale(0.00001)
PetActionBarFrame:EnableMouse(false)
ShapeshiftBarFrame:EnableMouse(false)
 
local elements = {
MainMenuBar, MainMenuBarArtFrame, BonusActionBarFrame, VehicleMenuBar,
PossessBarFrame, PetActionBarFrame, ShapeshiftBarFrame,
ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight,
}
for _, element in pairs(elements) do
if element:GetObjectType() == "Frame" then
element:UnregisterAllEvents()
end
 
if element ~= MainMenuBar then
element:Hide()
end
element:SetAlpha(0)
end
elements = nil
 
-- fix main bar keybind not working after a talent switch. :X
hooksecurefunc('TalentFrame_LoadUI', function()
PlayerTalentFrame:UnregisterEvent('ACTIVE_TALENT_GROUP_CHANGED')
end)
end
 
do
local uiManagedFrames = {
"MultiBarLeft",
"MultiBarRight",
"MultiBarBottomLeft",
"MultiBarBottomRight",
"ShapeshiftBarFrame",
"PossessBarFrame",
"PETACTIONBAR_YPOS",
"MultiCastActionBarFrame",
"MULTICASTACTIONBAR_YPOS",
"ChatFrame1",
"ChatFrame2",
}
for _, frame in pairs(uiManagedFrames) do
UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
end
uiManagedFrames = nil
end
 
function RightBarMouseOver(alpha)
EuiActionBarBackgroundRight:SetAlpha(alpha)
if C["actionbar"].bottompetbar ~= true then
EuiPetActionBarBackground:SetAlpha(alpha)
end
if (E["actionbar"].rightbars ~= 0 and E["actionbar"].splitbar ~= true) then
if MultiBarLeft:IsShown() then
for i=1, 12 do
local pb = _G["MultiBarLeftButton"..i]
pb:SetAlpha(alpha)
end
--MultiBarLeft:SetAlpha(alpha)
end
end
if E["actionbar"].rightbars > 1 then
if MultiBarBottomRight:IsShown() then
for i=1, 12 do
local pb = _G["MultiBarBottomRightButton"..i]
pb:SetAlpha(alpha)
end
--MultiBarBottomRight:SetAlpha(alpha)
end
end
if E["actionbar"].bottomrows ~= 3 then
if MultiBarRight:IsShown() then
for i=1, 12 do
local pb = _G["MultiBarRightButton"..i]
pb:SetAlpha(alpha)
end
--MultiBarRight:SetAlpha(alpha)
end
end
if EuiPetBar:IsShown() and C["actionbar"].bottompetbar ~= true then
for i=1, 10 do
local pb = _G["PetActionButton"..i]
pb:SetAlpha(alpha)
end
EuiPetBar:SetAlpha(alpha)
end
end
 
function ShapeShiftMouseOver(alpha)
for i=1, NUM_SHAPESHIFT_SLOTS do
local pb = _G["ShapeshiftButton"..i]
pb:SetAlpha(alpha)
end
end
 
do
if C["actionbar"].rightbarmouseover == true then
EuiActionBarBackgroundRight:SetAlpha(0)
EuiActionBarBackgroundRight:SetScript("OnEnter", function() RightBarMouseOver(1) end)
EuiActionBarBackgroundRight:SetScript("OnLeave", function() RightBarMouseOver(0) end)
end
end
\ No newline at end of file
Eui/element/actionbars/ab_functions.lua New file
0,0 → 1,227
------------------------------------------------------------------------
-- ActionBar Functions
------------------------------------------------------------------------
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
E.TotemBarOrientation = function(revert)
local position = ShapeShiftMover:GetPoint()
if position:match("TOP") then
revert = true
else
revert = false
end
 
return revert
end
 
function E.EuiPetBarUpdate(self, event)
local petActionButton, petActionIcon, petAutoCastableTexture, petAutoCastShine
for i=1, NUM_PET_ACTION_SLOTS, 1 do
local buttonName = "PetActionButton" .. i
petActionButton = _G[buttonName]
petActionIcon = _G[buttonName.."Icon"]
petAutoCastableTexture = _G[buttonName.."AutoCastable"]
petAutoCastShine = _G[buttonName.."Shine"]
local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i)
 
if not isToken then
petActionIcon:SetTexture(texture)
petActionButton.tooltipName = name
else
petActionIcon:SetTexture(_G[texture])
petActionButton.tooltipName = _G[name]
end
 
petActionButton.isToken = isToken
petActionButton.tooltipSubtext = subtext
 
if isActive and name ~= "PET_ACTION_FOLLOW" then
petActionButton:SetChecked(1)
if IsPetAttackAction(i) then
PetActionButton_StartFlash(petActionButton)
end
else
petActionButton:SetChecked(0)
if IsPetAttackAction(i) then
PetActionButton_StopFlash(petActionButton)
end
end
 
if autoCastAllowed then
petAutoCastableTexture:Show()
else
petAutoCastableTexture:Hide()
end
 
if autoCastEnabled then
AutoCastShine_AutoCastStart(petAutoCastShine)
else
AutoCastShine_AutoCastStop(petAutoCastShine)
end
 
-- grid display
if name then
if not C["actionbar"].showgrid then
petActionButton:SetAlpha(1)
end
else
if not C["actionbar"].showgrid then
petActionButton:SetAlpha(0)
end
end
 
if texture then
if GetPetActionSlotUsable(i) then
SetDesaturation(petActionIcon, nil)
else
SetDesaturation(petActionIcon, 1)
end
petActionIcon:Show()
else
petActionIcon:Hide()
end
 
-- between level 1 and 10 on cata, we don't have any control on Pet. (I lol'ed so hard)
-- Setting desaturation on button to true until you learn the control on class trainer.
-- you can at least control "follow" button.
if not PetHasActionBar() and texture and name ~= "PET_ACTION_FOLLOW" then
PetActionButton_StopFlash(petActionButton)
SetDesaturation(petActionIcon, 1)
petActionButton:SetChecked(0)
end
end
end
 
function E.EuiShiftBarUpdate()
local numForms = GetNumShapeshiftForms()
local texture, name, isActive, isCastable
local button, icon, cooldown
local start, duration, enable
for i = 1, NUM_SHAPESHIFT_SLOTS do
button = _G["ShapeshiftButton"..i]
icon = _G["ShapeshiftButton"..i.."Icon"]
if i <= numForms then
texture, name, isActive, isCastable = GetShapeshiftFormInfo(i)
icon:SetTexture(texture)
 
cooldown = _G["ShapeshiftButton"..i.."Cooldown"]
if texture then
cooldown:SetAlpha(1)
else
cooldown:SetAlpha(0)
end
 
start, duration, enable = GetShapeshiftFormCooldown(i)
CooldownFrame_SetTimer(cooldown, start, duration, enable)
 
if isActive then
ShapeshiftBarFrame.lastSelected = button:GetID()
button:SetChecked(1)
else
button:SetChecked(0)
end
 
if isCastable then
icon:SetVertexColor(1.0, 1.0, 1.0)
else
icon:SetVertexColor(0.4, 0.4, 0.4)
end
end
end
end
 
function E.PositionAllPanels()
EuiActionBarBackground:ClearAllPoints()
EuiPetActionBarBackground:ClearAllPoints()
EuiLineToPetActionBarBackground:ClearAllPoints()
 
if C["actionbar"].bottompetbar ~= true then
EuiActionBarBackground:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, E.Scale(4))
if E["actionbar"].rightbars > 0 then
EuiPetActionBarBackground:SetPoint("RIGHT", EuiActionBarBackgroundRight, "LEFT", E.Scale(-6), 0)
else
EuiPetActionBarBackground:SetPoint("RIGHT", UIParent, "RIGHT", E.Scale(-6), E.Scale(-13.5))
end
EuiPetActionBarBackground:SetSize(E.petbuttonsize + (E.buttonspacing * 2), (E.petbuttonsize * 10) + (E.buttonspacing * 11))
EuiLineToPetActionBarBackground:SetSize(30, 265)
EuiLineToPetActionBarBackground:SetPoint("LEFT", EuiPetActionBarBackground, "RIGHT", 0, 0)
else
EuiActionBarBackground:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, (E.buttonsize + (E.buttonspacing * 2)) + E.Scale(8))
EuiPetActionBarBackground:SetSize((E.petbuttonsize * 10) + (E.buttonspacing * 11), E.petbuttonsize + (E.buttonspacing * 2))
EuiPetActionBarBackground:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, E.Scale(4))
EuiLineToPetActionBarBackground:SetSize(265, 30)
EuiLineToPetActionBarBackground:SetPoint("BOTTOM", EuiPetActionBarBackground, "TOP", 0, 0)
end
 
if E["actionbar"].bottomrows == 3 then
EuiActionBarBackground:SetHeight((E.buttonsize * 3) + (E.buttonspacing * 4))
elseif E["actionbar"].bottomrows == 2 then
EuiActionBarBackground:SetHeight((E.buttonsize * 2) + (E.buttonspacing * 3))
else
EuiActionBarBackground:SetHeight(E.buttonsize + (E.buttonspacing * 2))
end
 
--SplitBar
if E["actionbar"].splitbar == true then
if E["actionbar"].bottomrows == 3 then
EuiSplitActionBarLeftBackground:SetWidth((E.buttonsize * 4) + (E.buttonspacing * 5))
EuiSplitActionBarRightBackground:SetWidth((E.buttonsize * 4) + (E.buttonspacing * 5))
else
EuiSplitActionBarLeftBackground:SetWidth((E.buttonsize * 3) + (E.buttonspacing * 4))
EuiSplitActionBarRightBackground:SetWidth((E.buttonsize * 3) + (E.buttonspacing * 4))
end
EuiSplitActionBarLeftBackground:Show()
EuiSplitActionBarRightBackground:Show()
EuiSplitActionBarLeftBackground:SetHeight(EuiActionBarBackground:GetHeight())
EuiSplitActionBarRightBackground:SetHeight(EuiActionBarBackground:GetHeight())
else
EuiSplitActionBarLeftBackground:Hide()
EuiSplitActionBarRightBackground:Hide()
end
 
--RightBar
EuiActionBarBackgroundRight:Show()
if E["actionbar"].rightbars == 1 then
EuiActionBarBackgroundRight:SetWidth(E.buttonsize + (E.buttonspacing * 2))
elseif E["actionbar"].rightbars == 2 then
EuiActionBarBackgroundRight:SetWidth((E.buttonsize * 2) + (E.buttonspacing * 3))
elseif E["actionbar"].rightbars == 3 then
EuiActionBarBackgroundRight:SetWidth((E.buttonsize * 3) + (E.buttonspacing * 4))
else
EuiActionBarBackgroundRight:Hide()
end
end
 
function E.PositionAllBars()
if E["actionbar"].rightbars > 2 and E["actionbar"].splitbar == true then
E["actionbar"].rightbars = 2
end
 
if E["actionbar"].bottomrows == 3 and E["actionbar"].rightbars ~= 0 and E["actionbar"].splitbar == true then
E["actionbar"].rightbars = 0
if E.ABLock == true then
RightBarBig:Show()
end
end
 
if E["actionbar"].bottomrows == 3 and E["actionbar"].rightbars > 2 then
E["actionbar"].rightbars = 2
end
 
if E["actionbar"].rightbars ~= 0 or (E["actionbar"].bottomrows == 3 and E["actionbar"].splitbar == true) then
RightBarBig:Hide()
else
if E.ABLock == true then
RightBarBig:Show()
end
end
 
E.PositionAllPanels()
E.PositionMainBar()
E.PositionBar2()
E.PositionBar3()
E.PositionBar4()
E.PositionBar5()
E.PositionBarPet(EuiPetBar)
E.PositionWatchFrame()
end
\ No newline at end of file
Eui/element/actionbars/movers.lua New file
0,0 → 1,333
--Create interactable actionbars
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
local function Button_OnEnter(self)
self.Text:SetTextColor(1, 1, 1)
self:SetBackdropBorderColor(23/255,132/255,209/255)
end
 
local function Button_OnLeave(self)
self.Text:SetTextColor(23/255,132/255,209/255)
E.EuiSetTemplate(self)
end
 
local function Button_OnEvent(self, event)
if self:IsShown() then self:Hide() end
end
 
local btnnames = {}
 
local function CreateMoverButton(name, text)
local b = CreateFrame("Button", name, UIParent)
E.EuiSetTemplate(b)
b:RegisterEvent("PLAYER_REGEN_DISABLED")
b:SetScript("OnEvent", Button_OnEvent)
b:SetScript("OnEnter", Button_OnEnter)
b:SetScript("OnLeave", Button_OnLeave)
b:EnableMouse(true)
b:Hide()
E.EuiCreateShadow(b)
tinsert(btnnames, tostring(name))
 
local t = b:CreateFontString(nil, "OVERLAY", b)
t:SetFont(E.font,14,"THINOUTLINE")
t:SetShadowOffset(E.mult, -E.mult)
t:SetShadowColor(0, 0, 0)
t:SetPoint("CENTER")
t:SetJustifyH("CENTER")
t:SetText(text)
t:SetTextColor(23/255,132/255,209/255)
b.Text = t
end
 
local function SaveBars(var, val)
E["actionbar"][var] = val
E.PositionAllBars()
end
 
function E.ToggleABLock()
if InCombatLockdown() then return end
 
if E.ABLock == true then
E.ABLock = false
else
E.ABLock = true
end
 
for i, btnnames in pairs(btnnames) do
if E.ABLock == false then
_G[btnnames]:EnableMouse(false)
_G[btnnames]:Hide()
EuiInfoLeftRButton.text:SetTextColor(1,1,1)
EuiInfoLeftRButton.text:SetText("UnLock")
else
_G[btnnames]:EnableMouse(true)
if btnnames == "RightBarBig" and not (E["actionbar"].rightbars ~= 0 or (E["actionbar"].bottomrows == 3 and E["actionbar"].splitbar == true)) then
_G[btnnames]:Show()
elseif btnnames ~= "RightBarBig" then
_G[btnnames]:Show()
end
EuiInfoLeftRButton.text:SetTextColor(23/255,132/255,209/255)
EuiInfoLeftRButton.text:SetText("Lock")
end
end
end
 
--Create our buttons
do
CreateMoverButton("LeftSplit", "<")
CreateMoverButton("RightSplit", ">")
CreateMoverButton("TopMainBar", "+")
CreateMoverButton("RightBarBig", "<")
CreateMoverButton("RightBarInc", "<")
CreateMoverButton("RightBarDec", ">")
end
 
--Position & Size our buttons after variables loaded
local barloader = CreateFrame("Frame")
barloader:RegisterEvent("PLAYER_ENTERING_WORLD")
barloader:SetScript("OnEvent", function(self)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
 
if EuiData == nil then EuiData = {} end
if EuiData[E.myrealm] == nil then EuiData[E.myrealm] = {} end
if EuiData[E.myrealm][E.MyName] == nil then EuiData[E.myrealm][E.MyName] = {} end
if EuiData[E.myrealm][E.MyName]["actionbar"] == nil then EuiData[E.myrealm][E.MyName]["actionbar"] = {} end
 
E["actionbar"] = EuiData[E.myrealm][E.MyName]["actionbar"]
 
--Default settings
if E["actionbar"].splitbar == nil then E["actionbar"].splitbar = true end
if E["actionbar"].bottomrows == nil then E["actionbar"].bottomrows = 1 end
if E["actionbar"].rightbars == nil then E["actionbar"].rightbars = 0 end
 
if E["actionbar"].splitbar == true then
LeftSplit:SetPoint("TOPRIGHT", EuiSplitActionBarLeftBackground, "TOPLEFT", E.Scale(-4), 0)
LeftSplit:SetPoint("BOTTOMLEFT", EuiSplitActionBarLeftBackground, "BOTTOMLEFT", E.Scale(-19), 0)
LeftSplit.Text:SetText(">")
 
RightSplit:SetPoint("TOPLEFT", EuiSplitActionBarRightBackground, "TOPRIGHT", E.Scale(4), 0)
RightSplit:SetPoint("BOTTOMRIGHT", EuiSplitActionBarRightBackground, "BOTTOMRIGHT", E.Scale(19), 0)
RightSplit.Text:SetText("<")
else
LeftSplit:SetPoint("TOPRIGHT", EuiMainMenuBar, "TOPLEFT", E.Scale(-4), 0)
LeftSplit:SetPoint("BOTTOMLEFT", EuiMainMenuBar, "BOTTOMLEFT", E.Scale(-19), 0)
 
RightSplit:SetPoint("TOPLEFT", EuiMainMenuBar, "TOPRIGHT", E.Scale(4), 0)
RightSplit:SetPoint("BOTTOMRIGHT", EuiMainMenuBar, "BOTTOMRIGHT", E.Scale(19), 0)
end
 
if E["actionbar"].bottomrows == 3 then
TopMainBar.Text:SetText("-")
else
TopMainBar.Text:SetText("+")
end
 
TopMainBar:SetPoint("BOTTOMLEFT", EuiMainMenuBar, "TOPLEFT", 0, E.Scale(4))
TopMainBar:SetPoint("TOPRIGHT", EuiMainMenuBar, "TOPRIGHT", 0, E.Scale(19))
 
if EuiPetBar:IsShown() and not C["actionbar"].bottompetbar == true then
RightBarBig:SetPoint("TOPRIGHT", EuiPetBar, "LEFT", E.Scale(-3), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", EuiPetBar, "LEFT", E.Scale(-19), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
else
RightBarBig:SetPoint("TOPRIGHT", UIParent, "RIGHT", E.Scale(-1), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", UIParent, "RIGHT", E.Scale(-16), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
end
 
EuiPetBar:HookScript("OnShow", function(self)
if C["actionbar"].bottompetbar == true then return end
if InCombatLockdown() then return end
RightBarBig:ClearAllPoints()
RightBarBig:SetPoint("TOPRIGHT", EuiPetBar, "LEFT", E.Scale(-3), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", EuiPetBar, "LEFT", E.Scale(-19), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
end)
 
EuiPetBar:HookScript("OnHide", function(self)
if InCombatLockdown() then return end
if C["actionbar"].bottompetbar == true then return end
RightBarBig:ClearAllPoints()
RightBarBig:SetPoint("TOPRIGHT", UIParent, "RIGHT", E.Scale(-1), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", UIParent, "RIGHT", E.Scale(-16), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
end)
 
RightBarBig:HookScript("OnEnter", function()
if InCombatLockdown() then return end
RightBarBig:ClearAllPoints()
if EuiPetBar:IsShown() and not C["actionbar"].bottompetbar == true then
RightBarBig:SetPoint("TOPRIGHT", EuiPetBar, "LEFT", E.Scale(-3), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", EuiPetBar, "LEFT", E.Scale(-19), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
else
RightBarBig:SetPoint("TOPRIGHT", UIParent, "RIGHT", E.Scale(-1), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", UIParent, "RIGHT", E.Scale(-16), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
end
end)
 
if E["actionbar"].rightbars ~= 0 or (E["actionbar"].bottomrows == 3 and E["actionbar"].splitbar == true) then
RightBarBig:Hide()
end
 
RightBarInc:SetParent(EuiActionBarBackgroundRight)
RightBarDec:SetParent(EuiActionBarBackgroundRight)
 
--Disable some default button stuff
if C["actionbar"].rightbarmouseover == true then
RightBarInc:SetScript("OnEnter", function() RightBarMouseOver(1) end)
RightBarInc:SetScript("OnLeave", function() RightBarMouseOver(0) end)
RightBarDec:SetScript("OnEnter", function() RightBarMouseOver(1) end)
RightBarDec:SetScript("OnLeave", function() RightBarMouseOver(0) end)
else
RightBarInc:SetScript("OnEnter", function() end)
RightBarInc:SetScript("OnLeave", function() end)
RightBarDec:SetScript("OnEnter", function() end)
RightBarDec:SetScript("OnLeave", function() end)
end
 
RightBarDec:SetAlpha(1)
RightBarInc:SetAlpha(1)
 
RightBarInc:SetPoint("TOPLEFT", EuiActionBarBackgroundRight, "BOTTOMLEFT", 0, E.Scale(-4))
RightBarInc:SetPoint("BOTTOMRIGHT", EuiActionBarBackgroundRight, "BOTTOM", E.Scale(-2), E.Scale(-19))
 
RightBarDec:SetPoint("TOPRIGHT", EuiActionBarBackgroundRight, "BOTTOMRIGHT", 0, E.Scale(-4))
RightBarDec:SetPoint("BOTTOMLEFT", EuiActionBarBackgroundRight, "BOTTOM", E.Scale(2), E.Scale(-19))
 
E.ABLock = false
EuiInfoLeftRButton.text:SetTextColor(1,1,1)
EuiInfoLeftRButton.text:SetText("UnLock")
E.PositionAllBars()
end)
 
--Setup button clicks
do
LeftSplit:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
if E["actionbar"].splitbar ~= true then
SaveBars("splitbar", true)
LeftSplit.Text:SetText(">")
LeftSplit:ClearAllPoints()
LeftSplit:SetPoint("TOPRIGHT", EuiSplitActionBarLeftBackground, "TOPLEFT", E.Scale(-4), 0)
LeftSplit:SetPoint("BOTTOMLEFT", EuiSplitActionBarLeftBackground, "BOTTOMLEFT", E.Scale(-19), 0)
 
RightSplit.Text:SetText("<")
RightSplit:ClearAllPoints()
RightSplit:SetPoint("TOPLEFT", EuiSplitActionBarRightBackground, "TOPRIGHT", E.Scale(4), 0)
RightSplit:SetPoint("BOTTOMRIGHT", EuiSplitActionBarRightBackground, "BOTTOMRIGHT", E.Scale(19), 0)
else
SaveBars("splitbar", false)
LeftSplit.Text:SetText("<")
LeftSplit:ClearAllPoints()
LeftSplit:SetPoint("TOPRIGHT", EuiMainMenuBar, "TOPLEFT", E.Scale(-4), 0)
LeftSplit:SetPoint("BOTTOMLEFT", EuiMainMenuBar, "BOTTOMLEFT", E.Scale(-19), 0)
 
RightSplit.Text:SetText(">")
RightSplit:ClearAllPoints()
RightSplit:SetPoint("TOPLEFT", EuiMainMenuBar, "TOPRIGHT", E.Scale(4), 0)
RightSplit:SetPoint("BOTTOMRIGHT", EuiMainMenuBar, "BOTTOMRIGHT", E.Scale(19), 0)
end
end)
 
RightSplit:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
 
if E["actionbar"].splitbar ~= true then
SaveBars("splitbar", true)
LeftSplit.Text:SetText(">")
LeftSplit:ClearAllPoints()
LeftSplit:SetPoint("TOPRIGHT", EuiSplitActionBarLeftBackground, "TOPLEFT", E.Scale(-4), 0)
LeftSplit:SetPoint("BOTTOMLEFT", EuiSplitActionBarLeftBackground, "BOTTOMLEFT", E.Scale(-19), 0)
 
RightSplit.Text:SetText("<")
RightSplit:ClearAllPoints()
RightSplit:SetPoint("TOPLEFT", EuiSplitActionBarRightBackground, "TOPRIGHT", E.Scale(4), 0)
RightSplit:SetPoint("BOTTOMRIGHT", EuiSplitActionBarRightBackground, "BOTTOMRIGHT", E.Scale(19), 0)
else
SaveBars("splitbar", false)
LeftSplit.Text:SetText("<")
LeftSplit:ClearAllPoints()
LeftSplit:SetPoint("TOPRIGHT", EuiMainMenuBar, "TOPLEFT", E.Scale(-4), 0)
LeftSplit:SetPoint("BOTTOMLEFT", EuiMainMenuBar, "BOTTOMLEFT", E.Scale(-19), 0)
 
RightSplit.Text:SetText(">")
RightSplit:ClearAllPoints()
RightSplit:SetPoint("TOPLEFT", EuiMainMenuBar, "TOPRIGHT", E.Scale(4), 0)
RightSplit:SetPoint("BOTTOMRIGHT", EuiMainMenuBar, "BOTTOMRIGHT", E.Scale(19), 0)
end
end)
 
TopMainBar:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
 
if E["actionbar"].bottomrows == 1 then
SaveBars("bottomrows", 2)
TopMainBar.Text:SetText("+")
elseif E["actionbar"].bottomrows == 2 then
SaveBars("bottomrows", 3)
TopMainBar.Text:SetText("-")
elseif E["actionbar"].bottomrows == 3 then
SaveBars("bottomrows", 1)
TopMainBar.Text:SetText("+")
end
end)
 
RightBarBig:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
if C["actionbar"].rightbarmouseover ~= true then
E.SlideIn(EuiActionBarBackgroundRight)
else
EuiActionBarBackgroundRight:SetAlpha(0)
end
SaveBars("rightbars", 1)
self:Hide()
end)
 
RightBarInc:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
 
if E["actionbar"].rightbars == 1 then
SaveBars("rightbars", 2)
elseif E["actionbar"].rightbars == 2 then
SaveBars("rightbars", 3)
elseif E["actionbar"].rightbars == 3 then
SaveBars("rightbars", 0)
RightBarBig:Show()
RightBarBig:ClearAllPoints()
if EuiPetBar:IsShown() and not C["actionbar"].bottompetbar == true then
RightBarBig:SetPoint("TOPRIGHT", EuiPetBar, "LEFT", E.Scale(-3), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", EuiPetBar, "LEFT", E.Scale(-19), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
else
RightBarBig:SetPoint("TOPRIGHT", UIParent, "RIGHT", E.Scale(-1), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", UIParent, "RIGHT", E.Scale(-16), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
end
end
if C["actionbar"].rightbarmouseover == true then
RightBarMouseOver(1)
end
end)
 
RightBarDec:SetScript("OnMouseDown", function(self)
if InCombatLockdown() then return end
 
if E["actionbar"].rightbars == 1 then
SaveBars("rightbars", 0)
RightBarBig:Show()
RightBarBig:ClearAllPoints()
if EuiPetBar:IsShown() and not C["actionbar"].bottompetbar == true then
RightBarBig:SetPoint("TOPRIGHT", EuiPetBar, "LEFT", E.Scale(-3), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", EuiPetBar, "LEFT", E.Scale(-19), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
else
RightBarBig:SetPoint("TOPRIGHT", UIParent, "RIGHT", E.Scale(-1), (EuiActionBarBackgroundRight:GetHeight() * 0.2))
RightBarBig:SetPoint("BOTTOMLEFT", UIParent, "RIGHT", E.Scale(-16), -(EuiActionBarBackgroundRight:GetHeight() * 0.2))
end
elseif E["actionbar"].rightbars == 2 then
SaveBars("rightbars", 1)
elseif E["actionbar"].rightbars == 3 then
SaveBars("rightbars", 2)
end
 
if C["actionbar"].rightbarmouseover == true then
RightBarMouseOver(1)
end
end)
end
\ No newline at end of file
Eui/element/actionbars/bind.lua New file
0,0 → 1,298
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
local bind = CreateFrame("Frame", "EuiHoverBind", UIParent)
-- SLASH COMMAND
SlashCmdList.MOUSEOVERBIND = function()
if InCombatLockdown() then print(L.bind_combat) return end
if not bind.loaded then
local find = string.find
local _G = getfenv(0)
 
bind:SetFrameStrata("DIALOG")
bind:EnableMouse(true)
bind:EnableKeyboard(true)
bind:EnableMouseWheel(true)
bind.texture = bind:CreateTexture()
bind.texture:SetAllPoints(bind)
bind.texture:SetTexture(0, 0, 0, .25)
bind:Hide()
 
local elapsed = 0
GameTooltip:HookScript("OnUpdate", function(self, e)
elapsed = elapsed + e
if elapsed < .2 then return else elapsed = 0 end
if (not self.comparing and IsModifiedClick("COMPAREITEMS")) then
GameTooltip_ShowCompareItem(self)
self.comparing = true
elseif ( self.comparing and not IsModifiedClick("COMPAREITEMS")) then
for _, frame in pairs(self.shoppingTooltips) do
frame:Hide()
end
self.comparing = false
end
end)
hooksecurefunc(GameTooltip, "Hide", function(self) for _, tt in pairs(self.shoppingTooltips) do tt:Hide() end end)
 
bind:SetScript("OnEvent", function(self) self:Deactivate(false) end)
bind:SetScript("OnLeave", function(self) self:HideFrame() end)
bind:SetScript("OnKeyUp", function(self, key) self:Listener(key) end)
bind:SetScript("OnMouseUp", function(self, key) self:Listener(key) end)
bind:SetScript("OnMouseWheel", function(self, delta) if delta>0 then self:Listener("MOUSEWHEELUP") else self:Listener("MOUSEWHEELDOWN") end end)
 
function bind:Update(b, spellmacro)
if not self.enabled or InCombatLockdown() then return end
self.button = b
self.spellmacro = spellmacro
 
self:ClearAllPoints()
self:SetAllPoints(b)
self:Show()
 
ShoppingTooltip1:Hide()
 
if spellmacro=="SPELL" then
self.button.id = SpellBook_GetSpellBookSlot(self.button)
self.button.name = GetSpellBookItemName(self.button.id, SpellBookFrame.bookType)
 
GameTooltip:AddLine("Trigger")
GameTooltip:Show()
GameTooltip:SetScript("OnHide", function(self)
self:SetOwner(bind, "ANCHOR_NONE")
self:SetPoint("BOTTOM", bind, "TOP", 0, 1)
self:AddLine(bind.button.name, 1, 1, 1)
bind.button.bindings = {GetBindingKey(spellmacro.." "..bind.button.name)}
if #bind.button.bindings == 0 then
self:AddLine("No bindings set.", .6, .6, .6)
else
self:AddDoubleLine("Binding", "Key", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
self:AddDoubleLine(i, bind.button.bindings[i])
end
end
self:Show()
self:SetScript("OnHide", nil)
end)
elseif spellmacro=="MACRO" then
self.button.id = self.button:GetID()
 
if floor(.5+select(2,MacroFrameTab1Text:GetTextColor())*10)/10==.8 then self.button.id = self.button.id + 36 end
 
self.button.name = GetMacroInfo(self.button.id)
 
GameTooltip:SetOwner(bind, "ANCHOR_NONE")
GameTooltip:SetPoint("BOTTOM", bind, "TOP", 0, 1)
GameTooltip:AddLine(bind.button.name, 1, 1, 1)
 
bind.button.bindings = {GetBindingKey(spellmacro.." "..bind.button.name)}
if #bind.button.bindings == 0 then
GameTooltip:AddLine("No bindings set.", .6, .6, .6)
else
GameTooltip:AddDoubleLine("Binding", "Key", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
GameTooltip:AddDoubleLine("Binding"..i, bind.button.bindings[i], 1, 1, 1)
end
end
GameTooltip:Show()
elseif spellmacro=="STANCE" or spellmacro=="PET" then
self.button.id = tonumber(b:GetID())
self.button.name = b:GetName()
 
if not self.button.name then return end
 
if not self.button.id or self.button.id < 1 or self.button.id > (spellmacro=="STANCE" and 10 or 12) then
self.button.bindstring = "CLICK "..self.button.name..":LeftButton"
else
self.button.bindstring = (spellmacro=="STANCE" and "SHAPESHIFTBUTTON" or "BONUSACTIONBUTTON")..self.button.id
end
 
GameTooltip:AddLine("Trigger")
GameTooltip:Show()
GameTooltip:SetScript("OnHide", function(self)
self:SetOwner(bind, "ANCHOR_NONE")
self:SetPoint("BOTTOM", bind, "TOP", 0, 1)
self:AddLine(bind.button.name, 1, 1, 1)
bind.button.bindings = {GetBindingKey(bind.button.bindstring)}
if #bind.button.bindings == 0 then
self:AddLine("No bindings set.", .6, .6, .6)
else
self:AddDoubleLine("Binding", "Key", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
self:AddDoubleLine(i, bind.button.bindings[i])
end
end
self:Show()
self:SetScript("OnHide", nil)
end)
else
self.button.action = tonumber(b.action)
self.button.name = b:GetName()
 
if not self.button.name then return end
 
if not self.button.action or self.button.action < 1 or self.button.action > 132 then
self.button.bindstring = "CLICK "..self.button.name..":LeftButton"
else
local modact = 1+(self.button.action-1)%12
if self.button.action < 25 or self.button.action > 72 then
self.button.bindstring = "ACTIONBUTTON"..modact
elseif self.button.action < 73 and self.button.action > 60 then
self.button.bindstring = "MULTIACTIONBAR1BUTTON"..modact
elseif self.button.action < 61 and self.button.action > 48 then
self.button.bindstring = "MULTIACTIONBAR2BUTTON"..modact
elseif self.button.action < 49 and self.button.action > 36 then
self.button.bindstring = "MULTIACTIONBAR4BUTTON"..modact
elseif self.button.action < 37 and self.button.action > 24 then
self.button.bindstring = "MULTIACTIONBAR3BUTTON"..modact
end
end
 
GameTooltip:AddLine("Trigger")
GameTooltip:Show()
GameTooltip:SetScript("OnHide", function(self)
self:SetOwner(bind, "ANCHOR_NONE")
self:SetPoint("BOTTOM", bind, "TOP", 0, 1)
self:AddLine(bind.button.name, 1, 1, 1)
bind.button.bindings = {GetBindingKey(bind.button.bindstring)}
if #bind.button.bindings == 0 then
self:AddLine("No bindings set.", .6, .6, .6)
else
self:AddDoubleLine("Binding", "Key", .6, .6, .6, .6, .6, .6)
for i = 1, #bind.button.bindings do
self:AddDoubleLine(i, bind.button.bindings[i])
end
end
self:Show()
self:SetScript("OnHide", nil)
end)
end
end
 
function bind:Listener(key)
if key == "ESCAPE" or key == "RightButton" then
for i = 1, #self.button.bindings do
SetBinding(self.button.bindings[i])
end
print("All keybindings cleared for |cff00ff00"..self.button.name.."|r.")
self:Update(self.button, self.spellmacro)
if self.spellmacro~="MACRO" then GameTooltip:Hide() end
return
end
 
if key == "LSHIFT"
or key == "RSHIFT"
or key == "LCTRL"
or key == "RCTRL"
or key == "LALT"
or key == "RALT"
or key == "UNKNOWN"
or key == "LeftButton"
then return end
 
if key == "MiddleButton" then key = "BUTTON3" end
if key == "Button4" then key = "BUTTON4" end
if key == "Button5" then key = "BUTTON5" end
 
local alt = IsAltKeyDown() and "ALT-" or ""
local ctrl = IsControlKeyDown() and "CTRL-" or ""
local shift = IsShiftKeyDown() and "SHIFT-" or ""
 
if not self.spellmacro or self.spellmacro=="PET" or self.spellmacro=="STANCE" then
SetBinding(alt..ctrl..shift..key, self.button.bindstring)
else
SetBinding(alt..ctrl..shift..key, self.spellmacro.." "..self.button.name)
end
print(alt..ctrl..shift..key.." |cff00ff00bound to |r"..self.button.name..".")
self:Update(self.button, self.spellmacro)
if self.spellmacro~="MACRO" then GameTooltip:Hide() end
end
function bind:HideFrame()
self:ClearAllPoints()
self:Hide()
GameTooltip:Hide()
end
function bind:Activate()
self.enabled = true
self:RegisterEvent("PLAYER_REGEN_DISABLED")
end
function bind:Deactivate(save)
if save then
SaveBindings(2)
print(L.bind_saved)
else
LoadBindings(2)
print(L.bind_discard)
end
self.enabled = false
self:HideFrame()
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
StaticPopup_Hide("KEYBIND_MODE")
end
 
StaticPopupDialogs["KEYBIND_MODE"] = {
text = L.bind_instruct,
button1 = L.bind_save,
button2 = L.bind_discardbind,
OnAccept = function() bind:Deactivate(true) end,
OnCancel = function() bind:Deactivate(false) end,
timeout = 0,
whileDead = 1,
hideOnEscape = false
}
 
-- REGISTERING
local stance = ShapeshiftButton1:GetScript("OnClick")
local pet = PetActionButton1:GetScript("OnClick")
local button = SecureActionButton_OnClick
 
local function register(val)
if val.IsProtected and val.GetObjectType and val.GetScript and val:GetObjectType()=="CheckButton" and val:IsProtected() then
local script = val:GetScript("OnClick")
if script==button then
val:HookScript("OnEnter", function(self) bind:Update(self) end)
elseif script==stance then
val:HookScript("OnEnter", function(self) bind:Update(self, "STANCE") end)
elseif script==pet then
val:HookScript("OnEnter", function(self) bind:Update(self, "PET") end)
end
end
end
 
local val = EnumerateFrames()
while val do
register(val)
val = EnumerateFrames(val)
end
 
for i=1,12 do
local b = _G["SpellButton"..i]
b:HookScript("OnEnter", function(self) bind:Update(self, "SPELL") end)
end
 
local function registermacro()
for i=1,36 do
local b = _G["MacroButton"..i]
b:HookScript("OnEnter", function(self) bind:Update(self, "MACRO") end)
end
end
 
if not IsAddOnLoaded("Blizzard_MacroUI") then
hooksecurefunc("LoadAddOn", function(addon)
if addon=="Blizzard_MacroUI" then
registermacro()
end
end)
else
registermacro()
end
bind.loaded = 1
end
if not bind.enabled then
bind:Activate()
StaticPopup_Show("KEYBIND_MODE")
end
end
SLASH_MOUSEOVERBIND1 = "/bindkey"
SLASH_MOUSEOVERBIND2 = "/hoverbind"
if not IsAddOnLoaded("HealBot") then
SLASH_MOUSEOVERBIND3 = "/hb"
end
\ No newline at end of file
Eui/element/actionbars/barpet.lua New file
0,0 → 1,81
local E, C = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 
if not C["actionbar"].enable == true then return end
 
---------------------------------------------------------------------------
-- setup PetActionBar
---------------------------------------------------------------------------
 
local bar = CreateFrame("Frame", "EuiPetBar", EuiActionBarBackground, "SecureHandlerStateTemplate")
bar:ClearAllPoints()
bar:SetAllPoints(EuiPetActionBarBackground)
 
function E.PositionBarPet(self)
local button
for i = 1, 10 do
button = _G["PetActionButton"..i]
button:ClearAllPoints()
button:SetParent(EuiPetBar)
EuiPetActionBarBackground:SetParent(EuiPetBar)
button:SetFrameStrata("MEDIUM")
button:SetSize(E.petbuttonsize, E.petbuttonsize)
if i == 1 then
button:SetPoint("TOPLEFT", E.buttonspacing, -E.buttonspacing)
else
if C["actionbar"].bottompetbar ~= true then
button:SetPoint("TOP", _G["PetActionButton"..(i - 1)], "BOTTOM", 0, -E.buttonspacing)
else
button:SetPoint("LEFT", _G["PetActionButton"..(i - 1)], "RIGHT", E.buttonspacing, 0)
end
end
button:Show()
self:SetAttribute("addchild", button)
end
 
--Setup Mouseover
if C["actionbar"].rightbarmouseover == true and C["actionbar"].bottompetbar ~= true then
EuiPetActionBarBackground:SetAlpha(0)
EuiPetActionBarBackground:SetScript("OnEnter", function() RightBarMouseOver(1) end)
EuiPetActionBarBackground:SetScript("OnLeave", function() RightBarMouseOver(0) end)
EuiLineToPetActionBarBackground:SetScript("OnEnter", function() RightBarMouseOver(1) end)
EuiLineToPetActionBarBackground:SetScript("OnLeave", function() RightBarMouseOver(0) end)
 
for i=1, 10 do
local b = _G["PetActionButton"..i]
b:SetAlpha(0)
b:HookScript("OnEnter", function() RightBarMouseOver(1) end)
b:HookScript("OnLeave", function() RightBarMouseOver(0) end)
end
end
end
 
bar:RegisterEvent("PLAYER_LOGIN")
bar:RegisterEvent("PLAYER_CONTROL_LOST")
bar:RegisterEvent("PLAYER_CONTROL_GAINED")
bar:RegisterEvent("PLAYER_ENTERING_WORLD")
bar:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED")
bar:RegisterEvent("PET_BAR_UPDATE")
bar:RegisterEvent("PET_BAR_UPDATE_USABLE")
bar:RegisterEvent("PET_BAR_UPDATE_COOLDOWN")
bar:RegisterEvent("PET_BAR_HIDE")
bar:RegisterEvent("UNIT_PET")
bar:RegisterEvent("UNIT_FLAGS")
bar:RegisterEvent("UNIT_AURA")
bar:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
-- bug reported by Affli on t12 BETA
PetActionBarFrame.showgrid = 1 -- hack to never hide pet button. :X
 
E.PositionBarPet(self)
RegisterStateDriver(self, "visibility", "[pet,novehicleui,nobonusbar:5] show; hide")
hooksecurefunc("PetActionBar_Update", E.EuiPetBarUpdate)
elseif event == "PET_BAR_UPDATE" or event == "UNIT_PET" and arg1 == "player"
or event == "PLAYER_CONTROL_LOST" or event == "PLAYER_CONTROL_GAINED" or event == "PLAYER_FARSIGHT_FOCUS_CHANGED" or event == "UNIT_FLAGS"
or arg1 == "pet" and (event == "UNIT_AURA") then
E.EuiPetBarUpdate()
elseif event == "PET_BAR_UPDATE_COOLDOWN" then
PetActionBar_UpdateCooldowns()
else
E.StylePet()
end
end)
\ No newline at end of file
Eui/element/actionbars/bartotem.lua New file
0,0 → 1,32
-- we just use default totem bar for shaman
-- we parent it to our shapeshift bar.
-- This is approx the same script as it was in WOTLK Eui version.
local E, C = unpack(select(2, ...))
 
local EUICF = C
local EUIDB = E
local EUIL = L
 
if EUICF["actionbar"].enable ~= true then return end
if EUIDB.MyClass ~= "SHAMAN" then return end
 
if MultiCastActionBarFrame then
MultiCastActionBarFrame:SetScript("OnUpdate", nil)
MultiCastActionBarFrame:SetScript("OnShow", nil)
MultiCastActionBarFrame:SetScript("OnHide", nil)
MultiCastActionBarFrame:SetParent(EuiShiftBar)
MultiCastActionBarFrame:ClearAllPoints()
MultiCastActionBarFrame:SetPoint("BOTTOMLEFT", EuiShiftBar, "BOTTOMLEFT", -2, -2)
 
hooksecurefunc("MultiCastActionButton_Update",function(actionbutton) if not InCombatLockdown() then actionbutton:SetAllPoints(actionbutton.slotButton) end end)
 
MultiCastActionBarFrame.SetParent = EUIDB.dummy
MultiCastActionBarFrame.SetPoint = EUIDB.dummy
MultiCastRecallSpellButton.SetPoint = EUIDB.dummy -- bug fix, see http://www.tukui.org/v2/forums/topic.php?id=2405
 
if EUICF["actionbar"].shapeshiftmouseover == true then
MultiCastActionBarFrame:SetAlpha(0)
MultiCastActionBarFrame:HookScript("OnEnter", function() MultiCastActionBarFrame:SetAlpha(1) end)
MultiCastActionBarFrame:HookScript("OnLeave", function() MultiCastActionBarFrame:SetAlpha(0) end)
end
end
Eui/element/nameplate.lua New file
0,0 → 1,632
local E, C = unpack(select(2, ...))
if C["other"].nameplate ~= true then return end
local showhealth = C["other"].nameplatevalue -- ÐÕÃû°åÖÐï@ʾÉúÃüÖµ
local enhancethreat = true
local classicons = true -- ï@ʾš˜IˆD˜Ë
local nameTex = [=[Interface\AddOns\Eui\media\nameTex.tga]=]
local Role = "Caster" --Melee,Caster,Tank
local FONT = STANDARD_TEXT_FONT
local FONTSIZE = 11 -- ×Öów´óС
local FONTFLAG = "THINOUTLINE"
local hpHeight = 12
local hpWidth = 110
local iconSize = 25 -- Ê©·¨ºÍš˜IµÈˆD˜ËµÄ´óС
local cbHeight = 5
local cbWidth = 110
local goodcolor = {75/255, 175/255, 76/255}
local badcolor = {0.78, 0.25, 0.25}
local transitioncolor = {218/255, 197/255, 92/255} --High Threat, Losing Threat color
local hostilecolor = {0.78, 0.25, 0.25}
local friendlyplayercolor = {75/255, 175/255, 76/255}
local neutralcolor = {218/255, 197/255, 92/255}
local friendlynpccolor = {0.31, 0.45, 0.63}
 
 
-- Nameplate Filter, Add the Nameplates name exactly here that you do NOT want to see
PlateBlacklist = {
--ÏÂÃæ¿ÉÒÔÔOÖÃÊÇ·ñï@ʾË_MµÄһЩˆDòv
["Earth Elemental Totem"] = true,
["Fire Elemental Totem"] = true,
["Fire Resistance Totem"] = true,
["Flametongue Totem"] = true,
["Frost Resistance Totem"] = true,
["Healing Stream Totem"] = true,
["Magma Totem"] = true,
["Mana Spring Totem"] = true,
["Nature Resistance Totem"] = true,
["Searing Totem"] = true,
["Stoneclaw Totem"] = true,
["Stoneskin Totem"] = true,
["Strength of Earth Totem"] = true,
["Windfury Totem"] = true,
["Totem of Wrath"] = true,
["Wrath of Air Totem"] = true,
 
--Army of the Dead
["Army of the Dead Ghoul"] = true,
 
--Hunter Trap
["Venomous Snake"] = true,
["Viper"] = true,
 
--Test
--["Unbound Seer"] = true,
}
 
--Dont Touch
local numChildren = -1
local frames = {}
local mult = 768/string.match(GetCVar("gxResolution"), "%d+x(%d+)")/UIParent:GetScale()
local noscalemult = mult * UIParent:GetScale()
local dummy = function() end
 
--Change defaults if we are showing health text or not
if showhealth ~= true then
hpHeight = 7
iconSize = 20
end
 
local NamePlates = CreateFrame("Frame", nil, UIParent)
NamePlates:SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end)
SetCVar("ShowClassColorInNameplate",1)
SetCVar("showVKeyCastbar",1)
 
local ShortValue = function(value)
if value >= 1e6 then
return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
elseif value >= 1e3 or value <= -1e3 then
return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
else
return value
end
end
 
local function QueueObject(parent, object)
parent.queue = parent.queue or {}
parent.queue[object] = true
end
 
local function HideObjects(parent)
for object in pairs(parent.queue) do
if(object:GetObjectType() == 'Texture') then
object:SetTexture(nil)
object.SetTexture = dummy
elseif (object:GetObjectType() == 'FontString') then
object.ClearAllPoints = dummy
object.SetFont = dummy
object.SetPoint = dummy
object:Hide()
object.Show = dummy
object.SetText = dummy
object.SetShadowOffset = dummy
else
object:Hide()
object.Show = dummy
end
end
end
 
local function CheckBlacklist(frame, ...)
if PlateBlacklist[frame.name:GetText()] or (UnitLevel("player") ~= 1 and frame.oldlevel:GetText() == tostring(1)) then
frame:SetScript("OnUpdate", function() end)
frame.hp:Hide()
frame.cb:Hide()
frame.overlay:Hide()
frame.oldlevel:Hide()
end
end
 
local function HideDrunkenText(frame, ...)
if frame and frame.oldlevel and frame.oldlevel:IsShown() then
frame.oldlevel:Hide()
end
end
 
local function ForEachPlate(functionToRun, ...)
for frame in pairs(frames) do
if frame:IsShown() then
functionToRun(frame, ...)
end
end
end
 
local goodR, goodG, goodB = unpack(goodcolor)
local badR, badG, badB = unpack(badcolor)
local transitionR, transitionG, transitionB = unpack(transitioncolor)
local function UpdateThreat(frame, elapsed)
frame.hp:Show()
 
if enhancethreat ~= true then
if(frame.region:IsShown()) then
local _, val = frame.region:GetVertexColor()
if(val > 0.7) then
frame.healthborder_tex1:SetTexture(transitionR, transitionG, transitionB)
frame.healthborder_tex2:SetTexture(transitionR, transitionG, transitionB)
frame.healthborder_tex3:SetTexture(transitionR, transitionG, transitionB)
frame.healthborder_tex4:SetTexture(transitionR, transitionG, transitionB)
else
frame.healthborder_tex1:SetTexture(badR, badG, badB)
frame.healthborder_tex2:SetTexture(badR, badG, badB)
frame.healthborder_tex3:SetTexture(badR, badG, badB)
frame.healthborder_tex4:SetTexture(badR, badG, badB)
end
else
frame.healthborder_tex1:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex2:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex3:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex4:SetTexture(0.6, 0.6, 0.6)
end
else
if not frame.region:IsShown() then
if InCombatLockdown() and frame.hasclass ~= true and frame.isFriendly ~= true then
--No Threat
if Role == "Tank" then
frame.hp:SetStatusBarColor(badR, badG, badB)
frame.hp.hpbg:SetTexture(badR, badG, badB, 0.25)
else
frame.hp:SetStatusBarColor(goodR, goodG, goodB)
frame.hp.hpbg:SetTexture(goodR, goodG, goodB, 0.25)
end
else
--Set colors to their original, not in combat
frame.hp:SetStatusBarColor(frame.hp.rcolor, frame.hp.gcolor, frame.hp.bcolor)
frame.hp.hpbg:SetTexture(frame.hp.rcolor, frame.hp.gcolor, frame.hp.bcolor, 0.25)
end
else
--Ok we either have threat or we're losing/gaining it
local r, g, b = frame.region:GetVertexColor()
if g + b == 0 then
--Have Threat
if Role == "Tank" then
frame.hp:SetStatusBarColor(goodR, goodG, goodB)
frame.hp.hpbg:SetTexture(goodR, goodG, goodB, 0.25)
else
frame.hp:SetStatusBarColor(badR, badG, badB)
frame.hp.hpbg:SetTexture(badR, badG, badB, 0.25)
end
else
--Losing/Gaining Threat
frame.hp:SetStatusBarColor(transitionR, transitionG, transitionB)
frame.hp.hpbg:SetTexture(transitionR, transitionG, transitionB, 0.25)
end
end
end
 
-- show current health value
local minHealth, maxHealth = frame.healthOriginal:GetMinMaxValues()
local valueHealth = frame.healthOriginal:GetValue()
local d =(valueHealth/maxHealth)*100
 
if showhealth == true then
frame.hp.value:SetText(ShortValue(valueHealth).." - "..(string.format("%d%%", math.floor((valueHealth/maxHealth)*100))))
end
 
--Change frame style if the frame is our target or not
if UnitName("target") == frame.name:GetText() and frame:GetAlpha() == 1 then
--Targetted Unit
frame.name:SetTextColor(1, 1, 0)
else
--Not Targetted
frame.name:SetTextColor(1, 1, 1)
end
 
--Setup frame shadow to change depending on enemy players health, also setup targetted unit to have white shadow
if frame.hasclass == true or frame.isFriendly == true then
if(d <= 50 and d >= 20) then
frame.healthborder_tex1:SetTexture(1, 1, 0)
frame.healthborder_tex2:SetTexture(1, 1, 0)
frame.healthborder_tex3:SetTexture(1, 1, 0)
frame.healthborder_tex4:SetTexture(1, 1, 0)
elseif(d < 20) then
frame.healthborder_tex1:SetTexture(1, 0, 0)
frame.healthborder_tex2:SetTexture(1, 0, 0)
frame.healthborder_tex3:SetTexture(1, 0, 0)
frame.healthborder_tex4:SetTexture(1, 0, 0)
else
frame.healthborder_tex1:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex2:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex3:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex4:SetTexture(0.6, 0.6, 0.6)
end
elseif (frame.hasclass ~= true and frame.isFriendly ~= true) and enhancethreat == true then
frame.healthborder_tex1:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex2:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex3:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex4:SetTexture(0.6, 0.6, 0.6)
end
end
 
local function Colorize(frame)
local r,g,b = frame.hp:GetStatusBarColor()
if frame.hasclass == true then frame.isFriendly = false return end
 
if g+b == 0 then -- hostile
r,g,b = unpack(hostilecolor)
frame.isFriendly = false
elseif r+b == 0 then -- friendly npc
r,g,b = unpack(friendlynpccolor)
frame.isFriendly = true
elseif r+g > 1.95 then -- neutral
r,g,b = unpack(neutralcolor)
frame.isFriendly = false
elseif r+g == 0 then -- friendly player
r,g,b = unpack(friendlyplayercolor)
frame.isFriendly = true
else -- enemy player
frame.isFriendly = false
end
frame.hp:SetStatusBarColor(r,g,b)
end
 
local function UpdateObjects(frame)
local frame = frame:GetParent()
 
local r, g, b = frame.hp:GetStatusBarColor()
local r, g, b = floor(r*100+.5)/100, floor(g*100+.5)/100, floor(b*100+.5)/100
local classname = ""
 
frame.hp:ClearAllPoints()
frame.hp:SetSize(hpWidth, hpHeight)
frame.hp:SetPoint('TOP', frame, 'TOP', 0, -noscalemult*3)
frame.hp:GetStatusBarTexture():SetHorizTile(true)
 
frame.healthbarbackdrop_tex:ClearAllPoints()
frame.healthbarbackdrop_tex:SetPoint("TOPLEFT", frame.hp, "TOPLEFT", -noscalemult*3, noscalemult*3)
frame.healthbarbackdrop_tex:SetPoint("BOTTOMRIGHT", frame.hp, "BOTTOMRIGHT", noscalemult*3, -noscalemult*3)
 
--Class Icons
for class, color in pairs(E.RAID_CLASS_COLORS) do
if E.RAID_CLASS_COLORS[class].r == r and E.RAID_CLASS_COLORS[class].g == g and E.RAID_CLASS_COLORS[class].b == b then
classname = class
end
end
if (classname) then
texcoord = CLASS_BUTTONS[classname]
if texcoord then
frame.hasclass = true
else
texcoord = {0.5, 0.75, 0.5, 0.75}
frame.hasclass = false
end
else
texcoord = {0.5, 0.75, 0.5, 0.75}
frame.hasclass = false
end
 
if frame.hp.rcolor == 0 and frame.hp.gcolor == 0 and frame.hp.bcolor ~= 0 then
texcoord = {0.5, 0.75, 0.5, 0.75}
frame.hasclass = true
end
frame.class:SetTexCoord(texcoord[1],texcoord[2],texcoord[3],texcoord[4])
 
if classicons ~= true then
frame.class:SetAlpha(0)
end
 
--create variable for original colors
Colorize(frame)
frame.hp.rcolor, frame.hp.gcolor, frame.hp.bcolor = frame.hp:GetStatusBarColor()
frame.hp.hpbg:SetTexture(frame.hp.rcolor, frame.hp.gcolor, frame.hp.bcolor, 0.25)
 
--Set the name text
frame.name:SetText(frame.oldname:GetText())
 
--Setup level text
local level, elite, mylevel = tonumber(frame.oldlevel:GetText()), frame.elite:IsShown(), UnitLevel("player")
frame.hp.level:ClearAllPoints()
if showhealth == true then
frame.hp.level:SetPoint("RIGHT", frame.hp, "RIGHT", 2, 0)
else
frame.hp.level:SetPoint("RIGHT", frame.hp, "LEFT", -1, 0)
end
 
frame.hp.level:SetTextColor(frame.oldlevel:GetTextColor())
if frame.boss:IsShown() then
frame.hp.level:SetText("B")
frame.hp.level:SetTextColor(0.8, 0.05, 0)
frame.hp.level:Show()
elseif not elite and level == mylevel then
frame.hp.level:Hide()
else
frame.hp.level:SetText(level..(elite and "+" or ""))
end
 
frame.overlay:ClearAllPoints()
frame.overlay:SetAllPoints(frame.hp)
 
HideObjects(frame)
end
 
local function UpdateCastbar(frame)
frame:ClearAllPoints()
frame:SetSize(cbWidth, cbHeight)
frame:SetPoint('TOP', frame:GetParent().hp, 'BOTTOM', 0, -8)
frame:GetStatusBarTexture():SetHorizTile(true)
 
if(not frame.shield:IsShown()) then
frame:SetStatusBarColor(0.78, 0.25, 0.25, 1)
end
 
local frame = frame:GetParent()
frame.castbarbackdrop_tex:ClearAllPoints()
frame.castbarbackdrop_tex:SetPoint("TOPLEFT", frame.cb, "TOPLEFT", -noscalemult*3, noscalemult*3)
frame.castbarbackdrop_tex:SetPoint("BOTTOMRIGHT", frame.cb, "BOTTOMRIGHT", noscalemult*3, -noscalemult*3)
end
 
local function UpdateCastText(frame, curValue)
local minValue, maxValue = frame:GetMinMaxValues()
 
if UnitChannelInfo("target") then
frame.time:SetFormattedText("%.1f ", curValue)
frame.name:SetText(select(1, (UnitChannelInfo("target"))))
end
 
if UnitCastingInfo("target") then
frame.time:SetFormattedText("%.1f ", maxValue - curValue)
frame.name:SetText(select(1, (UnitCastingInfo("target"))))
end
end
 
local OnValueChanged = function(self, curValue)
UpdateCastText(self, curValue)
if self.needFix then
UpdateCastbar(self)
self.needFix = nil
end
end
 
local OnSizeChanged = function(self)
self.needFix = true
end
 
local function OnHide(frame)
frame.overlay:Hide()
frame.cb:Hide()
frame.hasclass = nil
frame.isFriendly = nil
frame.hp.rcolor = nil
frame.hp.gcolor = nil
frame.hp.bcolor = nil
end
 
local function SkinObjects(frame)
local hp, cb = frame:GetChildren()
local threat, hpborder, cbshield, cbborder, cbicon, overlay, oldname, oldlevel, bossicon, raidicon, elite = frame:GetRegions()
frame.healthOriginal = hp
 
--Just make sure these are correct
hp:SetFrameLevel(9)
cb:SetFrameLevel(9)
 
 
-- Create Cast Icon Backdrop frame
local healthbarbackdrop_tex = hp:CreateTexture(nil, "BACKGROUND")
healthbarbackdrop_tex:SetPoint("TOPLEFT", hp, "TOPLEFT", -noscalemult*3, noscalemult*3)
healthbarbackdrop_tex:SetPoint("BOTTOMRIGHT", hp, "BOTTOMRIGHT", noscalemult*3, -noscalemult*3)
healthbarbackdrop_tex:SetTexture(0.1, 0.1, 0.1)
frame.healthbarbackdrop_tex = healthbarbackdrop_tex
 
--Create our fake border.. fuck blizz
local healthbarborder_tex1 = hp:CreateTexture(nil, "BORDER")
healthbarborder_tex1:SetPoint("TOPLEFT", hp, "TOPLEFT", -noscalemult*2, noscalemult*2)
healthbarborder_tex1:SetPoint("TOPRIGHT", hp, "TOPRIGHT", noscalemult*2, noscalemult*2)
healthbarborder_tex1:SetHeight(noscalemult)
healthbarborder_tex1:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex1 = healthbarborder_tex1
 
local healthbarborder_tex2 = hp:CreateTexture(nil, "BORDER")
healthbarborder_tex2:SetPoint("BOTTOMLEFT", hp, "BOTTOMLEFT", -noscalemult*2, -noscalemult*2)
healthbarborder_tex2:SetPoint("BOTTOMRIGHT", hp, "BOTTOMRIGHT", noscalemult*2, -noscalemult*2)
healthbarborder_tex2:SetHeight(noscalemult)
healthbarborder_tex2:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex2 = healthbarborder_tex2
 
local healthbarborder_tex3 = hp:CreateTexture(nil, "BORDER")
healthbarborder_tex3:SetPoint("TOPLEFT", hp, "TOPLEFT", -noscalemult*2, noscalemult*2)
healthbarborder_tex3:SetPoint("BOTTOMLEFT", hp, "BOTTOMLEFT", noscalemult*2, -noscalemult*2)
healthbarborder_tex3:SetWidth(noscalemult)
healthbarborder_tex3:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex3 = healthbarborder_tex3
 
local healthbarborder_tex4 = hp:CreateTexture(nil, "BORDER")
healthbarborder_tex4:SetPoint("TOPRIGHT", hp, "TOPRIGHT", noscalemult*2, noscalemult*2)
healthbarborder_tex4:SetPoint("BOTTOMRIGHT", hp, "BOTTOMRIGHT", -noscalemult*2, -noscalemult*2)
healthbarborder_tex4:SetWidth(noscalemult)
healthbarborder_tex4:SetTexture(0.6, 0.6, 0.6)
frame.healthborder_tex4 = healthbarborder_tex4
 
hp:SetStatusBarTexture(nameTex)
frame.hp = hp
 
--Actual Background for the Healthbar
hp.hpbg = hp:CreateTexture(nil, 'BORDER')
hp.hpbg:SetAllPoints(hp)
hp.hpbg:SetTexture(1,1,1,0.25)
 
--Create Overlay Highlight
frame.overlay = overlay
frame.overlay:SetTexture(1,1,1,0.15)
frame.overlay:SetAllPoints(hp)
 
--Create Name
hp.level = hp:CreateFontString(nil, "OVERLAY")
hp.level:SetFont(FONT, FONTSIZE, FONTFLAG)
hp.level:SetTextColor(1, 1, 1)
hp.level:SetShadowOffset(mult, -mult)
 
--Needed for level text
frame.oldlevel = oldlevel
frame.boss = bossicon
frame.elite = elite
 
--Create Health Text
if showhealth == true then
hp.value = hp:CreateFontString(nil, "OVERLAY")
hp.value:SetFont(FONT, FONTSIZE, FONTFLAG)
hp.value:SetPoint("LEFT", hp, 2, 0)
hp.value:SetTextColor(1,1,1)
hp.value:SetShadowOffset(mult, -mult)
end
 
-- Create Cast Bar Backdrop frame
local castbarbackdrop_tex = cb:CreateTexture(nil, "BACKGROUND")
castbarbackdrop_tex:SetPoint("TOPLEFT", cb, "TOPLEFT", -noscalemult*3, noscalemult*3)
castbarbackdrop_tex:SetPoint("BOTTOMRIGHT", cb, "BOTTOMRIGHT", noscalemult*3, -noscalemult*3)
castbarbackdrop_tex:SetTexture(0.1, 0.1, 0.1)
frame.castbarbackdrop_tex = castbarbackdrop_tex
 
--Create our fake border.. fuck blizz
local castbarborder_tex1 = cb:CreateTexture(nil, "BORDER")
castbarborder_tex1:SetPoint("TOPLEFT", cb, "TOPLEFT", -noscalemult*2, noscalemult*2)
castbarborder_tex1:SetPoint("TOPRIGHT", cb, "TOPRIGHT", noscalemult*2, noscalemult*2)
castbarborder_tex1:SetHeight(noscalemult)
castbarborder_tex1:SetTexture(0.6, 0.6, 0.6)
 
local castbarborder_tex2 = cb:CreateTexture(nil, "BORDER")
castbarborder_tex2:SetPoint("BOTTOMLEFT", cb, "BOTTOMLEFT", -noscalemult*2, -noscalemult*2)
castbarborder_tex2:SetPoint("BOTTOMRIGHT", cb, "BOTTOMRIGHT", noscalemult*2, -noscalemult*2)
castbarborder_tex2:SetHeight(noscalemult)
castbarborder_tex2:SetTexture(0.6, 0.6, 0.6)
 
local castbarborder_tex3 = cb:CreateTexture(nil, "BORDER")
castbarborder_tex3:SetPoint("TOPLEFT", cb, "TOPLEFT", -noscalemult*2, noscalemult*2)
castbarborder_tex3:SetPoint("BOTTOMLEFT", cb, "BOTTOMLEFT", noscalemult*2, -noscalemult*2)
castbarborder_tex3:SetWidth(noscalemult)
castbarborder_tex3:SetTexture(0.6, 0.6, 0.6)
 
local castbarborder_tex4 = cb:CreateTexture(nil, "BORDER")
castbarborder_tex4:SetPoint("TOPRIGHT", cb, "TOPRIGHT", noscalemult*2, noscalemult*2)
castbarborder_tex4:SetPoint("BOTTOMRIGHT", cb, "BOTTOMRIGHT", -noscalemult*2, -noscalemult*2)
castbarborder_tex4:SetWidth(noscalemult)
castbarborder_tex4:SetTexture(0.6, 0.6, 0.6)
 
--Setup CastBar Icon
cbicon:ClearAllPoints()
cbicon:SetPoint("TOPLEFT", hp, "TOPRIGHT", 8, 0)
cbicon:SetSize(iconSize, iconSize)
cbicon:SetTexCoord(.07, .93, .07, .93)
cbicon:SetDrawLayer("OVERLAY")
 
-- Create Cast Icon Backdrop frame
local casticonbackdrop_tex = cb:CreateTexture(nil, "BACKGROUND")
casticonbackdrop_tex:SetPoint("TOPLEFT", cbicon, "TOPLEFT", -noscalemult*3, noscalemult*3)
casticonbackdrop_tex:SetPoint("BOTTOMRIGHT", cbicon, "BOTTOMRIGHT", noscalemult*3, -noscalemult*3)
casticonbackdrop_tex:SetTexture(0.1, 0.1, 0.1)
 
local casticonborder_tex = cb:CreateTexture(nil, "BORDER")
casticonborder_tex:SetPoint("TOPLEFT", cbicon, "TOPLEFT", -noscalemult*2, noscalemult*2)
casticonborder_tex:SetPoint("BOTTOMRIGHT", cbicon, "BOTTOMRIGHT", noscalemult*2, -noscalemult*2)
casticonborder_tex:SetTexture(0.6, 0.6, 0.6)
 
--Create Health Backdrop Frame
local casticonbackdrop2_tex = cb:CreateTexture(nil, "ARTWORK")
casticonbackdrop2_tex:SetPoint("TOPLEFT", cbicon, "TOPLEFT", -noscalemult, noscalemult)
casticonbackdrop2_tex:SetPoint("BOTTOMRIGHT", cbicon, "BOTTOMRIGHT", noscalemult, -noscalemult)
casticonbackdrop2_tex:SetTexture(0.1, 0.1, 0.1)
 
--Create Cast Time Text
cb.time = cb:CreateFontString(nil, "ARTWORK")
cb.time:SetPoint("RIGHT", cb, "LEFT", -1, 0)
cb.time:SetFont(FONT, FONTSIZE, FONTFLAG)
cb.time:SetTextColor(1, 1, 1)
cb.time:SetShadowOffset(mult, -mult)
 
--Create Cast Name Text
cb.name = cb:CreateFontString(nil, "ARTWORK")
cb.name:SetPoint("TOP", cb, "BOTTOM", 0, -3)
cb.name:SetFont(FONT, FONTSIZE, FONTFLAG)
cb.name:SetTextColor(1, 1, 1)
cb.name:SetShadowOffset(mult, -mult)
 
cb.icon = cbicon
cb.shield = cbshield
cb:HookScript('OnShow', UpdateCastbar)
cb:HookScript('OnSizeChanged', OnSizeChanged)
cb:HookScript('OnValueChanged', OnValueChanged)
cb:SetStatusBarTexture(nameTex)
frame.cb = cb
 
--Create Name Text
local name = hp:CreateFontString(nil, 'OVERLAY')
name:SetPoint('BOTTOMLEFT', hp, 'TOPLEFT', -10, 3)
name:SetPoint('BOTTOMRIGHT', hp, 'TOPRIGHT', 10, 3)
name:SetFont(FONT, FONTSIZE, FONTFLAG)
name:SetShadowOffset(mult, -mult)
frame.oldname = oldname
frame.name = name
 
--Reposition and Resize RaidIcon
raidicon:ClearAllPoints()
raidicon:SetPoint("BOTTOM", hp, "TOP", 0, 16)
raidicon:SetSize(iconSize*1.4, iconSize*1.4)
frame.raidicon = raidicon
 
--Create Class Icon
local cIconTex = hp:CreateTexture(nil, "OVERLAY")
cIconTex:SetPoint("BOTTOM", hp, "TOP", 0, 16)
cIconTex:SetTexture("Interface\\WorldStateFrame\\Icons-Classes")
cIconTex:SetSize(iconSize, iconSize)
frame.class = cIconTex
 
--Hide Old Stuff
QueueObject(frame, oldlevel)
QueueObject(frame, threat)
QueueObject(frame, hpborder)
QueueObject(frame, cbshield)
QueueObject(frame, cbborder)
QueueObject(frame, oldname)
QueueObject(frame, bossicon)
QueueObject(frame, elite)
 
UpdateObjects(hp)
UpdateCastbar(cb)
 
frame.hp:HookScript('OnShow', UpdateObjects)
frame:HookScript('OnHide', OnHide)
frames[frame] = true
end
 
local select = select
local function HookFrames(...)
for index = 1, select('#', ...) do
local frame = select(index, ...)
local region = frame:GetRegions()
 
if(not frames[frame] and not frame:GetName() and region and region:GetObjectType() == 'Texture' and region:GetTexture() == [=[Interface\TargetingFrame\UI-TargetingFrame-Flash]=]) then
SkinObjects(frame)
frame.region = region
end
end
end
 
 
CreateFrame('Frame'):SetScript('OnUpdate', function(self, elapsed)
if(WorldFrame:GetNumChildren() ~= numChildren) then
numChildren = WorldFrame:GetNumChildren()
HookFrames(WorldFrame:GetChildren())
end
 
if(self.elapsed and self.elapsed > 0.2) then
for frame in pairs(frames) do
UpdateThreat(frame, self.elapsed)
end
 
self.elapsed = 0
else
self.elapsed = (self.elapsed or 0) + elapsed
end
 
ForEachPlate(CheckBlacklist)
ForEachPlate(HideDrunkenText)
end)
 
if C["other"].nameplateauto == true then
NamePlates:RegisterEvent("PLAYER_REGEN_ENABLED")
function NamePlates:PLAYER_REGEN_ENABLED()
SetCVar("nameplateShowEnemies", 0)
end
NamePlates:RegisterEvent("PLAYER_REGEN_DISABLED")
function NamePlates:PLAYER_REGEN_DISABLED()
SetCVar("nameplateShowEnemies", 1)
end
end
\ No newline at end of file
Eui/element/bag.xml New file
0,0 → 1,511
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="bag.lua"/>
 
<Frame name="BaudBagContainerDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true">
<Scripts>
<OnLoad>
BaudBagContainerDropDown_OnLoad(self);
</OnLoad>
</Scripts>
</Frame>
 
<Frame name="BaudBagSubBagTemplate" virtual="true">
<Anchors><Anchor point="CENTER"/></Anchors>
<Scripts>
<OnLoad>
BaudBagSubBag_OnLoad(self);
</OnLoad>
<OnEvent>
BaudBagSubBag_OnEvent(self, event);
</OnEvent>
</Scripts>
</Frame>
 
<Frame name="BaudBagContainerTemplate" topLevel="true" frameStrata="MEDIUM" movable="true" enableMouse="true" parent="UIParent" hidden="true" virtual="true">
<Size><AbsDimension x="640" y="560"/></Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentName" inherits="GameFontNormal" justifyH="LEFT">
<Size><AbsDimension y="12"/></Size>
</FontString>
</Layer>
</Layers>
<Frames>
<Frame name="$parentBackdrop">
<Frames>
<Frame name="$parentTextures" setAllPoints="true"/>
</Frames>
</Frame>
<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT"/>
</Anchors>
<Scripts>
<OnClick>
self:GetParent():Hide();
</OnClick>
</Scripts>
</Button>
<Button name="$parentMenuButton">
<Size><AbsDimension x="16" y="16"/></Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentCloseButton" relativePoint="TOPLEFT">
<Offset><AbsDimension y="-7"/></Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-PlusButton-Up"/>
<PushedTexture file="Interface\Buttons\UI-PlusButton-Down"/>
<HighlightTexture file="Interface\Buttons\UI-PlusButton-Hilight" alphaMode="ADD"/>
<Scripts>
<OnClick>
BaudBagContainerDropDown_Show(self);
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad>
BaudBagContainer_OnLoad(self);
</OnLoad>
<OnShow>
BaudBagContainer_OnShow(self);
</OnShow>
<OnHide>
BaudBagContainer_OnHide(self);
</OnHide>
<OnUpdate>
BaudBagContainer_OnUpdate(self);
</OnUpdate>
<OnDragStart>
BaudBagContainer_OnDragStart(self);
</OnDragStart>
<OnDragStop>
BaudBagContainer_OnDragStop(self);
</OnDragStop>
</Scripts>
</Frame>
 
 
<Frame name="BaudBagBagsFrameTemplate" enableMouse="true" virtual="true">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentBackdrop" relativePoint="TOPLEFT"/>
</Anchors>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<BackgroundInsets><AbsInset left="5" right="5" top="5" bottom="5"/></BackgroundInsets>
<TileSize><AbsValue val="16"/></TileSize>
<EdgeSize><AbsValue val="16"/></EdgeSize>
</Backdrop>
<Scripts>
<OnLoad>
self:SetBackdropColor(0,0,0,1);
</OnLoad>
<OnShow>
BaudBagBagsFrame_OnShow(self);
</OnShow>
</Scripts>
</Frame>
 
 
 
<Frame name="BaudBagFirstContainerTemplate" inherits="BaudBagContainerTemplate" virtual="true">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentSlots" inherits="GameFontNormal" justifyH="LEFT"/>
</Layer>
</Layers>
<Frames>
<CheckButton name="$parentBagsButton">
<Size><AbsDimension x="24" y="24"/></Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentName" relativePoint="LEFT">
<Offset><AbsDimension x="-5"/></Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
<CheckedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
<Scripts>
<OnClick>
BaudBagBagsButton_OnClick(self);
</OnClick>
</Scripts>
</CheckButton>
<Frame name="$parentMoneyFrame" inherits="SmallMoneyFrameTemplate">
<Size><AbsDimension x="206" y="14"/></Size>
</Frame>
</Frames>
</Frame>
 
<Frame name="BBCont1_1" inherits="BaudBagFirstContainerTemplate">
<Frames>
<Frame name="$parentBagsFrame" inherits="BaudBagBagsFrameTemplate">
<Frames>
<Button name="BaudBagKeyRingButton">
<Size><AbsDimension x="39" y="18"/></Size>
<Anchors>
<Anchor point="BOTTOM">
<Offset><AbsDimension y="8"/></Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-Button-KeyRing"/>
<HighlightTexture file="Interface\Buttons\UI-Button-KeyRing-Highlight" alphaMode="ADD"/>
<PushedTexture file="Interface\Buttons\UI-Button-KeyRing-Down"/>
<Scripts>
<OnLoad>
BaudBagKeyRing_OnLoad(self);
</OnLoad>
</Scripts>
</Button>
</Frames>
</Frame>
</Frames>
</Frame>
 
<Frame name="BBCont2_1" inherits="BaudBagFirstContainerTemplate">
<Frames>
<Frame name="$parentBagsFrame" inherits="BaudBagBagsFrameTemplate">
<Frames>
<Frame name="BaudBagBankSlotPurchaseFrame" parent="BBCont2_1BagsFrame" setAllPoints="true">
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentSlotCost" inherits="GameFontHighlight" text="Slot:" justifyH="LEFT">
<Size><AbsDimension x="30" y="20"/></Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset><AbsDimension x="15" y="25"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="BaudBagBankSlotPurchaseButton" inherits="UIPanelButtonTemplate" text="BANKSLOTPURCHASE">
<Size><AbsDimension y="21"/></Size>
<Anchors>
<Anchor point="BOTTOM">
<Offset><AbsDimension y="5"/></Offset>
</Anchor>
<Anchor point="LEFT">
<Offset><AbsDimension x="5"/></Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset><AbsDimension x="-5"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
PlaySound("igMainMenuOption");
StaticPopup_Show("CONFIRM_BUY_BANK_SLOT");
</OnClick>
</Scripts>
</Button>
<Frame name="$parentMoneyFrame" inherits="SmallMoneyFrameTemplate" hidden="false">
<Anchors><Anchor point="LEFT" relativeTo="$parentSlotCost" relativePoint="RIGHT"/></Anchors>
<Scripts>
<OnLoad>
SmallMoneyFrame_OnLoad(self);
MoneyFrame_SetType(self, "STATIC");
</OnLoad>
</Scripts>
</Frame>
</Frames>
</Frame>
</Frames>
</Frame>
<Frame name="BaudBagSubBag-1"/>
</Frames>
</Frame>
 
<Frame name="BaudBagFrame">
<Scripts>
<OnLoad>
BaudBag_OnLoad(self);
</OnLoad>
<OnEvent>
BaudBag_OnEvent(self, event);
</OnEvent>
</Scripts>
</Frame>
 
 
 
 
<CheckButton name="BaudBagCheckButtonTemplate" inherits="OptionsCheckButtonTemplate" virtual="true">
<Size><AbsDimension x="26" y="26"/></Size>
<HitRectInsets>
<AbsInset left="0" right="-65" top="0" bottom="0"/>
</HitRectInsets>
<Scripts>
<OnClick>
BaudBagCheckButton_OnClick(self);
</OnClick>
</Scripts>
</CheckButton>
 
<CheckButton name="BaudBagOptionsJoinCheckTemplate" inherits="OptionsCheckButtonTemplate" virtual="true">
<Size><AbsDimension x="26" y="26"/></Size>
<HitRectInsets>
<AbsInset left="0" right="0" top="0" bottom="0"/>
</HitRectInsets>
<Scripts>
<OnClick>
BaudBagOptionsJoinCheck_OnClick(self);
</OnClick>
</Scripts>
</CheckButton>
 
<Slider name="BaudBagSliderTemplate" inherits="OptionsSliderTemplate" virtual="true">
<Scripts>
<OnValueChanged>
BaudBagSlider_OnValueChanged(self);
</OnValueChanged>
</Scripts>
</Slider>
 
<Frame name="BaudBagOptionsContainerTemplate" virtual="true">
<Size><AbsDimension x="1" y="50"/></Size>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<BackgroundInsets><AbsInset left="5" right="5" top="5" bottom="5"/></BackgroundInsets>
<TileSize><AbsValue val="16"/></TileSize>
<EdgeSize><AbsValue val="16"/></EdgeSize>
</Backdrop>
</Frame>
 
 
<CheckButton name="BaudBagOptionsBagTemplate" inherits="ItemButtonTemplate" virtual="true">
<Size><AbsDimension x="37" y="37"/></Size>
<CheckedTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
<Scripts>
<OnClick>
BaudBagOptionsBag_OnClick(self);
</OnClick>
</Scripts>
</CheckButton>
 
 
<Frame name="BaudBagOptionsFrame" toplevel="true" frameStrata="MEDIUM" movable="true" enableMouse="true" parent="UIParent" hidden="true">
<Size><AbsDimension x="370" y="290"/></Size>
<Anchors><Anchor point="CENTER"/></Anchors>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
<TileSize><AbsValue val="32"/></TileSize>
<EdgeSize><AbsValue val="32"/></EdgeSize>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size><AbsDimension x="300" y="64"/></Size>
<Anchors>
<Anchor point="TOP">
<Offset><AbsDimension x="0" y="12"/></Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="$parentTitle" inherits="GameFontNormal">
<Anchors>
<Anchor point="TOP" relativeTo="$parentHeader">
<Offset><AbsDimension x="0" y="-14"/></Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="BaudBagVersionText" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset><AbsDimension x="-13" y="-13"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Frame name="BaudBagOptionsSetDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true">
<Anchors>
<Anchor point="TOPLEFT">
<Offset><AbsDimension x="20" y="-40"/></Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset><AbsDimension x="16" y="3"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
 
<CheckButton name="BaudBagEnabledCheck" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="BaudBagOptionsSetDropDown" relativePoint="RIGHT">
<Offset><AbsDimension x="5" y="3"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
BaudBagEnabledCheck_OnClick(self);
</OnClick>
</Scripts>
</CheckButton>
 
<EditBox name="BaudBagNameEditBox" inherits="InputBoxTemplate" letters="40" autoFocus="false">
<Size><AbsDimension x="165" y="16"/></Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset><AbsDimension x="40" y="-170"/></Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentText" inherits="GameFontNormal">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset><AbsDimension x="5" y="5"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnEscapePressed>
self:ClearFocus();
</OnEscapePressed>
<OnTextChanged>
BaudBagNameEditBox_OnTextChanged(self);
</OnTextChanged>
</Scripts>
</EditBox>
 
<Frame name="BaudBagOptionsBackgroundDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true">
<Anchors>
<Anchor point="LEFT" relativeTo="BaudBagNameEditBox">
<Offset><AbsDimension x="-30" y="-45"/></Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset><AbsDimension x="16" y="3"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
 
<CheckButton name="BaudBagCheckButton1" inherits="BaudBagCheckButtonTemplate" id="1">
<Anchors>
<Anchor point="LEFT" relativeTo="BaudBagOptionsBackgroundDropDown" relativePoint="RIGHT">
<Offset><AbsDimension x="-8" y="20"/></Offset>
</Anchor>
</Anchors>
</CheckButton>
 
<CheckButton name="BaudBagCheckButton2" inherits="BaudBagCheckButtonTemplate" id="2">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="BaudBagCheckButton1" relativePoint="BOTTOMLEFT">
<Offset><AbsDimension x="0" y="8"/></Offset>
</Anchor>
</Anchors>
</CheckButton>
 
<CheckButton name="BaudBagCheckButton3" inherits="BaudBagCheckButtonTemplate" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="BaudBagCheckButton2" relativePoint="BOTTOMLEFT">
<Offset><AbsDimension x="0" y="8"/></Offset>
</Anchor>
</Anchors>
</CheckButton>
 
<Slider name="BaudBagSlider1" minValue="2" maxValue="20" valueStep="1" inherits="BaudBagSliderTemplate" id="1">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset><AbsDimension x="-25" y="-170"/></Offset>
</Anchor>
</Anchors>
</Slider>
<Slider name="BaudBagSlider2" minValue="50" maxValue="200" valueStep="1" inherits="BaudBagSliderTemplate" id="2">
<Anchors>
<Anchor point="TOP" relativeTo="BaudBagSlider1" relativePoint="BOTTOM">
<Offset><AbsDimension y="-15"/></Offset>
</Anchor>
</Anchors>
</Slider>
 
<Button name="$parentDefaults" inherits="GameMenuButtonTemplate" text="DEFAULTS">
<Size><AbsDimension x="100" y="21"/></Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset><AbsDimension x="16" y="16"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
PlaySound("igMainMenuOptionCheckBoxOn");
BaudBagOptions_Defaults();
</OnClick>
</Scripts>
</Button>
<Button name="$parentCancel" inherits="GameMenuButtonTemplate" text="CANCEL">
<Size><AbsDimension x="100" y="21"/></Size>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset><AbsDimension x="-16" y="16"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
PlaySound("gsTitleOptionExit");
self:GetParent():Hide();
</OnClick>
</Scripts>
</Button>
<Button name="$parentOkay" inherits="GameMenuButtonTemplate" text="OKAY">
<Size><AbsDimension x="100" y="21"/></Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentCancel" relativePoint="LEFT">
<Offset><AbsDimension x="0" y="0"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
PlaySound("gsTitleOptionOK");
self:GetParent().SaveChanges = true;
self:GetParent():Hide();
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad>
BaudBagOptionsFrame_OnLoad(self);
</OnLoad>
<OnEvent>
BaudBagOptionsFrame_OnEvent(self);
</OnEvent>
<OnShow>
BaudBagOptionsFrame_OnShow(self);
</OnShow>
<OnHide>
BaudBagOptionsFrame_OnHide(self);
</OnHide>
<OnDragStart>
self:StartMoving();
</OnDragStart>
<OnDragStop>
self:StopMovingOrSizing();
self:SetUserPlaced(false);
</OnDragStop>
</Scripts>
</Frame>
</Ui>
Eui/element/element.xml New file
0,0 → 1,15
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="buff.lua"/>
<Script file="loot.lua"/>
<Script file="minimap.lua"/>
<Script file="tooltip.lua"/>
<Include file="bag.xml" />
<Script file="chat.lua"/>
<Script file="nameplate.lua"/>
<Script file="compare.lua"/>
<Script file="threat.lua"/>
<Script file="mirror.lua"/>
<Include file="actionbars\actionbars.xml"/>
<Script file="fane.lua"/>
<Script file="coolline.lua"/>
</Ui>
\ No newline at end of file
Eui/element/fane.lua New file
0,0 → 1,115
local E,C = unpack(select(2, ...))
if not C["chat"].enable == true then return end
local event = CreateFrame"Frame"
local dummy = function() end
local inherit = GameFontNormalSmall
 
local updateFS = function(self, inc, flags, ...)
if(self.GetFontString) then
self = self:GetFontString()
else
self = self:GetParent():GetFontString()
end
 
local font, fontSize = inherit:GetFont()
if(inc) then
self:SetFont(font, fontSize + 1, flags)
else
self:SetFont(font, fontSize, flags)
end
 
if((...)) then
self:SetTextColor(...)
end
end
 
local OnEnter = function(self)
updateFS(self, nil, 'OUTLINE', .64, .207, .933)
end
 
local OnLeave = function(self)
local r, g, b
if(_G["ChatFrame"..self:GetID()] == SELECTED_CHAT_FRAME) then
r, g, b = .63, .207, .933
else
r, g, b = 1, 1, 1
end
 
updateFS(self, nil, nil, r, g, b)
end
 
local OnShow = function(self)
updateFS(self, true, nil, 1, 0 , 0)
end
 
local OnHide = function(self)
updateFS(self, nil, nil, 1, 1, 1)
end
 
local rollCF = function()
for i = 1, 7 do
local chat = _G["ChatFrame"..i]
local tab = _G["ChatFrame"..i.."Tab"]
local flash = _G["ChatFrame"..i.."TabFlash"]
 
flash:GetRegions():SetTexture(nil)
flash:SetScript("OnShow", OnShow)
flash:SetScript("OnHide", OnHide)
 
_G["ChatFrame"..i.."TabLeft"]:Hide()
_G["ChatFrame"..i.."TabMiddle"]:Hide()
_G["ChatFrame"..i.."TabRight"]:Hide()
 
tab:SetScript("OnEnter", OnEnter)
tab:SetScript("OnLeave", OnLeave)
 
tab.SetAlpha = dummy
if(chat == SELECTED_CHAT_FRAME) then
updateFS(tab, nil, nil, .64, .207, .933)
else
updateFS(tab, nil, nil, 1, 1, 1)
end
-- tab:GetHighlightTexture():SetTexture(nil)
 
if(chat.isDocked) then
tab:Show()
tab.Hide = dummy
else
tab.SetAlpha = nil
tab.Hide = nil
end
end
end
 
event.PLAYER_LOGIN = function()
rollCF()
hooksecurefunc("FCF_OpenNewWindow", rollCF)
hooksecurefunc("FCF_Close", function(self, fallback)
local frame = fallback or self
UIParent.Hide(_G[frame:GetName().."Tab"])
end)
 
local _orig_FCF_Tab_OnClick = FCF_Tab_OnClick
FCF_Tab_OnClick = function(...)
_orig_FCF_Tab_OnClick(...)
 
for k, v in pairs(DOCKED_CHAT_FRAMES) do
local tab = _G[v:GetName() .. 'Tab']
local flash = _G[v:GetName() .. 'TabFlash']
if(v == SELECTED_CHAT_FRAME) then
updateFS(tab, nil, nil, .64, .207, .933)
elseif(flash:IsShown()) then
updateFS(tab, nil, nil, 1, 0, 0)
else
updateFS(tab, nil, nil, 1, 1, 1)
end
end
end
 
FCF_ChatTabFadeFinished = dummy
end
 
event:SetScript("OnEvent", function(self, event, ...)
self[event](self, event, ...)
end)
event:RegisterEvent"PLAYER_LOGIN"
Eui/element/mirror.lua New file
0,0 → 1,148
local E, C = unpack(select(2, ...))
local settings = {
width = 240,
height = 16,
 
position = {
["BREATH"] = 'TOP#UIParent#TOP#0#-96';
["EXHAUSTION"] = 'TOP#UIParent#TOP#0#-119';
["FEIGNDEATH"] = 'TOP#UIParent#TOP#0#-142';
};
 
colors = {
EXHAUSTION = {1, .9, 0};
BREATH = {.222, .444, .888};
DEATH = {1, .7, 0};
FEIGNDEATH = {1, .7, 0};
};
}
 
local Spawn, PauseAll
do
local barPool = {}
 
local loadPosition = function(self)
local pos = settings.position[self.type]
local p1, frame, p2, x, y = strsplit("#", pos)
 
return self:SetPoint(p1, frame, p2, x,y)
end
 
local OnUpdate = function(self, elapsed)
if(self.paused) then return end
 
self:SetValue(GetMirrorTimerProgress(self.type) / 1e3)
end
 
local Start = function(self, value, maxvalue, scale, paused, text)
if(paused > 0) then
self.paused = 1
elseif(self.paused) then
self.paused = nil
end
 
self.text:SetText(text)
 
self:SetMinMaxValues(0, maxvalue / 1e3)
self:SetValue(value / 1e3)
 
if(not self:IsShown()) then self:Show() end
end
 
function Spawn(type)
if(barPool[type]) then return barPool[type] end
local frame = CreateFrame('StatusBar', nil, UIParent)
 
frame:SetScript("OnUpdate", OnUpdate)
 
local r, g, b = unpack(settings.colors[type])
 
local bg = frame:CreateTexture(nil, 'BACKGROUND')
bg:SetAllPoints(frame)
bg:SetTexture(E.normTex)
bg:SetVertexColor(r * .3, g * .3, b * .3)
 
local panel = CreateFrame("Frame", nil, frame)
E.EuiCreatePanel(panel, settings.width, settings.height, "CENTER", frame, "CENTER", 0, 0)
panel:SetBackdropColor(0, 0, 0,1)
panel:SetBackdropBorderColor(0, 0, 0,1)
panel:SetFrameStrata(frame:GetFrameStrata())
panel:SetFrameLevel(frame:GetFrameLevel() - 1)
 
E.EuiCreateShadow(panel)
 
local text = frame:CreateFontString(nil, 'OVERLAY')
text:SetFont(E.font, 12, "OUTLINE")
text:SetShadowOffset(0,0)
text:SetShadowColor(0, 0, 0, 1)
 
text:SetJustifyH'CENTER'
text:SetTextColor(1, 1, 1)
 
text:SetPoint('LEFT', frame)
text:SetPoint('RIGHT', frame)
text:SetPoint('TOP', frame, 0, 0)
text:SetPoint('BOTTOM', frame, 0, 3)
 
frame:SetWidth(settings.width)
frame:SetHeight(settings.height)
 
frame:SetStatusBarTexture(E.normTex)
frame:SetStatusBarColor(r, g, b, .8)
 
frame.type = type
frame.text = text
 
frame.Start = Start
frame.Stop = Stop
 
loadPosition(frame)
 
barPool[type] = frame
return frame
end
 
function PauseAll(val)
for _, bar in next, barPool do
bar.paused = val
end
end
end
 
local frame = CreateFrame'Frame'
frame:SetScript('OnEvent', function(self, event, ...)
return self[event](self, ...)
end)
 
function frame:ADDON_LOADED(addon)
if addon ~= "Eui" then return end
UIParent:UnregisterEvent'MIRROR_TIMER_START'
self:UnregisterEvent'ADDON_LOADED'
self.ADDON_LOADED = nil
end
frame:RegisterEvent'ADDON_LOADED'
 
function frame:PLAYER_ENTERING_WORLD()
for i=1, MIRRORTIMER_NUMTIMERS do
local type, value, maxvalue, scale, paused, text = GetMirrorTimerInfo(i)
if(type ~= 'UNKNOWN') then
Spawn(type):Start(value, maxvalue, scale, paused, text)
end
end
end
frame:RegisterEvent'PLAYER_ENTERING_WORLD'
 
function frame:MIRROR_TIMER_START(type, value, maxvalue, scale, paused, text)
return Spawn(type):Start(value, maxvalue, scale, paused, text)
end
frame:RegisterEvent'MIRROR_TIMER_START'
 
function frame:MIRROR_TIMER_STOP(type)
return Spawn(type):Hide()
end
frame:RegisterEvent'MIRROR_TIMER_STOP'
 
function frame:MIRROR_TIMER_PAUSE(duration)
return PauseAll((duration > 0 and duration) or nil)
end
frame:RegisterEvent'MIRROR_TIMER_PAUSE'
Eui/element/loot.lua New file
0,0 → 1,309
-----------------------------------
-- Credit : Haste
-----------------------------------
local E, C = unpack(select(2, ...))
local L = {
fish = "Fishy loot",
empty = "Empty slot",
}
 
local addon = CreateFrame("Button", "EuiLoot")
local title = addon:CreateFontString(nil, "OVERLAY")
 
local iconsize = 22
local sq, ss, sn
 
local OnEnter = function(self)
local slot = self:GetID()
if(LootSlotIsItem(slot)) then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetLootItem(slot)
CursorUpdate(self)
end
 
self.drop:Show()
self.drop:SetVertexColor(1, 1, 0)
end
 
local OnLeave = function(self)
if(self.quality > 1) then
local color = ITEM_QUALITY_COLORS[self.quality]
self.drop:SetVertexColor(color.r, color.g, color.b)
else
self.drop:Hide()
end
 
GameTooltip:Hide()
ResetCursor()
end
 
local OnClick = function(self)
if(IsModifiedClick()) then
HandleModifiedItemClick(GetLootSlotLink(self:GetID()))
else
StaticPopup_Hide"CONFIRM_LOOT_DISTRIBUTION"
ss = self:GetID()
sq = self.quality
sn = self.name:GetText()
LootSlot(ss)
end
end
 
local OnUpdate = function(self)
if(GameTooltip:IsOwned(self)) then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetLootItem(self:GetID())
CursorOnUpdate(self)
end
end
 
local createSlot = function(id)
local frame = CreateFrame("Button", "EuiLootSlot"..id, addon)
frame:SetPoint("LEFT", E.Scale(8), 0)
frame:SetPoint("RIGHT", -E.Scale(8), 0)
frame:SetHeight(E.Scale(iconsize))
frame:SetID(id)
 
frame:SetScript("OnEnter", OnEnter)
frame:SetScript("OnLeave", OnLeave)
frame:SetScript("OnClick", OnClick)
frame:SetScript("OnUpdate", OnUpdate)
 
local iconFrame = CreateFrame("Frame", nil, frame)
iconFrame:SetHeight(E.Scale(iconsize))
iconFrame:SetWidth(E.Scale(iconsize))
iconFrame:ClearAllPoints()
iconFrame:SetPoint("RIGHT", frame)
 
E.EuiSetTemplate(iconFrame)
 
local icon = iconFrame:CreateTexture(nil, "ARTWORK")
icon:SetTexCoord(0.08, 0.92, 0.08, .92)
icon:SetPoint("TOPLEFT", iconFrame, E.Scale(2), -E.Scale(2))
icon:SetPoint("BOTTOMRIGHT", iconFrame, -E.Scale(2), E.Scale(2))
frame.icon = icon
 
local count = iconFrame:CreateFontString(nil, "OVERLAY")
count:ClearAllPoints()
count:SetJustifyH"RIGHT"
count:SetPoint("BOTTOMRIGHT", iconFrame, -E.Scale(1), E.Scale(2))
count:SetFont(E.fontn, 10, "OUTLINE")
count:SetShadowOffset(.8, -.8)
count:SetShadowColor(0, 0, 0, 1)
count:SetText(1)
frame.count = count
 
local name = frame:CreateFontString(nil, "OVERLAY")
name:SetJustifyH"LEFT"
name:ClearAllPoints()
name:SetPoint("LEFT", frame)
name:SetPoint("RIGHT", icon, "LEFT")
name:SetNonSpaceWrap(true)
name:SetFont(STANDARD_TEXT_FONT, 13, "OUTLINE")
name:SetShadowOffset(.8, -.8)
name:SetShadowColor(0, 0, 0, 1)
frame.name = name
 
local drop = frame:CreateTexture(nil, "ARTWORK")
drop:SetTexture"Interface\\QuestFrame\\UI-QuestLogTitleHighlight"
 
drop:SetPoint("LEFT", icon, "RIGHT", 0, 0)
drop:SetPoint("RIGHT", frame)
drop:SetAllPoints(frame)
drop:SetAlpha(.3)
frame.drop = drop
 
frame:SetPoint("TOP", addon, E.Scale(4), E.Scale((-8+iconsize)-(id*iconsize)))
addon.slots[id] = frame
return frame
end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
title:SetFont(STANDARD_TEXT_FONT, 13, "OUTLINE")
title:SetPoint("BOTTOMLEFT", addon, "TOPLEFT", 4, 4)
 
addon:SetScript("OnMouseDown", function(self) if(IsAltKeyDown()) then self:StartMoving() end end)
addon:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
addon:SetScript("OnHide", function(self)
StaticPopup_Hide"CONFIRM_LOOT_DISTRIBUTION"
CloseLoot()
end)
addon:SetMovable(true)
addon:RegisterForClicks"anyup"
 
addon:SetParent(UIParent)
addon:SetUserPlaced(true)
addon:SetPoint("TOPLEFT", 0, -104)
addon:SetWidth(256)
addon:SetHeight(64)
addon:SetBackdropColor(0.1, 0.1, 0.1, 0.8)
addon:SetBackdropBorderColor(0, 0, 0)
 
E.EuiSetTemplate(addon)
E.EuiCreateShadow(addon)
 
addon:SetClampedToScreen(true)
addon:SetClampRectInsets(0, 0, 14, 0)
addon:SetHitRectInsets(0, 0, -14, 0)
addon:SetFrameStrata"HIGH"
addon:SetToplevel(true)
 
addon.slots = {}
addon.LOOT_OPENED = function(self, event, autoloot)
self:Show()
 
if(not self:IsShown()) then
CloseLoot(not autoLoot)
end
 
local items = GetNumLootItems()
 
if(IsFishingLoot()) then
title:SetText(L.fish)
elseif(not UnitIsFriend("player", "target") and UnitIsDead"target") then
title:SetText(UnitName"target")
else
title:SetText(LOOT)
end
 
-- Blizzard uses strings here
if(GetCVar("lootUnderMouse") == "1") then
local x, y = GetCursorPosition()
x = x / self:GetEffectiveScale()
y = y / self:GetEffectiveScale()
 
self:ClearAllPoints()
self:SetPoint("TOPLEFT", nil, "BOTTOMLEFT", x-40, y+20)
self:GetCenter()
self:Raise()
end
 
local m, w, t = 0, 0, title:GetStringWidth()
if(items > 0) then
for i=1, items do
local slot = addon.slots[i] or createSlot(i)
local texture, item, quantity, quality, locked = GetLootSlotInfo(i)
local color = ITEM_QUALITY_COLORS[quality]
 
if(LootSlotIsCoin(i)) then
item = item:gsub("\n", ", ")
end
 
if(quantity > 1) then
slot.count:SetText(quantity)
slot.count:Show()
else
slot.count:Hide()
end
 
if(quality > 1) then
slot.drop:SetVertexColor(color.r, color.g, color.b)
slot.drop:Show()
else
slot.drop:Hide()
end
 
slot.quality = quality
slot.name:SetText(item)
slot.name:SetTextColor(color.r, color.g, color.b)
slot.icon:SetTexture(texture)
 
m = math.max(m, quality)
w = math.max(w, slot.name:GetStringWidth())
 
slot:Enable()
slot:Show()
end
else
local slot = addon.slots[1] or createSlot(1)
local color = ITEM_QUALITY_COLORS[0]
 
slot.name:SetText(L.empty)
slot.name:SetTextColor(color.r, color.g, color.b)
slot.icon:SetTexture[[Interface\Icons\INV_Misc_Herb_AncientLichen]]
 
items = 1
w = math.max(w, slot.name:GetStringWidth())
 
slot.count:Hide()
slot.drop:Hide()
slot:Disable()
slot:Show()
end
 
 
w = w + 60
t = t + 5
 
local color = ITEM_QUALITY_COLORS[m]
self:SetBackdropBorderColor(color.r, color.g, color.b, .8)
self:SetHeight(math.max((items*iconsize)+16), 20)
self:SetWidth(math.max(w, t))
end
 
addon.LOOT_SLOT_CLEARED = function(self, event, slot)
if(not self:IsShown()) then return end
 
addon.slots[slot]:Hide()
 
end
 
addon.LOOT_CLOSED = function(self)
StaticPopup_Hide"LOOT_BIND"
self:Hide()
 
for _, v in pairs(self.slots) do
v:Hide()
end
end
 
addon.OPEN_MASTER_LOOT_LIST = function(self)
ToggleDropDownMenu(1, nil, GroupLootDropDown, addon.slots[ss], 0, 0)
end
 
addon.UPDATE_MASTER_LOOT_LIST = function(self)
UIDropDownMenu_Refresh(GroupLootDropDown)
end
 
addon:SetScript("OnEvent", function(self, event, ...)
self[event](self, event, ...)
end)
 
addon:RegisterEvent"LOOT_OPENED"
addon:RegisterEvent"LOOT_SLOT_CLEARED"
addon:RegisterEvent"LOOT_CLOSED"
addon:RegisterEvent"OPEN_MASTER_LOOT_LIST"
addon:RegisterEvent"UPDATE_MASTER_LOOT_LIST"
addon:Hide()
 
-- Fuzz
LootFrame:UnregisterAllEvents()
table.insert(UISpecialFrames, "EuiLoot")
 
function _G.GroupLootDropDown_GiveLoot(self)
if ( sq >= MASTER_LOOT_THREHOLD ) then
local dialog = StaticPopup_Show("CONFIRM_LOOT_DISTRIBUTION", ITEM_QUALITY_COLORS[sq].hex..sn..FONT_COLOR_CODE_CLOSE, self:GetText())
if (dialog) then
dialog.data = self.value
end
else
GiveMasterLoot(ss, self.value)
end
CloseDropDownMenus()
end
 
StaticPopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].OnAccept = function(self, data)
GiveMasterLoot(ss, data)
end
Eui/element/map.lua New file
0,0 → 1,50
WorldM = CreateFrame("Frame")
 
-- Player Text Object
local Player = WorldMapButton:CreateFontString(nil, "ARTWORK")
Player:SetPoint("BOTTOM", WorldMapButton, -50, -21)
Player:SetFontObject("GameFontNormal")
Player:SetTextColor(1, 1, 1)
 
-- Divider
local Divider = WorldMapButton:CreateFontString(nil, "ARTWORK")
Divider:SetPoint("BOTTOM", WorldMapButton, 0, -21)
Divider:SetFontObject("GameFontNormal")
Divider:SetTextColor(1, 1, 1)
Divider:SetText("|")
 
-- Cursor Text Object
local Cursor = WorldMapButton:CreateFontString(nil, "ARTWORK")
Cursor:SetPoint("BOTTOM", WorldMapButton, 50, -21)
Cursor:SetFontObject("GameFontNormal")
Cursor:SetTextColor(1, 1, 1)
 
WorldMapButton:HookScript("OnUpdate", function(self, u)
-- Player Position
local PlayerX, PlayerY = GetPlayerMapPosition("player")
local mult = 10^1
PlayerX = math.floor(PlayerX*100*mult+0.5)/mult
PlayerY = math.floor(PlayerY*100*mult+0.5)/mult
Player:SetText(PlayerX.." - "..PlayerY)
 
-- Cursor Position
local cX, cY = WorldMapDetailFrame:GetCenter()
local CursorX, CursorY = GetCursorPosition()
CursorX = math.floor((((CursorX/WorldMapFrame:GetScale())-(cX-(WorldMapDetailFrame:GetWidth()/2)))/10)*mult+.05)/mult
CursorY = math.floor(((((cY+(WorldMapDetailFrame:GetHeight()/2))-(CursorY/WorldMapFrame:GetScale()))/WorldMapDetailFrame:GetHeight())*100)*mult+.05)/mult
 
if CursorX >= 100 or CursorY >= 100 or CursorX <= 0 or CursorY <= 0 then
Cursor:SetText("0 . 0")
else
Cursor:SetText(CursorX.." - "..CursorY)
end
end)
 
 
WorldMapFrame:EnableKeyboard(true)
WorldMapFrame:EnableMouse(true)
BlackoutWorld:Hide()
UIPanelWindows["WorldMapFrame"] = {area = "center"}
WorldMapFrame:HookScript("OnShow", function(self) self:SetScale(0.7) end)
 
WorldM:SetScript("OnEvent", UpdateParty)
Eui/element/chat.lua New file
0,0 → 1,906
local E,C = unpack(select(2, ...))
if not C["chat"].enable == true then return end
 
local AutoApply = true
local def_position = {"BOTTOMLEFT",UIParent,E.Scale(12),E.Scale(10)}
local chat_height = E.Scale(C["chat"].chath)
local chat_width = E.Scale(C["chat"].chatw)
local fontsize = 14
SetCVar("chatStyle", "classic")
local backdrop_tab = {
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
edgeFile = "Interface\\Buttons\\WHITE8x8",
tile = false, tileSize = 0, edgeSize = E.Scale(1),
insets = { left = -E.Scale(1), right = -E.Scale(1), top = -E.Scale(1), bottom = -E.Scale(1)}
}
--local eb_point = {"BOTTOM", -200, 180}
--local eb_width = 400
local tscol = "64C2F5"
local LinkHover = {}; LinkHover.show = {
["achievement"] = true,
["enchant"] = true,
["glyph"] = true,
["item"] = true,
["quest"] = true,
["spell"] = true,
["talent"] = true,
["unit"] = true,}
 
for i = 1, NUM_CHAT_WINDOWS do
local cf = _G['ChatFrame'..i]
if cf then
cf:SetFont(E.font, 12, "OUTLINE")
cf:SetFrameStrata("LOW")
cf:SetFrameLevel(2)
end
local tab = _G['ChatFrame'..i..'Tab']
if tab then
tab:GetFontString():SetFont(E.font, 13, "OUTLINE")
--fix for color and alpha of undocked frames
tab:GetFontString():SetTextColor(1,0.7,0)
tab:SetAlpha(1)
end
end
 
---------------- > Sticky Channels
ChatTypeInfo['SAY'].sticky = 1
ChatTypeInfo['YELL'].sticky = 0
ChatTypeInfo['EMOTE'].sticky = 0
ChatTypeInfo['PARTY'].sticky = 1
ChatTypeInfo['GUILD'].sticky = 1
ChatTypeInfo['OFFICER'].sticky = 1
ChatTypeInfo['RAID'].sticky = 1
ChatTypeInfo['RAID_WARNING'].sticky = 0
ChatTypeInfo['BATTLEGROUND'].sticky = 1
ChatTypeInfo['WHISPER'].sticky = 0
ChatTypeInfo['CHANNEL'].sticky = 1
 
---------------- > Custom timestamps color
TIMESTAMP_FORMAT_HHMM = "|cff"..tscol.."[%I:%M]|r "
TIMESTAMP_FORMAT_HHMMSS = "|cff"..tscol.."[%I:%M:%S]|r "
TIMESTAMP_FORMAT_HHMMSS_24HR = "|cff"..tscol.."[%H:%M:%S]|r "
TIMESTAMP_FORMAT_HHMMSS_AMPM = "|cff"..tscol.."[%I:%M:%S %p]|r "
TIMESTAMP_FORMAT_HHMM_24HR = "|cff"..tscol.."[%H:%M]|r "
TIMESTAMP_FORMAT_HHMM_AMPM = "|cff"..tscol.."[%I:%M %p]|r "
 
---------------- > Fading alpha
CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 1
CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 1
 
--[[ FirstFrameChat = EuiCreateFrame(UIParent,2,"BACKGROUND",true)
EuiSetTemplate(FirstFrameChat)
--FirstFrameChat:SetBackdrop(backdrop_tab)
FirstFrameChat:SetBackdropColor(.1,.1,.1,.7)
--FirstFrameChat:SetBackdropBorderColor(.3,.3,.3,1)
FirstFrameChat:SetPoint("BOTTOMLEFT",E.Scale(6),E.Scale(4))
FirstFrameChat:SetPoint("BOTTOMRIGHT",UIParent,"BOTTOMLEFT", chat_width,E.Scale(4))
FirstFrameChat:SetAlpha(1)
FirstFrameChat:SetFrameLevel(0)
FirstFrameChat:SetHeight(chat_height) ]]
 
 
---------------- > Function to move and scale chatframes
SetChat = function()
FCF_SetLocked(ChatFrame1, nil)
if LjxxuiInstallV335 ~= true then
FCF_SetChatWindowFontSize(self, ChatFrame1, fontsize)
end
ChatFrame1:ClearAllPoints()
-- ChatFrame1:SetPoint(unpack(def_position))
ChatFrame1:SetPoint("TOPLEFT", EuiLeftChatBackground, "TOPLEFT", E.Scale(2),-E.Scale(2))
ChatFrame1:SetPoint("BOTTOMRIGHT", EuiLeftChatBackground, "BOTTOMRIGHT", -E.Scale(2), E.Scale(2))
-- ChatFrame1:SetAllPoints(EuiLeftChatBackground)
ChatFrame1:SetWidth(chat_width-E.Scale(19))
ChatFrame1:SetHeight(chat_height-E.Scale(7))
ChatFrame1:SetFrameLevel(8)
ChatFrame1:SetUserPlaced(true)
for i=1,10 do local cf = _G["ChatFrame"..i] FCF_SetWindowAlpha(cf, 0) end
FCF_SavePositionAndDimensions(ChatFrame1)
FCF_SetLocked(ChatFrame1, 1)
ToggleChatColorNamesByClassGroup(true, "SAY")
ToggleChatColorNamesByClassGroup(true, "EMOTE")
ToggleChatColorNamesByClassGroup(true, "YELL")
ToggleChatColorNamesByClassGroup(true, "GUILD")
ToggleChatColorNamesByClassGroup(true, "OFFICER")
ToggleChatColorNamesByClassGroup(true, "GUILD_ACHIEVEMENT")
ToggleChatColorNamesByClassGroup(true, "ACHIEVEMENT")
ToggleChatColorNamesByClassGroup(true, "WHISPER")
ToggleChatColorNamesByClassGroup(true, "PARTY")
ToggleChatColorNamesByClassGroup(true, "PARTY_LEADER")
ToggleChatColorNamesByClassGroup(true, "RAID")
ToggleChatColorNamesByClassGroup(true, "RAID_LEADER")
ToggleChatColorNamesByClassGroup(true, "RAID_WARNING")
ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND")
ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND_LEADER")
ToggleChatColorNamesByClassGroup(true, "CHANNEL1")
ToggleChatColorNamesByClassGroup(true, "CHANNEL2")
ToggleChatColorNamesByClassGroup(true, "CHANNEL3")
ToggleChatColorNamesByClassGroup(true, "CHANNEL4")
ToggleChatColorNamesByClassGroup(true, "CHANNEL5")
end
SlashCmdList["SETCHAT"] = SetChat
SLASH_SETCHAT1 = "/setchat"
if AutoApply then
local f = CreateFrame"Frame"
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function() SetChat() end)
end
 
do
-- Buttons Hiding/moving
local kill = function(f) f:Hide() end
ChatFrameMenuButton:Hide()
ChatFrameMenuButton:SetScript("OnShow", kill)
FriendsMicroButton:Hide()
FriendsMicroButton:SetScript("OnShow", kill)
 
for i=1, 10 do
local cf = _G[format("%s%d", "ChatFrame", i)]
--fix fading
local tab = _G["ChatFrame"..i.."Tab"]
-- tab:SetAlpha(0)
-- tab.noMouseAlpha = 0
cf:SetFading(false)
_G["ChatFrame"..i.."TabLeft"]:SetTexture(nil)
_G["ChatFrame"..i.."TabMiddle"]:SetTexture(nil)
_G["ChatFrame"..i.."TabRight"]:SetTexture(nil)
_G["ChatFrame"..i.."TabSelectedMiddle"]:SetTexture(nil)
_G["ChatFrame"..i.."TabSelectedRight"]:SetTexture(nil)
_G["ChatFrame"..i.."TabSelectedLeft"]:SetTexture(nil)
_G["ChatFrame"..i.."TabHighlightLeft"]:SetTexture(nil)
_G["ChatFrame"..i.."TabHighlightRight"]:SetTexture(nil)
_G["ChatFrame"..i.."TabHighlightMiddle"]:SetTexture(nil)
 
local f = _G["ChatFrame"..i.."ButtonFrame"]
f.Show = f.Hide
f:Hide()
 
--Unlimited chatframes resizing
cf:SetMinResize(0,0)
cf:SetMaxResize(0,0)
 
--Allow the chat frame to move to the end of the screen
cf:SetClampedToScreen(false)
cf:SetClampRectInsets(0,0,0,0)
 
--EditBox Module
local ebParts = {'Left', 'Mid', 'Right'}
local eb = _G['ChatFrame'..i..'EditBox']
local cf = _G[format("%s%d", "ChatFrame", i)]
-- for _, ebPart in ipairs(ebParts) do
-- _G['ChatFrame'..i..'EditBox'..ebPart]:SetTexture(0, 0, 0, 0)
-- local ebed = _G['ChatFrame'..i..'EditBoxFocus'..ebPart]
-- ebed:SetTexture(0,0,0,0.8)
-- ebed:SetHeight(E.Scale(18))
-- end
local tex=({_G["ChatFrame"..i.."EditBox"]:GetRegions()})
tex[6]:SetAlpha(0) tex[7]:SetAlpha(0) tex[8]:SetAlpha(0) tex[9]:SetAlpha(0) tex[10]:SetAlpha(0) tex[11]:SetAlpha(0)
eb:SetAltArrowKeyMode(false)
eb:ClearAllPoints()
eb:SetPoint("BOTTOMLEFT", cf, "TOPLEFT", -E.Scale(14), 0)
--eb:SetPoint("BOTTOMLEFT", UIParent, eb_point[1], eb_point[2], eb_point[3])
eb:SetPoint("BOTTOMRIGHT", cf, "TOPRIGHT", E.Scale(12), 0)
--eb:SetPoint("BOTTOMRIGHT", UIParent, eb_point[1], eb_point[2]+eb_width, eb_point[3])
-- eb:EnableMouse(true)
 
--Remove scroll buttons
local bf = _G['ChatFrame'..i..'ButtonFrame']
bf:Hide()
bf:SetScript("OnShow", kill)
 
--Scroll to the bottom button
local function BottomButtonClick(self)
self:GetParent():ScrollToBottom();
end
local bb = _G["ChatFrame"..i.."ButtonFrameBottomButton"]
bb:SetParent(_G["ChatFrame"..i])
bb:SetHeight(E.Scale(18))
bb:SetWidth(E.Scale(18))
bb:ClearAllPoints()
bb:SetPoint("RIGHT", EuiTopChatBackground, "RIGHT", -1, 0)
bb:SetAlpha(0.4)
bb:RegisterForClicks("AnyDown")
bb.SetPoint = function() end
-- bb:SetScript("OnClick", BottomButtonClick)
bb:SetScript("OnClick", function(self, button)
if button == "LeftButton" then
BottomButtonClick(bb)
elseif button == "RightButton" then
if LFW_SHOW then
LFW_SHOW = false
DEFAULT_CHAT_FRAME:AddMessage("关闭LFW频道");
else
LFW_SHOW = true
DEFAULT_CHAT_FRAME:AddMessage("打开LFW频道");
end
end
end)
end
end
 
local editbox = CreateFrame('Button', nil, ChatFrame1EditBox)
editbox:SetBackdrop{
bgFile = E.normTex,
edgeFile = E.normTex,
tile = false, tileSize = 0, edgeSize = 1,
insets = {top = -1, left = -1, bottom = -1, right = -1},
}
--editbox:SetPoint('TOPLEFT', 'ChatFrame1EditBoxLeft', 'TOPLEFT', 12, -6)
--editbox:SetPoint('BOTTOMRIGHT', 'ChatFrame1EditBoxRight', 'BOTTOMRIGHT', -8, 6)
editbox:SetAllPoints(EuiTopChatBackground)
editbox:SetFrameLevel(ChatFrame1EditBox:GetFrameLevel()-1)
editbox:Hide()
 
local function colorize(r,g,b)
if type(r) == 'table' then
if r.r then
r,g,b = r.r, r.g, r.b
else
r,g,b = unpack(r)
end
end
if r and g and b then
editbox:SetBackdropBorderColor(r,g,b)
editbox:SetBackdropColor(r/5,g/5,b/5, 0.7)
end
end
 
hooksecurefunc('ChatEdit_UpdateHeader', function()
local type = DEFAULT_CHAT_FRAME.editBox:GetAttribute('chatType')
if ( type == 'CHANNEL' ) then
local id = GetChannelName(DEFAULT_CHAT_FRAME.editBox:GetAttribute('channelTarget'))
if id == 0 then colorize(0.5,0.5,0.5)
else colorize(ChatTypeInfo[type..id])
end
else colorize(ChatTypeInfo[type])
end
end)
 
local show_in = function(self,nf)
 
self.show_in = self:CreateAnimationGroup("In")
 
self.show_in.a = self.show_in:CreateAnimation("Translation")
self.show_in.a:SetOffset(0,-chat_height - 80)
self.show_in.a:SetDuration(0)
self.show_in.a:SetOrder(1)
 
self.show_in.b = self.show_in:CreateAnimation("Translation")
self.show_in.b:SetOffset(0,chat_height + 80)
self.show_in.b:SetDuration(.2)
self.show_in.b:SetOrder(2)
 
self.show_in.b:SetSmoothing("OUT")
 
end
 
local show_out = function(self,nf)
 
self.show_out = self:CreateAnimationGroup("OUT")
 
self.show_out.a = self.show_out:CreateAnimation("Translation")
self.show_out.a:SetOffset(0,-chat_height - 80)
self.show_out.a:SetDuration(.2)
self.show_out.a:SetOrder(1)
 
self.show_out.a:SetSmoothing("IN")
 
end
 
show_in(ChatFrame1EditBox)
show_in(editbox)
show_out(editbox)
 
editbox.show_out:SetScript("OnFinished",function() editbox:Hide() end)
 
ChatFrame1EditBox:HookScript("OnShow", function(self)
editbox:Show()
editbox.show_out:Stop()
editbox.show_in:Play()
self.show_in:Play()
end)
 
ChatFrame1EditBox:HookScript("OnHide", function(self)
editbox.show_in:Stop()
self.show_in:Stop()
editbox.show_out:Play()
end)
 
 
---------------- > TellTarget function
local function telltarget(msg)
if not UnitExists("target") or not (msg and msg:len()>0) or not UnitIsFriend("player","target") then return end
local name, realm = UnitName("target")
if realm and not UnitIsSameServer("player", "target") then
name = ("%s-%s"):format(name, realm)
end
SendChatMessage(msg, "WHISPER", nil, name)
end
SlashCmdList["TELLTARGET"] = telltarget
SLASH_TELLTARGET1 = "/tt"
SLASH_TELLTARGET2 = "/ее"
SLASH_TELLTARGET3 = "/wt"
 
---------------- > Channel names
local gsub = _G.string.gsub
local time = _G.time
local newAddMsg = {}
local chn, rplc
do
CHAT_BATTLEGROUND_GET = "|Hchannel:Battleground|h[BG]|h %s:\32"
CHAT_BATTLEGROUND_LEADER_GET = "|Hchannel:Battleground|h[BGL]|h %s:\32"
CHAT_GUILD_GET = "|Hchannel:Guild|h[G]|h %s:\32"
CHAT_PARTY_GET = "|Hchannel:Party|h[P]|h %s:\32"
CHAT_PARTY_LEADER_GET = "|Hchannel:party|h[PL]|h %s:\32"
CHAT_PARTY_GUIDE_GET = "|Hchannel:PARTY|h[PL]|h %s:\32"
CHAT_OFFICER_GET = "|Hchannel:o|h[O]|h %s:\32"
CHAT_RAID_GET = "|Hchannel:raid|h[R]|h %s:\32"
CHAT_RAID_LEADER_GET = "|Hchannel:raid|h[RL]|h %s:\32"
CHAT_RAID_WARNING_GET = "[RW] %s:\32"
CHAT_WHISPER_INFORM_GET = "to %s: "
CHAT_WHISPER_GET = "from %s: "
CHAT_SAY_GET = "%s:\32"
CHAT_YELL_GET = "%s:\32"
CHAT_BN_WHISPER_GET = "from %s:\32"
CHAT_BN_WHISPER_INFORM_GET = "to %s:\32"
CHAT_BN_WHISPER_SEND = "Tell %s:\32"
rplc = {
"[GEN]", --General
"[T]", --Trade
"[WD]", --WorldDefense
"[LD]", --LocalDefense
"[LFG]", --LookingForGroup
"[GR]", --GuildRecruitment
}
local L = GetLocale()
if L == "ruRU" then --Russian
chn = {
"%[%d+%. Общий.-%]",
"%[%d+%. Торговля.-%]",
"%[%d+%. Оборона: глобальный%]", --Defense: Global
"%[%d+%. Оборона.-%]", --Defense: Zone
"%[%d+%. Поиск спутников%]",
"%[%d+%. Гильдии.-%]",
}
elseif L == "deDE" then --German
chn = {
"%[%d+%. Allgemein.-%]",
"%[%d+%. Handel.-%]",
"%[%d+%. Weltverteidigung%]",
"%[%d+%. LokaleVerteidigung.-%]",
"%[%d+%. SucheNachGruppe%]",
"%[%d+%. Gildenrekrutierung.-%]",
}
else --English & any other language not translated above.
chn = {
"%[%d+%. General.-%]",
"%[%d+%. Trade.-%]",
"%[%d+%. WorldDefense%]",
"%[%d+%. LocalDefense.-%]",
"%[%d+%. LookingForGroup%]",
"%[%d+%. GuildRecruitment.-%]",
}
end
end
local function AddMessage(frame, text, ...)
for i = 1, 6 do
text = gsub(text, chn[i], rplc[i])
end
if CHAT_TIMESTAMP_FORMAT and not text:find("|r") then
text = BetterDate(CHAT_TIMESTAMP_FORMAT, time())..text
end
text = gsub(text, "%[(%d0?)%. .-%]", "[%1]") --custom channels
return newAddMsg[frame:GetName()](frame, text, ...)
end
do
for i = 1, 5 do
if i ~= 2 then -- skip combatlog
local f = _G[format("%s%d", "ChatFrame", i)]
newAddMsg[format("%s%d", "ChatFrame", i)] = f.AddMessage
f.AddMessage = AddMessage
end
end
end
 
---------------- > Enable/Disable mouse for editbox
--[[ eb_mouseon = function()
for i =1, 10 do
local eb = _G['ChatFrame'..i..'EditBox']
eb:EnableMouse(true)
end
end
eb_mouseoff = function()
for i =1, 10 do
local eb = _G['ChatFrame'..i..'EditBox']
eb:EnableMouse(false)
end
end
hooksecurefunc("ChatFrame_OpenChat",eb_mouseon)
hooksecurefunc("ChatEdit_SendText",eb_mouseoff)
]]
 
---------------- > ChatCopy Module
local lines = {}
do
--Create Frames/Objects
local frame = CreateFrame("Frame", "BCMCopyFrame", UIParent)
frame:SetBackdrop({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = {left = 3, right = 3, top = 5, bottom = 3}})
frame:SetBackdropColor(0,0,0,1)
frame:SetWidth(E.Scale(500))
frame:SetHeight(E.Scale(400))
frame:SetPoint("CENTER", UIParent, "CENTER")
frame:Hide()
frame:SetFrameStrata("DIALOG")
E.EuiSetTemplate(frame)
E.EuiCreateShadow(frame)
local scrollArea = CreateFrame("ScrollFrame", "BCMCopyScroll", frame, "UIPanelScrollFrameTemplate")
scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", E.Scale(8), -E.Scale(30))
scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -E.Scale(30), E.Scale(8))
 
local editBox = CreateFrame("EditBox", "BCMCopyBox", frame)
editBox:SetMultiLine(true)
editBox:SetMaxLetters(99999)
editBox:EnableMouse(true)
editBox:SetAutoFocus(false)
editBox:SetFontObject(ChatFontNormal)
editBox:SetWidth(E.Scale(400))
editBox:SetHeight(E.Scale(270))
editBox:SetScript("OnEscapePressed", function(f) f:GetParent():GetParent():Hide() f:SetText("") end)
scrollArea:SetScrollChild(editBox)
 
local close = CreateFrame("Button", "BCMCloseButton", frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", frame, "TOPRIGHT")
local copyFunc = function(frame, btn)
local cf = _G[format("%s%d", "ChatFrame", frame:GetID())]
local _, size = cf:GetFont()
FCF_SetChatWindowFontSize(cf, cf, 0.01)
local ct = 1
for i = select("#", cf:GetRegions()), 1, -1 do
local region = select(i, cf:GetRegions())
if region:GetObjectType() == "FontString" then
lines[ct] = tostring(region:GetText())
ct = ct + 1
end
end
local lineCt = ct - 1
local text = table.concat(lines, "\n", 1, lineCt)
FCF_SetChatWindowFontSize(cf, cf, size)
BCMCopyFrame:Show()
BCMCopyBox:SetText(text)
BCMCopyBox:HighlightText(0)
wipe(lines)
end
local hintFunc = function(frame)
GameTooltip:SetOwner(frame, "ANCHOR_TOP")
if SHOW_NEWBIE_TIPS == "1" then
GameTooltip:AddLine(CHAT_OPTIONS_LABEL, 1, 1, 1)
GameTooltip:AddLine(NEWBIE_TOOLTIP_CHATOPTIONS, nil, nil, nil, 1)
end
GameTooltip:AddLine((SHOW_NEWBIE_TIPS == "1" and "\n" or "").."|TInterface\\Buttons\\UI-GuildButton-OfficerNote-Disabled:27|tDouble-click to copy chat.", 1, 0, 0)
GameTooltip:Show()
end
for i = 1, 10 do
local tab = _G[format("%s%d%s", "ChatFrame", i, "Tab")]
tab:SetScript("OnDoubleClick", copyFunc)
tab:SetScript("OnEnter", hintFunc)
end
end
 
---------------- > Show tooltips when hovering a link in chat (credits to Adys for his LinkHover)
function LinkHover.OnHyperlinkEnter(_this, linkData, link)
local t = linkData:match("^(.-):")
if LinkHover.show[t] and IsAltKeyDown() then
ShowUIPanel(GameTooltip)
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR")
GameTooltip:SetHyperlink(link)
GameTooltip:Show()
end
end
function LinkHover.OnHyperlinkLeave(_this, linkData, link)
local t = linkData:match("^(.-):")
if LinkHover.show[t] then
HideUIPanel(GameTooltip)
end
end
local function main()
for i = 1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
frame:SetScript("OnHyperlinkEnter", LinkHover.OnHyperlinkEnter)
frame:SetScript("OnHyperlinkLeave", LinkHover.OnHyperlinkLeave)
end
end
main()
 
if C["chat"].hidejunk == true then
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL_JOIN", function(msg) return true end)
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL_LEAVE", function(msg) return true end)
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL_NOTICE", function(msg) return true end)
ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", function(msg) return true end)
ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", function(msg) return true end)
DUEL_WINNER_KNOCKOUT, DUEL_WINNER_RETREAT = "", ""
DRUNK_MESSAGE_ITEM_OTHER1 = "", ""
DRUNK_MESSAGE_ITEM_OTHER2 = "", ""
DRUNK_MESSAGE_ITEM_OTHER3 = "", ""
DRUNK_MESSAGE_ITEM_OTHER4 = "", ""
DRUNK_MESSAGE_OTHER1 = "", ""
DRUNK_MESSAGE_OTHER2 = "", ""
DRUNK_MESSAGE_OTHER3 = "", ""
DRUNK_MESSAGE_OTHER4 = "", ""
DRUNK_MESSAGE_ITEM_SELF1 = "", ""
DRUNK_MESSAGE_ITEM_SELF2 = "", ""
DRUNK_MESSAGE_ITEM_SELF3 = "", ""
DRUNK_MESSAGE_ITEM_SELF4 = "", ""
DRUNK_MESSAGE_SELF1 = "", ""
DRUNK_MESSAGE_SELF2 = "", ""
DRUNK_MESSAGE_SELF3 = "", ""
DRUNK_MESSAGE_SELF4 = "", ""
RAID_MULTI_LEAVE = "", ""
RAID_MULTI_JOIN = "", ""
ERR_PET_LEARN_ABILITY_S = "", ""
ERR_PET_LEARN_SPELL_S = "", ""
ERR_PET_SPELL_UNLEARNED_S = "", ""
end
 
--TAB切换频道模块
function ChatEdit_CustomTabPressed()
if (this:GetAttribute("chatType") == "SAY") then
if Ash_Tabcus then
this:SetAttribute("chatType", "CHANNEL");
this.text = "/"..Ash_Tabcus.." "..this.text
ChatEdit_UpdateHeader(this);
elseif (GetNumPartyMembers()>0) then
this:SetAttribute("chatType", "PARTY");
ChatEdit_UpdateHeader(this);
elseif (GetNumRaidMembers()>0) then
this:SetAttribute("chatType", "RAID");
ChatEdit_UpdateHeader(this);
elseif (GetNumBattlefieldScores()>0) then
this:SetAttribute("chatType", "BATTLEGROUND");
ChatEdit_UpdateHeader(this);
elseif (IsInGuild()) then
this:SetAttribute("chatType", "GUILD");
ChatEdit_UpdateHeader(this);
else
return;
end
elseif (this:GetAttribute("chatType") == "PARTY") then
if (GetNumRaidMembers()>0) then
this:SetAttribute("chatType", "RAID");
ChatEdit_UpdateHeader(this);
elseif (GetNumBattlefieldScores()>0) then
this:SetAttribute("chatType", "BATTLEGROUND");
ChatEdit_UpdateHeader(this);
elseif (IsInGuild()) then
this:SetAttribute("chatType", "GUILD");
ChatEdit_UpdateHeader(this);
else
this:SetAttribute("chatType", "SAY");
ChatEdit_UpdateHeader(this);
end
elseif (this:GetAttribute("chatType") == "RAID") then
if (GetNumBattlefieldScores()>0) then
this:SetAttribute("chatType", "BATTLEGROUND");
ChatEdit_UpdateHeader(this);
elseif (IsInGuild()) then
this:SetAttribute("chatType", "GUILD");
ChatEdit_UpdateHeader(this);
else
this:SetAttribute("chatType", "SAY");
ChatEdit_UpdateHeader(this);
end
elseif (this:GetAttribute("chatType") == "BATTLEGROUND") then
if (IsInGuild) then
this:SetAttribute("chatType", "GUILD");
ChatEdit_UpdateHeader(this);
else
this:SetAttribute("chatType", "SAY");
ChatEdit_UpdateHeader(this);
end
elseif (this:GetAttribute("chatType") == "GUILD") then
this:SetAttribute("chatType", "SAY");
ChatEdit_UpdateHeader(this);
elseif (this:GetAttribute("chatType") == "CHANNEL") then
if (GetNumPartyMembers()>0) then
this:SetAttribute("chatType", "PARTY");
ChatEdit_UpdateHeader(this);
elseif (GetNumRaidMembers()>0) then
this:SetAttribute("chatType", "RAID");
ChatEdit_UpdateHeader(this);
elseif (GetNumBattlefieldScores()>0) then
this:SetAttribute("chatType", "BATTLEGROUND");
ChatEdit_UpdateHeader(this);
elseif (IsInGuild()) then
this:SetAttribute("chatType", "GUILD");
ChatEdit_UpdateHeader(this);
else
this:SetAttribute("chatType", "SAY");
ChatEdit_UpdateHeader(this);
end
end
end
 
---------------- > Chat Scroll Module
hooksecurefunc('FloatingChatFrame_OnMouseScroll', function(self, dir)
if dir > 0 then
if IsShiftKeyDown() then
self:ScrollToTop()
elseif IsControlKeyDown() then
--only need to scroll twice because of blizzards scroll
self:ScrollUp()
self:ScrollUp()
end
elseif dir < 0 then
if IsShiftKeyDown() then
self:ScrollToBottom()
elseif IsControlKeyDown() then
--only need to scroll twice because of blizzards scroll
self:ScrollDown()
self:ScrollDown()
end
end
end)
 
---------------- > afk/dnd msg filter
local data = {}
local chatEvent = function(msg)
if(data[arg2] and data[arg2] == arg1)then
return true
else
data[arg2] = arg1
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", chatEvent)
ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", chatEvent)
 
---------------- > URLCopy Module
local tlds = {
"[Cc][Oo][Mm]", "[Uu][Kk]", "[Nn][Ee][Tt]", "[Dd][Ee]", "[Ff][Rr]", "[Ee][Ss]",
"[Bb][Ee]", "[Cc][Cc]", "[Uu][Ss]", "[Kk][Oo]", "[Cc][Hh]", "[Tt][Ww]",
"[Cc][Nn]", "[Rr][Uu]", "[Gg][Rr]", "[Ii][Tt]", "[Ee][Uu]", "[Tt][Vv]",
"[Nn][Ll]", "[Hh][Uu]", "[Oo][Rr][Gg]"}
local gsub = gsub
local filterFunc = function(self, event, msg, ...)
for i=1, 21 do --Number of TLD's in tlds table
local newMsg, found = gsub(msg, "(%S-%."..tlds[i].."/?%S*)", "|cffffffff|Hurl:%1|h[%1]|h|r")
if found > 0 then
return false, newMsg, ...
end
end
local newMsg, found = gsub(msg, "(%d+%.%d+%.%d+%.%d+:?%d*/?%S*)", "|cffffffff|Hurl:%1|h[%1]|h|r")
if found > 0 then
return false, newMsg, ...
end
end
do
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_OFFICER", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", filterFunc)
ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_CONVERSATION", filterFunc)
local currentLink = nil
ChatFrame_OnHyperlinkShow = function(self, link, text, button)
if (link):sub(1, 3) == "url" then
currentLink = (link):sub(5)
StaticPopup_Show("BCMUrlCopyDialog")
return
end
SetItemRef(link, text, button, self)
end
StaticPopupDialogs["BCMUrlCopyDialog"] = {
text = "URL",
button2 = TEXT(CLOSE),
hasEditBox = 1,
hasWideEditBox = 1,
showAlert = 1,
OnShow = function(frame)
local editBox = _G[frame:GetName().."WideEditBox"]
editBox:SetText(currentLink)
currentLink = nil
editBox:SetBackdropColor(0.1,0.1,0.1,1)
editBox:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
editBox:SetFocus()
editBox:HighlightText(0)
local button = _G[frame:GetName().."Button2"]
button:ClearAllPoints()
button:SetWidth(E.Scale(200))
button:SetPoint("CENTER", editBox, "CENTER", 0, -E.Scale(30))
_G[frame:GetName().."AlertIcon"]:Hide()
end,
EditBoxOnEscapePressed = function(frame) frame:GetParent():Hide() end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,}
end
 
if C["chat"].chatbar == true then
local cbar = CreateFrame("Frame", "favchat", favchat)
cbar:SetScript("OnEvent", function(self, event, ...) self[event](self, event, ...) end)
cbar:RegisterEvent("ADDON_LOADED")
 
function cbar:W(button)
ChatFrame_OpenChat("/w ", SELECTED_DOCK_FRAME);
end
function cbar:S(button)
ChatFrame_OpenChat("/s ", SELECTED_DOCK_FRAME);
end
 
function cbar:O(button)
ChatFrame_OpenChat("/o ", SELECTED_DOCK_FRAME);
end
function cbar:G(button)
ChatFrame_OpenChat("/g ", SELECTED_DOCK_FRAME);
end
 
function cbar:R(button)
ChatFrame_OpenChat("/raid ", SELECTED_DOCK_FRAME);
end
function cbar:P(button)
ChatFrame_OpenChat("/p ", SELECTED_DOCK_FRAME);
end
 
function cbar:GT(button)
ChatFrame_OpenChat("/1 ", SELECTED_DOCK_FRAME);
end
function cbar:LGT(button)
ChatFrame_OpenChat("/2 ", SELECTED_DOCK_FRAME);
end
 
function cbar:Y(button)
ChatFrame_OpenChat("/y ", SELECTED_DOCK_FRAME);
end
function cbar:YG(button)
ChatFrame_OpenChat("/4 ", SELECTED_DOCK_FRAME);
end
local space
space = (C["chat"].chatw - 60 - 14*10) / 11
function cbar:Style()
favchat:ClearAllPoints()
favchat:SetParent(UIParent)
s = CreateFrame("Button", "s", favchat)
s:ClearAllPoints()
s:SetParent(favchat)
s:SetPoint("LEFT", EuiBottomBackground, "LEFT", space, 0)
s:SetWidth(E.Scale(14))
s:SetHeight(E.Scale(14))
E.EuiSetTemplate(s)
s:RegisterForClicks("AnyUp")
s:SetScript("OnClick", cbar.S)
stex = E.EuiSetFontn(s)
stex:SetPoint("CENTER",0,0)
stex:SetText("S")
 
w = CreateFrame("Button", "w", favchat)
w:ClearAllPoints()
w:SetParent(favchat)
w:SetPoint("LEFT", s, "RIGHT", space, 0)
w:SetWidth(E.Scale(14))
w:SetHeight(E.Scale(14))
E.EuiSetTemplate(w)
w:RegisterForClicks("AnyUp")
w:SetScript("OnClick", cbar.W)
wtex = E.EuiSetFontn(w)
wtex:SetPoint("CENTER",0,0)
wtex:SetText("W")
 
g = CreateFrame("Button", "g", favchat)
g:ClearAllPoints()
g:SetParent(favchat)
g:SetPoint("LEFT", w, "RIGHT", space, 0)
g:SetWidth(E.Scale(14))
g:SetHeight(E.Scale(14))
E.EuiSetTemplate(g)
g:RegisterForClicks("AnyUp")
g:SetScript("OnClick", cbar.G)
gtex = E.EuiSetFontn(g)
gtex:SetPoint("CENTER",0,0)
gtex:SetText("G")
 
o = CreateFrame("Button", "o", favchat)
o:ClearAllPoints()
o:SetParent(favchat)
o:SetPoint("LEFT", g, "RIGHT", space, 0)
o:SetWidth(E.Scale(14))
o:SetHeight(E.Scale(14))
E.EuiSetTemplate(o)
o:RegisterForClicks("AnyUp")
o:SetScript("OnClick", cbar.O)
otex = E.EuiSetFontn(o)
otex:SetPoint("CENTER",0,0)
otex:SetText("O")
 
r = CreateFrame("Button", "r", favchat)
r:ClearAllPoints()
r:SetParent(favchat)
r:SetPoint("LEFT", o, "RIGHT", space, 0)
r:SetWidth(E.Scale(14))
r:SetHeight(E.Scale(14))
E.EuiSetTemplate(r)
r:RegisterForClicks("AnyUp")
r:SetScript("OnClick", cbar.R)
rtex = E.EuiSetFontn(r)
rtex:SetPoint("CENTER",0,0)
rtex:SetText("R")
 
p = CreateFrame("Button", "p", favchat)
p:ClearAllPoints()
p:SetParent(favchat)
p:SetPoint("LEFT", r, "RIGHT", space, 0)
p:SetWidth(E.Scale(14))
p:SetHeight(E.Scale(14))
E.EuiSetTemplate(p)
p:RegisterForClicks("AnyUp")
p:SetScript("OnClick", cbar.P)
ptex = E.EuiSetFontn(p)
ptex:SetPoint("CENTER",0,0)
ptex:SetText("P")
 
gt = CreateFrame("Button", "gt", favchat)
gt:ClearAllPoints()
gt:SetParent(favchat)
gt:SetPoint("LEFT", p, "RIGHT", space, 0)
gt:SetWidth(E.Scale(14))
gt:SetHeight(E.Scale(14))
E.EuiSetTemplate(gt)
gt:RegisterForClicks("AnyUp")
gt:SetScript("OnClick", cbar.GT)
gttex = E.EuiSetFontn(gt)
gttex:SetPoint("CENTER",0,0)
gttex:SetText("1")
 
lgt = CreateFrame("Button", "lgt", favchat)
lgt:ClearAllPoints()
lgt:SetParent(favchat)
lgt:SetPoint("LEFT", gt, "RIGHT", space, 0)
lgt:SetWidth(E.Scale(14))
lgt:SetHeight(E.Scale(14))
E.EuiSetTemplate(lgt)
lgt:RegisterForClicks("AnyUp")
lgt:SetScript("OnClick", cbar.LGT)
lgttex = E.EuiSetFontn(lgt)
lgttex:SetPoint("CENTER",0,0)
lgttex:SetText("2")
 
yg = CreateFrame("Button", "yg", favchat)
yg:ClearAllPoints()
yg:SetParent(favchat)
yg:SetPoint("LEFT", lgt, "RIGHT", space, 0)
yg:SetWidth(E.Scale(14))
yg:SetHeight(E.Scale(14))
E.EuiSetTemplate(yg)
yg:RegisterForClicks("AnyUp")
yg:SetScript("OnClick", cbar.YG)
ygtex = E.EuiSetFontn(yg)
ygtex:SetPoint("CENTER",0,0)
ygtex:SetText("4")
 
y = CreateFrame("Button", "y", favchat)
y:ClearAllPoints()
y:SetParent(favchat)
y:SetPoint("LEFT", yg, "RIGHT", space, 0)
y:SetWidth(E.Scale(14))
y:SetHeight(E.Scale(14))
E.EuiSetTemplate(y)
y:RegisterForClicks("AnyUp")
y:SetScript("OnClick", cbar.Y)
ytex = E.EuiSetFontn(y)
ytex:SetPoint("CENTER",0,0)
ytex:SetText("Y")
 
chatbarist = true
end
 
function cbar:ADDON_LOADED(event, name)
self:Style()
end
 
end
\ No newline at end of file
Eui/element/buff.lua New file
0,0 → 1,336
-- yleaf (yaroot@gmail.com)
local E, C = unpack(select(2, ...))
local BUFFS_PER_ROW = 14
local BUFF_MAX_DISPLAY = 40
local DEBUFF_MAX_DISPLAY = 16
local ROW_SPACING = 15.5
local SPACING = 2
local ICON_SIZE = 30
local COUNT_FONT = {E.fontn, 10, 'OUTLINE'}
local DURATION_FONT = {E.fontn, 12, 'OUTLINE'}
local TEMP_POSITION = {'TOPRIGHT', '~', 'TOPLEFT', -E.Scale(10), 0}
 
local function fuk(self)
self:UnregisterAllEvents()
self:SetScript('OnUpdate', nil)
self:SetScript('OnEvent', nil)
self:Hide()
end
 
fuk(BuffFrame)
fuk(TemporaryEnchantFrame)
 
 
local buffs = CreateFrame('Frame', 'EuiBuffFrame', UIParent)
local debuffs = CreateFrame('Frame', 'EuiDebuffFrame', UIParent)
local temps = CreateFrame('Frame', 'EuiTempEnchantFrame', UIParent)
do
local rows = ceil(BUFF_MAX_DISPLAY/BUFFS_PER_ROW)
 
buffs:SetWidth(BUFFS_PER_ROW*(ICON_SIZE+SPACING) - SPACING)
buffs:SetHeight(rows*(ICON_SIZE+ROW_SPACING))
 
local d_rows = ceil(DEBUFF_MAX_DISPLAY/BUFFS_PER_ROW)
 
debuffs:SetWidth(BUFFS_PER_ROW*(ICON_SIZE+SPACING) - SPACING)
debuffs:SetHeight(d_rows*(ICON_SIZE+ROW_SPACING))
 
buffs:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", -8, -20)
debuffs:SetPoint('TOPRIGHT', buffs, 'BOTTOMRIGHT')
 
temps:SetWidth(ICON_SIZE*2 + SPACING)
temps:SetHeight(ICON_SIZE)
 
if TEMP_POSITION[2] == '~' then TEMP_POSITION[2] = buffs end
temps:SetPoint(unpack(TEMP_POSITION))
end
 
 
local function onEnter(self)
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT')
GameTooltip:SetUnitAura(PlayerFrame.unit, self.index, self.filter)
end
 
local function onLeave(self)
GameTooltip:Hide()
end
 
local function onClick(self)
CancelUnitBuff(PlayerFrame.unit, self.index, self.filter)
end
 
local function tempOnClick(self)
if self.index == 16 then
CancelItemTempEnchantment(1)
elseif self.index == 17 then
CancelItemTempEnchantment(2)
end
end
 
local function tempOnEnter(self)
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT')
GameTooltip:SetInventoryItem('player', self.index)
end
 
local function createIcon(parent)
local button = CreateFrame('Button', nil, parent)
button:Hide()
 
button:SetScript('OnEnter', onEnter)
button:SetScript('OnLeave', onLeave)
 
button:SetHeight(ICON_SIZE)
button:SetWidth(ICON_SIZE)
 
local panel = CreateFrame("Frame", nil, button)
E.EuiCreatePanel(panel, ICON_SIZE, ICON_SIZE, "CENTER", button, "CENTER", 0, 0)
panel:SetBackdropColor(0, 0, 0,1)
if C["main"].classcolortheme == true then
local r, g, b = E.RAID_CLASS_COLORS[E.MyClass].r, E.RAID_CLASS_COLORS[E.MyClass].g, E.RAID_CLASS_COLORS[E.MyClass].b
panel:SetBackdropBorderColor(r, g, b,1)
else
panel:SetBackdropBorderColor(0.31, 0.45, 0.63,1)
end
panel:SetFrameStrata(button:GetFrameStrata())
panel:SetFrameLevel(button:GetFrameLevel() - 1)
 
E.EuiCreateShadow(panel)
 
local icon = button:CreateTexture(nil, 'BACKGROUND')
icon:SetPoint("TOPLEFT", button, 2, -2)
icon:SetPoint("BOTTOMRIGHT", button, -2, 2)
icon:SetTexCoord(.07, .93, .07, .93)
button.icon = icon
 
local count = button:CreateFontString(nil, 'OVERLAY')
count:SetFont(unpack(COUNT_FONT))
count:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -1, 0)
button.count = count
 
local duration = button:CreateFontString(nil, 'OVERLAY')
duration:SetFont(unpack(DURATION_FONT))
duration:SetTextColor(1, .9, 0)
duration:SetShadowColor(0, 0, 0)
duration:SetPoint('TOP', button, 'BOTTOM', 0, 0)
button.duration = duration
 
local overlay = button:CreateTexture(nil, 'OVERLAY')
overlay:SetTexture("")
overlay:SetPoint('TOPLEFT', button, -2, 2)
overlay:SetPoint('BOTTOMRIGHT', button, 2, -2)
button.overlay = overlay
 
return button
end
 
local function sortPositions(containor, max)
for i = 1, max do
local button = containor[i]
if i == 1 then
button:SetPoint('TOPRIGHT', containor)
else
local row = (i-1)/BUFFS_PER_ROW
if row == floor(row) then
button:SetPoint('TOPRIGHT', containor[i-BUFFS_PER_ROW], 'BOTTOMRIGHT', 0, -ROW_SPACING)
else
button:SetPoint('TOPRIGHT', containor[i-1], 'TOPLEFT', -SPACING, 0)
end
end
end
end
 
for i = 1, BUFF_MAX_DISPLAY do
local button = createIcon(buffs)
buffs[i] = button
button:EnableMouse(true)
button:RegisterForClicks'RightButtonUp'
button:SetScript('OnClick', onClick)
button.index = i
button.filter = 'HELPFUL'
end
 
for i = 1, DEBUFF_MAX_DISPLAY do
local button = createIcon(buffs)
debuffs[i] = button
button.index = i
button.filter = 'HARMFUL'
end
 
for i = 1, 2 do
local button = createIcon(buffs)
temps[i] = button
button.count:Hide()
button:EnableMouse(true)
button:RegisterForClicks'RightButtonUp'
button:SetScript('OnClick', tempOnClick)
button:SetScript('OnEnter', tempOnEnter)
end
 
temps[1]:SetPoint('TOPRIGHT', temps)
temps[2]:SetPoint('TOPRIGHT', temps[1], 'TOPLEFT', -SPACING, 0)
sortPositions(buffs, BUFF_MAX_DISPLAY)
sortPositions(debuffs, DEBUFF_MAX_DISPLAY)
 
local function formatTime(s)
local min = floor(s/60)
local sec = floor(s%60)
 
if s > 600 then
--return format('|cff00ff00%dm|r', min)
return format('%dm', min), s%60
elseif s > 60 then
--return format('|cffffd100%d:%02d|r', min, sec)
return format('%d:%02d', min, sec), s - floor(s)
else
return format('|cffff0000%ds|r', sec), s - floor(s)
end
end
 
local function onUpdate(self, el)
self.total = self.total - el
if self.total > 0 then return end
local timeleft, nextUpdate = formatTime(self.expirationTime - GetTime())
self.duration:SetText(timeleft)
self.total = nextUpdate
end
 
local function updateIcon(self, icon, count, expirationTime)
self.icon:SetTexture(icon)
if count and count>1 then
self.count:SetText(count)
self.count:Show()
else
self.count:Hide()
end
 
if expirationTime and expirationTime>0 then
self.duration:Show()
self.expirationTime = expirationTime
self.total = 0
self:SetScript('OnUpdate', onUpdate)
else
self.duration:Hide()
self.expirationTime = 0
self:SetScript('OnUpdate', nil)
end
self:Show()
end
 
local function updateTempIcon(self, icon, expirationTime)
self.icon:SetTexture(icon)
if expirationTime then
self.duration:SetText(formatTime(expirationTime/1000))
self.duration:Show()
else
self.duration:Hide()
end
self:Show()
end
 
local function hide(c, i, j)
for k = i, j do
c[k]:Hide()
end
end
 
local function updateAuras()
--local unit = UnitInVehicle('player') and 'vehicle' or 'player'
local unit = PlayerFrame.unit
 
for i = 1, BUFF_MAX_DISPLAY do
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, i, 'HELPFUL')
if name then
updateIcon(buffs[i], icon, count, expirationTime)
else
hide(buffs, i, BUFF_MAX_DISPLAY)
break
end
end
 
for i = 1, DEBUFF_MAX_DISPLAY do
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, i, 'HARMFUL')
if name then
updateIcon(debuffs[i], icon, count, expirationTime)
else
hide(debuffs, i, DEBUFF_MAX_DISPLAY)
break
end
end
end
 
local function updateTemporaty()
local hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges = GetWeaponEnchantInfo()
local index = 1
if hasOffHandEnchant then
local button = temps[index]
button.index = 17
updateTempIcon(button, GetInventoryItemTexture('player', 17), offHandExpiration)
index = index + 1
end
 
if hasMainHandEnchant then
local button = temps[index]
button.index = 16
updateTempIcon(button, GetInventoryItemTexture('player', 16), mainHandExpiration)
index = index + 1
end
 
if index <= 2 then
for i = index, 2 do
temps[i]:Hide()
end
end
end
 
function buffs:UNIT_AURA(event, unit)
--if unit == (UnitInVehicle('player') and 'vehicle' or 'player') then
if unit == PlayerFrame.unit then
updateAuras()
end
end
function buffs:PLAYER_ENTERING_WORLD()
updateAuras()
updateTemporaty()
end
 
function buffs:UNIT_INVENTORY_CHANGED(event, unit)
if unit == 'player' then
updateTemporaty()
end
end
 
buffs.UNIT_EXITED_VEHICLE = buffs.UNIT_AURA
buffs.UNIT_ENTERED_VEHICLE = buffs.UNIT_AURA
 
 
hooksecurefunc('BuffFrame_Update', updateAuras)
 
buffs:SetScript('OnEvent', function(self, event, ...) self[event](self,event,...) end)
buffs:RegisterEvent('UNIT_AURA')
buffs:RegisterEvent('PLAYER_ENTERING_WORLD')
buffs:RegisterEvent('UNIT_INVENTORY_CHANGED')
buffs:RegisterEvent('UNIT_EXITED_VEHICLE')
buffs:RegisterEvent('UNIT_ENTERED_VEHICLE')
 
local total = 0
temps:SetScript('OnUpdate', function(self, el)
total = total - el
if total > 0 then return end
total = 1
updateTemporaty()
end)
 
function E.AurasPostion(frame)
 
EuiDebuffFrame:ClearAllPoints()
EuiTempEnchantFrame:ClearAllPoints()
EuiDebuffFrame:SetPoint("TOPRIGHT", EuiBuffFrame, "BOTTOMRIGHT")
EuiTempEnchantFrame:SetPoint("TOPRIGHT", EuiBuffFrame, "TOPLEFT", -E.Scale(10), 0)
 
if E.Movers["AurasMover"]["moved"] ~= true then
AurasMover:ClearAllPoints()
AurasMover:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", E.Scale(-8), -20)
end
 
end
E.CreateMover(EuiBuffFrame, "AurasMover", "玩家BUFF/DEBUFF", false, E.AurasPostion)
\ No newline at end of file
Eui/unitframe/aura.lua New file
0,0 → 1,118
local E, C = unpack(select(2, ...))
if not C["raid"].raidaurawatch == true then return end
 
 
E.buffids = {
PRIEST = {
{6788, "TOPLEFT", {1, 0, 0}, true}, -- 虛弱靈魂
{48113, "TOPRIGHT", {0.2, 0.7, 0.2}}, -- 癒合禱言
{48068, "BOTTOMLEFT", {0.4, 0.7, 0.2}}, -- 恢復
{48066, "BOTTOMRIGHT", {0.81, 0.85, 0.1}, true}, -- 真言術:盾
},
DRUID = {
{48440, "TOPLEFT", {0.8, 0.4, 0.8}}, -- 回春術
{48443, "TOPRIGHT", {0.2, 0.8, 0.2}}, -- 癒合
{48450, "BOTTOMLEFT", {0.4, 0.8, 0.2}}, -- 生命之花
{53249, "BOTTOMRIGHT", {0.8, 0.4, 0}}, -- 野性痊癒
},
PALADIN = {
{53563, "TOPLEFT", {0.7, 0.3, 0.7}}, -- 聖光信標
{53601, "TOPRIGHT", {0.4, 0.7, 0.2}}, -- 崇聖護盾
},
SHAMAN = {
{61301, "TOPLEFT", {0.7, 0.3, 0.7}}, -- 激流
{49284, "TOPRIGHT", {0.2, 0.7, 0.2}}, -- 大地之盾
{16237, "BOTTOMLEFT", {0.4, 0.7, 0.2}}, -- 先祖堅韌
{52000, "BOTTOMRIGHT", {0.7, 0.4, 0}}, -- 大地生命
},
ALL = {
-- {2893, "RIGHT", {0, 1, 0}}, -- 驅毒術
{23333, "LEFT", {1, 0, 0}}, -- 戰歌旗幟
},
}
 
-- Raid debuffs
E.debuffids = {
-- Naxxramas
27808, -- Frost Blast
32407, -- Strange Aura
28408, -- Chains of Kel'Thuzad
 
-- Ulduar
66313, -- Fire Bomb
63134, -- Sara's Blessing
62717, -- Slag Pot
63018, -- Searing Light
64233, -- Gravity Bomb
63495, -- Static Disruption
 
-- Trial of the Crusader
66406, -- Snobolled!
67574, -- Pursued by Anub'arak
68510, -- Penetrating Cold
67651, -- Arctic Breath
68127, -- Legion Flame
67049, -- Incinerate Flesh
66869, -- Burning Bile
66823, -- Paralytic Toxin
 
 
-- 冰冠城塞
71224, -- 突變感染
71822, -- 暗影共鳴
70447, -- 暴躁軟泥怪黏著
72293, -- 墮落勇士印記
72448, -- 血魄符文
71473, -- 血腥女王精華
71624, -- 極樂斬擊
70923, -- 失控狂亂
70588, -- 鎮壓
71738, -- 腐敗
71733, -- 酸液爆發
72108, -- 死亡凋零
71289, -- 支配心智
69762, -- 無束魔法
69651, -- 致傷打擊
69065, -- 被刺穿
71218, -- 污穢毒氣
72442, -- 沸血
72769, -- 血魄氣息
69279, -- 氣體孢子
70949, -- 血腥女王精華
72151, -- 狂亂嗜血
71474, -- 狂亂嗜血
71340, -- 暗殞契印
72985, -- 群聚暗影
71267, -- 群聚暗影
71264, -- 群聚暗影
71807, -- 激光
70873, -- 翡翠精力
71941, -- H绿龙-扭曲梦魇-感谢网友Kio提供。
71283, -- 臟汁噴灑
69766, -- 不穩定
70126, -- 冰霜信標
70157, -- 寒冰之墓
71056, -- 冰息術
70106, -- 徹骨之寒
70128, -- 秘能連擊
73785, -- 亡域瘟疫
73779, -- 寄生
73800, -- 靈魂厲嘯
73797, -- 靈魂收割者
73708, -- 汙染
74322, -- 割取的靈魂
72855, -- H教授疾病
 
-- 晶紅聖所
74502, -- 衰弱烙印
75887, -- 熾炎光環
74562, -- 熾熱燃灼
74567, -- 燃灼印記
74792, -- 靈魂耗損
74795, -- 耗損印記
 
-- Other debuff
6215, -- Fear
67479, -- Impale
--20375, -- 骑士命令圣印测试
}
\ No newline at end of file
Eui/unitframe/unitframe.xml New file
0,0 → 1,18
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="plugin\aurawatch.lua"/>
<Script file="plugin\debuffhighlight.lua"/>
<Script file="plugin\reputation.lua"/>
<Script file="plugin\threat.lua"/>
<Script file="plugin\totem.lua"/>
<Script file="plugin\readycheck.lua"/>
<Script file="plugin\combatfeedback.lua"/>
<Script file="plugin\PowerSpark.lua"/>
<Script file="plugin\swing.lua"/>
<Script file="unitframe1.lua"/>
<Script file="unitframe2.lua"/>
<Script file="unitframe3.lua"/>
<Script file="unitframe4.lua"/>
<Script file="aura.lua"/>
<Script file="Clicksets.lua"/>
<Script file="raid.lua"/>
</Ui>
\ No newline at end of file
Eui/unitframe/unitframe1.lua New file
0,0 → 1,1261
local E, C = unpack(select(2, ...))
--[[
Title: oUF_Ljxx
Version: 30200
Requires: oUF 1.3.x
Credits: cadcamzy@hotmail.com
]]--
if C["unitframe"].aaaaunit ~= 1 then return end
local pty = 300 --头像基准高度300
local ptx = 250 --玩家与目标间的间隔500/2
--if C["unitframe"].playerx >0 then ptx = C["unitframe"].playerx end
--if C["unitframe"].playery >0 then pty = C["unitframe"].playery end
--if C["raid"].grid == true then pty = pty + 74 end
 
local playerwidth, petwidth, totwidth, focuswidth, partywidth = 230, 130, 130, 100, 180
local playerheight, petheight, totheight, focuswheight, partyheight = 36, 36, 22, 22, 28
 
if C["unitframe"].playerwidth >0 then playerwidth = C["unitframe"].playerwidth end
if C["unitframe"].petwidth >0 then petwidth = C["unitframe"].petwidth end
if C["unitframe"].totwidth >0 then totwidth = C["unitframe"].totwidth end
if C["unitframe"].focuswidth >0 then focuswidth = C["unitframe"].focuswidth end
focuswidth = (playerwidth-8) / 2
if C["unitframe"].playerheight >0 then playerheight = C["unitframe"].playerheight end
if C["unitframe"].petheight >0 then petheight = C["unitframe"].petheight end
if C["unitframe"].totheight >0 then totheight = C["unitframe"].totheight end
if C["unitframe"].focusheight >0 then focusheight = C["unitframe"].focusheight end
 
if C["raid"].grid == true then
ptx = (C["raid"].gridw * 5 + 20) / 2 + 4
pty = C["raid"].gridh * 5 + 20 + C["raid"].gridheight
 
else
ptx = totwidth / 2 + 8
pty = petheight + 162 + 23 + C["actionbar"].petbuttonsize + C["actionbar"].buttonspacing*2
end
 
local _, class = UnitClass('player')
local font = STANDARD_TEXT_FONT
local fontsize = 12
local fontsizesmall = 9
 
local TEXTURE = [[Interface\AddOns\Eui\media\nameTex]]
local BACKDROP = {
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
insets = {top = -1, left = -1, bottom = -1, right = -1},
}
local SHADOWS = {
edgeFile = "Interface\\AddOns\\Eui\\media\\glowTex",
edgeSize = 4,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
}
 
oUF.colors.class = {
["DEATHKNIGHT"] = { 196/255, 30/255, 60/255 },
["DRUID"] = { 255/255, 125/255, 10/255 },
["HUNTER"] = { 171/255, 214/255, 116/255 },
["MAGE"] = { 104/255, 205/255, 255/255 },
["PALADIN"] = { 245/255, 140/255, 186/255 },
["PRIEST"] = { 212/255, 212/255, 212/255 },
["ROGUE"] = { 255/255, 243/255, 82/255 },
["SHAMAN"] = { 41/255, 79/255, 155/255 },
["WARLOCK"] = { 148/255, 130/255, 201/255 },
["WARRIOR"] = { 199/255, 156/255, 110/255 },
}
 
oUF.colors.power = {
["MANA"] = {26/255, 139/255, 255/255},
["RAGE"] = {255/255, 26/255, 48/255},
["FOCUS"] = {80/255, 185/255, 230/255},
["ENERGY"] = {255/255, 225/255, 26/255},
["HAPPINESS"] = {0.00, 1.00, 1.00},
["RUNES"] = {0.50, 0.50, 0.50},
["RUNIC_POWER"] = {0.00, 0.82, 1.00},
["AMMOSLOT"] = {0.80, 0.60, 0.00},
["FUEL"] = {0.0, 0.55, 0.5},
["HOLY_POWER"] = {0.96, 0.55, 0.73},
["SOUL_SHARDS"] = {117/255, 82/255, 221/255},
}
 
oUF.colors.happiness = {
[1] = {182/225, 34/255, 32/255},
[2] = {220/225, 180/225, 52/225},
[3] = {143/255, 194/255, 32/255},
}
 
oUF.colors.reaction = {
[1] = {182/255, 34/255, 32/255},
[2] = {182/255, 34/255, 32/255},
[3] = {182/255, 92/255, 32/255},
[4] = {220/225, 180/255, 52/255},
[5] = {143/255, 194/255, 32/255},
[6] = {143/255, 194/255, 32/255},
[7] = {143/255, 194/255, 32/255},
[8] = {143/255, 194/255, 32/255},
}
 
oUF.colors.runes = {
{196/255, 30/255, 58/255};
{173/255, 217/255, 25/255};
{35/255, 127/255, 255/255};
{178/255, 53/255, 240/255};
}
 
 
local menu = function(self)
local unit = self.unit:sub(1, -2)
local cunit = self.unit:gsub("^%l", string.upper)
 
if(cunit == 'Vehicle') then
cunit = 'Pet'
end
 
 
if(unit == "party") then
ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
elseif(_G[cunit.."FrameDropDown"]) then
ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
end
end
 
local function hex(r, g, b)
if(type(r) == 'table') then
if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
end
return string.format('|cff%02x%02x%02x', r * 255, g * 255, b * 255)
end
 
local function truncate(value)
if(value >= 1e6) and (not C["unitframe"].totalhpmp == true) then
-- return gsub(format('%.1fm', value / 1e6), '%.?0+([km])$', '%1')
return ("%.1fm"):format(value / 1e6)
elseif(value >= 1e3) and (not C["unitframe"].totalhpmp == true) then
-- return gsub(format('%.0fk', value / 1e3), '%.?0+([km])$', '%1')
return ("%.1fk"):format(value / 1e3)
elseif C["unitframe"].totalhpmp == true then
return value
else
return value
end
end
 
local function ColourGradient(perc)
if perc <= 0.5 then
return 255, perc*510, 0
else
return 510 - perc*510, 255, 0
end
end
 
 
 
--[[
tags
]]--
 
oUF.Tags['name'] = function(unit)
 
local c = (not UnitIsConnected(unit)) and oUF.colors.disconnected or
(not UnitIsPlayer(unit)) and oUF.colors.reaction[UnitReaction(unit, 'player')] or
(UnitFactionGroup(unit) and UnitIsEnemy(unit, 'player') and UnitIsPVP(unit)) and {1, 0, 0} or {1, 1, 1}
local cn = oUF.colors.class[select(2, UnitClass(unit))] or {1,1,1}
if UnitIsPlayer(unit) ~= 1 then cn = {1,.9,0} end
if C["unitframe"].colorClassName == true then
return format('|cff%02x%02x%02x%s|r', cn[1] * 255, cn[2] * 255, cn[3] * 255, E.utf8sub(UnitName(unit),7,false))
else
return format('|cff%02x%02x%02x%s|r', c[1] * 255, c[2] * 255, c[3] * 255, E.utf8sub(UnitName(unit), 7, false))
end
end
oUF.TagEvents['name'] = 'UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION'
 
oUF.Tags['shortname'] = function(unit)
 
local c = (not UnitIsConnected(unit)) and oUF.colors.disconnected or
(not UnitIsPlayer(unit)) and oUF.colors.reaction[UnitReaction(unit, 'player')] or
(UnitFactionGroup(unit) and UnitIsEnemy(unit, 'player') and UnitIsPVP(unit)) and {1, 0, 0} or {1, 1, 1}
local cn = oUF.colors.class[select(2, UnitClass(unit))] or {1,1,1}
if UnitIsPlayer(unit) ~= 1 then cn = {1,.9,0} end
if C["unitframe"].colorClassName == true then
return format('|cff%02x%02x%02x%s|r', cn[1] * 255, cn[2] * 255, cn[3] * 255, E.utf8sub(UnitName(unit),3,false))
else
return format('|cff%02x%02x%02x%s|r', c[1] * 255, c[2] * 255, c[3] * 255, E.uft8sub(UnitName(unit),3,false))
end
end
oUF.TagEvents['shortname'] = 'UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION'
 
 
oUF.Tags['difficulty'] = function(unit)
local level = UnitLevel(unit);
return UnitCanAttack('player', unit) and hex(GetQuestDifficultyColor((level > 0) and level or 99)) or '|cff0090ff'
end
 
oUF.TagEvents['status'] = 'UNIT_HEALTH'
oUF.Tags['status'] = function(unit)
return not UnitIsConnected(unit) and PLAYER_OFFLINE or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and DEAD
end
 
oUF.TagEvents['hp'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['hp'] = function(unit)
if unit then
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local r,g,b = ColourGradient(min/max)
return format('|cff%02x%02x%02x%s|r', r, g, b, truncate(min))
else
return ""
end
end
 
oUF.TagEvents['hpprec'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['hpperc'] = function(unit)
if unit then
local min, max = UnitHealth(unit), UnitHealthMax(unit)
return format('%s%%', floor(min/max*100))
else
return ""
end
end
 
oUF.Tags['xdpp'] = function(unit)
local min, max = UnitPower(unit, 0), UnitPowerMax(unit, 0)
return unit == 'player' and UnitPowerType(unit) ~= 0 and min ~= max and ('|cff5F9BFF%d%%|r |'):format(min / max * 100)
end
oUF.TagEvents['xdpp'] = 'UNIT_MANA UPDATE_SHAPESHIFT_FORM'
 
 
oUF.TagEvents['pp'] = oUF.TagEvents['curpp']
oUF.Tags['pp'] = function(unit)
local power = UnitPower(unit)
 
if (power > 0) then
local num, str = UnitPowerType(unit)
local c = oUF.colors.power[str]
return c and format('|cff%02x%02x%02x%s|r', c[1] * 255, c[2] * 255, c[3] * 255, truncate(power))
end
end
 
oUF.TagEvents['ppprec'] = 'UNIT_MANA UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['ppprec'] = function(unit)
if unit then
local power = UnitPower(unit)
local pmin, pmax = UnitPower(unit), UnitPowerMax(unit)
local hmin, hmax = UnitHealth(unit), UnitHealthMax(unit)
if (power > 0) then
local num, str = UnitPowerType(unit)
local c = oUF.colors.power[str]
return c and format('%s-|cff%02x%02x%02x%s|r', floor(hmin/hmax*100), c[1] * 255, c[2] * 255, c[3] * 255, floor(pmin/pmax*100))
else
return format('%s%%', floor(hmin/hmax*100))
end
else
return ""
end
end
 
--[[
functions
]]--
local function updateCombo(self, event, unit)
if(unit == PlayerFrame.unit and unit ~= self.CPoints.unit) then
self.CPoints.unit = unit
end
end
 
local PostUpdateHealth = function(Health, unit, min, max)
if(UnitIsDead(unit) or UnitIsGhost(unit)) then
Health:SetValue(0)
end
--[[ if (not unit) or (C["unitframe"].colorClass ~= true) or unit == 'player' then return end
local class = select(2, UnitClass(unit))
if C["unitframe"].colorClass == true then
if UnitIsPlayer(unit) then
Health:SetStatusBarColor(E.RAID_CLASS_COLORS[class].r, E.RAID_CLASS_COLORS[class].g, E.RAID_CLASS_COLORS[class].b)
else
Health:SetStatusBarColor(.26,.26,.26,1)
end
end ]]
end
 
local PostUpdatePower = function(Power, unit, min, max)
local power = UnitPower(unit)
if power > 0 then
if(UnitIsDead(unit) or UnitIsGhost(unit)) then
Power:SetValue(0)
end
local num, str = UnitPowerType(unit)
local c = {1,1,1}
if oUF.colors.power[str] then c = oUF.colors.power[str] end
Power:SetStatusBarColor(c[1], c[2], c[3])
end
end
 
local UpdateCB = function(self, event, unit)
if unit ~= self.unit then return end
local uclass = {r=1,g=1,b=1}
if UnitClass(unit) then
uclass.r = oUF.colors.class[select(2,UnitClass(unit))][1] or 1
uclass.g = oUF.colors.class[select(2,UnitClass(unit))][2] or 1
uclass.b = oUF.colors.class[select(2,UnitClass(unit))][3] or 1
end
if UnitIsPlayer(unit) ~= 1 then uclass = {r=1,g=.9,b=0} end
self.Castbar.Text:SetTextColor(uclass.r, uclass.g, uclass.b)
end
 
local PostCreateIcon = function(Auras, button)
 
E.EuiSetTemplate(button)
button.cd.noOCC = true
button.cd.noCooldownCount = true -- hide CDC CDs
Auras.disableCooldown = false -- hide CD spiral
Auras.showDebuffType = false -- show debuff border type color
--[[
local count = button.count
count:ClearAllPoints()
count:SetPoint"BOTTOMRIGHT"
 
 
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.icon:SetDrawLayer("BACKGROUND")
 
button.overlay:SetTexture([=[Interface\AddOns\Eui\unitframe\textures\iconborder]=])
button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT", -1, 1)
button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1, -1)
button.overlay:SetTexCoord(0.03, 0.97, 0.03, 0.97)
button.overlay.Hide = function(self) self:SetVertexColor(0, 0, 0) end
]]
button.cd:SetReverse()
button.icon:SetPoint("TOPLEFT", 2, -2)
button.icon:SetPoint("BOTTOMRIGHT", -2, 2)
button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
button.icon:SetDrawLayer('ARTWORK')
 
button.count:SetPoint("BOTTOMRIGHT", 1, 0)
button.count:SetJustifyH("RIGHT")
button.count:SetFont(E.fontn, 10, "THICKOUTLINE")
button.count:SetTextColor(0.84, 0.75, 0.65)
 
button.overlayFrame = CreateFrame("frame", nil, button, nil)
button.cd:SetFrameLevel(button:GetFrameLevel() + 1)
button.cd:ClearAllPoints()
button.cd:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2)
button.cd:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)
button.overlayFrame:SetFrameLevel(button.cd:GetFrameLevel() + 1)
button.overlay:SetParent(button.overlayFrame)
button.count:SetParent(button.overlayFrame)
 
button.remaining = E.EuiSetFontn(button, E.font, 12, "LEFT")
button.remaining:SetPoint("CENTER", 0 , 2)
 
button.Glow = CreateFrame("Frame", nil, button)
button.Glow:SetPoint("TOPLEFT", button, "TOPLEFT", -3, 3)
button.Glow:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 3, -3)
button.Glow:SetFrameStrata("BACKGROUND")
button.Glow:SetBackdrop{edgeFile = E.glowTex, edgeSize = 5, insets = {left = 0, right = 0, top = 0, bottom = 0}}
button.Glow:SetBackdropColor(0, 0, 0, 0)
button.Glow:SetBackdropBorderColor(0, 0, 0)
end
 
local FormatTime = function(s)
local day, hour, minute = 86400, 3600, 60
if s >= day then
return format("%dd", floor(s/day + 0.5)), s % day
elseif s >= hour then
return format("%dh", floor(s/hour + 0.5)), s % hour
elseif s >= minute then
if s <= minute then
return format('%d:%02d', floor(s/60), s % minute), s - floor(s)
end
return format("%dm", floor(s/minute + 0.5)), s % minute
elseif s >= minute / 12 then
return floor(s + 0.5), (s * 100 - floor(s * 100))/100
end
return format("%.1f", s), (s * 100 - floor(s * 100))/100
end
 
local CreateAuraTimer = function(self,elapsed)
if self.timeLeft then
self.elapsed = (self.elapsed or 0) + elapsed
-- local w = self:GetWidth()
if self.elapsed >= 0.1 then
if not self.first then
self.timeLeft = self.timeLeft - self.elapsed
else
self.timeLeft = self.timeLeft - GetTime()
self.first = false
end
if self.timeLeft > 0 and (self.cast == 'player' or self.cast == 'vehicle') then
local time = FormatTime(self.timeLeft)
self.remaining:SetText(time)
if self.timeLeft < 5 then
self.remaining:SetTextColor(1, 0, 0)
else
self.remaining:SetTextColor(1, 0.9, 0)
end
else
self.remaining:Hide()
self:SetScript("OnUpdate", nil)
end
self.elapsed = 0
end
end
end
 
local PostUpdateIcon
do
local playerUnits = {
player = true,
pet = true,
vehicle = true,
}
PostUpdateIcon = function(icons, unit, icon, index, offset, filter, isDebuff)
local texture = icon.icon
if(playerUnits[icon.owner]) then
texture:SetDesaturated(false)
else
if icon.debuff then texture:SetDesaturated(true) end
if C["unitframe"].onlyplayer == true then icon:Hide() end --只显示玩家施放的DEBUFF
end
local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
-- Creating aura timers
if duration and duration > 0 and (unitCaster == 'player' or unitCaster == 'vehicle') then
icon.remaining:Show()
else
icon.remaining:Hide()
end
icon.duration = duration
icon.timeLeft = expirationTime
icon.first = true
icon.cast = unitCaster
icon:SetScript("OnUpdate", CreateAuraTimer)
end
 
end
 
local CheckInterrupt = function(self, unit)
if unit == "vehicle" then unit = "player" end
 
if self.interrupt and UnitCanAttack("player", unit) then
self:SetStatusBarColor(1, 0, 0, 0.5)
else
self:SetStatusBarColor(1,1,1,.8)
end
end
 
local channelingTicks = {
-- warlock
[GetSpellInfo(1120)] = 5, -- drain soul
[GetSpellInfo(689)] = 5, -- drain life
[GetSpellInfo(5740)] = 3, -- rain of fire
-- druid
[GetSpellInfo(740)] = 4, -- Tranquility
[GetSpellInfo(16914)] = 10, -- Hurricane
-- priest
[GetSpellInfo(15407)] = 3, -- mind flay
[GetSpellInfo(48045)] = 5, -- mind sear
[GetSpellInfo(47540)] = 2, -- penance
-- mage
[GetSpellInfo(5143)] = 5, -- arcane missiles
[GetSpellInfo(10)] = 5, -- blizzard
[GetSpellInfo(12051)] = 4, -- evocation
}
local ticks = {}
local setBarTicks = function(castBar, ticknum)
if ticknum and ticknum > 0 then
local delta = castBar:GetWidth() / ticknum
for k = 1, ticknum do
if not ticks[k] then
ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
ticks[k]:SetTexture(E.normTex)
ticks[k]:SetVertexColor(0, 0, 0)
ticks[k]:SetWidth(1.6)
ticks[k]:SetHeight(castBar:GetHeight())
end
ticks[k]:ClearAllPoints()
ticks[k]:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
ticks[k]:Show()
end
else
for k, v in pairs(ticks) do
v:Hide()
end
end
end
 
local CheckCast = function(self, unit, name, rank, castid)
self:SetAlpha(1.0)
self:SetStatusBarColor(1,1,1,.8)
if unit == "player"then
if self.casting then
setBarTicks(self, 0)
else
local spell = UnitChannelInfo(unit)
self.channelingTicks = channelingTicks[spell] or 0
setBarTicks(self, self.channelingTicks)
end
elseif (unit == "target" or unit == "focus" or unit == "party") and self.interrupt then
self:SetStatusBarColor(1, 0, 0,.8)
else
self:SetStatusBarColor(1, 1, 1,.8)
end
end
 
-- custom castbar text
local function CustomTimeText(self, duration)
self.Time:SetFormattedText('%.1f / %.1f', duration, self.max)
end
 
local function CreateShadow(f)
local shadow = CreateFrame("Frame", nil, f)
shadow:SetFrameLevel(1)
shadow:SetFrameStrata(f:GetFrameStrata())
shadow:SetPoint("TOPLEFT", -4, 4)
shadow:SetPoint("BOTTOMRIGHT", 4, -4)
shadow:SetBackdrop(SHADOWS)
shadow:SetBackdropColor(0, 0, 0, 0)
shadow:SetBackdropBorderColor(0, 0, 0, 1)
end
 
local function CPointsUpdate(self, event, unit)
if unit == "pet" then return end
local cp = UnitExists("vehicle") and GetComboPoints("vehicle", "target") or GetComboPoints("player", "target")
local cpoints = self.CPoints
for i = 1, MAX_COMBO_POINTS do
if i <= cp then
cpoints[i]:Show()
else
cpoints[i]:Hide()
end
end
if self.Auras then
self.Auras:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 1, cp > 0 and 18 or 4)
end
end
 
--[[
layout
]]--
local Shared = function(self, unit, isSingle)
 
self.menu = menu
self:SetAttribute("*type2", "menu")
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self:RegisterForClicks"AnyDown"
self:SetBackdrop({
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
edgeFile = "Interface\\Buttons\\WHITE8x8",
tile = false, tileSize = 0, edgeSize = 1,
insets = { left = -1, right = -1, top = -1, bottom = -1}
})
self:SetBackdropColor(.1,.1,.1,1)
self:SetBackdropBorderColor(.3,.3,.3,1)
CreateShadow(self)
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
 
local Health = CreateFrame("StatusBar", nil, self)
Health:SetStatusBarTexture(TEXTURE)
Health:SetStatusBarColor(.26,.26,.26,1)
Health:SetPoint('BOTTOMRIGHT', self, -2, 2)
Health:SetPoint('TOPLEFT', self, 2, -2)
Health.frequentUpdates = true
self.Health = Health
-- Health.colorTapping = true
self.Health.colorClass = C["unitframe"].colorClass
self.Health.colorSmooth = true
self.Health.colorClassNPC = false
self.Health.colorClassPet = false
 
local HealthBG = Health:CreateTexture(nil, "BORDER")
HealthBG:SetAllPoints(self.Health)
HealthBG:SetTexture(.08,.08,.08)
Health.bg = HealthBG
 
local powerbg = CreateFrame("Frame", nil, self)
powerbg:SetBackdrop(self:GetBackdrop())
powerbg:SetBackdropColor(.1,.1,.1,1)
powerbg:SetBackdropBorderColor(.3,.3,.3,1)
powerbg:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -4)
powerbg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, -16)
 
CreateShadow(powerbg)
 
local Power = CreateFrame("StatusBar", nil, self)
Power:SetStatusBarTexture(TEXTURE)
Power:SetParent(self)
Power:SetFrameLevel(powerbg:GetFrameLevel()+1)
Power:SetPoint('TOPLEFT', powerbg,'TOPLEFT', 2, -2)
Power:SetPoint('BOTTOMRIGHT', powerbg,'BOTTOMRIGHT', -2, 2)
self.Power = Power
self.Power.powerbg = powerbg
 
Power.bg = Power:CreateTexture(nil, 'BORDER')
Power.bg:SetAllPoints(Power)
Power.bg:SetTexture(0,0,.1)
Power.bg.multiplier = 0.5
 
Power.frequentUpdates = true
Power.colorTapping = true
Power.colorHappiness = true
Power.colorClass = false
-- Power.colorReaction = true
Power.colorDisconnected = true
 
Health.PostUpdate = PostUpdateHealth
Power.PostUpdate = PostUpdatePower
 
 
if unit == "player" or unit == "target" then
local leader = Health:CreateTexture(nil, "OVERLAY")
leader:SetWidth(14)
leader:SetHeight(14)
leader:SetPoint("TOPLEFT", 17, 8)
self.Leader = leader
 
local MasterLooter = Health:CreateTexture(nil, 'OVERLAY')
MasterLooter:SetWidth(14)
MasterLooter:SetHeight(14)
MasterLooter:SetPoint("TOPLEFT", 31, 8)
self.MasterLooter = MasterLooter
 
local RaidIcon = Health:CreateTexture(nil, "OVERLAY")
RaidIcon:SetPoint("CENTER", 1, 1)
RaidIcon:SetHeight(16)
RaidIcon:SetWidth(16)
RaidIcon:SetTexture("Interface\\AddOns\\Eui\\media\\raidicons.blp")
 
self.RaidIcon = RaidIcon
end
local info = self.Health:CreateFontString(nil, 'OVERLAY')
info:SetFont(E.font, fontsize, "OUTLINE")
info:SetHeight(18)
info:SetJustifyH('LEFT')
info.frequentUpdates = 0.1
 
local value = self.Health:CreateFontString(nil, 'OVERLAY')
value:SetFont(E.font, fontsize, "OUTLINE")
value:SetHeight(18)
value:SetJustifyH('RIGHT')
value.frequentUpdates = 0.1
 
local valuepp = self.Power:CreateFontString(nil, 'OVERLAY')
valuepp:SetFont(E.font, fontsize, "OUTLINE")
valuepp:SetHeight(18)
valuepp:SetJustifyH('RIGHT')
valuepp.frequentUpdates = 0.1
 
if C["unitframe"].portrait == true then
local portrait = CreateFrame('PlayerModel', nil, self)
portrait:SetBackdrop(self:GetBackdrop())
portrait:SetBackdropColor(.1,.1,.1,1)
portrait:SetBackdropBorderColor(.3,.3,.3,1)
portrait:SetScript('OnShow', function(self) self:SetCamera(0) end)
portrait:SetWidth(playerheight+16)
portrait:SetHeight(playerheight+16)
portrait.type = '3D'
self.Portrait = portrait
CreateShadow(portrait)
 
if(unit == 'player') then
portrait:SetPoint('TOPRIGHT', self, 'TOPLEFT', -4, 0)
elseif(unit == 'target') then
portrait:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, 0)
end
end
 
 
 
if(unit == 'player' or unit == 'target' or unit == 'party') then
self:SetWidth(playerwidth)
self:SetHeight(playerheight)
Health:SetHeight(playerheight-13)
info:SetPoint('LEFT', self.Health, 2, 0)
info:SetWidth(180)
self:Tag(info, '[difficulty][smartlevel] [rare]|r[name]')
 
value:SetPoint('RIGHT', self.Health, -2, 0)
value:SetWidth(100)
self:Tag(value, '[hp] - [hpperc]')
 
valuepp:SetPoint('RIGHT', self.Power, -2, 1)
valuepp:SetWidth(60)
if class == 'DRUID' then
self:Tag(valuepp, '[xdpp] [pp]')
else
self:Tag(valuepp, '[pp]')
end
 
if unit == 'party' then
self:SetWidth(partywidth)
self:SetHeight(partyheight)
Health:SetHeight(partyheight-13)
info:SetPoint('LEFT', self.Health, 2, 0)
info:SetWidth(100)
value:SetPoint('RIGHT', self.Health, -2, 0)
value:SetWidth(90)
self:Tag(value, '[hp]-[hpperc]')
end
 
elseif(unit == 'pet' or unit:find("boss%d")) then
 
self:SetWidth(petwidth)
self:SetHeight(petheight)
Health:SetHeight(23)
 
info:SetPoint('LEFT', self.Health, 2, 0)
info:SetWidth(98)
self:Tag(info, '[name]')
 
value:SetPoint('RIGHT', self.Health, -2, -0)
self:Tag(value, '[hpperc]')
 
elseif(unit == 'targettarget') then
 
self:SetWidth(totwidth)
self:SetHeight(totheight)
 
Health:SetHeight(18)
Power:Hide()
Power.powerbg:Hide()
info:SetPoint('LEFT', self.Health, 2, 0)
info:SetWidth(98)
self:Tag(info, '[shortname]')
 
value:SetPoint('RIGHT', self.Health, -2, 0)
self:Tag(value, '[ppprec]')
 
elseif(unit == 'focustarget' or unit == 'focus') then
self:SetWidth(focuswidth)
self:SetHeight(focusheight)
 
Health:SetHeight(18)
Power:Hide()
Power.powerbg:Hide()
 
info:SetPoint('LEFT', self.Health, 2, 0)
info:SetWidth(98)
self:Tag(info, '[shortname]')
 
value:SetPoint('RIGHT', self.Health, -2, 0)
self:Tag(value, '[ppprec]')
 
else
self:SetWidth(110)
self:SetHeight(20)
Health:SetHeight(16)
Power:Hide()
Power.powerbg:Hide()
 
info:SetPoint('LEFT', self.Health,2,0)
info:SetWidth(50)
self:Tag(info, '[shortname]')
 
value:SetPoint('RIGHT', self.Health, -2,0)
self:Tag(value, '[hpperc]')
 
end
if (unit == 'player' or unit == 'target' or unit == 'focus') then
if C["unitframe"].castbar == true then
if C["unitframe"].bigcastbar == false then
local cb = CreateFrame("StatusBar", nil, self)
cb:SetStatusBarTexture(TEXTURE)
cb:SetStatusBarColor(1,1,1,.8)
if unit == 'focus' then
cb:SetAllPoints(Health)
else
cb:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -8)
cb:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -8)
cb:SetHeight(18)
end
cb:SetToplevel(true)
cb:SetFrameStrata("MEDIUM")
self.Castbar = cb
elseif C["unitframe"].bigcastbar == true then
--大型施法条
local unm = {strsplit("/", C["unitframe"].bigcastbarpos)}
if #unm ~= 6 then unm = {0,500,0,168,0,120} end
local bcb = CreateFrame("StatusBar", "EuiUnitframeCastbar"..unit, UIParent)
bcb:SetStatusBarTexture(TEXTURE)
bcb:SetStatusBarColor(1,1,1,.8)
bcb:SetHeight(24*C["unitframe"].bigcastbarscale)
bcb:SetWidth(240*C["unitframe"].bigcastbarscale)
bcb:SetFrameStrata("MEDIUM")
if unit == 'player' then
bcb:SetPoint("BOTTOM", UIParent, "BOTTOM", unm[3], unm[4])
elseif unit == 'target' then
bcb:SetPoint("BOTTOM", UIParent, "BOTTOM", unm[5], unm[6])
elseif unit == 'focus' then
bcb:SetPoint("BOTTOM", UIParent, "BOTTOM", unm[1], unm[2])
bcb:SetWidth(300*C["unitframe"].bigcastbarscale)
end
 
local i = bcb:CreateTexture(nil, "ARTWORK")
i:SetWidth(bcb:GetHeight()-2)
i:SetHeight(bcb:GetHeight()-2)
i:SetTexCoord(0.1, 0.9, 0.1, 0.9)
i:Show()
i:SetPoint("RIGHT", bcb, "LEFT", -6, 0)
 
bg = CreateFrame("Frame", nil, bcb)
bg:SetBackdrop(self:GetBackdrop())
bg:SetBackdropColor(.1,.1,.1,1)
bg:SetBackdropBorderColor(.3,.3,.3,1)
bg:SetFrameLevel(1)
CreateShadow(bg)
bg:SetPoint("TOPLEFT", i, "TOPLEFT", -2 , 2)
bg:SetPoint("BOTTOMRIGHT", i, "BOTTOMRIGHT", 2, -2)
 
self.Castbar = bcb
self.Castbar.Icon = i
end
self.Castbar.PostCastStart = CheckCast
self.Castbar.bg = self.Castbar:CreateTexture(nil, "BORDER")
self.Castbar.bg:SetAllPoints(self.Castbar)
self.Castbar.bg:SetTexture(TEXTURE)
self.Castbar.bg:SetVertexColor(.15,.15,.15)
 
self.FrameBackdrop = CreateFrame("Frame", nil, self)
self.FrameBackdrop:SetParent(self.Castbar)
self.FrameBackdrop:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT", -2, 2)
self.FrameBackdrop:SetPoint("BOTTOMRIGHT", self.Castbar, "BOTTOMRIGHT", 2, -2)
self.FrameBackdrop:SetFrameStrata("BACKGROUND")
self.FrameBackdrop:SetBackdrop {
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
edgeFile = "Interface\\Buttons\\WHITE8x8",
tile = false, tileSize = 0, edgeSize = 1,
insets = { left = -1, right = -1, top = -1, bottom = -1}
}
self.FrameBackdrop:SetFrameLevel(1)
self.FrameBackdrop:SetBackdropColor(.1,.1,.1,1)
self.FrameBackdrop:SetBackdropBorderColor(.3,.3,.3,1)
 
 
self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
if unit == 'focus' and C["unitframe"].bigcastbar ~= true then
self.Castbar.Text:SetFont(E.font, fontsizesmall, "OUTLINE")
self.Castbar.Text:SetHeight(18)
self.Castbar.Text:SetJustifyH('LEFT')
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 4, 0)
else
self.Castbar.Text:SetFont(E.font, fontsize, "OUTLINE")
self.Castbar.Text:SetHeight(18)
end
 
table.insert(self.__elements, UpdateCB)
self:RegisterEvent("UNIT_SPELLCAST_START", UpdateCB)
self:RegisterEvent("UNIT_SPELLCAST_FAILED", UpdateCB)
self:RegisterEvent("UNIT_SPELLCAST_STOP", UpdateCB)
self.Castbar.Text:SetJustifyH('LEFT')
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 4, 0)
 
if unit == 'player' then
local z = self.Castbar:CreateTexture(nil,"ADD")
z:SetTexture(TEXTURE)
z:SetVertexColor(.8,.31,.45,.7)
z:SetPoint("TOPRIGHT")
z:SetPoint("BOTTOMRIGHT")
self.Castbar.SafeZone = z
end
 
self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')
self.Castbar.Time:SetFont(E.font, fontsizesmall, "OUTLINE")
self.Castbar.Time:SetHeight(18)
self.Castbar.Time:SetJustifyH('RIGHT')
self.Castbar.Time:SetPoint("RIGHT", self.Castbar, -4, 0)
self.Castbar.CustomTimeText = CustomTimeText
self.Castbar.PostCastStart = CheckCast
self.Castbar.PostChannelStart = CheckCast
end
end
-- enable range checking
if(unit == 'party' or unit == 'raid') then
self.Range = { insideAlpha = 1, outsideAlpha = .5, }
end
--DZ,XD连击点
if(unit == 'target' and (class == 'ROGUE' or class == 'DRUID')) and C["unitframe"].cpoint == true then
self.CPoints = CreateFrame('Frame', nil, self)
self.CPoints:SetWidth(playerwidth-4)
self.CPoints:SetHeight(8)
self.CPoints:SetBackdropColor(0,0,0,0)
self.CPoints:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 2, 5)
 
for i = 1,5 do
self.CPoints[i] = CreateFrame("StatusBar", self:GetName().."_CPoints"..i, self)
self.CPoints[i]:SetHeight(8)
self.CPoints[i]:SetWidth((playerwidth-4-16)/5)
self.CPoints[i]:SetStatusBarTexture(TEXTURE)
self.CPoints[i]:SetBackdrop(BACKDROP)
self.CPoints[i]:SetBackdropColor(.1,.1,.1,1)
 
self.CPoints[i].bg = CreateFrame("Frame", nil, self.CPoints[i])
self.CPoints[i].bg:SetPoint("TOPLEFT", self.CPoints[i], "TOPLEFT", -2, 2)
self.CPoints[i].bg:SetPoint("BOTTOMRIGHT", self.CPoints[i], "BOTTOMRIGHT", 2, -2)
self.CPoints[i].bg:SetBackdrop(self:GetBackdrop())
self.CPoints[i].bg:SetBackdropColor(.1,.1,.1,1)
self.CPoints[i].bg:SetBackdropBorderColor(.3,.3,.3,1)
CreateShadow(self.CPoints[i].bg)
self.CPoints[i].bg:SetFrameLevel(self.CPoints[i]:GetFrameLevel()-1)
 
if (i == 1) then
self.CPoints[i]:SetPoint("BOTTOMLEFT", self.CPoints, "BOTTOMLEFT", 0, 0)
else
self.CPoints[i]:SetPoint("TOPLEFT", self.CPoints[i-1], "TOPRIGHT", 4, 0)
end
end
self.CPoints[1]:SetStatusBarColor(152/255, 190/255, 24/255)
self.CPoints[2]:SetStatusBarColor(152/255, 190/255, 24/255)
self.CPoints[3]:SetStatusBarColor(30/255, 110/255, 220/255)
self.CPoints[4]:SetStatusBarColor(30/255, 110/255, 220/255)
self.CPoints[5]:SetStatusBarColor(160/255, 24/255, 48/255)
self.CPoints.Update = CPointsUpdate
end
--DK符文条
 
if(class == 'DEATHKNIGHT' and unit == 'player') and C["unitframe"].cpoint == true then
self.Runes = CreateFrame('Frame', nil, self)
self.Runes:SetWidth(playerwidth-4)
self.Runes:SetHeight(8)
self.Runes:SetBackdropColor(0,0,0,0)
self.Runes:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 2, 5)
for i = 1, 6 do
self.Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self)
self.Runes[i]:SetHeight(8)
self.Runes[i]:SetWidth((playerwidth-4 -20) /6)
self.Runes[i]:SetStatusBarTexture(TEXTURE)
self.Runes[i]:SetBackdrop(BACKDROP)
self.Runes[i]:SetBackdropColor(.1,.1,.1,1)
 
self.Runes[i].bg = self.Runes[i]:CreateTexture(nil, "BORDER")
self.Runes[i].bg:SetAllPoints(self.Runes[i])
self.Runes[i].bg:SetTexture(0.3, 0.3, 0.3)
 
self.Runes[i].FrameBackdrop = CreateFrame("Frame", nil, self.Runes[i])
self.Runes[i].FrameBackdrop:SetPoint("TOPLEFT", self.Runes[i], "TOPLEFT", -2, 2)
self.Runes[i].FrameBackdrop:SetPoint("BOTTOMRIGHT", self.Runes[i], "BOTTOMRIGHT", 2, -2)
self.Runes[i].FrameBackdrop:SetBackdrop(self:GetBackdrop())
self.Runes[i].FrameBackdrop:SetBackdropColor(.1,.1,.1,1)
self.Runes[i].FrameBackdrop:SetBackdropBorderColor(.3,.3,.3,1)
CreateShadow(self.Runes[i].FrameBackdrop)
self.Runes[i].FrameBackdrop:SetFrameLevel(self.Runes[i]:GetFrameLevel()-1)
 
if (i == 1) then
self.Runes[i]:SetPoint("BOTTOMLEFT", self.Runes, "BOTTOMLEFT", 0, 0)
else
self.Runes[i]:SetPoint("TOPLEFT", self.Runes[i-1], "TOPRIGHT", 4, 0)
end
end
end
 
 
 
--oUF_Tot 图腾条
if(unit == 'player' and class == 'SHAMAN') and C["unitframe"].cpoint == true then
self.TotemBar = CreateFrame('Frame', nil, UIParent)
self.TotemBar:SetHeight(6)
self.TotemBar:SetWidth(playerwidth-4)
self.TotemBar:SetBackdropColor(0,0,0,0)
for i = 1, 4 do
self.TotemBar[i] = CreateFrame("StatusBar", nil, self)
self.TotemBar[i]:SetHeight(8)
self.TotemBar[i]:SetWidth((playerwidth-4-12)/4)
 
if (i == 1) then
self.TotemBar[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 2, 5)
else
self.TotemBar[i]:SetPoint("TOPLEFT", self.TotemBar[i-1], "TOPRIGHT", 4, 0)
end
 
self.TotemBar[i]:SetStatusBarTexture(TEXTURE)
self.TotemBar[i]:SetBackdrop(BACKDROP)
self.TotemBar[i]:SetBackdropColor(0, 0, 0)
self.TotemBar[i]:SetMinMaxValues(0, 1)
self.TotemBar[i].destroy = true
 
self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER")
self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
self.TotemBar[i].bg:SetTexture(TEXTURE)
self.TotemBar[i].bg.multiplier = 0.25
 
self.TotemBar[i].FrameBackdrop = CreateFrame("Frame", nil, self.TotemBar[i])
self.TotemBar[i].FrameBackdrop:SetPoint("TOPLEFT", self.TotemBar[i], "TOPLEFT", -2, 2)
self.TotemBar[i].FrameBackdrop:SetPoint("BOTTOMRIGHT", self.TotemBar[i], "BOTTOMRIGHT", 2, -2)
self.TotemBar[i].FrameBackdrop:SetBackdrop(self:GetBackdrop())
self.TotemBar[i].FrameBackdrop:SetBackdropColor(.1,.1,.1,1)
self.TotemBar[i].FrameBackdrop:SetBackdropBorderColor(.3,.3,.3,1)
CreateShadow(self.TotemBar[i].FrameBackdrop)
self.TotemBar[i].FrameBackdrop:SetFrameLevel(self.TotemBar[i]:GetFrameLevel()-1)
end
end
 
 
--[[ oUF_CombatFeedback support
if (unit == 'player' or unit == 'target') then
self.CombatFeedbackText = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight')
self.CombatFeedbackText:SetPoint("RIGHT", health, "RIGHT", -2, 0)
end
]]
-- 添加战斗标志
if (unit == 'player') then
self.Combat = self.Health:CreateTexture(nil, "OVERLAY")
self.Combat:SetPoint('TOPRIGHT', -1, 7)
self.Combat:SetHeight(16)
self.Combat:SetWidth(16)
-- self.Combat:SetVertexColor(255, 0, 0)
end
 
-- 添加PVP标志
-- PvP icon
if unit == 'player' and C["unitframe"].showPvP == true then
self.PvP = self.Health:CreateTexture(nil, 'OVERLAY')
self.PvP:SetWidth(14)
self.PvP:SetHeight(14)
self.PvP:SetPoint('TOPLEFT', -1, 7)
self.PvP:SetTexture('Interface\\CharacterFrame\\UI-StateIcon')
self.PvP:SetTexCoord(0.09, 0.43, 0.08, 0.42)
end
 
--五秒回蓝
if unit == "player" and C["unitframe"].powerspark == true and (class ~= "ROGUE" and class ~= "WARRIOR" and class ~= "DEATHKNIGHT") then
local spark = Power:CreateTexture(nil, "OVERLAY")
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetVertexColor(1, 1, 1, 0.5)
spark:SetBlendMode("ADD")
spark:SetHeight(Power:GetHeight()*2)
spark:SetWidth(Power:GetHeight())
self.Spark = spark
end
 
--自动功击条
if unit == 'player' and C["unitframe"].swing == true then
local swing = CreateFrame("StatusBar",nil,self)
swing:SetStatusBarTexture(TEXTURE)
swing:SetStatusBarColor(.8,.8,.8)
swing:SetHeight(1)
swing:SetWidth(playerwidth-4)
swing:SetPoint("TOP", self.Health, "BOTTOM", 0, -1)
self.Swing = swing
end
 
end
 
local UnitSpecific = {
 
player = function(self, ...)
Shared(self, ...)
local Health, Power = self.Helth, self.Power
local Debuffs = CreateFrame("Frame", nil, self)
if (E.MyClass == "DEATHKNIGHT" or E.MyClass == "SHAMAN") and C["unitframe"].playerdebuffnum > 0 then
Debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 1, 18)
else
Debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 1, 4)
end
Debuffs.showDebuffType = true
Debuffs.initialAnchor = 'BOTTOMLEFT'
Debuffs:SetHeight(75)
Debuffs:SetWidth(C["unitframe"].playerwidth-4)
Debuffs.num = C["unitframe"].playerdebuffnum
Debuffs.size = 25
Debuffs.spacing = 4
Debuffs['growth-x'] = 'RIGHT'
Debuffs['growth-y'] = 'UP'
self.Debuffs = Debuffs
 
Debuffs.PostCreateIcon = PostCreateIcon
Debuffs.PostUpdateIcon = PostUpdateIcon
end,
 
target = function(self, ...)
Shared(self, ...)
 
local Health, Power = self.Health, self.Power
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 1, 4)
Auras.showDebuffType = true
Auras:SetWidth(C["unitframe"].playerwidth-4)
Auras:SetHeight(C["unitframe"].playerheight * 2)
Auras.size = 25
Auras.spacing = 4
Auras.gap = true
Auras.numBuffs = 18
Auras.numDebuffs = 21
Auras.PostCreateIcon = PostCreateIcon
Auras.PostUpdateIcon = PostUpdateIcon
self.Auras = Auras
--[[
local Buffs = CreateFrame("Frame", nil, self)
Buffs.initialAnchor = 'TOPLEFT'
Buffs["growth-x"] = 'RIGHT'
Buffs['growth-y'] = 'DOWN'
-- Buffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, -1)
Buffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT' , 1, -4)
Buffs:SetHeight(123)
Buffs:SetWidth(C["unitframe"].playerwidth-4)
Buffs.num = 18
Buffs.size = 21
Buffs.spacing = 4
self.Buffs = Buffs
 
local Debuffs = CreateFrame("Frame", nil, self)
Debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 1, 4)
Debuffs.showDebuffType = true
Debuffs.initialAnchor = 'BOTTOMLEFT'
Debuffs:SetHeight(75)
Debuffs:SetWidth(C["unitframe"].playerwidth-4)
Debuffs.num = 27
Debuffs.size = 21
Debuffs.spacing = 4
Debuffs['growth-x'] = 'RIGHT'
Debuffs['growth-y'] = 'UP'
self.Debuffs = Debuffs
 
Debuffs.PostCreateIcon = PostCreateIcon
Debuffs.PostUpdateIcon = PostUpdateIcon
Buffs.PostCreateIcon = PostCreateIcon
Buffs.PostUpdateIcon = PostUpdateIcon]]
end,
 
targettarget = function(self, ...)
Shared(self, ...)
 
local Health, Power = self.Health, self.Power
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 1, 2)
Auras.showDebuffType = true
Auras:SetWidth(132)
Auras:SetHeight(26)
Auras.size = 21
Auras.spacing = 6
Auras.gap = false
Auras.numBuffs = 0
Auras.numDebuffs = C["unitframe"].totdebuffs
 
Auras.PostCreateIcon = PostCreateIcon
self.Auras = Auras
end,
 
focus = function(self, ...)
Shared(self, ...)
 
local Health, Power = self.Health, self.Power
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 1, 2)
Auras.showDebuffType = true
Auras:SetWidth(132)
Auras:SetHeight(26)
Auras.size = 21
Auras.spacing = 6
Auras.gap = false
Auras.numBuffs = C["unitframe"].Fbuffs
Auras.numDebuffs = C["unitframe"].Fdebuffs
 
Auras.PostCreateIcon = PostCreateIcon
self.Auras = Auras
end,
 
focustarget = function(self, ...)
Shared(self, ...)
 
local Health, Power = self.Health, self.Power
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 1, 2)
Auras.showDebuffType = true
Auras:SetWidth(132)
Auras:SetHeight(26)
Auras.size = 21
Auras.spacing = 6
Auras.gap = false
Auras.numBuffs = 0
Auras.numDebuffs = 0
 
Auras.PostCreateIcon = PostCreateIcon
self.Auras = Auras
end,
party = function(self, ...)
Shared(self, ...)
 
local Health, Power = self.Health, self.Power
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 1, 4)
Auras.showDebuffType = true
Auras:SetWidth(180)
Auras:SetHeight(18)
Auras.size = 16
Auras.spacing = 4
Auras.gap = true
Auras.numBuffs = 4
Auras.numDebuffs = 3
Auras.PostCreateIcon = PostCreateIcon
self.Auras = Auras
end,
pet = function(self, ...)
Shared(self, ...)
local Health, Power = self.Health, self.Power
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 1, 4)
Auras.showDebuffType = true
Auras:SetWidth(130)
Auras:SetHeight(18)
Auras.size = 16
Auras.spacing = 4
Auras.gap = true
Auras.numBuffs = 4
Auras.numDebuffs = 3
Auras.PostCreateIcon = PostCreateIcon
self.Auras = Auras
end,
}
 
 
--[[
register style
]]--
oUF:RegisterStyle("Ljxx", Shared)
 
for unit,layout in next, UnitSpecific do
oUF:RegisterStyle('Ljxx - ' .. unit:gsub("^%l", string.upper), layout)
end
 
local spawnHelper = function(self, unit, ...)
if(UnitSpecific[unit]) then
self:SetActiveStyle('Ljxx - ' .. unit:gsub("^%l", string.upper))
local object = self:Spawn(unit)
object:SetPoint(...)
return object
else
self:SetActiveStyle'Ljxx'
local object = self:Spawn(unit)
object:SetPoint(...)
return object
end
end
 
 
 
--[[
factory
]]--
oUF:RegisterStyle('Ljxx - MT', Shared)
oUF:Factory(function(self)
spawnHelper(self, 'player', 'TOPRIGHT', UIParent, 'BOTTOM', -ptx, pty)
spawnHelper(self, 'target', 'TOPLEFT', UIParent, 'BOTTOM', ptx, pty)
spawnHelper(self, 'targettarget', 'TOPLEFT', UIParent, 'BOTTOM', ptx, pty-34-playerheight-16)
spawnHelper(self, 'focus', 'TOPRIGHT', UIParent, 'BOTTOM', -ptx-focuswidth-8, pty-34-playerheight-16)
if C["unitframe"].portrait == true then
spawnHelper(self, 'pet', 'TOPRIGHT', UIParent, 'BOTTOM', -ptx-playerwidth-8-playerheight-16, pty)
else
spawnHelper(self, 'pet', 'TOPRIGHT', UIParent, 'BOTTOM', -ptx-playerwidth-8, pty)
end
spawnHelper(self, 'focustarget', 'TOPRIGHT', UIParent, 'BOTTOM', -ptx, pty-34-playerheight-16)
end)
 
oUF:DisableBlizzard'party'
--[[
do
for k,v in pairs(UnitPopupMenus) do
for x,y in pairs(UnitPopupMenus[k]) do
if y == "SET_FOCUS" then
table.remove(UnitPopupMenus[k],x)
elseif y == "CLEAR_FOCUS" then
table.remove(UnitPopupMenus[k],x)
end
end
end
end]]
\ No newline at end of file
Eui/unitframe/unitframe2.lua New file
0,0 → 1,1301
local E, C = unpack(select(2, ...))
if C["unitframe"].aaaaunit ~= 2 then return end
local cfg = CreateFrame("Frame")
local lib = CreateFrame("Frame")
local cast = CreateFrame("Frame")
-----------------------------
-- MEDIA
-----------------------------
local MediaPath = "Interface\\Addons\\Eui\\media\\"
cfg.statusbar_texture = MediaPath.."statusbar"
cfg.auratex = MediaPath.."iconborder"
cfg.font = STANDARD_TEXT_FONT
cfg.bfont = STANDARD_TEXT_FONT
cfg.backdrop_texture = MediaPath.."backdrop"
cfg.backdrop_edge_texture = MediaPath.."backdrop_edge"
 
-----------------------------
-- CONFIG
-----------------------------
 
--config variables
cfg.showtot = true
cfg.showpet = true
cfg.showfocus = true
cfg.interruptcb = {1, 0, 0} --color setting for uninterruptable casts
cfg.stylebuffs = true -- replacing default buff frame
cfg.BUFFpos = {"TOPRIGHT", "UIParent", "TOPRIGHT", -195, -20} -- buffs position
 
if select(2, UnitClass("player")) =="SHAMAN" or select(2, UnitClass("player")) == "DEATHKNIGHT" then
cfg.DEBUFFpos = {"BOTTOMLEFT", "oUF_monoPlayerFrame", "TOPLEFT", 2, 14} -- debuffs position
else
cfg.DEBUFFpos = {"BOTTOMLEFT", "oUF_monoPlayerFrame", "TOPLEFT", 1.5, 4} -- debuffs position
end
cfg.BFIsize = 24 -- buff frame icon size
cfg.playerauras = false -- small aura frame for player
cfg.auratimers = true -- aura timers
cfg.ATIconSizeThreshold = 16 -- how big some icon should be to display the custom timer
cfg.ATSize = 9 -- aura timer font size
cfg.RMalpha = 0.6 -- raid mark alpha
cfg.RMsize = 16 -- raid mark size
cfg.focusCBuserplaced = true -- false to lock focus cast bar to the focus frame
cfg.focusCBwidth = 205 -- focus cb width
cfg.focusCBheight = 15 -- focus cb height
 
local ptx
local pty
if C["raid"].grid == true then
ptx = (C["raid"].gridw * 5 + 20) / 2 + 4
pty = C["raid"].gridh * 5 + 20 + C["raid"].gridheight
 
else
ptx = C["unitframe"].totwidth / 2 + 8
pty = C["unitframe"].petheight + 162 + 23 + C["actionbar"].petbuttonsize + C["actionbar"].buttonspacing*2
end
--if C["actionbar"].actionbarrows > 2 then pty = pty + 33 end
-- Frames position
cfg.Ppos = {"TOPRIGHT","UIParent","BOTTOM", -ptx, pty} -- player
cfg.Tpos = {"TOPLEFT","UIParent","BOTTOM", ptx, pty} -- target
-- cfg.focusCBposition = {"TOP",UIParent,"BOTTOM",10,362}
cfg.Fpos = {'TOPRIGHT', 'UIParent', 'BOTTOM', -ptx-8-(C["unitframe"].playerwidth-8)/2, pty-34-C["unitframe"].playerheight} -- focus
cfg.FTpos = {"TOPRIGHT", 'UIParent', 'BOTTOM', -ptx, pty-34-C["unitframe"].playerheight} -- focusTarget
cfg.PEpos = {'TOPRIGHT', 'UIParent', 'BOTTOM', -ptx-C["unitframe"].playerwidth-8, pty} -- pet
cfg.TTpos = {'TOPLEFT', 'UIParent', 'BOTTOM', ptx, pty-34-C["unitframe"].playerheight} -- ToT
 
-- Size and scale
cfg.Pwidth = C["unitframe"].playerwidth -- Player frame
cfg.Pheight = C["unitframe"].playerheight
cfg.Pscale = 1
 
cfg.Twidth = C["unitframe"].playerwidth -- Target frame
cfg.Theight = C["unitframe"].playerheight
cfg.Tscale = 1
 
cfg.PTTwidth = C["unitframe"].petwidth -- Pet and ToT frames(原133)
cfg.PTTheight = C["unitframe"].petheight
cfg.PTTscale = 1
 
cfg.Fwidth = (cfg.Pwidth-8) / 2 --Focus frame 110
cfg.Fheight = C["unitframe"].focusheight
cfg.Fscale = 1
cfg.colorClass = C["unitframe"].colorClass --palyer and target show colorClass
-----------------------------
-- FUNCTIONS
-----------------------------
local SVal = function(val)
if val then
if (val >= 1e6) then
return ("%.1fm"):format(val / 1e6)
elseif (val >= 1e3) then
return ("%.1fk"):format(val / 1e3)
else
return ("%d"):format(val)
end
end
end
 
local function hex(r, g, b)
if r then
if (type(r) == 'table') then
if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
end
return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255)
end
end
 
pcolors = setmetatable({
power = setmetatable({
['MANA']= { 95/255, 155/255, 255/255 },
['RAGE']= { 250/255, 75/255, 60/255 },
['FOCUS'] = { 255/255, 209/255, 71/255 },
['ENERGY'] = { 200/255, 255/255, 200/255 },
['RUNIC_POWER'] = { 0/255, 209/255, 255/255 },
["AMMOSLOT"] = { 200/255, 255/255, 200/255 },
["FUEL"] = { 250/255, 75/255, 60/255 },
["POWER_TYPE_STEAM"] = {0.55, 0.57, 0.61},
["POWER_TYPE_PYRITE"] = {0.60, 0.09, 0.17},
["POWER_TYPE_HEAT"] = {0.55,0.57,0.61},
["POWER_TYPE_OOZE"] = {0.76,1,0},
["POWER_TYPE_BLOOD_POWER"] = {0.7,0,1},
}, {__index = oUF.colors.power}),
}, {__index = oUF.colors})
 
oUF.Tags['mono:info'] = function(u)
local level = UnitLevel(u)
local race = UnitRace(u) or nil
local typ = UnitClassification(u)
local color = GetQuestDifficultyColor(level)
 
if level <= 0 then
level = "??"
color.r, color.g, color.b = 1, 0, 0
end
 
if typ=="rareelite" then
return hex(color)..level..'r+'
elseif typ=="elite" then
return hex(color)..level..'+'
elseif typ=="rare" then
return hex(color)..level..'r'
else
if u=="target" and UnitIsPlayer("target") then
if level == 80 then level = "" end
return hex(color)..level.." |cffFFFFFF"..race.."|r"
else
return hex(color)..level
end
end
end
oUF.TagEvents['mono:info'] = 'UNIT_LEVEL PLAYER_LEVEL_UP UNIT_CLASSIFICATION_CHANGED'
 
oUF.Tags['mono:hp'] = function(u) -- THIS IS FUCKING MADNESS!!!
if UnitIsDead(u) or UnitIsGhost(u) or not UnitIsConnected(u) then
return oUF.Tags['mono:DDG'](u)
else
local per = oUF.Tags['perhp'](u).."%" or 0
local def = oUF.Tags['missinghp'](u) or 0
local min, max = UnitHealth(u), UnitHealthMax(u)
if u == "player" or u == "target" then
if C["unitframe"].totalhpmp == true then
return min.." | "..per
else
return SVal(min).." | "..per
end
elseif u == "focus" or u == "pet" or u == "focustarget" or u == "targettarget" then
return per
else
if UnitIsPlayer(u) and not UnitIsEnemy("player",u) then
if min~=max then
return SVal(max).." | |cffe15f8b"..-def.."|r"
else
return SVal(min).." | "..per
end
else
return SVal(min).." | "..per
end
end
end
end
oUF.TagEvents['mono:hp'] = 'UNIT_HEALTH'
 
oUF.Tags['mono:hpperc'] = function(u)
local per = oUF.Tags['perhp'](u)
if UnitIsDead(u) or UnitIsGhost(u) or not UnitIsConnected(u) then
return oUF.Tags['mono:DDG'](u)
elseif min~=max and per < 90 then
return per.."%"
end
end
oUF.TagEvents['mono:hpperc'] = 'UNIT_HEALTH'
 
oUF.Tags['mono:pp'] = function(u)
local _, str = UnitPowerType(u)
if str then
return hex(pcolors.power[str])..SVal(UnitPower(u))
end
end
oUF.TagEvents['mono:pp'] = 'UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER'
 
oUF.Tags['mono:color'] = function(u, r)
local _, class = UnitClass(u)
local reaction = UnitReaction(u, "player")
 
if (UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) then
return hex(oUF.colors.tapped)
elseif (u == "pet") and GetPetHappiness() then
return hex(oUF.colors.happiness[GetPetHappiness()])
elseif (UnitIsPlayer(u)) then
return hex(oUF.colors.class[class])
elseif reaction then
return hex(oUF.colors.reaction[reaction])
else
return hex(1, 1, 1)
end
end
oUF.TagEvents['mono:color'] = 'UNIT_REACTION UNIT_HEALTH UNIT_HAPPINESS'
 
oUF.Tags['mono:name'] = function(u, r)
local name = UnitName(r or u)
return E.utf8sub(name, 12, true)
end
oUF.TagEvents['mono:name'] = 'UNIT_NAME_UPDATE'
 
oUF.Tags['mono:longname'] = function(u, r)
local name = UnitName(r or u)
return E.utf8sub(name, 20, true)
end
oUF.TagEvents['mono:longname'] = 'UNIT_NAME_UPDATE'
 
oUF.Tags['mono:DDG'] = function(u)
if UnitIsDead(u) then
return "|cffCFCFCF Dead|r"
elseif UnitIsGhost(u) then
return "|cffCFCFCF Ghost|r"
elseif not UnitIsConnected(u) then
return "|cffCFCFCF D/C|r"
end
end
oUF.TagEvents['mono:DDG'] = 'UNIT_HEALTH'
 
oUF.Tags['mono:druidpower'] = function(u)
local min, max = UnitPower(u, 0), UnitPowerMax(u, 0)
return u == 'player' and UnitPowerType(u) ~= 0 and min ~= max and ('|cff5F9BFF%d%%|r |'):format(min / max * 100)
end
oUF.TagEvents['mono:druidpower'] = 'UNIT_MANA UPDATE_SHAPESHIFT_FORM'
 
-----------------------------
-- local variables
-----------------------------
oUF.colors.power['MANA'] = {.3,.45,.65}
oUF.colors.power['RAGE'] = {.7,.3,.3}
oUF.colors.power['FOCUS'] = {.7,.45,.25}
oUF.colors.power['ENERGY'] = {.65,.65,.35}
oUF.colors.power['RUNIC_POWER'] = {.45,.45,.75}
oUF.colors.power['AMMOSLOT'] = {.8,.6,0}
oUF.colors.power['FUEL'] = {0,.55,.5}
oUF.colors.power['POWER_TYPE_STEAM'] = {.55,.57,.61}
oUF.colors.power['POWER_TYPE_PYRITE'] = {.6,.09,.17}
oUF.colors.power['POWER_TYPE_HEAT'] = {.9,.45,.1}
oUF.colors.power['POWER_TYPE_OOZE'] = {.1,.1,.9}
oUF.colors.power['POWER_TYPE_BLOOD_POWER'] = {.9,.1,.1}
local _, pType = UnitPowerType("player")
local pcolor = oUF.colors.power[pType] or {.3,.45,.65}
local class = select(2, UnitClass("player"))
 
-----------------------------
-- FUNCTIONS
-----------------------------
cast.CustomTimeText = function(self, duration)
self.Time:SetFormattedText('%.1f | %.1f', duration, self.max)
end
local channelingTicks = {
-- warlock
[GetSpellInfo(1120)] = 5, -- drain soul
[GetSpellInfo(689)] = 5, -- drain life
[GetSpellInfo(5740)] = 3, -- rain of fire
-- druid
[GetSpellInfo(740)] = 4, -- Tranquility
[GetSpellInfo(16914)] = 10, -- Hurricane
-- priest
[GetSpellInfo(15407)] = 3, -- mind flay
[GetSpellInfo(48045)] = 5, -- mind sear
[GetSpellInfo(47540)] = 2, -- penance
-- mage
[GetSpellInfo(5143)] = 5, -- arcane missiles
[GetSpellInfo(10)] = 5, -- blizzard
[GetSpellInfo(12051)] = 4, -- evocation
}
local ticks = {}
cast.setBarTicks = function(castBar, ticknum)
if ticknum and ticknum > 0 then
local delta = castBar:GetWidth() / ticknum
for k = 1, ticknum do
if not ticks[k] then
ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
ticks[k]:SetTexture(cfg.statusbar_texture)
ticks[k]:SetVertexColor(0, 0, 0)
ticks[k]:SetWidth(1.6)
ticks[k]:SetHeight(castBar:GetHeight())
end
ticks[k]:ClearAllPoints()
ticks[k]:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
ticks[k]:Show()
end
else
for k, v in pairs(ticks) do
v:Hide()
end
end
end
 
cast.CheckCast = function(self, unit, name, rank, castid)
self:SetAlpha(1.0)
self.Spark:Show()
self:SetStatusBarColor(unpack(self.casting and self.CastingColor or self.ChannelingColor))
if unit == "player"then
if self.casting then
cast.setBarTicks(self, 0)
else
local spell = UnitChannelInfo(unit)
self.channelingTicks = channelingTicks[spell] or 0
cast.setBarTicks(self, self.channelingTicks)
end
elseif (unit == "target" or unit == "focus" or unit == "party") and self.interrupt then
self:SetStatusBarColor(1,0,0,.8)
else
self:SetStatusBarColor(255/255, 128/255, 128/255,1)
end
end
 
--fontstring func
lib.gen_fontstring = function(f, name, size, outline)
local fs = f:CreateFontString(nil, "OVERLAY")
fs:SetFont(name, size, outline)
fs:SetShadowColor(0,0,0,1)
return fs
end
 
--backdrop table
local backdrop_tab = {
bgFile = cfg.backdrop_texture,
edgeFile = cfg.backdrop_edge_texture,
tile = false, tileSize = 0, edgeSize = 5,
insets = {left = 5, right = 5, top = 5, bottom = 5,},
}
 
--backdrop func
lib.gen_backdrop = function(f)
f:SetBackdrop(backdrop_tab);
f:SetBackdropColor(0,0,0,0.6)
f:SetBackdropBorderColor(0,0,0,1)
end
 
--right click menu
lib.menu = function(self)
local unit = self.unit:sub(1, -2)
local cunit = self.unit:gsub("^%l", string.upper)
if(cunit == 'Vehicle') then
cunit = 'Player'
end
if unit == "party" then
ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
elseif(_G[cunit.."FrameDropDown"]) then
ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
end
end
 
--init func
lib.init = function(f)
f:SetAttribute("initial-height", f.height)
f:SetAttribute("initial-width", f.width)
f:SetAttribute("initial-scale", f.scale)
f:SetPoint("CENTER",UIParent,"CENTER",0,0)
f.menu = lib.menu
f:RegisterForClicks("AnyUp")
f:SetAttribute("*type2", "menu")
f:SetScript("OnEnter", UnitFrame_OnEnter)
f:SetScript("OnLeave", UnitFrame_OnLeave)
end
 
------ [Building frames]
--gen healthbar func
lib.gen_hpbar = function(f)
--statusbar
local s = CreateFrame("StatusBar", nil, f)
s:SetStatusBarTexture(cfg.statusbar_texture)
s:SetHeight(f.height-9)
s:SetWidth(f.width)
s:SetPoint("TOPLEFT", f, "TOPLEFT",0,0)
s:SetPoint("TOPRIGHT", f, "TOPRIGHT", 0,0)
 
s:SetAlpha(0.66)
s:SetOrientation("HORIZONTAL")
if f.mystyle ~= "player" and f.mystyle ~="target" and f.mystyle~="pet" then
s:SetHeight(f.height)
end
--helper
local h = CreateFrame("Frame", nil, s)
h:SetFrameLevel(0)
h:SetPoint("TOPLEFT",-4,4)
h:SetPoint("BOTTOMRIGHT",4,-4)
lib.gen_backdrop(h)
--bg
local b = s:CreateTexture(nil, "BACKGROUND")
b:SetTexture(cfg.statusbar_texture)
b:SetAllPoints(s)
f.Health = s
f.Health.bg = b
end
--gen hp strings func
lib.gen_hpstrings = function(f, unit)
--creating helper frame here so our font strings don't inherit healthbar parameters
local h = CreateFrame("Frame", nil, f)
h:SetAllPoints(f.Health)
h:SetFrameLevel(15)
local valsize
if f.mystyle == "arenatarget" or f.mystyle == "partypet" then valsize = 11 else valsize = 13 end
local name = lib.gen_fontstring(h, cfg.font, 13, "THINOUTLINE")
local hpval = lib.gen_fontstring(h, cfg.font, valsize, "THINOUTLINE")
if f.mystyle == "target" or f.mystyle == "tot" then
name:SetPoint("RIGHT", f.Health, "RIGHT",-3,0)
hpval:SetPoint("LEFT", f.Health, "LEFT",3,0)
name:SetJustifyH("RIGHT")
name:SetPoint("LEFT", hpval, "RIGHT", 5, 0)
else
name:SetPoint("LEFT", f.Health, "LEFT",3,0)
hpval:SetPoint("RIGHT", f.Health, "RIGHT",-3,0)
name:SetJustifyH("LEFT")
name:SetPoint("RIGHT", hpval, "LEFT", -5, 0)
end
f:Tag(name, '[mono:color][mono:longname]')
f:Tag(hpval, '[mono:hp]')
end
 
--gen swing func
lib.gen_swing = function(f)
local swing = CreateFrame("StatusBar",nil,f)
swing:SetStatusBarTexture(cfg.statusbar_texture)
swing:SetStatusBarColor(.8,.8,.8)
swing:SetHeight(1)
swing:SetWidth(f.width-28)
swing:SetPoint("TOP", f.Health, "BOTTOM", 0, -1)
if f.mystyle == "player" and C["unitframe"].swing == true then
swing:Show()
else
swing:Hide()
end
f.Swing = swing
end
 
--gen powerbar func
lib.gen_ppbar = function(f)
--statusbar
if f.mystyle ~= "player" and f.mystyle ~= "target" and f.mystyle ~= "pet" then return end
local s = CreateFrame("StatusBar", nil, f)
s:SetStatusBarTexture(cfg.statusbar_texture)
s:SetHeight(9)
s:SetWidth(f.width-28)
s:SetPoint("TOP",f.Health,"BOTTOM",0,-2)
if f.mystyle == "player" and C["unitframe"].powerspark == true then
--Powerspark func
local spark = s:CreateTexture(nil, "OVERLAY")
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetVertexColor(1, 1, 1, 0.5)
spark:SetBlendMode("ADD")
spark:SetHeight(s:GetHeight()*2)
spark:SetWidth(s:GetHeight())
--Options and settings
--spark.rtl = true
--Make the spark go from Right To Left instead
--Defaults to false
--spark.manatick = true
--Show mana regen ticks outside FSR (like the energy ticker)
--Defaults to false
--spark.highAlpha = 1
--What alpha setting to use for the FSR and energy spark
--Defaults to spark:GetAlpha()
--spark.lowAlpha = 0.25
--What alpha setting to use for the mana regen ticker
--Defaults to highAlpha / 4
f.Spark = spark
end
--helper
local h = CreateFrame("Frame", nil, s)
h:SetFrameLevel(0)
h:SetPoint("TOPLEFT",-4,4)
h:SetPoint("BOTTOMRIGHT",4,-4)
lib.gen_backdrop(h)
--bg
local b = s:CreateTexture(nil, "BACKGROUND")
b:SetTexture(cfg.statusbar_texture)
b:SetAllPoints(s)
f.Power = s
f.Power.bg = b
end
 
 
--filling up powerbar with text strings
lib.gen_ppstrings = function(f, unit)
--helper frame
local h = CreateFrame("Frame", nil, f)
h:SetAllPoints(f.Power)
h:SetFrameLevel(10)
local fh
if f.mystyle == "arena" then fh = 9 else fh = 11 end
local pp = lib.gen_fontstring(h, cfg.font, fh, "THINOUTLINE")
local info = lib.gen_fontstring(h, cfg.font, fh, "THINOUTLINE")
if f.mystyle == "target" or f.mystyle == "tot" then
info:SetPoint("RIGHT", f.Power, "RIGHT",-3,0)
pp:SetPoint("LEFT", f.Power, "LEFT",3,0)
info:SetJustifyH("RIGHT")
else
info:SetPoint("LEFT", f.Power, "LEFT",3,0)
pp:SetPoint("RIGHT", f.Power, "RIGHT",-5,0)
info:SetJustifyH("LEFT")
end
if class == "DRUID" then
f:Tag(pp, '[mono:druidpower] [mono:pp]')
else
f:Tag(pp, '[mono:pp]')
end
f:Tag(info, '[mono:info]')
end
 
--3d portrait behind hp bar
lib.gen_portrait = function(f)
local p = CreateFrame("PlayerModel", nil, f.Health)
p:SetFrameStrata("BACKGROUND")
p:SetWidth(f.Health:GetWidth()-2)
p:SetHeight(f.Health:GetHeight()-2)
p:SetPoint("TOP", f.Health, "TOP", 0, -2)
f.Portrait = p
end
 
------ [Castbar, +mirror castbar too!]
--gen castbar
lib.gen_castbar = function(f)
if C["unitframe"].castbar == true then
local s = CreateFrame("StatusBar", "oUF_monoCastbar"..f.mystyle, f)
s:SetWidth(f.width-28)
s:SetHeight(22)
s:SetStatusBarTexture(cfg.statusbar_texture)
s:SetStatusBarColor(pcolor[1], pcolor[2], pcolor[3],1)
s:SetFrameLevel(9)
--color
s.CastingColor = {pcolor[1], pcolor[2], pcolor[3]}
s.CompleteColor = {0.12, 0.86, 0.15}
s.FailColor = {1.0, 0.09, 0}
s.ChannelingColor = {pcolor[1], pcolor[2], pcolor[3]}
--helper
local h = CreateFrame("Frame", nil, s)
h:SetFrameLevel(0)
h:SetPoint("TOPLEFT",-4,4)
h:SetPoint("BOTTOMRIGHT",4,-4)
lib.gen_backdrop(h)
--backdrop
local b = s:CreateTexture(nil, "BACKGROUND")
b:SetTexture(cfg.statusbar_texture)
b:SetAllPoints(s)
b:SetVertexColor(pcolor[1]*0.2,pcolor[2]*0.2,pcolor[3]*0.2,0.7)
--spark
sp = s:CreateTexture(nil, "OVERLAY")
sp:SetBlendMode("ADD")
sp:SetAlpha(0.5)
sp:SetHeight(s:GetHeight()*2.5)
--spell text
local txt = lib.gen_fontstring(s, cfg.font, 11, "THINOUTLINE")
txt:SetPoint("LEFT", 2, 0)
txt:SetJustifyH("LEFT")
--time
local t = lib.gen_fontstring(s, cfg.font, 12, "THINOUTLINE")
t:SetPoint("RIGHT", -2, 0)
txt:SetPoint("RIGHT", t, "LEFT", -5, 0)
--icon
local i = s:CreateTexture(nil, "ARTWORK")
-- i:SetSize(s:GetHeight()-2,s:GetHeight()-2)
i:SetWidth(s:GetHeight()-2)
i:SetHeight(s:GetHeight()-2)
i:SetPoint("RIGHT", s, "LEFT", -4.5, 0)
i:SetTexCoord(0.1, 0.9, 0.1, 0.9)
i:Show()
--helper2 for icon
local h2 = CreateFrame("Frame", nil, s)
h2:SetFrameLevel(0)
h2:SetPoint("TOPLEFT",i,"TOPLEFT",-5,5)
h2:SetPoint("BOTTOMRIGHT",i,"BOTTOMRIGHT",5,-5)
lib.gen_backdrop(h2)
if f.mystyle == "player" then
--latency only for player unit
local z = s:CreateTexture(nil,"ADD")
z:SetTexture(cfg.statusbar_texture)
z:SetVertexColor(.8,.31,.45)
z:SetPoint("TOPRIGHT")
z:SetPoint("BOTTOMRIGHT")
s.SafeZone = z
end
if f.mystyle == "focus" and cfg.focusCBuserplaced then
s:SetAllPoints(f.Health)
s:SetToplevel(true)
 
--[[
s:SetPoint(unpack(cfg.focusCBposition))
s:SetWidth(cfg.focusCBwidth)
s:SetHeight(cfg.focusCBheight)
i:SetWidth(s:GetHeight()-2)
i:SetHeight(s:GetHeight()-2)
sp:SetHeight(s:GetHeight()*2.5) ]]
elseif f.mystyle == "pet" then
s:SetPoint("TOPRIGHT",f.Power,"BOTTOMRIGHT",0,-4)
s:SetScale(f:GetScale())
s:SetSize(s:GetWidth()-2, f.height/3)
i:SetPoint("RIGHT", s, "LEFT", -2, 0)
h2:SetFrameLevel(9)
b:Hide() txt:Hide() t:Hide() h:Hide()
else
s:SetPoint("TOPRIGHT",f.Power,"BOTTOMRIGHT",0,-4)
end
s.CustomTimeText = cast.CustomTimeText
s.PostCastStart = cast.CheckCast
s.PostChannelStart = cast.CheckCast
f.Castbar = s
f.Castbar.Text = txt
f.Castbar.Time = t
f.Castbar.Icon = i
f.Castbar.Spark = sp
end
end
--gen Mirror Cast Bar
lib.gen_mirrorcb = function(f)
for _, bar in pairs({'MirrorTimer1','MirrorTimer2','MirrorTimer3',}) do
for i, region in pairs({_G[bar]:GetRegions()}) do
if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
region:Hide()
end
end
_G[bar..'Border']:Hide()
_G[bar]:SetParent(UIParent)
_G[bar]:SetScale(1)
_G[bar]:SetHeight(16)
_G[bar]:SetWidth(280)
_G[bar]:SetBackdropColor(.1,.1,.1)
_G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
_G[bar..'Background']:SetTexture(cfg.statusbar_texture)
_G[bar..'Background']:SetAllPoints(bar)
_G[bar..'Background']:SetVertexColor(.15,.15,.15,.75)
_G[bar..'Text']:SetFont(cfg.font, 14)
_G[bar..'Text']:ClearAllPoints()
_G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)
_G[bar..'StatusBar']:SetAllPoints(_G[bar])
--glowing borders
local h = CreateFrame("Frame", nil, _G[bar])
h:SetFrameLevel(0)
h:SetPoint("TOPLEFT",-4,4)
h:SetPoint("BOTTOMRIGHT",4,-4)
lib.gen_backdrop(h)
end
end
 
------ [Auras, all of them!]
-- Creating our own timers with blackjack and hookers!
lib.FormatTime = function(s)
local day, hour, minute = 86400, 3600, 60
if s >= day then
return format("%dd", floor(s/day + 0.5)), s % day
elseif s >= hour then
return format("%dh", floor(s/hour + 0.5)), s % hour
elseif s >= minute then
if s <= minute * 5 then
return format('%d:%02d', floor(s/60), s % minute), s - floor(s)
end
return format("%dm", floor(s/minute + 0.5)), s % minute
elseif s >= minute / 12 then
return floor(s + 0.5), (s * 100 - floor(s * 100))/100
end
return format("%.1f", s), (s * 100 - floor(s * 100))/100
end
 
lib.CreateAuraTimer = function(self,elapsed)
if self.timeLeft then
self.elapsed = (self.elapsed or 0) + elapsed
local w = self:GetWidth()
if self.elapsed >= 0.1 then
if not self.first then
self.timeLeft = self.timeLeft - self.elapsed
else
self.timeLeft = self.timeLeft - GetTime()
self.first = false
end
if self.timeLeft > 0 and w > cfg.ATIconSizeThreshold then
local time = lib.FormatTime(self.timeLeft)
self.remaining:SetText(time)
if self.timeLeft < 5 then
self.remaining:SetTextColor(1, 0, 0)
else
self.remaining:SetTextColor(0.84, 0.75, 0.65)
end
else
self.remaining:Hide()
self:SetScript("OnUpdate", nil)
end
self.elapsed = 0
end
end
end
 
lib.PostUpdateIcon = function(self, unit, icon, index, offset)
local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
-- Debuff desaturation
if unitCaster ~= 'player' and unitCaster ~= 'vehicle' and not UnitIsFriend('player', unit) and icon.debuff then
icon.icon:SetDesaturated(true)
if C["unitframe"].onlyplayer == true then icon:Hide() end --只显示玩家施放的DEBUFF
else
icon.icon:SetDesaturated(false)
end
-- Creating aura timers
if duration and duration > 0 and (unitCaster == 'player' or unitCaster == 'vehicle') then
icon.remaining:Show()
else
icon.remaining:Hide()
end
icon.duration = duration
icon.timeLeft = expirationTime
icon.first = true
icon:SetScript("OnUpdate", lib.CreateAuraTimer)
end
-- creating aura icons
lib.PostCreateIcon = function(self, button)
button.cd:SetReverse()
button.cd.noOCC = true
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.icon:SetDrawLayer("BACKGROUND")
--count
button.count:ClearAllPoints()
button.count:SetJustifyH("RIGHT")
button.count:SetPoint("BOTTOMRIGHT", 2, -2)
button.count:SetTextColor(0.7,0.7,0.7)
--helper
local h = CreateFrame("Frame", nil, button)
h:SetFrameLevel(0)
h:SetPoint("TOPLEFT",-4,4)
h:SetPoint("BOTTOMRIGHT",4,-4)
lib.gen_backdrop(h)
--another helper frame for our fontstring to overlap the cd frame
local h2 = CreateFrame("Frame", nil, button)
h2:SetAllPoints(button)
h2:SetFrameLevel(10)
button.remaining = lib.gen_fontstring(h2, cfg.bfont, cfg.ATSize, "THINOUTLINE")
button.remaining:SetPoint("TOP", 0, -2)
--overlay texture for debuff types display
button.overlay:SetTexture(cfg.auratex)
button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT", -1.6, 1.6)
button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1.6, -1.6)
button.overlay:SetTexCoord(0.03, 0.96, 0.03, 0.96)
button.overlay.Hide = function(self) self:SetVertexColor(0, 0, 0) end
end
 
--auras for certain frames
lib.createAuras = function(f)
a = CreateFrame('Frame', nil, f)
if f.mystyle=="target" then
a:SetPoint('BOTTOMLEFT', f.Health, 'TOPLEFT', 1.5, 2)
a['growth-x'] = 'RIGHT'
a['growth-y'] = 'UP'
a.initialAnchor = 'BOTTOMLEFT'
else
a:SetPoint('TOPLEFT', f.Health, 'BOTTOMLEFT', 1.5, -2)
a['growth-x'] = 'RIGHT'
a['growth-y'] = 'DOWN'
a.initialAnchor = 'TOPLEFT'
end
a.gap = true
a.spacing = 4
a.size = 20
a.showDebuffType = true
if f.mystyle=="target" or (f.mystyle=="player" and cfg.playerauras) then
if f.mystyle=="player" and (class == "DEATHKNIGHT" or (class == "SHAMAN")) then
-- making space for rune or totem bar
a:SetPoint('BOTTOMLEFT', f.Health, 'TOPLEFT', 1, 6+f.height/3)
end
a:SetHeight((a.size+a.spacing)*2)
a:SetWidth((a.size+a.spacing)*9)
a.numBuffs = 20
a.numDebuffs = 20
elseif f.mystyle=="focus" or f.mystyle=="focustarget" then
a.size = 18
a.spacing = 4.5
a:SetHeight((a.size+a.spacing)*2)
a:SetWidth((a.size+a.spacing)*5)
a.numBuffs = C["unitframe"].Fbuffs
a.numDebuffs = C["unitframe"].Fdebuffs
end
f.Auras = a
a.PostCreateIcon = lib.PostCreateIcon
a.PostUpdateIcon = lib.PostUpdateIcon
end
-- buffs
lib.createBuffs = function(f)
--Hiding Deafault Player's buff frames
if cfg.stylebuffs then
_G["BuffFrame"]:Hide()
_G["BuffFrame"]:UnregisterAllEvents()
_G["BuffFrame"]:SetScript("OnUpdate", nil)
end
b = CreateFrame("Frame", nil, f)
b.initialAnchor = "TOPLEFT"
b["growth-y"] = "DOWN"
b.num = 5
b.size = 18
b.spacing = 4.5
b:SetHeight((b.size+b.spacing)*2)
b:SetWidth((b.size+b.spacing)*12)
if f.mystyle=="player" and cfg.stylebuffs then
b:SetPoint(unpack(cfg.BUFFpos))
b.initialAnchor = "TOPRIGHT"
b['growth-x'] = "LEFT"
b.size = cfg.BFIsize
b:SetWidth((b.size+b.spacing+1) * 15)
b.num = 0 --在原EUI头像中已有定义,这儿设为0取消.
b.spacing = 6
elseif f.mystyle=="pet" then
b.initialAnchor = "BOTTOMLEFT"
b:SetPoint("BOTTOMLEFT", f.Health, "TOPLEFT", 1, 2)
b["growth-x"] = "RIGHT"
b["growth-y"] = "UP"
b.num = 4
elseif f.mystyle=="tot" then
b:SetPoint("TOPLEFT", f.Health, "BOTTOMLEFT", 1, -2)
b.num = 0
end
b.PostCreateIcon = lib.PostCreateIcon
b.PostUpdateIcon = lib.PostUpdateIcon
f.Buffs = b
end
--debuffs
lib.createDebuffs = function(f)
d = CreateFrame("Frame", nil, f)
d.initialAnchor = "TOPRIGHT"
d["growth-y"] = "DOWN"
d.num = 5
d.size = 18
d.spacing = 4.5
d:SetHeight((d.size+d.spacing)*2)
d:SetWidth((d.size+d.spacing) * 5)
d.showDebuffType = true
if f.mystyle=="player" and cfg.stylebuffs then
d:SetPoint(unpack(cfg.DEBUFFpos))
d.size = cfg.BFIsize
d:SetWidth((d.size+d.spacing) * 15)
d.initialAnchor = "BOTTOMLEFT"
d['growth-x'] = "RIGHT"
d['growth-y'] = 'UP'
d.num = C["unitframe"].playerdebuffnum
d.spacing = 6
elseif f.mystyle=="pet" then
d:SetPoint("TOPLEFT", f.Health, "TOPRIGHT", d.spacing, -1)
d.initialAnchor = "TOPLEFT"
d.num = 0
elseif f.mystyle=="tot" then
d:SetPoint("TOPLEFT", f.Health, "BOTTOMLEFT", d.spacing, -2)
d.initialAnchor = "TOPLEFT"
d['growth-x'] = "RIGHT"
d['growth-y'] = "DOWN"
d.num = C["unitframe"].totdebuffs
end
d.PostCreateIcon = lib.PostCreateIcon
d.PostUpdateIcon = lib.PostUpdateIcon
f.Debuffs = d
end
 
------ [Extra functionality]
--gen DK runes
lib.gen_Runes = function(f)
if class ~= "DEATHKNIGHT" or C["unitframe"].cpoint ~= true then return
else
local runeloadcolors = {
[1] = {0.59, 0.31, 0.31},
[2] = {0.59, 0.31, 0.31},
[3] = {0.33, 0.51, 0.33},
[4] = {0.33, 0.51, 0.33},
[5] = {0.31, 0.45, 0.53},
[6] = {0.31, 0.45, 0.53},}
f.Runes = CreateFrame("Frame", nil, f)
for i = 1, 6 do
r = CreateFrame("StatusBar", f:GetName().."_Runes"..i, f)
-- r:SetSize(f.width/6 - 2, f.height/3)
r:SetWidth(f.width/6 - 2)
r:SetHeight(8)
if (i == 1) then
r:SetPoint("BOTTOMLEFT", f.Health, "TOPLEFT", 1, 3)
else
r:SetPoint("TOPLEFT", f.Runes[i-1], "TOPRIGHT", 2, 0)
end
r:SetStatusBarTexture(cfg.statusbar_texture)
--r:GetStatusBarTexture():SetHorizTile(false)
r:SetStatusBarColor(unpack(runeloadcolors[i]))
r.bd = r:CreateTexture(nil, "BORDER")
r.bd:SetAllPoints()
r.bd:SetTexture(cfg.statusbar_texture)
r.bd:SetVertexColor(0.15, 0.15, 0.15)
f.b = CreateFrame("Frame", nil, r)
f.b:SetPoint("TOPLEFT", r, "TOPLEFT", -4, 4)
f.b:SetPoint("BOTTOMRIGHT", r, "BOTTOMRIGHT", 4, -5)
f.b:SetBackdrop(backdrop_tab)
f.b:SetBackdropColor(0, 0, 0, 0)
f.b:SetBackdropBorderColor(0,0,0,1)
f.Runes[i] = r
end
end
end
--gen TotemBar for shamans
lib.gen_TotemBar = function(f)
if class ~= "SHAMAN" or C["unitframe"].cpoint ~= true then return
else
f.TotemBar = {}
for i = 1, 4 do
tb = CreateFrame("StatusBar", nil, f)
--tb:SetSize(f.width/4 - 2, f.height/3)
tb:SetWidth(f.width/4 - 2)
tb:SetHeight(8)
tb:SetStatusBarTexture(cfg.statusbar_texture)
tb:SetMinMaxValues(0, 1)
if (i == 1) then
tb:SetPoint("BOTTOMLEFT", f.Health, "TOPLEFT", 1, 1)
else
tb:SetPoint("TOPLEFT", f.TotemBar[i-1], "TOPRIGHT", 2, 0)
end
tb.bd = tb:CreateTexture(nil, "BORDER")
tb.bd:SetAllPoints()
tb.bd:SetTexture(cfg.statusbar_texture)
tb.bd:SetVertexColor(0.15, 0.15, 0.15)
tb.bg = CreateFrame("Frame", nil, tb)
tb.bg:SetPoint("TOPLEFT", tb, "TOPLEFT", -4, 4)
tb.bg:SetPoint("BOTTOMRIGHT", tb, "BOTTOMRIGHT", 4, -5)
tb.bg:SetBackdrop(backdrop_tab)
tb.bg:SetBackdropColor(0,0,0,0)
tb.bg:SetBackdropBorderColor(0,0,0,1)
f.TotemBar[i] = tb
end
end
end
--gen combo points
lib.CPUpdate = function(self, event, unit)
if unit == "pet" then return end
local cp = UnitExists("vehicle") and GetComboPoints("vehicle", "target") or GetComboPoints("player", "target")
local cpoints = self.CPoints
for i = 1, MAX_COMBO_POINTS do
if i <= cp then
cpoints[i]:Show()
else
cpoints[i]:Hide()
end
end
if self.Auras then
self.Auras:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 1.5, cp > 0 and 14 or 4)
end
end
 
lib.gen_CPoints = function(f)
if f.mystyle == 'target' and C["unitframe"].cpoint == true then
f.CPoints = {}
for i = 1, MAX_COMBO_POINTS do
cp = CreateFrame("Frame",nil,f)
-- cp:SetSize(f.width/5 - 2, f.height/3)
cp:SetWidth(f.width/5 - 2)
cp:SetHeight(8)
if i == 1 then
cp:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 1, 3)
else
cp:SetPoint('TOPLEFT', f.CPoints[i-1], 'TOPRIGHT', 2, 0)
end
cp.bd = cp:CreateTexture(nil,"LOW")
cp.bd:SetAllPoints(cp)
cp.bd:SetTexture(cfg.statusbar_texture)
cp.bg = CreateFrame("Frame", nil, cp)
cp.bg:SetPoint("TOPLEFT", cp, "TOPLEFT", -4, 4)
cp.bg:SetPoint("BOTTOMRIGHT", cp, "BOTTOMRIGHT", 4, -5)
cp.bg:SetBackdrop(backdrop_tab)
cp.bg:SetBackdropColor(0,0,0,0)
cp.bg:SetBackdropBorderColor(0,0,0,1)
f.CPoints[i] = cp
end
f.CPoints[1].bd:SetVertexColor(.3,.6,.3)
f.CPoints[2].bd:SetVertexColor(.3,.6,.3)
f.CPoints[3].bd:SetVertexColor(.6,.6,.3)
f.CPoints[4].bd:SetVertexColor(.6,.6,.3)
f.CPoints[5].bd:SetVertexColor(.7,.3,.3)
f.CPoints.Update = lib.CPUpdate
end
end
--gen combat and LFD icons
lib.gen_InfoIcons = function(f)
local h = CreateFrame("Frame",nil,f)
h:SetAllPoints(f.Health)
h:SetFrameLevel(10)
--combat icon
if f.mystyle == 'player' then
f.Combat = h:CreateTexture(nil, 'OVERLAY')
f.Combat = h:CreateTexture(nil, "OVERLAY")
f.Combat:SetPoint('TOPRIGHT', -1, 7)
f.Combat:SetHeight(14)
f.Combat:SetWidth(14)
-- f.Combat:SetVertexColor(255, 0, 0)
end
 
-- PvP icon
if f.mystyle == 'player' and C["unitframe"].showPvP == true then
f.PvP = h:CreateTexture(nil, 'OVERLAY')
f.PvP:SetWidth(14)
f.PvP:SetHeight(14)
f.PvP:SetPoint('TOPLEFT', -1, 7)
f.PvP:SetTexture('Interface\\CharacterFrame\\UI-StateIcon')
f.PvP:SetTexCoord(0.09, 0.43, 0.08, 0.42)
end
--Leader icon
li = h:CreateTexture(nil, "OVERLAY")
li:SetPoint("TOPLEFT", f, 0, 6)
-- li:SetSize(12,12)
li:SetWidth(12)
li:SetHeight(12)
f.Leader = li
--Assist icon
ai = h:CreateTexture(nil, "OVERLAY")
ai:SetPoint("TOPLEFT", f, 0, 6)
--ai:SetSize(12,12)
ai:SetWidth(12)
ai:SetHeight(12)
f.Assistant = ai
--ML icon
local ml = h:CreateTexture(nil, 'OVERLAY')
--ml:SetSize(12,12)
ml:SetWidth(12)
ml:SetHeight(12)
ml:SetPoint('LEFT', f.Leader, 'RIGHT')
f.MasterLooter = ml
end
--gen raid mark icons
lib.gen_RaidMark = function(f)
local h = CreateFrame("Frame", nil, f)
h:SetAllPoints(f)
h:SetFrameLevel(10)
h:SetAlpha(cfg.RMalpha)
local ri = h:CreateTexture(nil,'OVERLAY',h)
ri:SetPoint("CENTER", f, "CENTER", 0, 0)
--ri:SetSize(cfg.RMsize, cfg.RMsize)
ri:SetWidth(cfg.RMsize)
ri:SetHeight(cfg.RMsize)
f.RaidIcon = ri
end
--gen Temporary enchant frame
lib.gen_tempench = function(f)
if cfg.stylebuffs then
local ench,i = {},0
for i = 1,2 do
ench[i] = _G["TempEnchant"..i]
_G["TempEnchant"..i.."Border"]:Hide()
--_G["TempEnchant"..i.."Duration"]:SetFont(cfg.font, 9, "THINOUTLINE")
ench[i]:ClearAllPoints()
ench[i]:SetWidth(30)
ench[i]:SetHeight(30)
ench[i]:Show()
if i==1 then
ench[i]:SetPoint("TOPRIGHT", f, "TOPLEFT", -10, 0)
elseif i==2 then
ench[i]:SetPoint("RIGHT", ench[i-1], "LEFT", -10, 0)
end
--helper frame for nifty background
local h = CreateFrame("Frame", nil, ench[i])
h:SetFrameLevel(20)
h:SetPoint("TOPLEFT",-3.5,3.5)
h:SetPoint("BOTTOMRIGHT",3.5,-3.5)
h:SetBackdrop(backdrop_tab);
h:SetBackdropColor(0,0,0,0)
h:SetBackdropBorderColor(0,0,0,1)
end
end
end
--gen hilight texture
lib.gen_highlight = function(f)
local OnEnter = function(f)
UnitFrame_OnEnter(f)
f.Highlight:Show()
end
local OnLeave = function(f)
UnitFrame_OnLeave(f)
f.Highlight:Hide()
end
f:SetScript("OnEnter", OnEnter)
f:SetScript("OnLeave", OnLeave)
local hl = f.Health:CreateTexture(nil, "OVERLAY")
hl:SetAllPoints(f.Health)
hl:SetTexture(cfg.backdrop_texture)
hl:SetVertexColor(.5,.5,.5,.1)
hl:SetBlendMode("ADD")
hl:Hide()
f.Highlight = hl
end
 
-- oUF_CombatFeedback
lib.gen_combat_feedback = function(f)
local h = CreateFrame("Frame", nil, f.Health)
h:SetAllPoints(f.Health)
h:SetFrameLevel(30)
local cfbt = lib.gen_fontstring(h, cfg.font, 18, "THINOUTLINE")
cfbt:SetPoint("CENTER", f.Health, "BOTTOM", 0, -1)
cfbt.maxAlpha = 0.75
cfbt.ignoreEnergize = true
f.CombatFeedbackText = cfbt
end
 
-----------------------------
-- STYLE FUNCTIONS
-----------------------------
local function genStyle(self)
lib.init(self)
lib.gen_hpbar(self)
lib.gen_hpstrings(self)
lib.gen_ppbar(self)
lib.gen_highlight(self)
lib.gen_RaidMark(self)
end
 
--the player style
local function CreatePlayerStyle(self)
self.width = cfg.Pwidth
self.height = cfg.Pheight
self.scale = cfg.Pscale
self.mystyle = "player"
genStyle(self)
self.Health.frequentUpdates = true
self.Health.Smooth = false
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self.Health.colorSmooth = true
self.Health.bg.multiplier = 0.1
self.Power.frequentUpdates = true
self.Power.Smooth = false
self.Power.colorPower = true
self.Health.colorClass = cfg.colorClass
self.Health.colorClassNPC = false
self.Power.bg.multiplier = 0.3
lib.gen_castbar(self)
if C["unitframe"].portrait == true then
lib.gen_portrait(self)
end
lib.createBuffs(self)
lib.createDebuffs(self)
lib.gen_mirrorcb(self)
lib.gen_ppstrings(self)
lib.gen_Runes(self)
lib.gen_TotemBar(self)
lib.gen_InfoIcons(self)
lib.gen_tempench(self)
if cfg.playerauras then
lib.createAuras(self)
end
lib.gen_combat_feedback(self)
lib.gen_swing(self)--平砍计时条
end
 
--the target style
local function CreateTargetStyle(self)
self.width = cfg.Twidth
self.height = cfg.Theight
self.scale = cfg.Tscale
self.mystyle = "target"
genStyle(self)
self.Health.frequentUpdates = true
self.Health.Smooth = false
self.Health.colorDisconnected = true
self.Health.colorHappiness = true
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self.Health.colorSmooth = true
self.Health.bg.multiplier = 0.1
self.Power.frequentUpdates = true
self.Power.Smooth = false
self.Power.colorPower = true
self.Power.bg.multiplier = 0.3
self.Health.colorClass = cfg.colorClass
self.Health.colorClassNPC = false
lib.gen_castbar(self)
if C["unitframe"].portrait == true then
lib.gen_portrait(self)
end
lib.createAuras(self)
lib.gen_ppstrings(self)
lib.gen_CPoints(self)
lib.gen_combat_feedback(self)
end
 
--the tot style
local function CreateToTStyle(self)
self.width = C["unitframe"].totwidth
self.height = C["unitframe"].totheight
self.scale = cfg.PTTscale
self.mystyle = "tot"
genStyle(self)
self.Health.frequentUpdates = true
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self.Health.colorSmooth = true
self.Health.colorDisconnected = true
self.Health.colorHappiness = true
self.Health.colorClass = false
self.Health.bg.multiplier = 0.1
-- self.Power.colorPower = true
-- self.Power.bg.multiplier = 0.3
lib.createBuffs(self)
lib.createDebuffs(self)
end
 
--the pet style
local function CreatePetStyle(self)
self.width = cfg.PTTwidth
self.height = cfg.PTTheight
self.scale = cfg.PTTscale
self.mystyle = "pet"
self.disallowVehicleSwap = true
genStyle(self)
self.Health.frequentUpdates = true
self.Health.colorDisconnected = true
self.Health.colorHappiness = true
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self.Health.colorSmooth = true
self.Health.bg.multiplier = 0.1
self.Power.frequentUpdates = true
self.Power.colorPower = true
self.Power.bg.multiplier = 0.3
-- lib.gen_castbar(self)
lib.createBuffs(self)
lib.createDebuffs(self)
end
 
--the focus style
local function CreateFocusStyle(self)
self.width = cfg.Fwidth
self.height = cfg.Fheight
self.scale = cfg.Fscale
self.mystyle = "focus"
genStyle(self)
self.Health.frequentUpdates = true
self.Health.colorDisconnected = true
self.Health.colorHappiness = true
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self.Health.colorSmooth = true
self.Health.bg.multiplier = 0.1
-- self.Power.frequentUpdates = true
-- self.Power.colorPower = true
-- self.Power.bg.multiplier = 0.3
lib.gen_castbar(self)
lib.createAuras(self)
end
 
--the focus target style
local function CreateFotStyle(self)
self.width = cfg.Fwidth
self.height = cfg.Fheight
self.scale = cfg.Fscale
self.mystyle = "focustarget"
genStyle(self)
self.Health.frequentUpdates = true
self.Health.colorDisconnected = true
self.Health.colorHappiness = true
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self.Health.colorSmooth = true
self.Health.bg.multiplier = 0.1
-- self.Power.frequentUpdates = true
-- self.Power.colorPower = true
-- self.Power.bg.multiplier = 0.3
-- lib.gen_castbar(self)
lib.createAuras(self)
end
 
oUF:RegisterStyle("monoPlayer", CreatePlayerStyle)
oUF:SetActiveStyle("monoPlayer")
oUF:Spawn("player", "oUF_monoPlayerFrame"):SetPoint(unpack(cfg.Ppos))
 
oUF:RegisterStyle("monoTarget", CreateTargetStyle)
oUF:SetActiveStyle("monoTarget")
oUF:Spawn("target", "oUF_monoTargetFrame"):SetPoint(unpack(cfg.Tpos))
 
if cfg.showpet then
oUF:RegisterStyle("monoPet", CreatePetStyle)
oUF:SetActiveStyle("monoPet")
oUF:Spawn("pet", "oUF_monoPetFrame"):SetPoint(unpack(cfg.PEpos))
end
 
if cfg.showtot then
oUF:RegisterStyle("monoToT", CreateToTStyle)
oUF:SetActiveStyle("monoToT")
oUF:Spawn("targettarget", "oUF_mono_ToTFrame"):SetPoint(unpack(cfg.TTpos))
end
 
if cfg.showfocus then
oUF:RegisterStyle("monoFocus", CreateFocusStyle)
oUF:SetActiveStyle("monoFocus")
oUF:Spawn("focus", "oUF_monoFocusFrame"):SetPoint(unpack(cfg.Fpos))
oUF:RegisterStyle("monoFoT", CreateFotStyle)
oUF:SetActiveStyle("monoFoT")
oUF:Spawn("focustarget", "oUF_mono_FoTFrame"):SetPoint(unpack(cfg.FTpos))
else
oUF:DisableBlizzard'focus'
end
 
oUF:DisableBlizzard'party'
\ No newline at end of file
Eui/unitframe/unitframe3.lua New file
0,0 → 1,1049
local E, C = unpack(select(2, ...))
if C["unitframe"].aaaaunit ~= 3 then return end
 
BuffFrame:Hide()
local _, class = UnitClass('player')
local texture = [[Interface\AddOns\Eui\media\Cabaret.tga]]
local border = [[Interface\AddOns\Eui\media\border.tga]]
local font = E.font
local fontsize = 15
--local height, width = 27, 270
local height, width = C["unitframe"].playerheight, C["unitframe"].playerwidth
 
 
local buffsize = 26
 
-- Buffs/Debuffs
local Debuffs = true
local Buffs = true
local PlayerOnlyDebuffs = false
local DebuffType = true
local CooldownCount = true
 
-- General Stuff
local PvPIcon = C["unitframe"].showPvP
local Portraits = C["unitframe"].portrait
 
-- SwingBar
local SwingMeele = true
local SwingRange = false
local SwingClassColors = true
 
-- Castbar
local CastBars = C["unitframe"].castbar
local Safezone = true
local Latency = true
local ClassColor = C["unitframe"].colorClass
 
--RuneFrame:Hide()
 
local backdrop = {
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
insets = {top = -1, left = -1, bottom = -1, right = -1},
}
 
local colors = setmetatable({
power = setmetatable({
['MANA'] = {.31,.45,.63},
['RAGE'] = {.69,.31,.31},
['FOCUS'] = {.71,.43,.27},
['ENERGY'] = {.65,.63,.35},
}, {__index = oUF.colors.power}),
}, {__index = oUF.colors})
 
oUF.colors.runes = {
{196/255, 30/255, 58/255};
{173/255, 217/255, 25/255};
{35/255, 127/255, 255/255};
{178/255, 53/255, 240/255};
}
local CheckInterrupt = function(self, unit)
if unit == "vehicle" then unit = "player" end
if self.interrupt then
self.Bg:SetVertexColor(1, 0, 0, 0.6)
else
self.Bg:SetVertexColor(0, 0, 0, 0.6)
end
end
 
local function UpdateChannelStart(self, event, unit, name, rank, text)
if (self.Latency) then
self.Latency:ClearAllPoints()
self.Latency:SetPoint('LEFT', self, 'BOTTOMLEFT', 1, -1)
 
local _, _, ms = GetNetStats()
self.Latency:SetFormattedText('%dms', ms)
end
 
if (self.SafeZone) then
self.SafeZone:SetDrawLayer('ARTWORK')
self.SafeZone:SetPoint('TOPLEFT', self)
self.SafeZone:SetPoint('BOTTOMLEFT', self)
end
CheckInterrupt(self, unit)
end
 
local function UpdateCastStart(self, event, unit, name, rank, text, castid)
if (self.Latency) then
self.Latency:ClearAllPoints()
self.Latency:SetPoint('RIGHT', self, 'BOTTOMRIGHT', -1, 1)
 
local _, _, ms = GetNetStats()
self.Latency:SetFormattedText('%dms', ms)
end
 
if (self.SafeZone) then
self.SafeZone:SetDrawLayer('BORDER')
self.SafeZone:SetPoint('TOPRIGHT', self)
self.SafeZone:SetPoint('BOTTOMRIGHT', self)
end
CheckInterrupt(self, unit)
end
 
local menu = function(self)
local unit = self.unit:sub(1, -2)
local cunit = self.unit:gsub('(.)', string.upper, 1)
 
if(unit == 'party' or unit == 'partypet') then
ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor', 0, 0)
elseif(_G[cunit..'FrameDropDown']) then
ToggleDropDownMenu(1, nil, _G[cunit..'FrameDropDown'], 'cursor', 0, 0)
end
end
 
local updateRIcon = function(self, event)
local index = GetRaidTargetIndex(self.unit)
if(index) then
self.RIcon:SetText(ICON_LIST[index]..'22|t')
else
self.RIcon:SetText()
end
end
 
------------------------------
--Tags
------------------------------
 
local function ShortenValue(value)
if(value >= 1e6) then
return ('%.2fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1')
elseif(value >= 1e4) then
return ('%.1fk'):format(value / 1e3):gsub('%.?0+([km])$', '%1')
else
return value
end
end
 
oUF.Tags['Afterhealth'] = function(unit)
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local status = not UnitIsConnected(unit) and 'Offline' or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and 'Dead'
 
if(status) then
return status
elseif(unit == 'target' and UnitCanAttack('player', unit)) then
return ('%s | %d %%'):format(ShortenValue(min), min / max * 100)
elseif(unit == 'player' and min ~= max) then
return ('%d | %d%%'):format(min - max, min / max * 100)
elseif(unit == 'focus') then
return ('%d%%'):format(min/max * 100)
elseif(min ~= max) then
return ('%s | %s'):format(ShortenValue(min), ShortenValue(max))
else
return max
end
end
oUF.TagEvents['Afterhealth'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
 
oUF.Tags['Afterpower'] = function(unit)
local power = UnitPower(unit)
if(power > 0 and not UnitIsDeadOrGhost(unit)) then
return power
end
end
oUF.TagEvents['Afterpower'] = oUF.TagEvents.missingpp
 
local function UpdateDruidPower(self)
local bar = self.DruidPower
local num, str = UnitPowerType('player')
local min = UnitPower('player', (num ~= 0) and 0 or 3)
local max = UnitPowerMax('player', (num ~= 0) and 0 or 3)
 
bar:SetMinMaxValues(0, max)
 
if(min ~= max) then
bar:SetValue(min)
bar:SetAlpha(1)
 
if(num ~= 0) then
bar:SetStatusBarColor(unpack(colors.power['MANA']))
bar.Text:SetFormattedText('%d | %d%%', min, math.floor(min / max * 100))
else
bar:SetStatusBarColor(unpack(colors.power['ENERGY']))
bar.Text:SetText()
end
else
bar:SetAlpha(0)
bar.Text:SetText()
end
end
 
------------------------------
--Aura config
------------------------------
 
local auraIcon = function(icons, button)
 
if(DebuffType) then
icons.showDebuffType = true
end
 
if(CooldownCount) then
button.cd.noCooldownCount = true
end
button.cd.noOCC = true
button.icon:SetTexCoord(0.03, 0.97, 0.03, 0.97)
 
button.overlay:SetTexture(border)
button.overlay:SetTexCoord(0, 1, 0, 1)
button.overlay:ClearAllPoints()
button.overlay:SetPoint('TOPRIGHT', button, 1.35, 1.35)
button.overlay:SetPoint('BOTTOMLEFT', button, -1.35, -1.35)
button.overlay.Hide = function(self) self:SetVertexColor(0.35, 0.35, 0.35, 1) end
 
button.cd:SetReverse()
button.cd:ClearAllPoints()
button.cd:SetPoint('TOPRIGHT', button.icon, 'TOPRIGHT', -1, -1)
button.cd:SetPoint('BOTTOMLEFT', button.icon, 'BOTTOMLEFT', 1, 1)
 
button.count:SetFont(E.font, 14, 'OUTLINE')
button.count:ClearAllPoints()
button.count:SetPoint('BOTTOMRIGHT', 1, 1)
 
button.remaining = E.EuiSetFontn(button, E.font, 12, "LEFT")
button.remaining:SetPoint("CENTER", 0 , 2)
 
if (not button.background) then
button.background = button:CreateTexture(nil, 'BACKGROUND')
button.background:SetPoint('TOPLEFT', button.icon, 'TOPLEFT', -4, 4)
button.background:SetPoint('BOTTOMRIGHT', button.icon, 'BOTTOMRIGHT', 4, -4)
button.background:SetTexture([[Interface\AddOns\Eui\media\borderBackground]])
button.background:SetVertexColor(0, 0, 0, 1)
end
end
 
local FormatTime = function(s)
local day, hour, minute = 86400, 3600, 60
if s >= day then
return format("%dd", floor(s/day + 0.5)), s % day
elseif s >= hour then
return format("%dh", floor(s/hour + 0.5)), s % hour
elseif s >= minute then
if s <= minute then
return format('%d:%02d', floor(s/60), s % minute), s - floor(s)
end
return format("%dm", floor(s/minute + 0.5)), s % minute
elseif s >= minute / 12 then
return floor(s + 0.5), (s * 100 - floor(s * 100))/100
end
return format("%.1f", s), (s * 100 - floor(s * 100))/100
end
 
local CreateAuraTimer = function(self,elapsed)
if self.timeLeft then
self.elapsed = (self.elapsed or 0) + elapsed
-- local w = self:GetWidth()
if self.elapsed >= 0.1 then
if not self.first then
self.timeLeft = self.timeLeft - self.elapsed
else
self.timeLeft = self.timeLeft - GetTime()
self.first = false
end
if self.timeLeft > 0 and (self.cast == 'player' or self.cast == 'vehicle') then
local time = FormatTime(self.timeLeft)
self.remaining:SetText(time)
if self.timeLeft < 5 then
self.remaining:SetTextColor(1, 0, 0)
else
self.remaining:SetTextColor(1, 0.9, 0)
end
else
self.remaining:Hide()
self:SetScript("OnUpdate", nil)
end
self.elapsed = 0
end
end
end
 
local PostUpdateIcon
do
local playerUnits = {
player = true,
pet = true,
vehicle = true,
}
PostUpdateIcon = function(icons, unit, icon, index, offset, filter, isDebuff)
local texture = icon.icon
if(playerUnits[icon.owner]) then
texture:SetDesaturated(false)
else
if icon.debuff then texture:SetDesaturated(true) end
if C["unitframe"].onlyplayer == true then icon:Hide() end --Ö»ÏÔʾÍæ¼ÒÊ©·ÅµÄDEBUFF
end
 
local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
-- Creating aura timers
if duration and duration > 0 and (unitCaster == 'player' or unitCaster == 'vehicle') then
icon.remaining:Show()
else
icon.remaining:Hide()
end
icon.duration = duration
icon.timeLeft = expirationTime
icon.first = true
icon.cast = unitCaster
icon:SetScript("OnUpdate", CreateAuraTimer)
end
 
end
 
------------------------------
--Layout
------------------------------
 
local func = function(self, unit)
self.colors = colors
self.menu = menu
self.ignoreHealComm = true
self.DebuffHighlightBackdrop = false
self.DebuffHighlightFilter = false
 
self:EnableMouse(true)
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self:RegisterForClicks'anyup'
self:SetAttribute('*type2', 'menu')
 
E.CreateBorder(self, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4)
 
local hp = CreateFrame'StatusBar'
--[[ if(unit == 'targettarget')then
hp:SetHeight(height*.85)
else
hp:SetHeight(height*.85)
end
]]
if unit =='pet' then
hp:SetHeight(C["unitframe"].petheight*.85)
elseif unit =='targettarget' then
hp:SetHeight(C["unitframe"].totheight*.85)
elseif unit =='focus' then
hp:SetHeight(C["unitframe"].focusheight*.85)
elseif unit =='focustarget' then
hp:SetHeight(C["unitframe"].focusheight*.8*.85)
else
hp:SetHeight(height*.85)
end
 
 
hp:SetStatusBarTexture(texture)
hp.Smooth = false
hp:SetStatusBarColor(.25, .25, .25)
hp.frequentUpdates = true
hp:SetParent(self)
hp:SetPoint'TOP'
hp:SetPoint'LEFT'
hp:SetPoint'RIGHT'
 
local hpbg = hp:CreateTexture(nil, 'BORDER')
hpbg:SetAllPoints(hp)
hpbg:SetTexture(0, 0, 0, 0.9)
 
self:SetBackdrop(backdrop)
self:SetBackdropColor(0, 0, 0, 0.9)
 
local hpp = hp:CreateFontString(nil, 'OVERLAY')
hpp:SetFont(font, fontsize, 'OUTLINE')
hpp:SetPoint('RIGHT',hp, -2, 0)
self:Tag(hpp, '[raidcolor][Afterhealth]')
 
if unit == 'player' then
hpp:SetPoint('RIGHT',hp, -2, 0)
elseif unit == 'target' or unit:find("boss%d") then
hpp:SetPoint('RIGHT',hp, -2, 0)
elseif unit == 'focus' then
hpp:SetPoint('RIGHT',hp, -2,0)
elseif unit == 'focus' or unit == 'pet' or unit == 'targettarget' or unit == 'focustarget' then
hpp:SetPoint('BOTTOMLEFT', self, 'BOTTOMRIGHT', 500000000, -500000000)
end
 
hp.bg = hpbg
hp.value = hpp
self.Health = hp
self.OverrideUpdateHealth = updateHealth
 
 
local pp = CreateFrame'StatusBar'
-- pp:SetHeight(height*.11)
if unit =='pet' then
pp:SetHeight(C["unitframe"].petheight*.11)
elseif unit =='targettarget' then
pp:SetHeight(C["unitframe"].totheight*.11)
elseif unit =='focus' then
pp:SetHeight(C["unitframe"].focusheight*.11)
elseif unit =='focustarget' then
pp:SetHeight(C["unitframe"].focusheight*.8*.11)
else
pp:SetHeight(height*.11)
end
pp:SetStatusBarTexture(texture)
pp.frequentUpdates = true
pp.colorTapping = true
pp.colorHappiness = true
pp.colorClass = true
pp.colorReaction = true
pp.Smooth = false
pp:SetParent(self)
pp:SetPoint('BOTTOM')
pp:SetPoint('LEFT', .2, 0)
pp:SetPoint('RIGHT', -.2, 0)
 
local ppbg = pp:CreateTexture(nil, 'BORDER')
ppbg:SetAllPoints(pp)
ppbg:SetTexture(texture)
ppbg.multiplier = .3
 
local ppp = pp:CreateFontString(nil, 'OVERLAY')
ppp:SetFont(font, fontsize, 'OUTLINE')
if unit == 'targettarget' or unit == 'focustarget' or unit == 'focus' then
ppp:SetPoint('LEFT',hpp,'RIGHT', -5000, 0)
else
ppp:SetPoint('LEFT',hpp,'RIGHT', -(C["unitframe"].playerwidth-5), 0)
end
self:Tag(ppp, '[raidcolor][Afterpower]')
 
pp.value = ppp
pp.bg = ppbg
self.Power = pp
self.PostUpdatePower = updatePower
 
--------------------------------
--CastBars
--------------------------------
 
if(CastBars)then
if(unit == 'player' or unit == 'focus' or unit == 'target' or unit == 'pet') then
self.Castbar = CreateFrame('StatusBar', nil, self)
self.Castbar:SetStatusBarTexture(texture)
self.Castbar:SetScale(1)
self.Castbar:SetStatusBarColor(.25, .25, .25)
E.CreateBorder(self.Castbar, 11, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
 
self.Castbar.Bg = self.Castbar:CreateTexture(nil, 'BACKGROUND')
self.Castbar.Bg:SetAllPoints(self.Castbar)
self.Castbar.Bg:SetTexture(texture)
self.Castbar.Bg:SetVertexColor(0, 0, 0, 0.6)
 
if(unit == 'player')then
local playerColor = E.RAID_CLASS_COLORS[select(2, UnitClass('player'))]
if(ClassColor)then
self.Castbar:SetStatusBarColor(playerColor.r, playerColor.g, playerColor.b)
end
-- self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
-- self.Castbar.Icon:SetHeight(44)
-- self.Castbar.Icon:SetWidth(44)
-- self.Castbar.Icon:SetPoint("RIGHT", 52, 7)
 
-- self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY")
-- self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT")
-- self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT")
-- self.IconOverlay:SetTexture(border)
-- self.IconOverlay:SetVertexColor(0.35, 0.35, 0.35, 1)
 
-- self.Castbar.IconBack = self.Castbar:CreateTexture(nil, "BACKGROUND")
-- self.Castbar.IconBack:SetPoint("TOPLEFT",self.Castbar.Icon,"TOPLEFT",-6,6)
-- self.Castbar.IconBack:SetPoint("BOTTOMRIGHT",self.Castbar.Icon,"BOTTOMRIGHT",6,-6)
-- self.Castbar.IconBack:SetTexture([[Interface\AddOns\Eui\media\borderBackground]])
-- self.Castbar.IconBack:SetVertexColor(0, 0, 0, 1)
 
if class == 'SHAMAN' or class == 'DEATHKNIGHT' then
self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -30)
else
self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -10)
end
self.Castbar:SetHeight(20)
self.Castbar:SetWidth(C["unitframe"].playerwidth)
-- self.Castbar:SetScale(0.8)
self.Castbar:SetParent(UIParent)
 
if(Safezone)then
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil, 'BORDER')
self.Castbar.SafeZone:SetTexture('Interface\\Buttons\\WHITE8x8')
self.Castbar.SafeZone:SetVertexColor(1, 0.5, 0, 1)
end
 
if(Latency)then
self.Castbar.Latency = self:CreateFontString(nil, 'ARTWORK')
self.Castbar.Latency:SetFont(font, 12, 'OUTLINE')
self.Castbar.Latency:SetParent(self.Castbar)
self.Castbar.Latency:SetDrawLayer('OVERLAY')
self.Castbar.Latency:SetVertexColor(0.6, 0.6, 0.6)
self.Castbar.Latency:SetAlpha(1)
end
 
 
 
end
 
self.Castbar.CustomDelayText = function(self, duration)
self.Time:SetFormattedText('(|cffff0000-%.1f|r) %.1f | %.1f', self.delay, duration, self.max)
end
 
self.Castbar.CustomTimeText = function(self, duration)
self.Time:SetFormattedText('%.1f | %.1f', duration, self.max)
end
 
self.Castbar.Time = self:CreateFontString(nil, 'ARTWORK')
self.Castbar.Time:SetFont(font, 13, 'OUTLINE')
self.Castbar.Time:SetPoint('RIGHT', self.Castbar, 'RIGHT', -7, 0)
self.Castbar.Time:SetHeight(10)
self.Castbar.Time:SetJustifyH('RIGHT')
self.Castbar.Time:SetParent(self.Castbar)
 
self.Castbar.Text = self:CreateFontString(nil, 'ARTWORK')
self.Castbar.Text:SetFont(font, 13, 'OUTLINE')
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 4, 0)
self.Castbar.Text:SetPoint('RIGHT', self.Castbar.Time, 'LEFT', -7, 0)
self.Castbar.Text:SetHeight(10)
self.Castbar.Text:SetJustifyH('LEFT')
self.Castbar.Text:SetParent(self.Castbar)
 
if (unit == 'focus') then
self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', -10, -10)
self.Castbar:SetWidth(260)
self.Castbar:SetHeight(25)
self.Castbar:SetStatusBarColor(.25, .25, .25)
self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
self.Castbar.Icon:SetHeight(44)
self.Castbar.Icon:SetWidth(44)
self.Castbar.Icon:SetPoint("LEFT", -52, 7)
self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY")
self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT")
self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT")
self.IconOverlay:SetTexture(border)
self.IconOverlay:SetVertexColor(0.35, 0.35, 0.35, 1)
self.Castbar.IconBack = self.Castbar:CreateTexture(nil, "BACKGROUND")
self.Castbar.IconBack:SetPoint("TOPLEFT",self.Castbar.Icon,"TOPLEFT",-6,6)
self.Castbar.IconBack:SetPoint("BOTTOMRIGHT",self.Castbar.Icon,"BOTTOMRIGHT",6,-6)
self.Castbar.IconBack:SetTexture([[Interface\AddOns\Eui\media\borderBackground]])
self.Castbar.IconBack:SetVertexColor(0, 0, 0, 1)
elseif (unit == 'target') then
self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -10)
self.Castbar:SetWidth(C["unitframe"].playerwidth)
self.Castbar:SetHeight(20)
self.Castbar:SetStatusBarColor(.25, .25, .25)
self.Castbar:SetParent(self)
elseif (unit == 'pet') then
self.Castbar:SetStatusBarColor(.25, .25, .25)
self.Castbar:SetParent(self)
self.Castbar:SetHeight(22)
self.Castbar:SetWidth(C["unitframe"].petwidth)
self.Castbar:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 10)
end
if unit == 'player' or unit == 'target' or unit == 'focus' then
self.Castbar.PostCastStart = UpdateCastStart
self.Castbar.PostChannelStart = UpdateChannelStart
end
end
 
end
 
for _, bar in pairs({
'MirrorTimer1',
'MirrorTimer2',
'MirrorTimer3',
}) do
for i, region in pairs({_G[bar]:GetRegions()}) do
if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
region:Hide()
end
end
 
E.CreateBorder(_G[bar], 11, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
 
_G[bar..'Border']:Hide()
 
_G[bar]:SetParent(UIParent)
_G[bar]:SetScale(1.132)
_G[bar]:SetHeight(20)
_G[bar]:SetWidth(280)
 
_G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
_G[bar..'Background']:SetTexture('Interface\\Buttons\\WHITE8x8')
_G[bar..'Background']:SetAllPoints(bar)
_G[bar..'Background']:SetVertexColor(0, 0, 0, 0.5)
 
_G[bar..'Text']:SetFont(CastingBarFrameText:GetFont(), 13)
_G[bar..'Text']:ClearAllPoints()
_G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)
 
_G[bar..'StatusBar']:SetAllPoints(_G[bar])
end
--------------------------------
--Signs
--------------------------------
if(unit == 'player') then
local leader = hp:CreateTexture(nil, 'OVERLAY')
leader:SetHeight(15)
leader:SetWidth(15)
leader:SetPoint('BOTTOMLEFT', hp, 'TOPLEFT', -5, -2)
leader:SetTexture('Interface\\GroupFrame\\UI-Group-LeaderIcon')
self.Leader = leader
 
local masterlooter = hp:CreateTexture(nil, 'OVERLAY')
masterlooter:SetHeight(15)
masterlooter:SetWidth(15)
masterlooter:SetPoint('LEFT', leader, 'RIGHT')
self.MasterLooter = masterlooter
end
------------------------------
--Portraits
------------------------------
if(Portraits) then
local portrait = CreateFrame('PlayerModel', nil, self)
portrait:SetBackdrop(backdrop)
portrait:SetBackdropColor(0, 0, 0, .9)
portrait:SetScript('OnShow', function(self) self:SetCamera(0) end)
portrait:SetWidth(height*1.5)
portrait:SetHeight(height*1.5)
portrait.type = '3D'
self.Portrait = portrait
 
E.CreateBorder(portrait, 12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
 
if(unit == 'player') then
portrait:SetPoint('TOPRIGHT', self, 'TOPLEFT', -11, 0)
elseif(unit == 'target') then
portrait:SetPoint('TOPLEFT', self, 'TOPRIGHT', 11, 0)
elseif(unit == 'focus' or unit == 'pet') then
portrait:SetPoint('TOPRIGHT', self, 'TOPLEFT', -11, 0)
 
end
end
------------------------------------
--ICON
------------------------------------
 
if(PvPIcon) then
local pvp = hp:CreateTexture(nil, 'OVERLAY')
pvp:SetPoint('BOTTOMRIGHT', hp, 'TOPRIGHT', 18, -45)
pvp:SetHeight(28)
pvp:SetWidth(28)
self.PvP = pvp
end
 
if(unit == 'player') then
self.Resting = self.Power:CreateTexture(nil, 'OVERLAY')
self.Resting:SetHeight(18)
self.Resting:SetWidth(20)
self.Resting:SetPoint('BOTTOMLEFT', -8.5, -8.5)
self.Resting:SetTexture('Interface\\CharacterFrame\\UI-StateIcon')
self.Resting:SetTexCoord(0,0.5,0,0.421875)
end
 
local Combat = hp:CreateTexture(nil, 'OVERLAY')
Combat:SetHeight(21)
Combat:SetWidth(21)
Combat:SetPoint('BOTTOMLEFT', hp, -10, -10)
self.Combat = Combat
 
local ricon = hp:CreateFontString(nil, 'OVERLAY')
ricon:SetFontObject(GameFontNormalSmall)
ricon:SetTextColor(1, 1, 1)
ricon:SetPoint('CENTER', hp, 0, 12)
ricon:SetHeight(24)
ricon:SetWidth(24)
self.RIcon = ricon
self:RegisterEvent('RAID_TARGET_UPDATE', updateRIcon)
table.insert(self.__elements, updateRIcon)
 
if(unit == 'target') and C["unitframe"].cpoint == true then
local cpoints = self:CreateFontString(nil, 'OVERLAY')
cpoints:SetFont(font, 26, 'OUTLINE')
cpoints:SetPoint('RIGHT', self, 'LEFT', -10, 0)
cpoints:SetJustifyH('RIGHT')
self:Tag(cpoints, '[cpoints]')
end
 
if(unit == 'player' or unit == 'target' or unit =='focus' or unit == 'pet' or unit == 'targetarget' or unit == 'focustarget') then
local cbft = hp:CreateFontString(nil, 'OVERLAY')
cbft:SetPoint('CENTER', self)
cbft:SetFont(font, 21, 'OUTLINE')
self.CombatFeedbackText = cbft
self.CombatFeedbackText.maxAlpha = 1
 
end
 
if(unit~='player')then
local name = hp:CreateFontString(nil, 'OVERLAY')
if(unit == 'targettarget' or unit == 'pet' or unit == 'focustarget') then
name:SetPoint('CENTER')
name:SetWidth(150)
elseif unit == 'focus' then
name:SetPoint('LEFT', hp, 'LEFT', 2, 0)
name:SetJustifyH'LEFT'
name:SetWidth(150)
else
name:SetPoint('LEFT', hp, 'LEFT', -2, 27)
name:SetJustifyH'LEFT'
name:SetWidth(300)
end
name:SetFont(font, fontsize, 'OUTLINE')
name:SetTextColor(1, 1, 1)
name:SetHeight(fontsize)
self.Info = name
if(unit == 'target')then
self:Tag(self.Info,'[difficulty][level][shortclassification] [raidcolor][name]')
else
self:Tag(self.Info,'[raidcolor][name]')
end
-- self:SetAttribute('initial-scale', 0.8)
end
----------------------------------
-- Auras
----------------------------------
if unit == 'target' then
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', -1, 27)
Auras.showDebuffType = true
Auras:SetWidth(C["unitframe"].playerwidth-4)
Auras:SetHeight(C["unitframe"].playerheight * 2)
Auras.size = 25
Auras.spacing = 4
Auras.gap = true
Auras.numBuffs = 18
Auras.numDebuffs = 21
Auras.PostCreateIcon = auraIcon
Auras.PostUpdateIcon = PostUpdateIcon
self.Auras = Auras
end
 
if(Buffs) and unit ~= 'target' then
local buffs = CreateFrame('Frame', nil, self)
-- buffs:SetHeight(width)
-- buffs:SetWidth(540)
buffs:SetHeight(width)
buffs:SetWidth(width*2)
buffs.PostCreateIcon = auraIcon
--[[ if(unit == 'player') then
buffs.initialAnchor = 'TOPLEFT'
buffs['growth-y'] = 'DOWN'
buffs['growth-x'] = 'RIGHT'
buffs:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
buffs.size = 36
buffs.spacing = 5
end]]
 
if(unit == 'pet' or unit == 'focus' or unit == 'target') then
buffs.initialAnchor = 'TOPLEFT'
buffs['growth-y'] = 'RIGHT'
buffs['growth-x'] = 'DOWN'
buffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', -3, -8)
buffs.size = 28
buffs.spacing = 3
end
 
if(unit == 'focus' or unit == 'pet') then
buffs.num = 2
elseif(unit=='target') then
buffs.num = 9
else
buffs.num = 40
end
self.Buffs = buffs
buffs.PostUpdateIcon = PostUpdateIcon
end
 
if(Debuffs) and unit ~= 'target' then
local debuffs = CreateFrame('Frame', nil, self)
debuffs:SetHeight(width)
debuffs:SetWidth(width)
debuffs.PostCreateIcon = auraIcon
if(unit == 'pet'or unit == 'focus') then
debuffs:SetPoint('LEFT', self, 'RIGHT', 7, 0)
debuffs['growth-x'] = 'RIGHT'
debuffs.initialAnchor = 'LEFT'
debuffs.size = 28
debuffs.spacing = 5
elseif(unit == 'player') then
debuffs:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -132)
debuffs['growth-x'] = 'RIGHT'
debuffs.initialAnchor = 'TOPLEFT'
 
elseif(unit == 'targettarget' or unit == 'focustarget') then
debuffs:SetPoint('LEFT', self, 'RIGHT', 20, 5)
debuffs['growth-x'] = 'RIGHT'
debuffs.initialAnchor = 'LEFT'
else
debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', -4, 27)
debuffs['growth-y'] = 'UP'
debuffs.initialAnchor = 'BOTTOMLEFT'
if(PlayerOnlyDebuffs)then
debuffs.onlyShowPlayer = false
end
end
debuffs.size = 24
debuffs.spacing = 3
if(unit == 'player') then
debuffs.size = 32
debuffs:SetWidth(500)
debuffs.spacing = 5
debuffs.num = 32
elseif(unit == 'targettarget') then
debuffs.num = 0
elseif(unit=='target') then
debuffs.num = 20
else
debuffs.num = 4
end
if unit == 'player' then debuffs.num =0 end
self.Debuffs = debuffs
debuffs.PostUpdateIcon = PostUpdateIcon
end
 
if(unit == 'player') then
if(IsAddOnLoaded('oUF_Swing')) then
self.Swing = CreateFrame('StatusBar', nil, self)
self.Swing:SetPoint('TOP', self, 'BOTTOM', 335, -1)
self.Swing:SetStatusBarTexture(texture)
self.Swing:SetStatusBarColor(1, 0.7, 0)
self.Swing:SetHeight(15)
self.Swing:SetWidth(width)
self.Swing:SetBackdrop(backdrop)
self.Swing:SetBackdropColor(0, 0, 0)
 
local playerColor = E.RAID_CLASS_COLORS[select(2, UnitClass('player'))]
if(SwingClassColors)then
self.Swing:SetStatusBarColor(playerColor.r, playerColor.g, playerColor.b)
end
 
E.CreateBorder(self.Swing, 12, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
 
self.Swing.Text = self.Swing:CreateFontString(nil, 'OVERLAY')
self.Swing.Text:SetFont(font, 24, 'OUTLINE')
self.Swing.Text:SetPoint('CENTER', self.Swing)
 
self.Swing.bg = self.Swing:CreateTexture(nil, 'BORDER')
self.Swing.bg:SetAllPoints(self.Swing)
self.Swing.bg:SetTexture(0, 0, 0, 0.1)
 
if(SwingMeele)then
self.Swing.disableMelee = false
end
 
if(SwingRange)then
self.Swing.disableRanged = false
end
end
 
if class == 'DEATHKNIGHT' and C["unitframe"].cpoint == true then
self.Runes = CreateFrame('Frame', nil, UIParent)
for i = 1, 6 do
self.Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self)
if(i == 1) then
self.Runes[i]:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -8)
else
self.Runes[i]:SetPoint('TOPLEFT', self.Runes[i-1], 'TOPRIGHT', 5, 0)
end
self.Runes[i]:SetStatusBarTexture(texture)
self.Runes[i]:SetHeight(10)
self.Runes[i]:SetWidth((width-20)/6 - 0.85)
self.Runes[i]:SetBackdrop(backdrop)
self.Runes[i]:SetBackdropColor(.1, .1, .1)
-- self.Runes[i]:SetMinMaxValues(0, 1)
 
E.CreateBorder(self.Runes[i], 12, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
 
self.Runes[i].bg = self.Runes[i]:CreateTexture(nil, 'BORDER')
self.Runes[i].bg:SetAllPoints(self.Runes[i])
self.Runes[i].bg:SetTexture(0.1, 0.1, 0.1)
end
end
 
if class == 'SHAMAN' and C["unitframe"].cpoint == true then
self.TotemBar = {}
self.TotemBar.Destroy = true
for i = 1, 4 do
self.TotemBar[i] = CreateFrame('StatusBar', nil, self)
self.TotemBar[i]:SetHeight(12)
self.TotemBar[i]:SetWidth((width-5)/4 - 5)
if (i == 1) then
self.TotemBar[i]:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', -1, -9)
else
self.TotemBar[i]:SetPoint('RIGHT', self.TotemBar[i-1], 'LEFT', -8, 0)
end
 
E.CreateBorder(self.TotemBar[i], 12, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
 
self.TotemBar[i]:SetStatusBarTexture(texture)
self.TotemBar[i]:SetBackdrop(backdrop)
self.TotemBar[i]:SetBackdropColor(0,0,0,6)
self.TotemBar[i]:SetMinMaxValues(0, 1)
 
self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, 'BORDER')
self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
self.TotemBar[i].bg:SetTexture(texture)
self.TotemBar[i].bg.multiplier = 0.3
end
end
 
if(IsAddOnLoaded('oUF_Experience')) then
self.Experience = CreateFrame('StatusBar', nil, self)
self.Experience:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -13)
self.Experience:SetStatusBarTexture(texture)
self.Experience:SetStatusBarColor(0,.7,1)
self.Experience:SetHeight(15)
self.Experience:SetWidth((unit == 'pet') and 150 or width)
self.Experience:SetBackdrop(backdrop)
self.Experience:SetBackdropColor(0, 0, 0, .5)
 
self.Experience.Tooltip = true
 
E.CreateBorder(self.Experience, 12, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
 
self.Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY')
self.Experience.Text:SetFont(font, fontsize, 'OUTLINE')
self.Experience.Text:SetPoint('CENTER', self.Experience)
self.Experience.bg = self.Experience:CreateTexture(nil, 'BORDER')
self.Experience.bg:SetAllPoints(self.Experience)
self.Experience.bg:SetTexture(0, 0, 0, .5)
end
 
if(class == 'DRUID') then
self.DruidPower = CreateFrame('StatusBar', nil, self)
self.DruidPower:SetPoint('BOTTOM', self.Power, 'TOP')
self.DruidPower:SetStatusBarTexture(texture)
self.DruidPower:SetHeight(1)
self.DruidPower:SetWidth(width)
self.DruidPower:SetAlpha(0)
 
self.DruidPower.Text = self.DruidPower:CreateFontString(nil, 'OVERLAY')
self.DruidPower.Text:SetFont(font, fontsize, 'OUTLINE')
self.DruidPower.Text:SetPoint('CENTER', self.DruidPower)
self.DruidPower.Text:SetTextColor(unpack(colors.power['MANA']))
 
self:RegisterEvent('UNIT_MANA', UpdateDruidPower)
self:RegisterEvent('UNIT_ENERGY', UpdateDruidPower)
self:RegisterEvent('PLAYER_LOGIN', UpdateDruidPower)
end
 
end
 
if(unit =='focus' or unit == 'pet' or unit == 'targetarget' or unit == 'focustarget') then
--[[
self.Range = {
insideAlpha = 1,
outsideAlpha = 0.3,
}
]]
self.SpellRange = true
 
self.SpellRange = {
insideAlpha = 1,
outsideAlpha = 0.3,
}
 
end
 
if unit =='pet' then
self:SetAttribute('initial-width', C["unitframe"].petwidth)
self:SetAttribute('initial-height', C["unitframe"].petheight)
elseif unit =='targettarget' then
self:SetAttribute('initial-width', C["unitframe"].totwidth)
self:SetAttribute('initial-height', C["unitframe"].totheight)
elseif unit =='focus' then
self:SetAttribute('initial-width', C["unitframe"].focuswidth)
self:SetAttribute('initial-height', C["unitframe"].focusheight)
elseif unit =='focustarget' then
self:SetAttribute('initial-width', C["unitframe"].focuswidth*0.8)
self:SetAttribute('initial-height', C["unitframe"].focusheight*0.8)
else
self:SetAttribute('initial-height', height)
self:SetAttribute('initial-width', width)
-- self:SetAttribute('initial-scale', 0.8)
end
 
self.disallowVehicleSwap = true
 
return self
 
end
 
local function menu(self)
if(self.unit:match('party')) then
ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor')
else
FriendsDropDown.unit = self.unit
FriendsDropDown.id = self.id
FriendsDropDown.initialize = RaidFrameDropDown_Initialize
ToggleDropDownMenu(1, nil, FriendsDropDown, 'cursor')
end
end
 
local function UpdateThreat(self, _, unit)
if (self.unit ~= unit) then
return
end
 
if (self.Aggro) then
local threat = UnitThreatSituation(self.unit)
if (threat == 3) then
self.Aggro:SetText('|cFFFF0000AGGRO')
self.Health:SetBackdropColor(0.9, 0, 0)
else
self.Aggro:SetText('')
self.Health:SetBackdropColor(0, 0, 0)
end
end
end
 
 
oUF:RegisterStyle('Aftermathh', func)
oUF:SetActiveStyle'Aftermathh'
 
if C["raid"].grid == true then
ptx = (C["raid"].gridw * 5 + 20) / 2 + 4
pty = C["raid"].gridh * 5 + 20 + C["raid"].gridheight
 
else
ptx = C["unitframe"].totwidth / 2 + 8
pty = C["unitframe"].petheight + 162 + 23 + C["actionbar"].petbuttonsize + C["actionbar"].buttonspacing*2
end
--if C["actionbar"].actionbarrows > 2 then pty = pty + 33 end
 
local player = oUF:Spawn('player')
player:SetPoint('TOPRIGHT', UIParent, 'BOTTOM', -ptx, pty)
local target = oUF:Spawn('target')
target:SetPoint('TOPLEFT', UIParent, 'BOTTOM', ptx, pty)
local tot = oUF:Spawn('targettarget')
tot:SetPoint('BOTTOMLEFT', oUF_AftermathhTarget, "TOPRIGHT", 11, 11)
local pet = oUF:Spawn('pet')
pet:SetPoint('BOTTOMRIGHT', oUF_AftermathhPlayer, "TOPLEFT", -11, 11)
local focus = oUF:Spawn('focus')
focus:SetPoint('LEFT', UIParent, 105, -158)
local fot = oUF:Spawn('focustarget')
fot:SetPoint('BOTTOMLEFT',oUF_AftermathhFocus, "TOPLEFT" ,0, 11)
 
oUF:DisableBlizzard'party'
--[[ do
for k,v in pairs(UnitPopupMenus) do
for x,y in pairs(UnitPopupMenus[k]) do
if y == "SET_FOCUS" then
table.remove(UnitPopupMenus[k],x)
elseif y == "CLEAR_FOCUS" then
table.remove(UnitPopupMenus[k],x)
end
end
end
end ]]
\ No newline at end of file
Eui/unitframe/plugin/combatfeedback.lua New file
0,0 → 1,148
local damage_format = "-%d"
local heal_format = "+%d"
local maxAlpha = 0.6
local updateFrame
local feedback = {}
local originalHeight = {}
local color
local colors = {
STANDARD = { 1, 1, 1 }, -- color for everything not in the list below
-- damage colors
IMMUNE = { 1, 1, 1 },
DAMAGE = { 1, 0, 0 },
CRUSHING = { 1, 0, 0 },
CRITICAL = { 1, 0, 0 },
GLANCING = { 1, 0, 0 },
ABSORB = { 1, 1, 1 },
BLOCK = { 1, 1, 1 },
RESIST = { 1, 1, 1 },
MISS = { 1, 1, 1 },
-- heal colors
HEAL = { 0, 1, 0 },
CRITHEAL = { 0, 1, 0 },
-- energize colors
ENERGIZE = { 0.41, 0.8, 0.94 },
CRITENERGIZE = { 0.41, 0.8, 0.94 },
}
 
local function createUpdateFrame()
if updateFrame then return end
updateFrame = CreateFrame("Frame")
updateFrame:Hide()
updateFrame:SetScript("OnUpdate", function()
if next(feedback) == nil then
updateFrame:Hide()
return
end
for object, startTime in pairs(feedback) do
local maxalpha = object.CombatFeedbackText.maxAlpha
local elapsedTime = GetTime() - startTime
if ( elapsedTime < COMBATFEEDBACK_FADEINTIME ) then
local alpha = maxalpha*(elapsedTime / COMBATFEEDBACK_FADEINTIME)
object.CombatFeedbackText:SetAlpha(alpha)
elseif ( elapsedTime < (COMBATFEEDBACK_FADEINTIME + COMBATFEEDBACK_HOLDTIME) ) then
object.CombatFeedbackText:SetAlpha(maxalpha)
elseif ( elapsedTime < (COMBATFEEDBACK_FADEINTIME + COMBATFEEDBACK_HOLDTIME + COMBATFEEDBACK_FADEOUTTIME) ) then
local alpha = maxalpha - maxalpha*((elapsedTime - COMBATFEEDBACK_HOLDTIME - COMBATFEEDBACK_FADEINTIME) / COMBATFEEDBACK_FADEOUTTIME)
object.CombatFeedbackText:SetAlpha(alpha)
else
object.CombatFeedbackText:Hide()
feedback[object] = nil
end
end
end)
end
 
 
local function combat(self, event, unit, eventType, flags, amount, dtype)
if unit ~= self.unit then return end
local FeedbackText = self.CombatFeedbackText
local fColors = FeedbackText.colors
local font, fontHeight, fontFlags = FeedbackText:GetFont()
fontHeight = FeedbackText.origHeight -- always start at original height
local text, arg
color = fColors and fColors.STANDARD or colors.STANDARD
if eventType == "IMMUNE" and not FeedbackText.ignoreImmune then
color = fColors and fColors.IMMUNE or colors.IMMUNE
fontHeight = fontHeight * 0.75
text = CombatFeedbackText[eventType]
elseif eventType == "WOUND" and not FeedbackText.ignoreDamage then
if amount ~= 0 then
if flags == "CRITICAL" then
color = fColors and fColors.CRITICAL or colors.CRITICAL
fontHeight = fontHeight * 1.5
elseif flags == "CRUSHING" then
color = fColors and fColors.CRUSING or colors.CRUSHING
fontHeight = fontHeight * 1.5
elseif flags == "GLANCING" then
color = fColors and fColors.GLANCING or colors.GLANCING
fontHeight = fontHeight * 0.75
else
color = fColors and fColors.DAMAGE or colors.DAMAGE
end
text = damage_format
arg = amount
elseif flags == "ABSORB" then
color = fColors and fColors.ABSORB or colors.ABSORB
fontHeight = fontHeight * 0.75
text = CombatFeedbackText["ABSORB"]
elseif flags == "BLOCK" then
color = fColors and fColors.BLOCK or colors.BLOCK
fontHeight = fontHeight * 0.75
text = CombatFeedbackText["BLOCK"]
elseif flags == "RESIST" then
color = fColors and fColors.RESIST or colors.RESIST
fontHeight = fontHeight * 0.75
text = CombatFeedbackText["RESIST"]
else
color = fColors and fColors.MISS or colors.MISS
text = CombatFeedbackText["MISS"]
end
elseif eventType == "BLOCK" and not FeedbackText.ignoreDamage then
color = fColors and fColors.BLOCK or colors.BLOCK
fontHeight = fontHeight * 0.75
text = CombatFeedbackText[eventType]
elseif eventType == "HEAL" and not FeedbackText.ignoreHeal then
text = heal_format
arg = amount
if flags == "CRITICAL" then
color = fColors and fColors.CRITHEAL or colors.CRITHEAL
fontHeight = fontHeight * 1.3
else
color = fColors and fColors.HEAL or colors.HEAL
end
elseif event == "ENERGIZE" and not FeedbackText.ignoreEnergize then
text = amount
if flags == "CRITICAL" then
color = fColors and fColors.ENERGIZE or colors.ENERGIZE
fontHeight = fontHeight * 1.3
else
color = fColors and fColors.CRITENERGIZE or colors.CRITENERGIZE
end
elseif not FeedbackText.ignoreOther then
text = CombatFeedbackText[eventType]
end
 
if text then
FeedbackText:SetFont(font,fontHeight,fontFlags)
FeedbackText:SetFormattedText(text, arg)
FeedbackText:SetTextColor(unpack(color))
FeedbackText:SetAlpha(0)
FeedbackText:Show()
feedback[self] = GetTime()
updateFrame:Show() -- start our onupdate
end
end
 
local function addCombat(object)
if not object.CombatFeedbackText then return end
-- store the original starting height
local font, fontHeight, fontFlags = object.CombatFeedbackText:GetFont()
object.CombatFeedbackText.origHeight = fontHeight
object.CombatFeedbackText.maxAlpha = object.CombatFeedbackText.maxAlpha or maxAlpha
createUpdateFrame()
object:RegisterEvent("UNIT_COMBAT", combat)
end
 
for k, object in ipairs(oUF.objects) do addCombat(object) end
oUF:RegisterInitCallback(addCombat)
Eui/unitframe/plugin/reputation.lua New file
0,0 → 1,68
--[[
 
Elements handled:
.Reputation [statusbar]
.Reputation.Text [fontstring] (optional)
 
Booleans:
- Tooltip
 
Functions that can be overridden from within a layout:
- PostUpdate(self, event, unit, bar, min, max, value, name, id)
- OverrideText(bar, min, max, value, name, id)
 
--]]
local function tooltip(self)
local name, id, min, max, value = GetWatchedFactionInfo()
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT', 5, -5)
GameTooltip:AddLine(string.format('%s (%s)', name, _G['FACTION_STANDING_LABEL'..id]))
GameTooltip:AddLine(string.format('%d / %d (%d%%)', value - min, max - min, (value - min) / (max - min) * 100))
GameTooltip:Show()
end
 
local function update(self, event, unit)
local bar = self.Reputation
if(not GetWatchedFactionInfo()) then return bar:Hide() end
 
local name, id, min, max, value = GetWatchedFactionInfo()
bar:SetMinMaxValues(min, max)
bar:SetValue(value)
bar:Show()
 
if(bar.Text) then
if(bar.OverrideText) then
bar:OverrideText(min, max, value, name, id)
else
bar.Text:SetFormattedText('%d / %d - %s', value - min, max - min, name)
end
end
 
if(bar.PostUpdate) then bar.PostUpdate(self, event, unit, bar, min, max, value, name, id) end
end
 
local function enable(self, unit)
local bar = self.Reputation
if(bar and unit == 'player') then
if(not bar:GetStatusBarTexture()) then
bar:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
 
self:RegisterEvent('UPDATE_FACTION', update)
 
if(bar.Tooltip) then
bar:EnableMouse()
bar:HookScript('OnLeave', GameTooltip_Hide)
bar:HookScript('OnEnter', tooltip)
end
 
return true
end
end
 
local function disable(self)
if(self.Reputation) then
self:UnregisterEvent('UPDATE_FACTION', update)
end
end
 
oUF:AddElement('Reputation', update, enable, disable)
Eui/unitframe/plugin/PowerSpark.lua New file
0,0 → 1,293
if not oUF then return end
 
local GetTime = GetTime
local UnitMana = UnitMana
local UnitManaMax = UnitManaMax
local GetSpellInfo = GetSpellInfo
local UnitCanAttack = UnitCanAttack
local UnitPowerType = UnitPowerType
 
local power, lastPower, maxPower
local pending, fsrtimer, timer
local playerGUID, lastSpellTime
local obj, bar, barWidth, spark, spark_SetPoint
local manatick, direction -- Settings for manatick and Right-to-Left
local highAlpha, lowAlpha
local inCombat, haveTarget
 
local mode, powerEvent, powerMaxEvent
local addon, reapplySettings, OnEventOther, OnEventActive, OnUpdateFSR, OnUpdateTST, OnUpdateGetWidth
 
-------------------------------------------------
-- Event-handlers -----------------------------
-------------------------------------------------
 
-- "default" event-handler
function OnEventOther(self, event, unit)
-- Only "UNIT_DISPLAYPOWER" or "PLAYER_ENTERING_WORLD" will be registered here
if unit and unit ~= "player" then return end
local powerType = UnitPowerType("player")
--DEFAULT_CHAT_FRAME:AddMessage("PowerType: " .. powerType)
-- Reset stuff
mode = nil
self:UnregisterAllEvents()
self:RegisterEvent("UNIT_DISPLAYPOWER")
pending = 0
fsrtimer = 0
lastSpellTime = nil
spark:Hide()
-- Make sure we have the GUID
playerGUID = playerGUID or UnitGUID("player")
if powerType == 0 then
power = UnitMana("player")
lastPower = power
maxPower = UnitManaMax("player")
mode = 0 -- Mana
powerEvent = "UNIT_MANA"
powerMaxEvent = "UNIT_MAXMANA"
if manatick then
self:SetScript("OnUpdate", OnUpdateTST)
spark:SetAlpha(lowAlpha)
if power < maxPower then
spark:Show()
end
end
elseif powerType == 3 then
power = UnitMana("player")
lastPower = power
maxPower = UnitManaMax("player")
mode = 3 -- Energy
powerEvent = "UNIT_ENERGY"
powerMaxEvent = "UNIT_MAXENERGY"
inCombat = not not InCombatLockdown() -- true/false > 1/nil
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
if not inCombat then self:RegisterEvent("PLAYER_TARGET_CHANGED") end
self:SetScript("OnUpdate", OnUpdateTST)
spark:SetAlpha(highAlpha)
if inCombat or power < maxPower then
spark:Show()
end
else
self:SetScript("OnEvent", OnEventOther)
self:SetScript("OnUpdate", nil)
return
end
-- bar:GetWidth() returns 0 at login for quite a while :(
if barWidth == 0 then
self:SetScript("OnUpdate", OnUpdateGetWidth)
end
self:RegisterEvent(powerEvent)
self:RegisterEvent(powerMaxEvent)
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
-- The CLEU event SPELL_CAST_SUCCESS only works for instant spells :(
-- Using good old UNIT_SPELLCAST_SUCCEEDED instead
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
self:RegisterEvent("PLAYER_DEAD")
self:SetScript("OnEvent", OnEventActive)
end
 
-- Event-handler for mana and energy
function OnEventActive(self, event, unit, combatEvent, sourceGUID, _, _, destGUID, _, _, spellId, _, _, amount)
if unit then
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
if destGUID ~= playerGUID then return end
if combatEvent == "SPELL_ENERGIZE" or combatEvent == "SPELL_PERIODIC_ENERGIZE" then
pending = pending + amount
-- Test when this happens (for periodic)
--if combatEvent == "SPELL_PERIODIC_ENERGIZE" then
--DEFAULT_CHAT_FRAME:AddMessage("Periodic! "..amount)
--end
end
elseif unit ~= "player" then
return
elseif event == powerEvent then
local anticipated = power + pending
power = UnitMana("player")
-- Was there a spell cast recently?
if lastSpellTime then
if power < lastPower then
local elapsed = GetTime() - lastSpellTime
if elapsed < 1 then
spark:SetAlpha(highAlpha)
spark:Show()
fsrtimer = elapsed
self:SetScript("OnUpdate", OnUpdateFSR)
end
end
lastSpellTime = nil
end
 
if mode == 0 then
if manatick then
-- Hide at full mana for mana ticker
if power == maxPower then
spark:Hide()
else
spark:Show()
end
end
else
-- Hide at full mana, out of combat and without target for energy ticker
if power == maxPower and not inCombat and not haveTarget then
spark:Hide()
else
spark:Show()
end
end
 
if power ~= anticipated and (power ~= maxPower or anticipated < maxPower) then
-- This should be a tick
timer = 0 -- Resync timer
--DEFAULT_CHAT_FRAME:AddMessage(power .. " - " .. anticipated .. " = " .. power-anticipated)
end
pending = 0
lastPower = power
elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
local _, _, _, cost, _, powerType, castTime = GetSpellInfo(combatEvent, sourceGUID) -- spell name is in combatEvent, rank in sourceGUID
--DEFAULT_CHAT_FRAME:AddMessage(combatEvent .. ", " .. cost .. ", " .. powerType .. ", " .. castTime)
if powerType == mode then
pending = pending - cost
if mode == 0 then
lastSpellTime = GetTime()
end
end
elseif event == powerMaxEvent then
maxPower = UnitManaMax("player")
if mode == 0 and not manatick then return end
-- Show the spark if we no longer have full mana
if power < maxPower then
spark:Show()
end
elseif event == "UNIT_DISPLAYPOWER" then
OnEventOther(self, "UNIT_DISPLAYPOWER", "player")
end
elseif event == "PLAYER_TARGET_CHANGED" then
haveTarget = UnitCanAttack("player", "target") -- Can't attack notarget
if haveTarget then
spark:Show()
elseif not inCombat and power == maxPower then
spark:Hide()
end
elseif event == "PLAYER_REGEN_DISABLED" then
inCombat = true
self:UnregisterEvent("PLAYER_TARGET_CHANGED") -- There's alot of target changing in combat.
spark:Show() -- It's ok, this event isn't registered for mana
elseif event == "PLAYER_REGEN_ENABLED" then
inCombat = false
haveTarget = UnitCanAttack("player", "target") -- Change this if above change!
self:RegisterEvent("PLAYER_TARGET_CHANGED")
if not haveTarget and power == maxPower then
spark:Hide()
end
elseif event == "PLAYER_DEAD" then
pending = -power
end
end
 
-------------------------------------------------
-- OnUpdates -----------------------------------
-------------------------------------------------
 
-- OnUpdate for Five Second Rule
function OnUpdateFSR(self, elapsed)
local f = fsrtimer + elapsed
local t = timer + elapsed
if t > 2 then t = t - 2 end -- Keep timer in check
if f > 5 then -- 5 is for lenght of "five sec rule", duh!
if manatick then
spark:SetAlpha(lowAlpha)
self:SetScript("OnUpdate", OnUpdateTST)
else
spark:Hide()
self:SetScript("OnUpdate", nil)
end
else
spark_SetPoint(spark, "CENTER", bar, direction, f * 0.2 * barWidth, 0) -- Haxx spark:SetPoint(...) to the maxx
end
fsrtimer = f
timer = t
end
 
-- OnUpdate for the Two Second Ticker
function OnUpdateTST(self, elapsed)
local t = timer + elapsed
if t > 2 then -- 2 is the time between ticks
t = t - 2 -- Subtracting 2 instead of setting to 0 to not accumulate small errors wich could lead to timer running out of sync
end
spark_SetPoint(spark, "CENTER", bar, direction, t * 0.5 * barWidth, 0) -- Haxx spark:SetPoint(...) to the maxx
timer = t
end
 
-- OnUpdate to get the bar width after login
-- Shouldn't run more than once or twice
function OnUpdateGetWidth(self, elapsed)
local t = timer + elapsed
local w = bar:GetWidth()
if w ~= 0 then
--DEFAULT_CHAT_FRAME:AddMessage("Got " .. w .. " after " .. t)
barWidth = spark.rtl and -w or w
if mode == 0 and manatick or mode == 3 then
self:SetScript("OnUpdate", OnUpdateTST)
else
self:SetScript("OnUpdate", nil)
end
return
end
--DEFAULT_CHAT_FRAME:AddMessage("Got " .. w .. " after " .. t)
timer = t
end
 
-------------------------------------------------
-- Init stuff ----------------------------------
-------------------------------------------------
 
function reapplySettings(object)
object = object or oUF.units["player"]
if not object then error("Must pass an object to oUF_PowerSpark_ReapplySettings") return end
local s = object.Spark
if not s then error("The object passed to oUF_PowerSpark_ReapplySettings must have a Spark") return end -- object must have Spark
obj = object
spark = object.Spark
s:ClearAllPoints()
spark_SetPoint = s.SetPoint
bar = s:GetParent() or object.Power -- default to object.Power if someone fucks up and don't parent their spark to something
barWidth = bar:GetWidth()
--DEFAULT_CHAT_FRAME:AddMessage(barWidth)
if s.rtl then -- Right-to-Left
direction = "RIGHT"
barWidth = -barWidth
else
direction = "LEFT"
end
manatick = s.manatick and true or false -- Wether or not to tick every 2 sec for mana (out of 5sr)
highAlpha = s.highAlpha or s:GetAlpha()
lowAlpha = s.lowAlpha or highAlpha * 0.25
end
-- Global function to call if you change sparkframe/barwidth/settings
oUF_PowerSpark_ReapplySettings = reapplySettings
 
local function addTicker(object)
if addon then return end -- Only one spark is supported.
object = object or oUF.units["player"]
if not object then return true end -- return true if no player frame was found at startup
local s = object.Spark
if not s then return true end -- object must have Spark
reapplySettings(object)
timer = 0
addon = CreateFrame("Frame")
-- UnitGUID("player") don't work right away at login
if IsLoggedIn() then
OnEventOther(addon, "UNIT_DISPLAYPOWER", "player")
else
addon:SetScript("OnEvent", OnEventOther)
addon:RegisterEvent("PLAYER_ENTERING_WORLD")
end
end
 
-- If you're looking at this code to figure out
-- how to init your own oUF module you probably
-- don't want to do it like this :P
if addTicker() then -- if addTicker() returns true no Spark was found
oUF:RegisterInitCallback(addTicker)
end
Eui/unitframe/plugin/aurawatch.lua New file
0,0 → 1,323
--[[------------------------------------------------------------------------------------------------------
oUF_AuraWatch by Astromech
Please leave comments, suggestions, and bug reports on this addon's WoWInterface page
 
To setup, create a table named AuraWatch in your unit frame. There are several options
you can specify, as explained below.
 
icons
Mandatory!
A table of frames to be used as icons. oUF_Aurawatch does not position
these frames, so you must do so yourself. Each icon needs a spellID entry,
which is the spell ID of the aura to watch. Table should be set up
such that values are icon frames, but the keys can be anything.
 
Note each icon can have several options set as well. See below.
strictMatching
Default: false
If true, AuraWatch will only show an icon if the specific aura
with the specified spell id is on the unit. If false, AuraWatch
will show the icon if any aura with the same name and icon texture
is on the unit. Strict matching can be undesireable because most
ranks of an aura have different spell ids.
missingAlpha
Default 0.75
The alpha value for icons of auras which have faded from the unit.
presentAlpha
Default 1
The alpha value for icons or auras present on the unit.
onlyShowMissing
Default false
If this is true, oUF_AW will hide icons if they are present on the unit.
onlyShowPresent
Default false
If this is true, oUF_AW will hide icons if they have expired from the unit.
hideCooldown
Default false
If this is true, oUF_AW will not create a cooldown frame
hideCount
Default false
If this is true, oUF_AW will not create a count fontstring
fromUnits
Default {["player"] = true, ["pet"] = true, ["vehicle"] = true}
A table of units from which auras can originate. Have the units be the keys
and "true" be the values.
anyUnit
Default false
Set to true for oUF_AW to to show an aura no matter what unit it
originates from. This will override any fromUnits setting.
PostCreateIcon
Default nil
A function to call when an icon is created to modify it, such as adding
a border or repositioning the count fontstring. Leave as nil to ignore.
The arguements are: AuraWatch table, icon, auraSpellID, auraName, unitFrame
 
Below are options set on a per icon basis. Set these as fields in the icon frames.
 
The following settings can be overridden from the AuraWatch table on a per-aura basis:
onlyShowMissing
onlyShowPresent
hideCooldown
hideCount
fromUnits
anyUnit
 
The following settings are unique to icons:
 
spellID
Mandatory!
The spell id of the aura, as explained above.
icon
Default aura texture
A texture value for this icon.
overlay
Default Blizzard aura overlay
An overlay for the icon. This is not created if a custom icon texture is created.
count
Default A fontstring
An fontstring to show the stack count of an aura.
 
Here is an example of how to set oUF_AW up:
 
local createAuraWatch = function(self, unit)
local auras = {}
 
-- A table of spellIDs to create icons for
-- To find spellIDs, look up a spell on www.wowhead.com and look at the URL
-- http://www.wowhead.com/?spell=SPELL_ID
local spellIDs = { ... }
 
auras.presentAlpha = 1
auras.missingAlpha = .7
auras.PostCreateIcon = myCustomIconSkinnerFunction
-- Set any other AuraWatch settings
auras.icons = {}
for i, sid in pairs(spellIDs) do
local icon = CreateFrame("Frame", nil, auras)
icon.spellID = sid
-- set the dimensions and positions
icon:SetWidth(24)
icon:SetHeight(24)
icon:SetPoint("BOTTOM", self, "BOTTOM", 0, 28 * i)
auras.icons[sid] = icon
-- Set any other AuraWatch icon settings
end
self.AuraWatch = auras
end
-----------------------------------------------------------------------------------------------------------]]
 
local parent = debugstack():match[[\AddOns\(.-)\]]
local global = GetAddOnMetadata(parent, 'X-oUF')
assert(global, 'X-oUF needs to be defined in the parent add-on.')
 
local UnitBuff, UnitDebuff, UnitGUID = UnitBuff, UnitDebuff, UnitGUID
local GUIDs = {}
 
local PLAYER_UNITS = {
player = true,
vehicle = true,
pet = true,
}
 
local setupGUID
do
local cache = setmetatable({}, {__type = "k"})
 
local frame = CreateFrame"Frame"
frame:SetScript("OnEvent", function(self, event)
for k,t in pairs(GUIDs) do
GUIDs[k] = nil
for a in pairs(t) do
t[a] = nil
end
cache[t] = true
end
end)
frame:RegisterEvent"PLAYER_REGEN_ENABLED"
frame:RegisterEvent"PLAYER_ENTERING_WORLD"
 
function setupGUID(guid)
local t = next(cache)
if t then
cache[t] = nil
else
t = {}
end
GUIDs[guid] = t
end
end
 
 
local function resetIcon(icon, frame, count, duration, remaining)
if icon.onlyShowMissing then
icon:Hide()
else
icon:Show()
if icon.cd then
if duration and duration > 0 then
icon.cd:SetCooldown(remaining - duration, duration)
icon.cd:Show()
else
icon.cd:Hide()
end
end
if icon.count then
icon.count:SetText((count > 1 and count))
end
if icon.overlay then
icon.overlay:Hide()
end
icon:SetAlpha(frame.presentAlpha)
end
end
 
local function expireIcon(icon, frame)
if icon.onlyShowPresent then
icon:Hide()
else
if (icon.cd) then icon.cd:Hide() end
if (icon.count) then icon.count:SetText() end
icon:SetAlpha(frame.missingAlpha)
if icon.overlay then
icon.overlay:Show()
end
icon:Show()
end
end
 
local found = {}
local function Update(frame, event, unit)
if frame.unit ~= unit then return end
local watch = frame.AuraWatch
local index, icons = 1, watch.watched
local _, name, texture, count, duration, remaining, caster, key, icon, spellid
local filter = "HELPFUL"
local guid = UnitGUID(unit)
if not guid then return end
if not GUIDs[guid] then setupGUID(guid) end
 
for key, icon in pairs(icons) do
icon:Hide()
end
 
while true do
name, _, texture, count, _, duration, remaining, caster, _, _, spellid = UnitAura(unit, index, filter)
if not name then
if filter == "HELPFUL" then
filter = "HARMFUL"
index = 1
else
break
end
else
if watch.strictMatching then
key = spellID
else
key = name..texture
end
icon = icons[key]
if icon and (icon.anyUnit or (caster and icon.fromUnits[caster])) then
resetIcon(icon, watch, count, duration, remaining)
GUIDs[guid][key] = true
found[key] = true
end
index = index + 1
end
end
 
for key in pairs(GUIDs[guid]) do
if icons[key] and not found[key] then
expireIcon(icons[key], watch)
end
end
 
for k in pairs(found) do
found[k] = nil
end
end
 
local function setupIcons(self)
 
local watch = self.AuraWatch
local icons = watch.icons
watch.watched = {}
if not watch.missingAlpha then watch.missingAlpha = 0.75 end
if not watch.presentAlpha then watch.presentAlpha = 1 end
 
for _,icon in pairs(icons) do
 
local name, _, image = GetSpellInfo(icon.spellID)
if not name then error("oUF_AuraWatch error: no spell with "..tostring(icon.spellID).." spell ID exists") end
icon.name = name
 
if not icon.cd and not (watch.hideCooldown or icon.hideCooldown) then
local cd = CreateFrame("Cooldown", nil, icon)
cd:SetAllPoints(icon)
icon.cd = cd
end
 
if not icon.icon then
local tex = icon:CreateTexture(nil, "BACKGROUND")
tex:SetAllPoints(icon)
tex:SetTexture(image)
icon.icon = tex
if not icon.overlay then
local overlay = icon:CreateTexture(nil, "OVERLAY")
overlay:SetTexture"Interface\\Buttons\\UI-Debuff-Overlays"
overlay:SetAllPoints(icon)
overlay:SetTexCoord(.296875, .5703125, 0, .515625)
overlay:SetVertexColor(1, 0, 0)
icon.overlay = overlay
end
end
 
if not icon.count and not (watch.hideCount or icon.hideCount) then
local count = icon:CreateFontString(nil, "OVERLAY")
count:SetFontObject(NumberFontNormal)
count:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -1, 0)
icon.count = count
end
 
if icon.onlyShowMissing == nil then
icon.onlyShowMissing = watch.onlyShowMissing
end
if icon.onlyShowPresent == nil then
icon.onlyShowPresent = watch.onlyShowPresent
end
if icon.fromUnits == nil then
icon.fromUnits = watch.fromUnits or PLAYER_UNITS
end
if icon.anyUnit == nil then
icon.anyUnit = watch.anyUnit
end
 
if watch.strictMatching then
watch.watched[icon.spellID] = icon
else
watch.watched[name..image] = icon
end
 
if watch.PostCreateIcon then watch:PostCreateIcon(icon, icon.spellID, name, self) end
end
end
 
local function Enable(self)
if self.AuraWatch then
self:RegisterEvent("UNIT_AURA", Update)
setupIcons(self)
return true
else
return false
end
end
 
local function Disable(self)
if self.AuraWatch then
self:UnregisterEvent("UNIT_AURA", Update)
for _,icon in pairs(self.AuraWatch.icons) do
icon:Hide()
end
end
end
 
oUF:AddElement("AuraWatch", Update, Enable, Disable)
Eui/unitframe/plugin/readycheck.lua New file
0,0 → 1,92
--[[
 
Elements handled:
.ReadyCheck [texture]
 
Options:
- delayTime [value] default: 10
- fadeTime [value] default: 1.5
 
Add-on originally made by Starlon
--]]
 
local GetReadyCheckStatus = GetReadyCheckStatus
 
local statusTexture = {
notready = [=[Interface\RAIDFRAME\ReadyCheck-NotReady]=],
ready = [=[Interface\RAIDFRAME\ReadyCheck-Ready]=],
waiting = [=[Interface\RAIDFRAME\ReadyCheck-Waiting]=],
}
 
function onUpdate(self, elapsed)
if(self.finish) then
self.finish = self.finish - elapsed
if(self.finish <= 0) then
self.finish = nil
end
elseif(self.fade) then
self.fade = self.fade - elapsed
if(self.fade <= 0) then
self.fade = nil
self:SetScript('OnUpdate', nil)
 
for k, v in next, oUF.objects do
if(v.ReadyCheck and v.unit == self.unit) then
v.ReadyCheck:Hide()
end
end
else
for k, v in next, oUF.objects do
if(v.ReadyCheck and v.unit == self.unit) then
v.ReadyCheck:SetAlpha(self.fade / self.offset)
end
end
end
end
end
 
local function update(self)
if(not IsRaidLeader() and not IsRaidOfficer() and not IsPartyLeader()) then return end
 
local status = GetReadyCheckStatus(self.unit)
if(status) then
self.ReadyCheck:SetTexture(statusTexture[status])
self.ReadyCheck:SetAlpha(1)
self.ReadyCheck:Show()
end
end
 
local function prepare(self)
local readycheck = self.ReadyCheck
local dummy = readycheck.dummy
 
dummy.unit = self.unit
dummy.finish = readycheck.delayTime or 10
dummy.fade = readycheck.fadeTime or 1.5
dummy.offset = readycheck.fadeTime or 1.5
 
dummy:SetScript('OnUpdate', onUpdate)
end
 
local function enable(self)
local readycheck = self.ReadyCheck
if(readycheck) then
self:RegisterEvent('READY_CHECK', update)
self:RegisterEvent('READY_CHECK_CONFIRM', update)
self:RegisterEvent('READY_CHECK_FINISHED', prepare)
 
readycheck.dummy = CreateFrame('Frame', nil, self)
 
return true
end
end
 
local function disable(self)
if(self.ReadyCheck) then
self:UnregisterEvent('READY_CHECK', update)
self:UnregisterEvent('READY_CHECK_CONFIRM', update)
self:UnregisterEvent('READY_CHECK_FINISHED', prepare)
end
end
 
oUF:AddElement('ReadyCheck', update, enable, disable)
Eui/unitframe/plugin/debuffhighlight.lua New file
0,0 → 1,89
local playerClass = select(2,UnitClass("player"))
local CanDispel = {
PRIEST = { Magic = true, Disease = true, },
SHAMAN = { Poison = true, Disease = true, Curse = true, },
PALADIN = { Magic = true, Poison = true, Disease = true, },
MAGE = { Curse = true, },
DRUID = { Curse = true, Poison = true, }
}
local dispellist = CanDispel[playerClass] or {}
local origColors = {}
local origBorderColors = {}
local origPostUpdateAura = {}
 
local function GetDebuffType(unit, filter)
if not UnitCanAssist("player", unit) then return nil end
local i = 1
while true do
local _, _, texture, _, debufftype = UnitAura(unit, i, "HARMFUL")
if not texture then break end
if debufftype and not filter or (filter and dispellist[debufftype]) then
return debufftype, texture
end
i = i + 1
end
end
 
local function Update(object, event, unit)
if object.unit ~= unit then return end
local debuffType, texture = GetDebuffType(unit, object.DebuffHighlightFilter)
if debuffType then
local color = DebuffTypeColor[debuffType]
if object.DebuffHighlightBackdrop then
object:SetBackdropColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or 1)
elseif object.DebuffHighlightUseTexture then
object.DebuffHighlight:SetTexture(texture)
else
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or .5)
end
else
if object.DebuffHighlightBackdrop then
local color = origColors[object]
object:SetBackdropColor(color.r, color.g, color.b, color.a)
color = origBorderColors[object]
object:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
elseif object.DebuffHighlightUseTexture then
object.DebuffHighlight:SetTexture(nil)
else
local color = origColors[object]
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, color.a)
end
end
end
 
local function Enable(object)
-- if we're not highlighting this unit return
if not object.DebuffHighlightBackdrop and not object.DebuffHighlight then
return
end
-- if we're filtering highlights and we're not of the dispelling type, return
if object.DebuffHighlightFilter and not CanDispel[playerClass] then
return
end
 
-- make sure aura scanning is active for this object
object:RegisterEvent("UNIT_AURA", Update)
 
if object.DebuffHighlightBackdrop then
local r, g, b, a = object:GetBackdropColor()
origColors[object] = { r = r, g = g, b = b, a = a}
r, g, b, a = object:GetBackdropBorderColor()
origBorderColors[object] = { r = r, g = g, b = b, a = a}
elseif not object.DebuffHighlightUseTexture then -- color debuffs
-- object.DebuffHighlight
local r, g, b, a = object.DebuffHighlight:GetVertexColor()
origColors[object] = { r = r, g = g, b = b, a = a}
end
 
return true
end
 
local function Disable(object)
if object.DebuffHighlightBackdrop or object.DebuffHighlight then
object:UnregisterEvent("UNIT_AURA", Update)
end
end
 
oUF:AddElement('DebuffHighlight', Update, Enable, Disable)
 
for i, frame in ipairs(oUF.objects) do Enable(frame) end
\ No newline at end of file
Eui/unitframe/plugin/trinkets.lua New file
0,0 → 1,119
local arenaUnits = {}
local arenaGUID = {}
local usedTrinkets = {}
local trinketFrame = {}
 
local TrinketUpdate = function(self, elapsed)
if ( self.endTime < GetTime() ) then
local object = self:GetParent()
if ( self.trinketUpAnnounce ) then
SendChatMessage("Trinket ready: "..UnitName(object.unit).." "..UnitClass(object.unit), "PARTY")
end
self:SetScript("OnUpdate", nil)
end
end
 
local UpdateTag = function(self, elapsed)
if ( self.endTime < GetTime() ) then
usedTrinkets[self.guid] = false
self:SetScript("OnUpdate", nil)
end
end
 
local TrinketUsed = function(guid, time)
local message
local unit = arenaGUID[guid]
if (unit and arenaUnits[unit].Trinket) then
arenaUnits[unit].Trinket:SetScript("OnUpdate", TrinketUpdate)
arenaUnits[unit].Trinket.endTime = GetTime() + time
CooldownFrame_SetTimer(arenaUnits[unit].Trinket.cooldownFrame, GetTime(), time, 1)
if ( arenaUnits[unit].Trinket.trinketUseAnnounce ) then
if ( time == 120 ) then
message = "Trinket used: "..UnitName(unit).." "..UnitClass(unit)
else
message = "WotF used: "..UnitName(unit).." "..UnitClass(unit)
end
SendChatMessage(message, "PARTY")
end
end
usedTrinkets[guid] = true
trinketFrame[guid] = CreateFrame("Frame")
trinketFrame[guid].endTime = GetTime() + time
trinketFrame[guid].guid = guid
trinketFrame[guid]:SetScript("OnUpdate", UpdateTag)
end
 
local Update = function(self, event, ...)
if ( event == "COMBAT_LOG_EVENT_UNFILTERED" ) then
local timestamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, spellID, spellName = ...
if ( eventType == "SPELL_CAST_SUCCESS" ) then
-- enemy trinket usage
if ( spellID == 59752 or spellID == 42292 ) then
TrinketUsed(sourceGUID, 120)
end
-- WotF
if ( spellID == 7744 ) then
TrinketUsed(sourceGUID, 45)
end
end
elseif ( event == "ARENA_OPPONENT_UPDATE" ) then
local unit, type = ...
if ( type == "seen" ) then
if ( UnitExists(unit) and UnitIsPlayer(unit) and arenaUnits[unit].Trinket ) then
arenaGUID[UnitGUID(unit)] = unit
if ( UnitFactionGroup(unit) == "Horde" ) then
arenaUnits[unit].Trinket.Icon:SetTexture(UnitLevel(unit) == 80 and "Interface\\Addons\\Tukui\\media\\INV_Jewelry_Necklace_38" or "Interface\\Addons\\Tukui\\media\\INV_Jewelry_TrinketPVP_02")
else
arenaUnits[unit].Trinket.Icon:SetTexture(UnitLevel(unit) == 80 and "Interface\\Addons\\Tukui\\media\\INV_Jewelry_Necklace_37" or "Interface\\Addons\\Tukui\\media\\INV_Jewelry_TrinketPVP_01")
end
end
end
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
for k, v in pairs(trinketFrame) do
v:SetScript("OnUpdate", nil)
end
for k, v in pairs(arenaUnits) do
v.Trinket:SetScript("OnUpdate", nil)
CooldownFrame_SetTimer(v.Trinket.cooldownFrame, 1, 1, 1)
end
arenaGUID = {}
usedTrinkets = {}
trinketFrame = {}
end
end
 
local frame = CreateFrame("Frame")
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
frame:RegisterEvent("ARENA_OPPONENT_UPDATE")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", Update)
 
oUF.Tags['[trinket]'] = function(unit)
if( usedTrinkets[UnitGUID(unit)] or not UnitIsPlayer(unit) ) then return end
local trinketIcon
if( UnitFactionGroup(unit) == "Horde" ) then
trinketIcon = UnitLevel(unit) == 80 and "Interface\\Icons\\INV_Jewelry_Necklace_38" or "Interface\\Icons\\INV_Jewelry_TrinketPVP_02"
else
trinketIcon = UnitLevel(unit) == 80 and "Interface\\Icons\\INV_Jewelry_Necklace_37" or "Interface\\Icons\\INV_Jewelry_TrinketPVP_01"
end
return string.format("|T%s:20:20:0:0|t", trinketIcon)
end
 
local Enable = function(self)
if ( self.Trinket ) then
self.Trinket.cooldownFrame = CreateFrame("Cooldown", nil, self.Trinket)
self.Trinket.cooldownFrame:SetAllPoints(self.Trinket)
self.Trinket.Icon = self.Trinket:CreateTexture(nil, "BORDER")
self.Trinket.Icon:SetAllPoints(self.Trinket)
self.Trinket.Icon:SetTexCoord(0, 1, 0, 1)
arenaUnits[self.unit] = self
end
end
 
local Disable = function(self)
if ( self.Trinket ) then
arenaUnits[self.unit] = nil
end
end
 
oUF:AddElement('Trinket', function() return end, Enable, Disable)
Eui/unitframe/plugin/swing.lua New file
0,0 → 1,178
--[[
Project.: oUF_Swing
File....: oUF_Swing.lua
Version.: 30300.4
Rev Date: 08/30/2010
Authors.: p3lim, Thalyra
]]
 
--[[
Elements handled:
.Swing [statusbar]
.Swing.Text [fontstring]
 
Shared:
- disableMelee [boolean]
- disableRanged [boolean]
- disableOoc [boolean] (Autohide on leaving Combat)
 
Functions that can be overridden from within a layout:
- :OverrideText(elapsed)
--]]
local E, C = unpack(select(2, ...))
if not C["unitframe"].swing == true then return end
 
local OnDurationUpdate
do
local elapsed = 0
--local castcheck = 0
--local lastcheck = 0
local slamelapsed = 0
local slam = GetSpellInfo(47475)
function OnDurationUpdate(self, elapsed)
--function OnDurationUpdate(self)
 
local spell = UnitCastingInfo("player")
 
if slam == spell then
slamelapsed = slamelapsed + elapsed
else
if slamelapsed ~= 0 then
self.min = self.min + slamelapsed
self.max = self.max + slamelapsed
self:SetMinMaxValues(self.min, self.max)
slamelapsed = 0
end
 
swingelapsed = GetTime()
if swingelapsed > self.max then
self:Hide()
self:SetScript("OnUpdate", nil)
else
self:SetValue(self.min + (swingelapsed - self.min))
 
if self.Text then
if self.OverrideText then
self:OverrideText(elapsed)
else
self.Text:SetFormattedText("%.1f", self.max - elapsed)
end
end
end
end
end
end
 
local function Melee(self, _, _, event, GUID, _, _, _, tarGUID, _, missType, spellName)
local bar = self.Swing
 
if UnitGUID(self.unit) == tarGUID then
 
if string.find(event, "MISSED") then
if missType == "PARRY" then
bar.max = bar.min + ((bar.max - bar.min) * 0.6)
bar:SetMinMaxValues(bar.min, bar.max)
end
end
 
elseif UnitGUID(self.unit) == GUID then
 
-- SPELL_EXTRA_ATTACKS
local swordprocc = false
if event == "SPELL_EXTRA_ATTACKS" and (spellName == GetSpellInfo(12815) or spellName == GetSpellInfo(13964)) then
swordprocc = true
end
-- SWING_DAMAGE, SWING_MISS, SPELL_CAST_SUCCESS
if not string.find(event, "SWING") and not string.find(event, "SPELL_CAST_SUCCESS") then return end
if string.find(event, "SPELL_CAST_SUCCESS") then
if spellName ~= GetSpellInfo(47450) and spellName ~= GetSpellInfo(47520) and spellName ~= GetSpellInfo(56815) and spellName ~= GetSpellInfo(48996) and spellName ~= GetSpellInfo(48480) then return end
end
 
if swordprocc == true then
swordprocc = false
else
bar.min = GetTime()
bar.max = bar.min + UnitAttackSpeed(self.unit)
local itemId = GetInventoryItemID("player", 17)
 
if itemId ~= nil then
local _, _, _, _, _, itemType = GetItemInfo(itemId)
local _, _, _, _, _, weaponType = GetItemInfo(25)
if itemType ~= weaponType then -- Worn Shortsword, little "hack" for language support
bar:Show()
bar:SetMinMaxValues(bar.min, bar.max)
bar:SetScript("OnUpdate", OnDurationUpdate)
else
bar:Hide()
bar:SetScript("OnUpdate", nil)
end
else
bar:Show()
bar:SetMinMaxValues(bar.min, bar.max)
bar:SetScript("OnUpdate", OnDurationUpdate)
end
end
 
end
end
 
local function Ranged(self, event, unit, spellName)
if spellName ~= GetSpellInfo(75) and spellName ~= GetSpellInfo(5019) then return end
 
local bar = self.Swing
bar.min = GetTime()
bar.max = bar.min + UnitRangedDamage(unit)
 
bar:Show()
bar:SetMinMaxValues(bar.min, bar.max)
bar:SetScript("OnUpdate", OnDurationUpdate)
end
 
local function Ooc(self)
local bar = self.Swing
bar:Hide()
end
 
local function Enable(self, unit)
local bar = self.Swing
if bar and unit == "player" then
 
if not bar.disableRanged then
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", Ranged)
end
 
if not bar.disableMelee then
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Melee)
end
 
if not bar.disableOoc then
self:RegisterEvent("PLAYER_REGEN_ENABLED", Ooc)
end
 
bar:Hide()
if not bar:GetStatusBarTexture() and not swing:GetTexture() then
bar:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
 
return true
end
end
 
local function Disable(self)
local bar = self.Swing
if bar then
if not bar.disableRanged then
self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED", Ranged)
end
 
if not bar.disableMelee then
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Melee)
end
 
if not bar.disableOoc then
self:UnregisterEvent("PLAYER_REGEN_ENABLED", Ooc)
end
end
end
 
oUF:AddElement("Swing", nil, Enable, Disable)
\ No newline at end of file
Eui/unitframe/plugin/threat.lua New file
0,0 → 1,94
--[[
Elements handled:
.ThreatBar - StatusBar
.Text - Text value of threat percentage
 
Options:
.Colors - Table of colors to use for threat coloring
.useRawThreat - Use raw threat percentage instead of normalized
.usePlayerTarget - Always use the player target to determine threat for non-player units.
- otherwise will always use the unit's target.
.maxThreatVal - For use with .useRawThreat. Allows threat percentage greater than 100.
]]--
 
if not showthreat == true then return end
 
local aggroColors = {
[1] = {0, 1, 0},
[2] = {1, 1, 0},
[3] = {1, 0, 0},
}
 
local function update(self, event, unit)
if( UnitAffectingCombat(self.unit) ) then
local _, _, threatpct, rawthreatpct, _ = UnitDetailedThreatSituation(self.unit, self.tar)
 
if( self.useRawThreat ) then
threatval = rawthreatpct or 0
else
threatval = threatpct or 0
end
 
self:SetValue(threatval)
if( self.Text ) then
self.Text:SetFormattedText("%3.1f", threatval)
end
 
if( threatval < 30 ) then
self:SetStatusBarColor(unpack(self.Colors[1]))
elseif( threatval >= 30 and threatval < 70 ) then
self:SetStatusBarColor(unpack(self.Colors[2]))
else
self:SetStatusBarColor(unpack(self.Colors[3]))
end
 
local numParty = GetNumPartyMembers()
local numRaid = GetNumRaidMembers()
 
-- this part is an addition by tukz because he is tired
-- to see this fucking bar appear when pvp'ing or in solo
if (threatval > 0) and (numParty > 0 or numRaid > 0) then
self:SetAlpha(1)
else
self:SetAlpha(0)
end
-- end of hack
 
end
end
 
local function enable(self)
local bar = self.ThreatBar
if( bar ) then
bar:Hide()
bar:SetMinMaxValues(0, bar.maxThreatVal or 100)
 
self:RegisterEvent("PLAYER_REGEN_ENABLED", function(self) self.ThreatBar:Hide() end)
self:RegisterEvent("PLAYER_REGEN_DISABLED", function(self) self.ThreatBar:Show() end)
 
bar:SetScript("OnUpdate", update)
 
bar.Colors = (self.ThreatBar.Colors or aggroColors)
bar.unit = self.unit
 
if( self.usePlayerTarget ) then
bar.tar = "playertarget"
else
bar.tar = bar.unit.."target"
end
 
return true
end
end
 
local function disable(self)
local bar = self.ThreatBar
if( bar ) then
bar:UnregisterEvent("PLAYER_REGEN_ENABLED")
bar:UnregisterEvent("PLAYER_REGEN_DISABLED")
bar:Hide()
bar:SetScript("OnEvent", nil)
end
end
 
oUF:AddElement("ThreatBar", function() return end, enable, disable)
\ No newline at end of file
Eui/unitframe/plugin/totem.lua New file
0,0 → 1,156
--[[
Documentation:
 
Element handled:
.TotemBar (must be a table with statusbar inside)
 
.TotemBar only:
.delay : The interval for updates (Default: 0.1)
.colors : The colors for the statusbar, depending on the totem
.Name : The totem name
.Destroy (boolean): Enables/Disable the totem destruction on right click
 
NOT YET IMPLEMENTED
.Icon (boolean): If true an icon will be added to the left or right of the bar
.IconSize : If the Icon is enabled then changed the IconSize (default: 8)
.IconJustify : any anchor like "TOPLEFT", "BOTTOMRIGHT", "TOP", etc
 
.TotemBar.bg only:
.multiplier : Sets the multiplier for the text or the background (can be two differents multipliers)
 
--]]
 
local _, pClass = UnitClass("player")
local total = 0
local delay = 0.01
 
-- In the order, fire, earth, water, air
local colors = {
[1] = {0.752,0.172,0.02},
[2] = {0.741,0.580,0.04},
[3] = {0,0.443,0.631},
[4] = {0.6,1,0.945},
}
 
local GetTotemInfo, SetValue, GetTime = GetTotemInfo, SetValue, GetTime
 
local Abbrev = function(name)
return (string.len(name) > 10) and string.gsub(name, "%s*(.)%S*%s*", "%1. ") or name
end
local function TotemOnClick(self,...)
local id = self.ID
local mouse = ...
--~ print(id, mouse)
if IsShiftKeyDown() then
for j = 1,4 do
DestroyTotem(j)
end
else
DestroyTotem(id)
end
end
 
local function InitDestroy(self)
local totem = self.TotemBar
for i = 1 , 4 do
local Destroy = CreateFrame("Button",nil, totem[i])
Destroy:SetAllPoints(totem[i])
Destroy:RegisterForClicks("LeftButtonUp", "RightButtonUp")
Destroy.ID = i
Destroy:SetScript("OnClick", TotemOnClick)
end
end
local function UpdateSlot(self, slot)
local totem = self.TotemBar
 
 
haveTotem, name, startTime, duration, totemIcon = GetTotemInfo(slot)
 
totem[slot]:SetStatusBarColor(unpack(totem.colors[slot]))
totem[slot]:SetValue(0)
 
-- Multipliers
if (totem[slot].bg.multiplier) then
local mu = totem[slot].bg.multiplier
local r, g, b = totem[slot]:GetStatusBarColor()
r, g, b = r*mu, g*mu, b*mu
totem[slot].bg:SetVertexColor(r, g, b)
end
 
totem[slot].ID = slot
 
-- If we have a totem then set his value
if(haveTotem) then
 
if totem[slot].Name then
totem[slot].Name:SetText(Abbrev(name))
end
if(duration >= 0) then
totem[slot]:SetValue(1 - ((GetTime() - startTime) / duration))
-- Status bar update
totem[slot]:SetScript("OnUpdate",function(self,elapsed)
total = total + elapsed
if total >= delay then
total = 0
haveTotem, name, startTime, duration, totemIcon = GetTotemInfo(self.ID)
if ((GetTime() - startTime) == 0) then
self:SetValue(0)
else
self:SetValue(1 - ((GetTime() - startTime) / duration))
end
end
end)
else
-- There's no need to update because it doesn't have any duration
totem[slot]:SetScript("OnUpdate",nil)
totem[slot]:SetValue(0)
end
else
-- No totem = no time
if totem[slot].Name then
totem[slot].Name:SetText(" ")
end
totem[slot]:SetValue(0)
end
 
end
 
local function Update(self, unit)
-- Update every slot on login, still have issues with it
for i = 1, 4 do
UpdateSlot(self, i)
end
end
 
local function Event(self,event,...)
if event == "PLAYER_TOTEM_UPDATE" then
UpdateSlot(self, ...)
end
end
 
local function Enable(self, unit)
local totem = self.TotemBar
 
if(totem) then
self:RegisterEvent("PLAYER_TOTEM_UPDATE" ,Event)
totem.colors = setmetatable(totem.colors or {}, {__index = colors})
delay = totem.delay or delay
if totem.Destroy then
InitDestroy(self)
end
TotemFrame:UnregisterAllEvents()
return true
end
end
 
local function Disable(self,unit)
local totem = self.TotemBar
if(totem) then
self:UnregisterEvent("PLAYER_TOTEM_UPDATE", Event)
 
TotemFrame:Show()
end
end
 
oUF:AddElement("TotemBar",Update,Enable,Disable)
 
Eui/unitframe/unitframe4.lua New file
0,0 → 1,604
local E,C = unpack(select(2, ...))
if C["unitframe"].aaaaunit ~= 4 then return end
----------------------------------------------------------
-- Config
----------------------------------------------------------
local castbars = C["unitframe"].castbar -- Enable or Disable the Castbars
 
-- Heights
local hpheight = C["unitframe"].playerheight * 5 / 6 -- Player & Target 14
local shpheight = 15 -- Target of Target, Focus, and Pet 10
local ppheight = C["unitframe"].playerheight / 6 -- Power 2
local cbheight = 15
 
-- Widths
local hpwidth = C["unitframe"].playerwidth -- Player, Focus, Pet and Target 288
local shpwidth = 156 -- Target of Target, and Focus width 196
 
-- Initial Positions (shift+alt+drag to move)
--local pty
if C["unitframe"].playery >0 then pty = C["unitframe"].playery else pty = 300 end
if C["raid"].grid == true then pty = pty + 94 end
 
playerx = -C["unitframe"].playerx
playery = pty
 
targetx = C["unitframe"].playerx
targety = pty
 
totx = 0
toty = pty + C["unitframe"].playerwidth/2
 
focusx = 20
focusy = -220
 
petx = 0
pety = pty
 
 
 
-- Texures and fonts
local texture = "Interface\\Buttons\\WHITE8x8"
local fontsize = 11
local font = STANDARD_TEXT_FONT
local TEXTURE = [[Interface\AddOns\Eui\media\dm2]]
local BACKDROP = {
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
insets = {top = -1, left = -1, bottom = -1, right = -1},
}
------------------------------------------------------
-- Boring Presets
------------------------------------------------------
local function Backdrop(frame)
frame:SetBackdrop({bgFile = texture, insets = {top = -2, left = -2, bottom = -2, right = -2}})
frame:SetBackdropColor(0, 0, 0, 1)
end
 
oUF.colors.power['MANA'] = {26/255, 139/255, 255/255}
local function updateCombo(self, event, unit)
if(unit == PlayerFrame.unit and unit ~= self.CPoints.unit) then
self.CPoints.unit = unit
end
end
 
local menu = function(self)
local unit = self.unit:sub(1, -2)
local cunit = self.unit:gsub('(.)', string.upper, 1)
if(unit == 'party' or unit == 'partypet') then
ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor', 0, 0)
elseif(_G[cunit..'FrameDropDown']) then
ToggleDropDownMenu(1, nil, _G[cunit..'FrameDropDown'], "cursor", 0, 0)
end
end
 
local CheckInterrupt = function(self, unit)
if unit == "vehicle" then unit = "player" end
 
if self.interrupt and UnitCanAttack("player", unit) then
self:SetStatusBarColor(1, 0, 0, 0.5)
else
self:SetStatusBarColor(.1, .4, .7,.8)
end
end
 
local CheckCast = function(self, unit, name, rank, castid)
CheckInterrupt(self, unit)
end
 
local CheckChannel = function(self, unit, name, rank)
CheckInterrupt(self, unit)
end
------------------------------------------------------------------------
-- Layout
------------------------------------------------------------------------
local function layout(self, unit)
self.menu = menu
self:RegisterForClicks('AnyDown')
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self:SetAttribute('*type2', 'menu')
self:SetMovable(true)
self:EnableMouse(true)
self:RegisterForDrag("LeftButton","RightButton")
self:SetScript("OnDragStart", function(self) if IsAltKeyDown() and IsShiftKeyDown() then self:StartMoving() end end)
self:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
self:SetUserPlaced(true)
 
-- Health
local hp = CreateFrame('StatusBar', nil, self)
hp:SetStatusBarTexture(texture)
hp:SetAllPoints(self)
 
Backdrop(hp)
hpbg = hp:CreateTexture(nil, 'BORDER')
hpbg:SetAllPoints(hp)
hpbg:SetTexture(texture)
hpbg:SetVertexColor(0.16,0.16,0.16,1)
 
hp.colorClass = true
hp.colorReaction = true
hp.colorTapping = true
hp.frequentUpdates = true
 
self.Health = hp
 
-- Power
pp = CreateFrame('StatusBar', nil, self)
pp:SetStatusBarTexture(texture)
pp:SetHeight(ppheight)
pp:SetPoint("BOTTOM", hp, "TOP", 0, 2)
pp:SetParent(self)
pp:SetPoint'LEFT'
pp:SetPoint'RIGHT'
 
Backdrop(pp)
ppbg = pp:CreateTexture(nil, 'BORDER')
ppbg:SetAllPoints(pp)
ppbg:SetTexture(texture)
ppbg:SetVertexColor(0.16,0.16,0.16,1)
 
pp.colorPower = true
pp.frequentUpdates = true
pp.frequentUpdates = true
 
self.Power = pp
 
-----------------------------------------------------------------------
-- Texts
-----------------------------------------------------------------------
local function gradient(perc)
if perc <= 0.5 then
return 255, perc*510, 0
else
return 510 - perc*510, 255, 0
end
end
local function truncate(value)
if(value >= 1e6) then
return gsub(format('%.2fm', value / 1e6), '%.?0+([km])$', '%1')
elseif(value >= 1e5) then
return gsub(format('%.1fk', value / 1e3), '%.?0+([km])$', '%1')
else
return value
end
end
local numberize = function(v)
if v <= 9999 then return v end
if v >= 1000000 then
local value = string.format("%.1fm", v/1000000)
return value
elseif v >= 10000 then
local value = string.format("%.1fk", v/1000)
return value
end
end
 
oUF.TagEvents['hp'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['hp'] = function(unit)
local r,g,b = gradient(UnitHealth(unit)/UnitHealthMax(unit))
return format('|cff%02x%02x%02x %s |cffFFFFFF | |r|cff%02x%02x%02x%d%%|r',
r, g, b, numberize(UnitHealth(unit)),
r, g, b, floor((UnitHealth(unit)/UnitHealthMax(unit))*1000)/10)
end
 
oUF.TagEvents['pp'] = oUF.TagEvents['curpp']
oUF.Tags['pp'] = function(unit)
local num, str = UnitPowerType(unit)
local c = oUF.colors.power[str]
return c and format('|cff%02x%02x%02x%s|r', c[1] * 255, c[2] * 255, c[3] * 255, numberize(oUF.Tags['curpp'](unit)))
end
 
oUF.TagEvents['[name]'] = 'UNIT_NAME_UPDATE'
oUF.Tags['[name]'] = function(unit)
local name = UnitName(unit)
return (string.len(name) > 16) and string.gsub(name, "%s?(.)%S+%s", "%1. ") or name
end
 
-- [[ Health Text ]] --
local curhealth = hp:CreateFontString(nil, 'OVERLAY')
curhealth:SetFont(font, fontsize, "OUTLINE")
self:Tag(curhealth, '[hp]')
curhealth.frequentUpdates = 0.1
 
-- [[ Power Text ]] --
local curpower = hp:CreateFontString(nil, 'OVERLAY')
curpower:SetFont(font, fontsize, "OUTLINE")
self:Tag(curpower, '[pp]')
curpower.frequentUpdates = 0.1
 
-- [[ Name Text ]] --
local unitnames = hp:CreateFontString(nil, 'OVERLAY')
unitnames:SetFont(font, fontsize, "OUTLINE")
self:Tag(unitnames,'[name]')
 
--[[ raid icon ]]--
self.RaidIcon = hp:CreateTexture(nil, "OVERLAY")
self.RaidIcon:SetHeight(16)
self.RaidIcon:SetWidth(16)
self.RaidIcon:SetPoint('Center', self, 0, 0)
self.RaidIcon:SetTexture'Interface\\TargetingFrame\\UI-RaidTargetingIcons'
 
--[[ castbar format ]]--
local CastBarTime = function(self, duration)
if self.channeling then
self.Time:SetFormattedText("%.1f", duration)
self.Time:SetFont(font, fontsize, "OUTLINE")
elseif self.casting then
self.Time:SetFormattedText("%.1f", self.max - duration)
self.Time:SetFont(font, fontsize, "OUTLINE")
end
end
-----------------------------------------------------------------------
-- Buffs / Debuffs
-----------------------------------------------------------------------
local function PostCreateAura(element, button)
button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
button.icon:SetDrawLayer('ARTWORK')
 
icBorder = CreateFrame("Frame", nil)
icBorder:SetParent(button)
icBorder:SetFrameLevel(0)
icBorder:SetPoint("TOPLEFT", button, "TOPLEFT")
icBorder:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT")
Backdrop(icBorder)
 
button.cd:SetReverse()
button.cd.noCooldownCount = true
end
--[[ buffs ]]--
self.Buffs = CreateFrame("Frame", nil, self)
self.Buffs.size = 18
self.Buffs:SetHeight(self.Buffs.size)
self.Buffs:SetWidth(hpwidth)
self.Buffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 2, -6)
self.Buffs.initialAnchor = 'TOPLEFT'
self.Buffs["growth-y"] = 'DOWN'
self.Buffs.num = 36
self.Buffs.spacing = 6
self.Buffs.PostCreateIcon = PostCreateAura
 
--[[ debuffs ]]--
self.Debuffs = CreateFrame("Frame", nil, self)
if unit == "target" then
self.Debuffs.size = 22
self.Debuffs:SetHeight(self.Debuffs.size)
self.Debuffs:SetWidth(hpwidth)
--self.Debuffs:SetPoint('TOPLEFT', oUF.units.player, 'BOTTOMLEFT', 2, -6)
self.Debuffs:SetPoint('BOTTOMLEFT',self,'TOPLEFT' , 2, 30)
self.Debuffs.initialAnchor = 'TOPLEFT'
self.Debuffs["growth-y"] = 'UP'
self.Debuffs.num = 16
self.Debuffs.spacing = 6
--self.Debuffs.onlyShowPlayer = true
self.Debuffs.PostCreateIcon = PostCreateAura
elseif unit == "focus" then
self.Debuffs.size = 22
self.Debuffs:SetHeight(self.Debuffs.size)
self.Debuffs:SetWidth(hpwidth)
self.Debuffs:SetPoint('TOPLEFT',self,'BOTTOMLEFT' , 2, -6)
self.Debuffs.initialAnchor = 'TOPLEFT'
self.Debuffs["growth-y"] = 'DOWN'
self.Debuffs.num = 8
self.Debuffs.spacing = 6
--self.Debuffs.onlyShowPlayer = true
self.Debuffs.PostCreateIcon = PostCreateAura--]]
elseif unit == "targettarget" then
self.Debuffs.size = 16
self.Debuffs:SetHeight(self.Debuffs.size)
self.Debuffs:SetWidth(C["unitframe"].totwidth)
self.Debuffs:SetPoint('BOTTOMLEFT',self,'TOPLEFT' , 2, 26)
self.Debuffs.initialAnchor = 'TOPLEFT'
self.Debuffs["growth-y"] = 'UP'
self.Debuffs.num = 4
self.Debuffs.spacing = 4
--self.Debuffs.onlyShowPlayer = true
self.Debuffs.PostCreateIcon = PostCreateAura
 
end
 
local PostUpdateIcon
do
local playerUnits = {
player = true,
pet = true,
vehicle = true,
}
PostUpdateIcon = function(icons, unit, icon, index, offset, filter, isDebuff)
local texture = icon.icon
if(playerUnits[icon.owner]) then
texture:SetDesaturated(false)
else
if icon.debuff then texture:SetDesaturated(true) end
if C["unitframe"].onlyplayer == true then icon:Hide() end --Ö»ÏÔʾÍæ¼ÒÊ©·ÅµÄDEBUFF
end
 
end
 
end
 
-----------------------------------------------------------------------
-- Cast Bars
-----------------------------------------------------------------------
if (castbars == true) then
self.Castbar = CreateFrame('StatusBar', nil, self)
self.Castbar:SetFrameLevel(3)
self.Castbar:SetStatusBarTexture(texture)
self.Castbar:SetStatusBarColor(.1, .4, .7)
 
self.castbarpp = self.Castbar:CreateFontString(nil, 'OVERLAY')
self.castbarpp:SetFont(font, fontsize, "OUTLINE")
self.castbarpp:SetJustifyH("LEFT")
self.castbarpp:SetShadowOffset(2,-2)
self.castbarpp:SetPoint("CENTER", self, "CENTER", 0,0)
self.castbarpp:SetText(UnitPower(unit))
 
self.Castbar:RegisterEvent("UNIT_MANA")
self.Castbar:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
self.Castbar:RegisterEvent("UNIT_HEALTH")
self.Castbar:SetScript("OnEvent", function()
local minp, maxp = UnitPower(unit, 0), UnitPowerMax(unit, 0)
if unit == 'player' then
if minp ~=maxp then
self.castbarpp:SetText(format('%s | |cff5F9BFF%s%%|r' ,minp ,floor(minp / maxp * 100)))
else
self.castbarpp:SetText(format('|cff5F9BFF%s|r', minp))
end
elseif unit == 'target' then
local minh, maxh = UnitHealth(unit), UnitHealthMax(unit)
if UnitPower(unit) > 0 then
self.castbarpp:SetText(format('%d%% | |cff5F9BFF%d%%|r' ,floor(minh / maxh * 100), floor(minp / maxp * 100)))
else
self.castbarpp:SetText(format('%d%%' ,floor(minh / maxh * 100)))
end
end
end)
 
Backdrop(self.Castbar)
cbbg = self.Castbar:CreateTexture(nil, 'BORDER')
cbbg:SetAllPoints(self.Castbar)
cbbg:SetTexture(texture)
cbbg:SetVertexColor(0.16,0.16,0.16,1)
 
self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
self.Castbar.Text:SetFont(font, fontsize, "OUTLINE")
 
self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')
self.Castbar.Time:SetFont(font, fontsize, "OUTLINE")
 
self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
self.Castbar.Icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
self.Castbar.Icon:SetDrawLayer('ARTWORK')
 
cbBorder = CreateFrame("Frame", nil)
cbBorder:SetParent(self.Castbar)
cbBorder:SetFrameLevel(0)
cbBorder:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT")
cbBorder:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT")
Backdrop(cbBorder)
 
self.Castbar:SetHeight(cbheight)
self.Castbar.PostCastStart = CheckCast
self.Castbar.PostChannelStart = CheckChannel
 
if unit=='pet' then
self.Castbar:SetWidth(C["unitframe"].petwidth)
self.Castbar:SetPoint('CENTER', oUF.units.pet, 'CENTER', 0, 17)
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 0, 15)
self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -2, 15)
elseif unit=='focus' then
self.Castbar.Icon:SetHeight(50)
self.Castbar.Icon:SetWidth(50)
self.Castbar.Icon:SetPoint("Center", 0, -36)
self.Castbar:SetWidth(300)
self.Castbar:SetHeight(10)
self.Castbar:SetPoint('CENTER', UIParent, 0, 200)
self.Castbar.Text:SetPoint('Left', self.Castbar, 0, 16)
self.Castbar.Time:SetPoint('Right', self.Castbar, -2, 16)
elseif unit=='target' then
self.Castbar:SetWidth(hpwidth)
self.Castbar:SetPoint('BOTTOM', pp, 'TOP', 0, 2)
 
self.Castbar.Icon:SetPoint("TOPLEFT", self.Castbar, "TOPRIGHT", 6, -2)
self.Castbar.Icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", (hpheight+ppheight+cbheight+6), 2)
 
self.Castbar.Text:SetPoint("RIGHT", self, "RIGHT", -2, 0)
self.Castbar.Time:SetPoint('LEFT', self, "LEFT", 2, 0)
elseif unit=='player' then
self.Castbar:SetWidth(hpwidth)
self.Castbar:SetPoint('BOTTOMRIGHT', pp, 'TOPRIGHT', 0, 2)
 
self.Castbar.Icon:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", -(hpheight+ppheight+cbheight+6), 2)
self.Castbar.Icon:SetPoint("TOPRIGHT", self.Castbar, "TOPLEFT", -6, -2)
 
self.Castbar.Text:SetPoint("LEFT", self, "LEFT", 2, 0)
self.Castbar.Time:SetPoint('RIGHT', self, "RIGHT", -2, 0)
 
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"ARTWORK")
self.Castbar.SafeZone:SetTexture(texture)
self.Castbar.SafeZone:SetVertexColor(0.85,0.10,0.10,0.20)
self.Castbar.SafeZone:SetPoint("TOPRIGHT")
self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT")
end
end
--[[ combo points ]]--
local localized, class = UnitClass('player')
if unit=='target' and C["unitframe"].cpoint == true then
if class == 'ROGUE' or class == 'DRUID' then
self.CPoints = {}
for i = 1, MAX_COMBO_POINTS do
self.CPoints[i] = CreateFrame('StatusBar', nil, self)
self.CPoints[i]:SetFrameStrata("HIGH")
self.CPoints[i]:SetStatusBarTexture(texture)
self.CPoints[i]:SetStatusBarColor(1, 0.8, 0)
self.CPoints[i]:SetHeight(2)
self.CPoints[i]:SetWidth((hpwidth / MAX_COMBO_POINTS)-2)
Backdrop(self.CPoints[i])
if (i == 1) then
self.CPoints[i]:SetPoint("BOTTOMLEFT", self.Power, "TOPLEFT", 1, 18)
else
self.CPoints[i]:SetPoint('LEFT', self.CPoints[i-1], 'RIGHT', 2, 0)
end
end
end
end
if class == 'DEATHKNIGHT' and unit == 'player' and C["unitframe"].cpoint == true then
self.Runes = CreateFrame('Frame', nil, self)
for i = 1, 6 do
self.Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self)
self.Runes[i]:SetFrameStrata("HIGH")
self.Runes[i]:SetStatusBarTexture(texture)
self.Runes[i]:SetWidth((hpwidth / 6)-2)
self.Runes[i]:SetHeight(2)
self.Runes[i].bg = self.Runes[i]:CreateTexture(nil, "BORDER")
self.Runes[i].bg:SetAllPoints(self.Runes[i])
self.Runes[i].bg:SetTexture(0.3, 0.3, 0.3)
Backdrop(self.Runes[i])
if (i == 1) then
self.Runes[i]:SetPoint("BOTTOMLEFT", self.Power, "TOPLEFT", 1, 18)
else
self.Runes[i]:SetPoint("LEFT", self.Runes[i-1], "RIGHT", 2, 0)
end
end
end
if class == "SHAMAN" and unit == 'player' and C["unitframe"].cpoint == true then
self.TotemBar = CreateFrame('Frame', nil, self)
for i = 1, 4 do
self.TotemBar[i] = CreateFrame("StatusBar", nil, self)
self.TotemBar[i]:SetHeight(2)
self.TotemBar[i]:SetWidth(hpwidth/4 -1)
 
if (i == 1) then
self.TotemBar[i]:SetPoint("BOTTOMLEFT", self.Power, "TOPLEFT", 1, 18)
else
self.TotemBar[i]:SetPoint("TOPLEFT", self.TotemBar[i-1], "TOPRIGHT", 1, 0)
end
self.TotemBar[i]:SetStatusBarTexture(TEXTURE)
self.TotemBar[i]:SetBackdrop(BACKDROP)
self.TotemBar[i]:SetBackdropColor(0, 0, 0)
self.TotemBar[i]:SetMinMaxValues(0, 1)
self.TotemBar[i].destroy = true
 
self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER")
self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
self.TotemBar[i].bg:SetTexture(TEXTURE)
self.TotemBar[i].bg.multiplier = 0.25
 
end
end
--[[
if(class == "WARLOCK" and unit == 'player') then
local color = self.colors.power["SOUL_SHARDS"]
self.SoulShards = CreateFrame("Frame", nil, self)
for i = 1, 3 do
self.SoulShards[i] = CreateFrame("StatusBar", self:GetName().."_Shards"..i, self)
self.SoulShards[i]:SetFrameStrata("HIGH")
self.SoulShards[i]:SetHeight(2)
self.SoulShards[i]:SetWidth((hpwidth/3)-2)
self.SoulShards[i]:SetStatusBarTexture(texture)
self.SoulShards[i]:SetStatusBarColor(color[1], color[2], color[3])
Backdrop(self.SoulShards[i])
if (i == 1) then
self.SoulShards[i]:SetPoint("BOTTOMLEFT", self.Power, "TOPLEFT", 1, 18)
else
self.SoulShards[i]:SetPoint('LEFT', self.SoulShards[i-1], "RIGHT", 2, 0)
end
end
end
if(class == "PALADIN" and unit == 'player') then
self.HolyPower = CreateFrame("Frame", nil, self)
for i = 1, 3 do
self.HolyPower[i] = CreateFrame("StatusBar", self:GetName().."_HolyPower"..i, self)
self.HolyPower[i]:SetFrameStrata("HIGH")
self.HolyPower[i]:SetHeight(2)
self.HolyPower[i]:SetWidth((hpwidth/3)-2)
self.HolyPower[i]:SetStatusBarTexture(texture)
self.HolyPower[i]:SetStatusBarColor(1, 0.8, 0)
Backdrop(self.HolyPower[i])
if (i == 1) then
self.HolyPower[i]:SetPoint("BOTTOMLEFT", self.Power, "TOPLEFT", 1, 18)
else
self.HolyPower[i]:SetPoint('LEFT', self.HolyPower[i-1], "RIGHT", 2, 0)
end
end
end
]]--
 
-----------------------------------------------------------------------
-- Frame Settings
-----------------------------------------------------------------------
if unit=='player' or unit=='target' then
curhealth:SetPoint("BOTTOM", self, "TOP", 0, 4+ppheight)
if unit == 'target' then
curpower:SetPoint('BOTTOMLEFT', self, "TOPLEFT", 2, 4+ppheight)
unitnames:SetPoint('BOTTOMRIGHT', self, "TOPRIGHT", -2, 4+ppheight)
self.Buffs.PostUpdateIcon = PostUpdateIcon
self.Debuffs.PostUpdateIcon = PostUpdateIcon
elseif unit=='player' then
self.Buffs:Hide()
self.Debuffs:Hide()
curpower:SetPoint('BOTTOMRIGHT', self, "TOPRIGHT", -2, 4+ppheight)
unitnames:SetPoint('BOTTOMLEFT', self, "TOPLEFT", 2, 4+ppheight)
end
end
 
if unit=='focus' or unit=='targettarget' or unit=='pet' or unit:find("boss%d") then
curhealth:Hide()
curpower:Hide()
self.Buffs:Hide()
self.Debuffs:Hide()
if unit=='targettarget' then
self.Power:Hide()
unitnames:SetPoint("BOTTOM", self, "TOP", 0, 4)
self.Debuffs:Show()
elseif unit =='pet' then
self.Power:Hide()
unitnames:SetPoint("TOP", self, "BOTTOM", 0, -4)
elseif unit=='focus' then
self.Debuffs:Show()
--unitnames:SetPoint('Center', self, 0, -shpheight-3)
unitnames:SetPoint('BOTTOM', self, "TOP", -C["unitframe"].focusheight-3)
else
self.Power:Hide()
unitnames:SetPoint("TOP", self, "BOTTOM", 0, -4)
end
end
end
 
oUF:RegisterStyle('LjxxB_', layout)
local Player = oUF:Spawn("player")
Player:SetPoint("BOTTOM",UIPrent,"BOTTOM", playerx, playery)
Player:SetHeight(hpheight)
Player:SetWidth(hpwidth)
 
local Target = oUF:Spawn("target")
Target:SetPoint("BOTTOM", targetx, targety)
Target:SetHeight(hpheight)
Target:SetWidth(hpwidth)
 
local ToT = oUF:Spawn("targettarget")
ToT:SetPoint("BOTTOM", totx, toty)
ToT:SetHeight(C["unitframe"].totheight/2)
ToT:SetWidth(C["unitframe"].totwidth)
 
local Focus = oUF:Spawn("focus")
Focus:SetPoint("LEFT", focusx, focusy)
Focus:SetHeight(C["unitframe"].focusheight)
Focus:SetWidth(C["unitframe"].focuswidth)
 
local Pet = oUF:Spawn("pet")
Pet:SetPoint("BOTTOM", petx, pety)
Pet:SetHeight(C["unitframe"].petheight/2)
Pet:SetWidth(C["unitframe"].petwidth)
 
oUF:DisableBlizzard'party'
--[[ do
for k,v in pairs(UnitPopupMenus) do
for x,y in pairs(UnitPopupMenus[k]) do
if y == "SET_FOCUS" then
table.remove(UnitPopupMenus[k],x)
elseif y == "CLEAR_FOCUS" then
table.remove(UnitPopupMenus[k],x)
end
end
end
end ]]
\ No newline at end of file
Eui/unitframe/raid.lua New file
0,0 → 1,719
local E, C = unpack(select(2, ...))
if not C["raid"].raid == true then return end
 
if C["raid"].texture == 0 then
BarTexture = "Interface\\AddOns\\Eui\\media\\nameTex"
elseif C["raid"].texture == 1 then
BarTexture = "Interface\\AddOns\\Eui\\media\\dM2"
elseif C["raid"].texture == 2 then
BarTexture = "Interface\\AddOns\\Eui\\media\\statusbar"
else
BarTexture = "Interface\\AddOns\\Eui\\media\\nameTex"
end
 
updateAllElements = function(frame)
for _, v in ipairs(frame.__elements) do
v(frame, "UpdateElement", frame.unit)
end
end
 
ShortValueNegative = function(v)
if v <= 999 then return v end
if v >= 1000000 then
local value = string.format("%.1fm", v/1000000)
return value
elseif v >= 1000 then
local value = string.format("%.1fk", v/1000)
return value
end
end
 
MLAnchorUpdate = function (self)
if self.Leader:IsShown() then
self.MasterLooter:SetPoint("TOPLEFT", 14, 8)
else
self.MasterLooter:SetPoint("TOPLEFT", 2, 8)
end
end
 
 
oUF.TagEvents['getnamecolor'] = 'UNIT_HAPPINESS'
oUF.Tags['getnamecolor'] = function(unit)
local reaction = UnitReaction(unit, 'player')
if (unit == 'pet' and GetPetHappiness()) then
local c = oUF.colors.happiness[GetPetHappiness()]
return string.format('|cff%02x%02x%02x', c[1] * 255, c[2] * 255, c[3] * 255)
elseif (UnitIsPlayer(unit)) then
return _TAGS['raidcolor'](unit)
elseif (reaction) then
local c = oUF.colors.reaction[reaction]
return string.format('|cff%02x%02x%02x', c[1] * 255, c[2] * 255, c[3] * 255)
else
r, g, b = .84,.75,.65
return string.format('|cff%02x%02x%02x', r * 255, g * 255, b * 255)
end
end
 
oUF.TagEvents['nameshort'] = 'UNIT_NAME_UPDATE'
oUF.Tags['nameshort'] = function(unit)
local name = UnitName(unit)
return E.utf8sub(name, 3, false)
end
 
oUF.TagEvents['namelong'] = 'UNIT_NAME_UPDATE'
oUF.Tags['namelong'] = function(unit)
local name = UnitName(unit)
return E.utf8sub(name, 20, true)
end
 
oUF.TagEvents['hpprec'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['hpprec'] = function(unit)
if unit then
local min, max = UnitHealth(unit), UnitHealthMax(unit)
return format('%s%%', floor(min/max*100))
else
return ""
end
end
 
local _, class = UnitClass("player")
local DebuffTypeColor = { };
DebuffTypeColor["Magic"] = { r = 0.20, g = 0.60, b = 1.00 };
DebuffTypeColor["Curse"] = { r = 0.60, g = 0.00, b = 1.00 };
DebuffTypeColor["Disease"] = { r = 0.60, g = 0.40, b = 0 };
DebuffTypeColor["Poison"] = { r = 0.00, g = 0.60, b = 0 };
 
local CanDispel = {
PRIEST = { Magic = true, Disease = true, },
SHAMAN = { Poison = true, Disease = true, Curse = true, },
PALADIN = { Magic = true, Poison = true, Disease = true, },
MAGE = { Curse = true, },
DRUID = { Curse = true, Poison = true, },
ROGUE = {},
HUNTER = {},
WARRIOR = {},
WARLOCK = {},
DEATHKNIGHT = {},
}
 
local ClickSets_Setsopt = {}
local classopt
if C["clickset"].aadefault == true then
ClickSets_Setsopt = E.ClickSets_Sets
classopt = class
else
ClickSets_Setsopt = C
classopt = "clickset"
end
 
 
local function UpdateThreat(self, event, unit)
if (self.unit ~= unit) or (unit == "target" or unit == "pet" or unit == "focus" or unit == "focustarget" or unit == "targettarget") then return end
local threat = UnitThreatSituation(self.unit)
local dtype
local i = 1
local candel = 1
if UnitIsPlayer(self.unit) then
while (true) do
dtype = select(5, UnitDebuff(self.unit, i))
if CanDispel[class][dtype] then candel = i end
if (not select(3, UnitDebuff(self.unit, i))) then
if i > 1 then dtype = select(5, UnitDebuff(self.unit, candel)) end
break;
end
i = i +1
end
end
if (threat == 3) then
if dtype then
if CanDispel[class][dtype] then
if self.panel then
self.panel:SetPoint("TOPLEFT", self, "TOPLEFT", -3, 3)
self.panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 3, -3)
self.panel:SetBackdropBorderColor(DebuffTypeColor[dtype].r, DebuffTypeColor[dtype].g, DebuffTypeColor[dtype].b,1)
self.panel:SetBackdropColor(DebuffTypeColor[dtype].r, DebuffTypeColor[dtype].g, DebuffTypeColor[dtype].b,1)
else
self.Name:SetTextColor(1,0.1,0.1)
end
end
else
if self.panel then
self.panel:SetBackdropBorderColor(.67,.06,.24,1)
self.panel:SetBackdropColor(.67,.06,.24,1)
self.panel:SetPoint("TOPLEFT", self, "TOPLEFT", -1, 1)
self.panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1)
else
self.Name:SetTextColor(1,0.1,0.1)
end
end
else
if dtype then
if CanDispel[class][dtype] then
if self.panel then
self.panel:SetBackdropBorderColor(DebuffTypeColor[dtype].r, DebuffTypeColor[dtype].g, DebuffTypeColor[dtype].b,1)
self.panel:SetBackdropColor(DebuffTypeColor[dtype].r, DebuffTypeColor[dtype].g, DebuffTypeColor[dtype].b,1)
self.panel:SetPoint("TOPLEFT", self, "TOPLEFT", -1, 1)
self.panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1)
else
self.Name:SetTextColor(1,0.1,0.1)
end
end
else
if self.panel then
self.panel:SetBackdropBorderColor(0,0,0,0.01)
self.panel:SetBackdropColor(0,0,0,0.01)
self.panel:SetPoint("TOPLEFT", self, "TOPLEFT", -1, 1)
self.panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1)
else
self.Name:SetTextColor(1,1,1)
end
end
end
 
end
 
local PostUpdateHealthRaid = function(health, unit, min, max)
if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
if not UnitIsConnected(unit) then
health.value:SetText("|cffD7BEA5".."D/C".."|r")
elseif UnitIsDead(unit) then
health.value:SetText("|cffD7BEA5".."DEAD".."|r")
elseif UnitIsGhost(unit) then
health.value:SetText("|cffD7BEA5".."GHOST".."|r")
end
else
-- local r, g, b
-- if not UnitIsPlayer(unit) and UnitIsFriend(unit, "player") then
-- r, g, b = 75/255, 175/255, 76/255
-- health:SetStatusBarColor(r, g, b)
-- health.bg:SetTexture(.1, .1, .1)
-- end
 
if min ~= max then
health.value:SetText("|cff559655-"..ShortValueNegative(max-min).."|r")
else
health.value:SetText(" ")
end
end
end
 
local iconsize = C["raid"].hotsize
local countOffsets = {
TOPLEFT = {iconsize, 0},
TOPRIGHT = {-iconsize, 0},
BOTTOMLEFT = {iconsize, 0},
BOTTOMRIGHT = {iconsize, 0},
LEFT = {iconsize, 0},
RIGHT = {-iconsize, 0},
TOP = {0, 0},
BOTTOM = {0, 0},
}
 
local function CreateAuraWatchIcon(self, icon)
E.EuiSetTemplate(icon)
icon.icon:SetPoint("TOPLEFT", 1, -1)
icon.icon:SetPoint("BOTTOMRIGHT", -1, 1)
icon.icon:SetTexCoord(.08, .92, .08, .92)
icon.icon:SetDrawLayer("ARTWORK")
if (icon.cd) then
icon.cd:SetReverse()
end
icon.overlay:SetTexture()
end
 
local function createAuraWatch(self,unit)
local auras = CreateFrame("Frame", nil, self)
auras:SetPoint("TOPLEFT", health, 1, -1)
auras:SetPoint("BOTTOMRIGHT", health, -1, 1)
 
local debuffs = spellIDs
 
auras.presentAlpha = 1
auras.missingAlpha = 0
auras.icons = {}
auras.PostCreateIcon = CreateAuraWatchIcon
 
local buffs = {}
local debuffs = E.debuffids
 
if (E.buffids["ALL"]) then
for key, value in pairs(E.buffids["ALL"]) do
tinsert(buffs, value)
end
end
 
if (E.buffids[class]) then
for key, value in pairs(E.buffids[class]) do
tinsert(buffs, value)
end
end
 
if (buffs) then
for key, spell in pairs(buffs) do
local icon = CreateFrame("Frame", nil, auras)
icon.spellID = spell[1]
icon.anyUnit = spell[4]
icon:SetWidth(iconsize)
icon:SetHeight(iconsize)
icon:SetPoint(spell[2], 0, 0)
 
local tex = icon:CreateTexture(nil, "OVERLAY")
tex:SetAllPoints(icon)
tex:SetTexture(E.normTex)
if (spell[3]) then
tex:SetVertexColor(unpack(spell[3]))
else
tex:SetVertexColor(0.8, 0.8, 0.8)
end
icon.text=tex
if C["raid"].hottime ~= true then
icon.noOCC = true
else
icon.noOCC = false
end
 
if icon.spellID == 49284 then icon.noOCC = true end
 
local count = icon:CreateFontString(nil, "OVERLAY")
count:SetFont(E.fontn, 8, "OUTLINE")
count:SetPoint("CENTER", unpack(countOffsets[spell[2]]))
icon.count = count
 
auras.icons[spell[1]] = icon
end
end
 
if (debuffs) then
for key, spellID in pairs(debuffs) do
local icon = CreateFrame("Frame", nil, auras)
icon.spellID = spellID
icon.anyUnit = true
-- icon:SetWidth(16.11)
-- icon:SetHeight(16.11)
icon:SetSize(16,16)
if ((key % 2) == 0) then
icon:SetPoint("RIGHT", self, "CENTER", -2, -2)
else
icon:SetPoint("LEFT", self, "CENTER", 2, -2)
end
icon.noOCC = true
 
local count = icon:CreateFontString(nil, "OVERLAY")
count:SetFont(E.fontn, 8, "THINOUTLINE")
count:SetPoint("BOTTOMRIGHT", 2, 2)
count:SetTextColor(1,.9,0)
icon.count = count
 
auras.icons[spellID] = icon
end
end
 
 
self.AuraWatch = auras
end
 
-- ------------------------------------------------------------------------
-- Layout
-- ------------------------------------------------------------------------
 
local function Shared(self, unit)
 
self.menu = SpawnMenu
self:SetAttribute('*type2', 'menu')
 
--ClickSets_Setsopt[class]
local key_tmp
if E.ClickSets_Sets then
if (ClickSets_Setsopt[classopt]) then
for key, value in pairs(ClickSets_Setsopt[classopt]) do
key_tmp = string.gsub(key,"z","-")
if value ~= 0 and key ~= "aadefault" and key ~= "aamouse" then
self:SetAttribute(key_tmp, 'spell')
self:SetAttribute(string.gsub(key_tmp,"type",'spell'), GetSpellInfo(value))
elseif value == 0 and key ~= "aadefault" and key ~= "aamouse" then
self:SetAttribute(string.gsub(key,"z","-"), nil)
self:SetAttribute(string.gsub(string.gsub(key,"z","-"),"type",'spell'), nil)
end
end
end
end
 
--self.colors = oUF.colors
self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
self:RegisterForClicks('AnyUp')
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
 
if C["raid"].grid == true then
self:SetAttribute('initial-height', C["raid"].gridh)
self:SetAttribute('initial-width', C["raid"].gridw)
else
self:SetAttribute('initial-height', C["raid"].nogridh)
self:SetAttribute('initial-width', C["raid"].nogridw)
end
 
 
self:SetBackdrop({
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
edgeFile = [=[Interface\Buttons\WHITE8x8]=],
tile = false, tileSize = 0, edgeSize = 1,
insets = { left = -1, right = -1, top = -1, bottom = -1}
})
self:SetBackdropColor(.1,.1,.1,1)
self:SetBackdropBorderColor(.3,.3,.3,1)
 
health = CreateFrame('StatusBar', nil, self)
health:SetPoint("TOPLEFT", self, "TOPLEFT", 2, -2)
health:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -2, 2)
 
if C["raid"].grid == true and GridHealthVettical == true then
health:SetOrientation('VERTICAL')
end
health:SetStatusBarTexture(BarTexture)
 
self.Health = health
 
--LFDRole icon
if self:GetAttribute("unitsuffix") ~= "target" and self:GetAttribute("unitsuffix") ~= "pet" then
self.LFDRole = self.Health:CreateTexture(nil, 'OVERLAY')
self.LFDRole:SetWidth(14)
self.LFDRole:SetHeight(14)
self.LFDRole:SetPoint('LEFT', -4, 0)
end
 
health.bg = health:CreateTexture(nil, 'BORDER')
health.bg:SetAllPoints(health)
health.bg:SetTexture(.08,.08,.08)
health.bg.multiplier = (0.3)
self.Health.bg = health.bg
 
health.value = health:CreateFontString(nil, "OVERLAY")
if C["raid"].grid == true then
health.value:SetPoint("BOTTOM", health, 0, 2)
else
health.value:SetPoint("RIGHT", health, -2, 0)
end
health.value:SetFont(E.fontn, 10, "THINOUTLINE")
health.value:SetTextColor(1,1,1)
health.value:SetShadowOffset(1, -1)
self.Health.value = health.value
 
health.PostUpdate = PostUpdateHealthRaid
 
health.colorDisconnected = true
health.colorClass = C["raid"].raidColorClass
health.colorSmooth = true
health.frequentUpdates = true
health.colorTapping = true
 
local powerbg = CreateFrame("Frame",nil,self)
powerbg:SetBackdrop(self:GetBackdrop())
powerbg:SetBackdropColor(.1,.1,.1,1)
powerbg:SetBackdropBorderColor(.3,.3,.3,1)
powerbg:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 6, 3)
powerbg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -6, -3)
powerbg:SetFrameLevel(health:GetFrameLevel()+1)
 
local power = CreateFrame("StatusBar", nil, powerbg)
power:SetStatusBarTexture(BarTexture)
power:SetParent(powerbg)
power:SetFrameLevel(powerbg:GetFrameLevel()+1)
power:SetPoint("TOPLEFT", powerbg, "TOPLEFT", 2, -2)
power:SetPoint("BOTTOMRIGHT", powerbg, "BOTTOMRIGHT", -2, 2)
self.Power = power
 
power.bg = power:CreateTexture(nil, "BORDER")
power.bg:SetAllPoints(power)
power.bg:SetTexture(0.3,0.3,.3)
power.bg.multiplier = 0.4
 
 
power.colorTapping = true
power.colorDisconnected = true
power.colorPower = true
power.colorReaction = true
power.frequentUpdates = true
 
local panel = CreateFrame("Frame", nil, self)
panel:SetPoint("TOPLEFT", self, "TOPLEFT", -1, 1)
panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1)
panel:SetBackdrop( {
bgFile = E.normTex,
edgeFile = E.normTex,
tile = false, tileSize = 0, edgeSize = 1,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
})
panel:SetFrameLevel(health:GetFrameLevel()-1)
panel:SetBackdropColor(0,0,0)
panel:SetBackdropBorderColor(0,0,0)
self.panel = panel
 
local name = health:CreateFontString(nil, "OVERLAY")
if C["raid"].grid == true then
name:SetPoint("TOP", health, 0, -3)
else
name:SetPoint("LEFT", health, 6, 1)
end
name:SetFont(E.font, 11, "THINOUTLINE")
name:SetShadowOffset(1, -1)
if C["raid"].grid == true then
self:Tag(name, "[getnamecolor][nameshort]")
else
self:Tag(name, "[getnamecolor][namelong]")
end
 
local range = {
insideAlpha = 1,
outsideAlpha = 0.4
}
self.Range = range
 
if self:GetParent():GetName():match"oUF_EUI_MT" or unit:find("boss%d") then
self:SetAttribute('initial-height', C["raid"].gridh-10)
self:SetAttribute('initial-width', C["raid"].gridw+20)
name:SetFont(E.font, 9, "OUTLINE")
name:SetPoint("CENTER",health,-2,0)
self:Tag(name, "[getnamecolor][nameshort] - [hpprec]")
health.value:ClearAllPoints()
self.Range.outsideAlpha = 1
 
end
 
if self:GetAttribute("unitsuffix") == "target" or self:GetAttribute("unitsuffix") == "pet" then
if C["raid"].grid == true then
self:SetAttribute('initial-height', C["raid"].gridh * 0.7)
else
self:SetAttribute('initial-width', C["raid"].nogridw * 0.7)
self:Tag(name, "[getnamecolor][nameshort]")
end
health.value:ClearAllPoints()
name:SetPoint("CENTER",health,-2,0)
self.Range.outsideAlpha = 1
end
 
self.Name = name
 
if C["raid"].raidthreat == true then
table.insert(self.__elements, UpdateThreat)
self:RegisterEvent('PLAYER_TARGET_CHANGED', UpdateThreat)
self:RegisterEvent('UNIT_THREAT_LIST_UPDATE', UpdateThreat)
self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', UpdateThreat)
self:RegisterEvent('UNIT_AURA', UpdateThreat)
end
 
local RaidIcon = health:CreateTexture(nil, 'OVERLAY')
RaidIcon:SetHeight(16)
RaidIcon:SetWidth(16)
if C["raid"].grid == true then
RaidIcon:SetPoint('CENTER', self, 'TOP', 0, -4)
else
RaidIcon:SetPoint('CENTER', self, 'LEFT')
end
RaidIcon:SetTexture("Interface\\AddOns\\Eui\\media\\raidicons.blp")
self.RaidIcon = RaidIcon
 
local Leader = health:CreateTexture(nil, "OVERLAY")
Leader:SetHeight(14)
Leader:SetWidth(14)
Leader:SetPoint("TOPLEFT", 2, 8)
self.Leader = Leader
 
-- master looter
local MasterLooter = health:CreateTexture(nil, "OVERLAY")
MasterLooter:SetHeight(14)
MasterLooter:SetWidth(14)
self.MasterLooter = MasterLooter
self:RegisterEvent("PARTY_LEADER_CHANGED", MLAnchorUpdate)
self:RegisterEvent("PARTY_MEMBERS_CHANGED", MLAnchorUpdate)
 
local ReadyCheck = power:CreateTexture(nil, "OVERLAY")
ReadyCheck:SetHeight(12)
ReadyCheck:SetWidth(12)
ReadyCheck:SetPoint('CENTER')
self.ReadyCheck = ReadyCheck
 
-- self.DebuffHighlightAlpha = 1
-- self.DebuffHighlightBackdrop = true
-- self.DebuffHighlightFilter = true
 
if C["raid"].raidaurawatch == true then
createAuraWatch(self,unit)
end
 
self:RegisterEvent("UNIT_PET", updateAllElements)
 
return self
end
 
local NUM_RAID_GROUPS --显示的小队数量
NUM_RAID_GROUPS = C["raid"].raidgroups
if NUM_RAID_GROUPS > 8 or NUM_RAID_GROUPS < 1 then NUM_RAID_GROUPS = 5 end
 
if C["raid"].showParty == true then
oUF:RegisterStyle('oUF_EUI_Party', Shared)
oUF:SetActiveStyle('oUF_EUI_Party')
local party
local showpartytarget
if C["raid"].showPartyTarget == true then
showpartytarget = "oUF_Party"
else
showpartytarget = "oUF_PartyNoTarget"
end
if C["raid"].grid == true then
local pty = C["raid"].gridh * 5 + 20 + C["raid"].gridheight
party = oUF:SpawnHeader("oUF_Party", nil, "party",
"showSolo", false,
"showPlayer", true,
"showParty", true,
"showRaid", true,
"xOffset", 5,
"point", "LEFT",
"template", showpartytarget.."H"
)
party:SetPoint("TOP", UIParent, "BOTTOM", 0, pty)
else
party = oUF:SpawnHeader("oUF_PartyDPS", nil, "party",
"showSolo", false,
"showPlayer", true,
"showParty", true,
"showRaid", true,
"yOffset", 28,
"point", "BOTTOM",
"template", showpartytarget.."V"
)
party:SetPoint("BOTTOMLEFT", UIParent, "LEFT", 22, -70)
end
end
 
if C["raid"].mt == true then
oUF:RegisterStyle('oUF_EUI_MT', Shared)
oUF:SetActiveStyle('oUF_EUI_MT')
local tank = oUF:SpawnHeader(
nil, nil, 'raid',
'ShowRaid', true,
'yOffset', -4,
'groupFilter', 'MAINTANK',
'template', 'oUF_Mtt'
)
tank:SetPoint("BOTTOMRIGHT", -200, 160)
end
 
if C["raid"].boss == true then
for i = 1,MAX_BOSS_FRAMES do
local t_boss = _G["Boss"..i.."TargetFrame"]
t_boss:UnregisterAllEvents()
t_boss.Show = function() return end
t_boss:Hide()
_G["Boss"..i.."TargetFrame".."HealthBar"]:UnregisterAllEvents()
_G["Boss"..i.."TargetFrame".."ManaBar"]:UnregisterAllEvents()
end
local boss = {}
for i = 1, MAX_BOSS_FRAMES do
boss[i] = oUF:Spawn("boss"..i, "oUF_Boss"..i)
if i == 1 then
boss[i]:SetPoint("BOTTOM", UIParent, "BOTTOM", 452, 560)
else
boss[i]:SetPoint('BOTTOM', boss[i-1], 'TOP', 0, 10)
end
end
end
 
oUF:Factory(function(self)
for i = 1, NUM_RAID_GROUPS do
oUF:RegisterStyle('oUF_EUI_RAID'..i, Shared)
oUF:SetActiveStyle("oUF_EUI_RAID"..i)
end
local raid = {}
if C["raid"].grid == true then
if C["raid"].grouphv == true then --队伍为横排
for i = 1, NUM_RAID_GROUPS do
raid[i] = self:SpawnHeader("oUF_EUI_raid"..i, nil, "raid",
"showParty", true,
"showPlayer", true,
"showRaid", true,
"xoffset", 5,
"yOffset", 5,
"point", "LEFT",
"groupFilter", tostring(i),
"groupingOrder", tostring(i),
"groupBy", "GROUP",
"maxColumns", 5,
"unitsPerColumn", 5,
"columnSpacing", 5
)
end
if C["raid"].raidDirection == true then --1队排在下面
for i = 1, NUM_RAID_GROUPS do
if i == 1 then
raid[1]:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", -(C["raid"].gridw * 5 + 5 * 4)/2, C["raid"].gridheight)
raid[1]:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", (C["raid"].gridw * 5 + 5 * 4)/2, C["raid"].gridheight)
else
raid[i]:SetPoint('BOTTOMLEFT', "oUF_EUI_raid"..tostring(i-1), 'TOPLEFT', 0, 5)
raid[i]:SetPoint('BOTTOMRIGHT', "oUF_EUI_raid"..tostring(i-1), 'TOPRIGHT', 0, 5)
end
end
else --5队排在下面.
for i = 1, NUM_RAID_GROUPS, 1 do
if i == 1 then
raid[1]:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", -(C["raid"].gridw * 5 + 5 * 4)/2, C["raid"].gridheight + C["raid"].gridh * (NUM_RAID_GROUPS-1) + 5*(NUM_RAID_GROUPS-1))
raid[1]:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", (C["raid"].gridw * 5 + 5 * 4)/2, C["raid"].gridheight + C["raid"].gridh * (NUM_RAID_GROUPS-1) + 5*(NUM_RAID_GROUPS-1))
else
raid[i]:SetPoint('TOPLEFT', "oUF_EUI_raid"..tostring(i-1), 'BOTTOMLEFT', 0, -5)
raid[i]:SetPoint('TOPRIGHT', "oUF_EUI_raid"..tostring(i-1), 'BOTTOMRIGHT', 0, -5)
end
end
end
else
for i = 1, NUM_RAID_GROUPS do --小队竖排
raid[i] = self:SpawnHeader("oUF_EUI_raid"..i, nil, "raid",
"showParty", true,
"showPlayer", true,
"showRaid", true,
"xoffset", 0,
"yOffset", 5,
"point", "BOTTOM",
"groupFilter", tostring(i),
"groupingOrder", tostring(i),
"groupBy", "GROUP",
"maxColumns", 1,
"unitsPerColumn", 5,
"columnSpacing", 3,
"columnAnchorPoint", raidDirection
)
end
raid[ceil(NUM_RAID_GROUPS / 2)]:SetPoint('BOTTOM', UIParent, 0, C["raid"].gridheight)
for i = ceil(NUM_RAID_GROUPS / 2) - 1, 1, -1 do
raid[i]:SetPoint('BOTTOMRIGHT', "oUF_EUI_raid"..tostring(i + 1), 'BOTTOMLEFT', -5, 0)
end
for i = ceil(NUM_RAID_GROUPS / 2) + 1, NUM_RAID_GROUPS do
raid[i]:SetPoint('BOTTOMLEFT', "oUF_EUI_raid"..tostring(i - 1), 'BOTTOMRIGHT', 5, 0)
end
end
else
for i = 1, NUM_RAID_GROUPS do
raid[i] = self:SpawnHeader("oUF_EUI_raid"..i, nil, "raid",
"showParty", true,
"showPlayer", true,
"showRaid", true,
"xoffset", 0,
"yOffset", -5,
"point", "TOP",
"groupFilter", tostring(i),
"groupingOrder", tostring(i),
"groupBy", "GROUP",
"maxColumns", 1,
"unitsPerColumn", 5,
"columnSpacing", 3,
"columnAnchorPoint", raidDirection
)
if i == 1 then
raid[i]:SetPoint('TOPLEFT', UIParent, 10, -20)
elseif i > 1 and i < 6 then
if C["raid"].groupspace < 0 then C["raid"].groupspace = 3 end
raid[i]:SetPoint('TOPLEFT', "oUF_EUI_raid"..tostring(i-1), 'BOTTOMLEFT', 0, -C["raid"].groupspace)
elseif i > 5 then --小队超过5队时,第6队排到第5队的右边
raid[i]:SetPoint('BOTTOMLEFT', "oUF_EUI_raid"..tostring(i-5), 'BOTTOMRIGHT', 16, 0)
end
end
end
end)
\ No newline at end of file
Eui/unitframe/Clicksets.lua New file
0,0 → 1,92
local E, C = unpack(select(2, ...))
if not C["raid"].clickset == true then return end
 
--[[
 
语法讲解:
type 鼠标
后面的1,2,3 分别是左键,右键 ,中键
前面前缀的shift,ctrl,alt对应键盘上的按钮。
若无前缀,如type2,就表示直接按鼠标右键。
像shift-type1,表示shift+左键
后面的数字为技能ID。
--后面的是注释,没有意义的.
--]]
 
E.ClickSets_Sets = {
PRIEST = { --牧师
["shift-type1"] = 139,--"恢復",
["ctrl-type1"] = 527,--"驅散魔法",
["alt-type1"] = 2061,--"快速治療",
["alt-ctrl-type1"] = 2010,--"復活術",
["type2"] = 17,--"真言術:盾",
["shift-type2"] = 33076,--"癒合禱言",
["ctrl-type2"] = 552,--"驅除疾病",
["alt-type2"] = 2060,--"強效治療術",
["alt-ctrl-type2"] = 32546,--"束縛治療",
["type3"] = 34863,--"治療之環",
},
 
DRUID = { --XD
["shift-type1"] = 774,--"回春術",
["ctrl-type1"] = 2893,--"驅毒術",
["alt-type1"] = 8936,--"癒合",
["alt-ctrl-type1"] = 50769,--"復活",
["type2"] = 53249,--"野性痊癒",
["shift-type2"] = 18562,--"迅捷治愈",
["ctrl-type2"] = 2782,--"解除詛咒",
["alt-type2"] = 50464,--"滋補術",
["type3"] = 33763,--"生命之花",
},
SHAMAN = { --SM
["alt-type1"] = 55459,--"治疗链",
["shift-type1"] = 49273,--"治疗波",
["ctrl-type1"] = 49284,--"大地之盾",
["alt-ctrl-type1"] = 49277,--"先祖之魂",
["type2"] = 61301,--"激流61301",
["alt-type2"] = 49276,--"次级治疗波",
["shift-type2"] = 49276,--"次级治疗波",
["ctrl-type2"] = 51886,--"净化灵魂",
["type3"] = 55459,--"治疗链",
},
 
PALADIN = { --QS
["shift-type1"] = 639,--"聖光術",
["alt-type1"] = 19750,--"聖光閃現",
["ctrl-type1"] = 53601,--"崇聖護盾",
["alt-ctrl-type1"] = 7328,--"救贖",
["type2"] = 20473,--"神聖震擊",
["shift-type2"] = 53653,--"聖光信標",
["ctrl-type2"] = 4987,--"淨化術",
["alt-type2"] = 19750,--"聖光閃現",
["alt-ctrl-type2"] = 633,--"聖療術",
},
 
WARRIOR = { --ZS
["ctrl-type1"] = 50720,--"戒備守護",
["type2"] = 3411,--"阻擾",
},
 
MAGE = { --FS
["shift-type1"] = 1008,--"魔法增效",
["alt-type1"] = 1461,--"秘法智力",
["ctrl-type1"] = 23028,--"秘法光輝",
["type2"] = 475,--"解除詛咒",
["ctrl-type2"] = 475,--"解除詛咒",
["shift-type2"] = 604,--"魔法抑制",
},
 
WARLOCK = { --SS
["alt-type1"] = 132,--"偵測隱形",
["ctrl-type1"] = 5697,--"魔息術",
["type2"] = 698,--"召喚儀式",
},
 
HUNTER = { --LR
["type2"] = 34477,--"誤導",
},
 
ROGUE = { --DZ
["type2"] = 57933,--"偷天換日",
},
}
\ No newline at end of file
Eui/info/apsp.lua New file
0,0 → 1,62
local E, C = unpack(select(2, ...))
if C["info"].apsp == 0 or C["info"].enable == false then return end
 
local StatAPSP = CreateFrame("Frame")
StatAPSP:SetAllPoints(EuiLeftStatBackground)
StatAPSP:EnableMouse(true)
 
function E.EuiInfoAPSPShow()
if StatAPSP:IsShown() then StatAPSP:Hide() else StatAPSP:Show() end
end
 
local int = 1
local stat = 0
local TextAPSP = E.EuiSetFontn(StatAPSP)
--TextAPSP:SetParent(StatAPSP)
TextAPSP:SetPoint("CENTER", StatAPSP, 0, 0)
 
local function UpdateAP(self, t)
int = int - t
if E.MyClass ~= "HUNTER" then
if int < 0 then
local base, posBuff, negBuff = UnitAttackPower("player");
local effective = base + posBuff + negBuff;
TextAPSP:SetText(effective)
int = 1
end
else
if int < 0 then
local base, posBuff, negBuff = UnitRangedAttackPower("player");
local effective = base + posBuff + negBuff;
TextAPSP:SetText(effective)
int = 1
end
end
end
 
local function UpdateSP(self, t)
int = int - t
if int < 0 then
TextAPSP:SetText(GetSpellBonusDamage(7))
int = 1
end
end
 
if C["info"].apsp == 1 then
StatAPSP:SetScript("OnUpdate", UpdateAP)
stat = 1
else
StatAPSP:SetScript("OnUpdate", UpdateSP)
stat =2
end
UpdateAP(StatAPSP, 10)
 
StatAPSP:SetScript("OnMouseDown", function()
if stat == 1 then
StatAPSP:SetScript("OnUpdate", UpdateSP)
stat = 2
else
StatAPSP:SetScript("OnUpdate", UpdateAP)
stat = 1
end
end)
\ No newline at end of file
Eui/info/guild.lua New file
0,0 → 1,101
local E, C = unpack(select(2, ...))
if C["info"].guild == 0 or C["info"].enable == false then return end
--if UnitLevel("player") == 80 then return end
 
local guild = CreateFrame ("StatusBar",nil,UIParent)
guild:SetWidth(70)
guild:SetHeight(10)
guild:SetStatusBarTexture(E.normTex)
guild:EnableMouse(true)
 
 
local tthead = {r=0.4,g=0.78,b=1}
local ttsubh = {r=0.75,g=0.9,b=1}
 
local name = guild:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
 
function guild:ShowBar()
if IsInGuild() then
GuildRoster()
local numOnline = (GetNumGuildMembers())
-- name:SetText("公会:"..numOnline)
local online, total, gmotd = 0, GetNumGuildMembers(true), GetGuildRosterMOTD()
for i = 0, total do if select(9, GetGuildRosterInfo(i)) then online = online + 1 end end
guild:SetStatusBarColor(75/255, 175/255, 75/255)
guild:SetMinMaxValues(min(0, online), total)
guild:SetValue(online)
name:SetText("公会:"..online)
else
name:SetText("Null")
guild:SetStatusBarColor(0,0,0)
end
 
 
guild:SetScript("OnEnter", function()
if not InCombatLockdown() then
if IsInGuild() then
GuildRoster()
local name, rank, level, zone, note, officernote, connected, status, class, zone_r, zone_g, zone_b, classc, levelc
local online, total, gmotd = 0, GetNumGuildMembers(true), GetGuildRosterMOTD()
for i = 0, total do if select(9, GetGuildRosterInfo(i)) then online = online + 1 end end
guild:SetStatusBarColor(75/255, 175/255, 75/255)
guild:SetMinMaxValues(min(0, online), total)
guild:SetValue(online)
 
GameTooltip:SetOwner(this, "ANCHOR_CURSOR");
GameTooltip:ClearAllPoints()
-- GameTooltip:SetPoint("BOTTOM", self, "TOP", 0, 1)
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -4, -6)
 
GameTooltip:ClearLines()
GameTooltip:AddDoubleLine(GetGuildInfo'player',format("%s: %d/%d","公会",online,total),tthead.r,tthead.g,tthead.b,tthead.r,tthead.g,tthead.b)
GameTooltip:AddLine' '
if gmotd ~= "" then GameTooltip:AddLine(format(" %s |cffaaaaaa- |cffffffff%s",GUILD_MOTD,gmotd),ttsubh.r,ttsubh.g,ttsubh.b,1) end
if online > 1 then
GameTooltip:AddLine' '
for i = 1, total do
if online <= 1 then
if online > 1 then GameTooltip:AddLine(format("+ %d 更多...", online - modules.Guild.maxguild),ttsubh.r,ttsubh.g,ttsubh.b) end
break
end
-- name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName
name, rank, _, level, _, zone, note, officernote, connected, status, class = GetGuildRosterInfo(i)
if connected and name ~= UnitName'player' then
if GetRealZoneText() == zone then zone_r, zone_g, zone_b = 0.3, 1.0, 0.3 else zone_r, zone_g, zone_b = 0.65, 0.65, 0.65 end
classc, levelc = (CUSTOM_CLASS_COLORS or E.RAID_CLASS_COLORS)[class], GetQuestDifficultyColor(level)
if IsShiftKeyDown() then
GameTooltip:AddDoubleLine(name.." |cff999999- |cffffffff"..rank,zone,classc.r,classc.g,classc.b,zone_r,zone_g,zone_b)
if note ~= "" then GameTooltip:AddLine(' "'..note..'"',ttsubh.r,ttsubh.g,ttsubh.b,1) end
if officernote ~= "" then GameTooltip:AddLine(" o: "..officernote,0.3,1,0.3,1) end
else
GameTooltip:AddDoubleLine(format("|cff%02x%02x%02x%d|r %s%s",levelc.r*255,levelc.g*255,levelc.b*255,level,name,' '..status),zone,classc.r,classc.g,classc.b,zone_r,zone_g,zone_b)
end
end
end
end
GameTooltip:Show()
end
end
end)
guild:SetScript("OnLeave", function() GameTooltip:Hide() end)
guild:SetScript("OnMouseDown", function() ToggleFriendsFrame(3) end)
end
 
-- Event Stuff -----------
--------------------------
local frame = CreateFrame("Frame",nil,UIParent)
frame:RegisterEvent("GUILD_ROSTER_SHOW")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("GUILD_ROSTER_UPDATE")
frame:RegisterEvent("PLAYER_GUILD_UPDATE")
frame:RegisterEvent("FRIENDLIST_UPDATE")
frame:RegisterEvent("CHAT_MSG_SYSTEM")
frame:SetScript("OnEvent", function()
guild:ShowBar()
end)
 
E.EuiInfo(C["info"].guild,guild)
\ No newline at end of file
Eui/info/dps.lua New file
0,0 → 1,178
local E, C = unpack(select(2, ...))
if C["info"].dps == 0 or C["info"].enable == false then return end
 
local StatDPS = CreateFrame("Frame")
StatDPS:SetAllPoints(EuiRightStatBackground)
 
function E.EuiInfoDPSShow()
if StatDPS:IsShown() then StatDPS:Hide() else StatDPS:Show() end
end
 
if C["info"].dps == 1 then
local events = {SWING_DAMAGE = true, RANGE_DAMAGE = true, SPELL_DAMAGE = true, SPELL_PERIODIC_DAMAGE = true, DAMAGE_SHIELD = true, DAMAGE_SPLIT = true, SPELL_EXTRA_ATTACKS = true}
local player_id = UnitGUID("player")
local dmg_total, last_dmg_amount = 0, 0
local cmbt_time = 0
 
local pet_id = UnitGUID("pet")
 
local Text = E.EuiSetFontn(StatDPS)
Text:SetText("0.0")
 
Text:SetPoint("CENTER", StatDPS, 0, 0)
 
StatDPS:EnableMouse(true)
StatDPS:SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end)
StatDPS:RegisterEvent("PLAYER_LOGIN")
 
StatDPS:SetScript("OnUpdate", function(self, elap)
if UnitAffectingCombat("player") then
cmbt_time = cmbt_time + elap
if cmbt_time > 0 and Text:GetText() == "0.0" then
CombatLogClearEntries()
end
end
 
Text:SetText(getDPS())
end)
 
function StatDPS:PLAYER_LOGIN()
StatDPS:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
StatDPS:RegisterEvent("PLAYER_REGEN_ENABLED")
StatDPS:RegisterEvent("PLAYER_REGEN_DISABLED")
StatDPS:RegisterEvent("UNIT_PET")
 
player_id = UnitGUID("player")
 
StatDPS:UnregisterEvent("PLAYER_LOGIN")
end
 
function StatDPS:UNIT_PET(unit)
if unit == "player" then
pet_id = UnitGUID("pet")
end
end
 
-- handler for the combat log. used http://www.wowwiki.com/API_COMBAT_LOG_EVENT for api
function StatDPS:COMBAT_LOG_EVENT_UNFILTERED(...)
-- filter for events we only care about. i.e heals
if not events[select(2, ...)] then return end
 
-- only use events from the player
local id = select(3, ...)
 
if id == player_id or id == pet_id then
if select(2, ...) == "SWING_DAMAGE" then
last_dmg_amount = select(9, ...)
else
last_dmg_amount = select(12, ...)
end
 
dmg_total = dmg_total + last_dmg_amount
end
end
 
function getDPS()
if (dmg_total == 0) then
return ("0.0 ")
else
return string.format("%.1f ", (dmg_total or 0) / (cmbt_time or 1))
end
end
 
 
function StatDPS:PLAYER_REGEN_ENABLED()
Text:SetText(getDPS())
end
 
function StatDPS:PLAYER_REGEN_DISABLED()
cmbt_time = 0
dmg_total = 0
last_dmg_amount = 0
end
 
StatDPS:SetScript("OnMouseDown", function (self, button, down)
cmbt_time = 0
dmg_total = 0
last_dmg_amount = 0
end)
end
 
--------------------------------------------------------------------
-- SUPPORT FOR HPS Feed...
--------------------------------------------------------------------
 
if C["info"].dps == 2 then
local events = {SPELL_HEAL = true, SPELL_PERIODIC_HEAL = true}
local player_id = UnitGUID("player")
local actual_heals_total, cmbt_time = 0
 
local hText = E.EuiSetFontn(StatDPS)
hText:SetText("0.0")
hText:SetPoint("CENTER", StatDPS, 0, 0)
 
StatDPS:EnableMouse(true)
StatDPS:SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end)
StatDPS:RegisterEvent("PLAYER_LOGIN")
 
StatDPS:SetScript("OnUpdate", function(self, elap)
if UnitAffectingCombat("player") then
StatDPS:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
cmbt_time = cmbt_time + elap
if cmbt_time > 0 and hText:GetText() == "0.0" then
CombatLogClearEntries()
end
else
StatDPS:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
hText:SetText(get_hps())
end)
 
function StatDPS:PLAYER_LOGIN()
StatDPS:RegisterEvent("PLAYER_REGEN_ENABLED")
StatDPS:RegisterEvent("PLAYER_REGEN_DISABLED")
 
player_id = UnitGUID("player")
 
StatDPS:UnregisterEvent("PLAYER_LOGIN")
end
 
-- handler for the combat log. used http://www.wowwiki.com/API_COMBAT_LOG_EVENT for api
function StatDPS:COMBAT_LOG_EVENT_UNFILTERED(...)
-- filter for events we only care about. i.e heals
if not events[select(2, ...)] then return end
if event == "PLAYER_REGEN_DISABLED" then return end
 
-- only use events from the player
local id = select(3, ...)
if id == player_id then
amount_healed = select(12, ...)
amount_over_healed = select(13, ...)
-- add to the total the healed amount subtracting the overhealed amount
actual_heals_total = actual_heals_total + math.max(0, amount_healed - amount_over_healed)
end
end
 
function StatDPS:PLAYER_REGEN_ENABLED()
hText:SetText(get_hps)
end
 
function StatDPS:PLAYER_REGEN_DISABLED()
cmbt_time = 0
actual_heals_total = 0
end
 
StatDPS:SetScript("OnMouseDown", function (self, button, down)
cmbt_time = 0
actual_heals_total = 0
end)
 
function get_hps()
if (actual_heals_total == 0) then
return ("0.0 ")
else
return string.format("%.1f ", (actual_heals_total or 0) / (cmbt_time or 1))
end
end
 
end
\ No newline at end of file
Eui/info/friend.lua New file
0,0 → 1,81
local E, C = unpack(select(2, ...))
if C["info"].friend == 0 or C["info"].enable == false then return end
--if UnitLevel("player") == 80 then return end
 
local friend = CreateFrame ("StatusBar",nil,UIParent)
friend:SetWidth(70)
friend:SetHeight(10)
friend:SetStatusBarTexture(E.normTex)
friend:EnableMouse(true)
 
local tthead = {r=0.4,g=0.78,b=1}
local ttsubh = {r=0.75,g=0.9,b=1}
 
local name = friend:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
 
function friend:ShowBar()
local online, total = 0, GetNumFriends()
for i = 0, total do
if select(5, GetFriendInfo(i)) then
online = online + 1
end
end
name:SetText("好友"..":"..online)
friend:SetStatusBarColor(170/255, 70/255, 70/255)
friend:SetMinMaxValues(min(0, online), total)
friend:SetValue(online)
 
friend:SetScript("OnEnter", function()
if not InCombatLockdown() then
ShowFriends()
self.hovered = true
local online, total = 0, GetNumFriends()
local name, level, class, zone, connected, status, note, classc, levelc, zone_r, zone_g, zone_b, grouped
for i = 0, total do if select(5, GetFriendInfo(i)) then online = online + 1 end end
friend:SetStatusBarColor(170/255, 70/255, 70/255)
friend:SetMinMaxValues(min(0, online), total)
friend:SetValue(online)
if online > 0 then
GameTooltip:SetOwner(this, "ANCHOR_CURSOR");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -4, -6)
GameTooltip:ClearLines()
GameTooltip:AddDoubleLine("好友列表:", format("在线: " .. "%s/%s",online,total),tthead.r,tthead.g,tthead.b,tthead.r,tthead.g,tthead.b)
GameTooltip:AddLine' '
-- name, level, class, area, connected, status, note
for i = 1, total do
name, level, class, zone, connected, status, note = GetFriendInfo(i)
if not connected then break end
if GetRealZoneText() == zone then zone_r, zone_g, zone_b = 0.3, 1.0, 0.3 else zone_r, zone_g, zone_b = 0.65, 0.65, 0.65 end
for k,v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end
if GetLocale() ~= "enUS" then -- feminine class localization (unsure if it's really needed)
for k,v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if class == v then class = k end end
end
classc, levelc = (CUSTOM_CLASS_COLORS or E.RAID_CLASS_COLORS)[class], GetQuestDifficultyColor(level)
if UnitInParty(name) or UnitInRaid(name) then grouped = "|cffaaaaaa*|r" else grouped = "" end
GameTooltip:AddDoubleLine(format("|cff%02x%02x%02x%d|r %s%s%s",levelc.r*255,levelc.g*255,levelc.b*255,level,name,grouped," "..status),zone,classc.r,classc.g,classc.b,zone_r,zone_g,zone_b)
if self.altdown and note then GameTooltip:AddLine(" "..note,ttsubh.r,ttsubh.g,ttsubh.b,1) end
end
GameTooltip:Show()
else GameTooltip:Hide() end
end
end)
friend:SetScript("OnMouseDown", function() ToggleFriendsFrame(1) end)
friend:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
 
-- Event Stuff -----------
--------------------------
local frame = CreateFrame("Frame",nil,UIParent)
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("FRIENDLIST_UPDATE")
frame:RegisterEvent("CHAT_MSG_SYSTEM")
frame:SetScript("OnEvent", function()
friend:ShowBar()
end)
 
E.EuiInfo(C["info"].friend,friend)
\ No newline at end of file
Eui/info/xp.lua New file
0,0 → 1,150
local E, C = unpack(select(2, ...))
if C["info"].xp == 0 or C["info"].enable == false then return end
--if UnitLevel("player") == 80 then return end
 
local xp = CreateFrame ("StatusBar",nil,UIParent)
xp:SetWidth(70)
xp:SetHeight(10)
xp:SetStatusBarTexture(E.normTex)
xp:EnableMouse(true)
 
local name = xp:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
 
local FactionInfo = {
[1] = {{ 170/255, 70/255, 70/255 }, "仇恨", "FFaa4646"},
[2] = {{ 170/255, 70/255, 70/255 }, "敌对", "FFaa4646"},
[3] = {{ 170/255, 70/255, 70/255 }, "冷漠", "FFaa4646"},
[4] = {{ 200/255, 180/255, 100/255 }, "中立", "FFc8b464"},
[5] = {{ 75/255, 175/255, 75/255 }, "友善", "FF4baf4b"},
[6] = {{ 75/255, 175/255, 75/255 }, "尊敬", "FF4baf4b"},
[7] = {{ 75/255, 175/255, 75/255 }, "崇敬", "FF4baf4b"},
[8] = {{ 155/255, 255/255, 155/255 }, "崇拜","FF9bff9b"},
}
 
local ShortValue = function(value)
if value >= 1e3 or value <= -1e3 then
return ("%.0fk"):format(value / 1e3):gsub("%.?+([km])$", "%1")
else
return value
end
end
 
local function CommaValue(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
 
local function colorize(r)
return FactionInfo[r][3]
end
 
 
function xp.ShowBar()
if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
local XP, maxXP = UnitXP("player"), UnitXPMax("player")
local restXP = GetXPExhaustion()
local percXP = floor(XP/maxXP*100)
local str
--Setup Text
if restXP then
str = format("%s%%|cffb3e1ff+%d%%|r", percXP, restXP/maxXP*100)
else
str = format("%s%%", percXP)
end
name:SetText(str)
--Setup Bar
 
xp:SetStatusBarColor(.7,.7,.9,.2)
xp:SetMinMaxValues(min(0, XP), maxXP)
xp:SetValue(XP)
 
--Setup Exp Tooltip
xp:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR")
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", xp, "BOTTOMLEFT", -4, -6)
GameTooltip:ClearLines()
GameTooltip:AddLine("经验:")
GameTooltip:AddLine(string.format('当前: %s/%s (%d%%)', CommaValue(XP), CommaValue(maxXP), (XP/maxXP)*100))
GameTooltip:AddLine(string.format('剩余: %s', CommaValue(maxXP-XP)))
if restXP then
GameTooltip:AddLine(string.format('|cffb3e1ff休息: %s (%d%%)', CommaValue(restXP), restXP/maxXP*100))
end
if GetWatchedFactionInfo() then
local name, rank, min, max, value = GetWatchedFactionInfo()
GameTooltip:AddLine(" ")
GameTooltip:AddLine(string.format('声望: %s', name))
GameTooltip:AddLine(string.format('等级: |c'..colorize(rank)..'%s|r', FactionInfo[rank][2]))
GameTooltip:AddLine(string.format('数值: %s/%s (%d%%)', CommaValue(value-min), CommaValue(max-min), (value-min)/(max-min)*100))
GameTooltip:AddLine(string.format('剩余: %s', CommaValue(max-value)))
end
GameTooltip:Show()
end)
xp:SetScript("OnLeave", function() GameTooltip:Hide() end)
 
--Send experience info in chat
xp:SetScript("OnMouseDown", function()
if GetNumRaidMembers() > 0 then
SendChatMessage("我当前经验为: "..CommaValue(XP).."/"..CommaValue(maxXP).." ("..floor((XP/maxXP)*100).."%) .","RAID")
elseif GetNumPartyMembers() > 0 then
SendChatMessage("我当前经验为: "..CommaValue(XP).."/"..CommaValue(maxXP).." ("..floor((XP/maxXP)*100).."%) .","PARTY")
else
SendChatMessage("我当前经验为: "..CommaValue(XP).."/"..CommaValue(maxXP).." ("..floor((XP/maxXP)*100).."%) .","SAY")
end
end)
else
if GetWatchedFactionInfo() then
local name2, rank, min, max, value = GetWatchedFactionInfo()
local str
--Setup Text
str = format("%d (%d%%)", value-min, (value-min)/(max-min)*100)
name:SetText(str)
--Setup Bar
xp:SetStatusBarColor(unpack(FactionInfo[rank][1]))
xp:SetMinMaxValues(min, max)
xp:SetValue(value)
--Setup Exp Tooltip
xp:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR")
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", xp, "BOTTOMLEFT", -4, -6)
GameTooltip:ClearLines()
GameTooltip:AddLine(" ")
GameTooltip:AddLine(string.format('声望: %s', name2))
GameTooltip:AddLine(string.format('等级: |c'..colorize(rank)..'%s|r', FactionInfo[rank][2]))
GameTooltip:AddLine(string.format('数值: %s/%s (%d%%)', CommaValue(value-min), CommaValue(max-min), (value-min)/(max-min)*100))
GameTooltip:AddLine(string.format('剩余: %s', CommaValue(max-value)))
GameTooltip:Show()
end)
xp:SetScript("OnLeave", function() GameTooltip:Hide() end)
else
name:SetText("Null")
xp:SetStatusBarColor(0,0,0)
--xp:SetStatusBarColor(.7,.7,.9,.2)
end
 
end
end
 
-- Event Stuff -----------
--------------------------
local frame = CreateFrame("Frame",nil,UIParent)
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("UPDATE_FACTION");
frame:RegisterEvent("PLAYER_XP_UPDATE");
frame:RegisterEvent("UPDATE_EXHAUSTION");
frame:SetScript("OnEvent", function()
xp.ShowBar()
end)
 
E.EuiInfo(C["info"].xp,xp)
\ No newline at end of file
Eui/info/durability.lua New file
0,0 → 1,464
local E, C = unpack(select(2, ...))
if C["info"].durability == 0 or C["info"].enable == false then return end
 
--状态报告
local MyData = {};
function StatReport_GetSpellText()
local text = "";
text = text..MyData.SSP.."法伤";
text = text..", ";
text = text..MyData.SHIT.."命中";
text = text..", ";
text = text..format("%.1f%%", MyData.SCRIT).."爆击";
text = text..", ";
text = text..MyData.SHASTE.."急速";
text = text..", ";
text = text..MyData.MP.."法力";
return text;
end
 
function StatReport_GetHealText()
local text = "";
text = text..MyData.SHP.."治疗";
text = text..", ";
text = text..format("%.1f%%", MyData.SCRIT).."爆击";
text = text..", ";
text = text..MyData.SHASTE.."急速";
text = text..", ";
text = text..MyData.MP.."法力";
text = text..", ";
text = text..MyData.SMR.."/".."5秒法力回复";
return text;
end
 
function StatReport_GetSpellAndHealText()
local text = "";
text = text..MyData.SSP.."法伤";
text = text..", ";
text = text..MyData.SHP.."治疗";
text = text..", ";
text = text..MyData.SHIT.."命中";
text = text..", ";
text = text..format("%.1f%%", MyData.SCRIT).."爆击";
text = text..", ";
text = text..MyData.SHASTE.."急速";
text = text..", ";
text = text..MyData.MP.."法力";
text = text..", ";
text = text..MyData.SMR.."/".."5秒法力回复";
return text;
end
 
function StatReport_GetMeleeText()
local text = "";
text = text..MyData.MAP.."强度";
text = text..", ";
text = text..MyData.MHIT.."命中";
text = text..", ";
text = text..format("%.1f%%", MyData.MCRIT).."爆击";
text = text..", ";
text = text..MyData.MEXPER.."精准";
return text;
end
 
function StatReport_GetRangedText()
local text = "";
text = text..MyData.RAP.."强度";
text = text..", ";
text = text..MyData.RHIT.."命中";
text = text..", ";
text = text..format("%.1f%%", MyData.RCRIT).."爆击";
return text;
end
 
function StatReport_GetTankText()
local text = "";
text = text..MyData.HP.."生命";
text = text..", ";
text = text..MyData.DEF.."防御";
text = text..", ";
text = text..format("%.1f%%", MyData.DODGE).."躲闪";
text = text..", ";
text = text..format("%.1f%%", MyData.PARRY).."招架";
text = text..", ";
text = text..format("%.1f%%", MyData.BLOCK).."格挡";
text = text..", ";
text = text..MyData.ARMOR.."护甲";
return text;
end
 
function StatReport_TalentData()
local name1,_,pointsSpent1 = GetTalentTabInfo(1);
local name2,_,pointsSpent2 = GetTalentTabInfo(2);
local name3,_,pointsSpent3 = GetTalentTabInfo(3);
local nameKey = "无";
local TalentStat = "";
if not(pointsSpent1 == 0 and pointsSpent2 == 0 and pointsSpent3 == 0) then
local tmpname, temppointsSpent;
tmpname = ((pointsSpent1 > pointsSpent2) and name1) or name2;
temppointsSpent = ((pointsSpent1 > pointsSpent2) and pointsSpent1) or pointsSpent2;
tmpname = ((temppointsSpent > pointsSpent3) and tmpname) or name3;
nameKey = tmpname;
end
if nameKey ~= "无" then
TalentStat = ("(%s/%s/%s)"):format(pointsSpent1, pointsSpent2, pointsSpent3);
end
return nameKey, TalentStat;
end
 
function StatReport_UnitAttackPower()
local base, posBuff, negBuff = UnitAttackPower("player");
return floor(base + posBuff + negBuff);
end
 
function StatReport_UnitRangedAttackPower()
local base, posBuff, negBuff = UnitRangedAttackPower("player");
return floor(base + posBuff + negBuff);
end
 
function StatReport_GetSpellBonusDamage()
local SSP = GetSpellBonusDamage(2);
for i=3, 7 do
SSP = max(SSP, GetSpellBonusDamage(i));
end
return floor(SSP);
end
 
function StatReport_GetSpellCritChance()
local SCRIT = GetSpellCritChance(2);
for i=3, 7 do
SCRIT = max(SCRIT, GetSpellCritChance(i));
end
return SCRIT;
end
 
function StatReport_UnitDefense()
local baseDEF, posDEF = UnitDefense("player");
return floor(baseDEF + posDEF);
end
 
function StatReport_UnitItem_ilvl_AVG(unit)
local _, uc = UnitClass(unit);
local ul = UnitLevel(unit);
--品质折算系数
local qualitypara = {
[0] = 0.0, --0:灰色
[1] = 0.1, --1:白色
[2] = 0.6, --2:绿色
[3] = 0.8, --3:蓝色
[4] = 1.0, --4:紫色
[5] = 1.05, --5:橙色
[6] = 1.15, --6:红色
[7] = 1.0, --7:金色
};
--装备级别加权系数默认值:法系
local slotpara = {
[1] = 3.5, --1:头
[2] = 2, --2:颈
[3] = 2.5, --3:肩
[4] = 0, --4:衬衣
[5] = 3.7, --5:胸
[6] = 2.3, --6:腰带
[7] = 3.5, --7:腿
[8] = 2.4, --8:脚
[9] = 1.6, --9:手腕
[10] = 2.5, --10:手套
[11] = 2.1, --11:手指1
[12] = 2.1, --12:手指2
[13] = 2, --13:饰品1
[14] = 2, --14:饰品2
[15] = 1.8, --15:背
[16] = 6, --16:主手
[17] = 2, --17:副手
[18] = 1, --18:远程武器
[19] = 0, --19:战袍
};
if uc == "HUNTER" then
slotpara[16] = 3;
slotpara[17] = 1;
slotpara[18] = 5;
elseif uc == "WARRIOR" then
if MyData.TKEY == GetTalentTabInfo(3) then
slotpara[16] = 3.5;
slotpara[17] = 4.5;
slotpara[18] = 1;
else
slotpara[16] = 5;
slotpara[17] = 3;
slotpara[18] = 1;
end
elseif uc == "ROGUE" or uc == "DEATHKNIGHT" then
slotpara[16] = 5;
slotpara[17] = 3;
slotpara[18] = 1;
elseif uc == "SHAMAN" then
if MyData.TKEY == GetTalentTabInfo(2) then
slotpara[16] = 5;
slotpara[17] = 3;
slotpara[18] = 1;
end
elseif uc == "PALADIN" then
if MyData.TKEY == GetTalentTabInfo(2) then
slotpara[16] = 3.5;
slotpara[17] = 4.5;
slotpara[18] = 1;
end
end
local quality, iLevel;
local itemcount = 0;
local levelcount = 0;
local paracount = 0;
for i=1, 18 ,1 do
if i~=4 then
local link = GetInventoryItemLink(unit, i);
if (link) then
_, _, quality, iLevel = GetItemInfo(link);
if(quality >=1 and quality <=7) then
if (quality == 7) and (iLevel < ul*2) then
iLevel = (ul*ul*ul)/2400;
end
itemcount = itemcount + 1;
levelcount = levelcount + iLevel*qualitypara[quality]*slotpara[i];
paracount = paracount + slotpara[i];
end
end
end
end
return floor((levelcount/paracount) + 0.5);
end
 
function StatReport_UpdateMyData()
MyData.Name = UnitName("player"); --名称
MyData.LV = UnitLevel("player"); --等级
MyData.CLASS, MyData.CLASS_EN = UnitClass("player"); --职业
MyData.HP = UnitHealthMax("player"); --生命值
MyData.MP = UnitManaMax("player"); --法力值
MyData.TKEY, MyData.TDATA = StatReport_TalentData(); --天赋
MyData.ILVL = StatReport_UnitItem_ilvl_AVG("player"); --综合装备等级
--基础属性
MyData.STR = UnitStat("player", 1); --力量
MyData.AGI = UnitStat("player", 2); --敏捷
MyData.STA = UnitStat("player", 3); --耐力
MyData.INT = UnitStat("player", 4); --智力
MyData.SPI = UnitStat("player", 5); --精神
--近战
MyData.MAP = StatReport_UnitAttackPower(); --强度
MyData.MHIT = GetCombatRating(6); --命中等级
MyData.MCRIT = GetCritChance(); --爆击率%
MyData.MEXPER = GetExpertise(); --精准
--远程
MyData.RAP = StatReport_UnitRangedAttackPower(); --强度
MyData.RHIT = GetCombatRating(7); --命中等级
MyData.RCRIT = GetRangedCritChance(); --爆击率%
--法术
MyData.SSP = StatReport_GetSpellBonusDamage(); --伤害加成
MyData.SHP = GetSpellBonusHealing(); --治疗加成
MyData.SHIT = GetCombatRating(8); --命中等级
MyData.SCRIT = StatReport_GetSpellCritChance(); --爆击率
MyData.SHASTE = GetCombatRating(20); --急速等级
MyData.SMR = floor(GetManaRegen()*5); --法力回复(每5秒)
--防御
_,_,MyData.ARMOR = UnitArmor("player"); --护甲
MyData.DEF = StatReport_UnitDefense(); --防御
MyData.DODGE = GetDodgeChance(); --躲闪%
MyData.PARRY = GetParryChance(); --招架%
MyData.BLOCK = GetBlockChance(); --格挡%
MyData.CRDEF = GetCombatRating(15); --韧性
end
 
 
 
local durability = CreateFrame ("StatusBar",nil,UIParent)
durability:SetWidth(70)
durability:SetHeight(10)
durability:SetStatusBarTexture(E.normTex)
durability:SetStatusBarColor(.7,.7,.9,.8)
durability:SetMinMaxValues(0,100)
durability:SetValue(0)
durability:EnableMouse(true)
 
local name = durability:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
 
local Slots = {
[1] = {1, "头", 1000},
[2] = {3, "肩", 1000},
[3] = {5, "胸", 1000},
[4] = {6, "腰", 1000},
[5] = {9, "腕", 1000},
[6] = {10, "手", 1000},
[7] = {7, "腿", 1000},
[8] = {8, "脚", 1000},
[9] = {16, "主手", 1000},
[10] = {17, "副手", 1000},
[11] = {18, "远程武器", 1000}
}
 
local Total = 0
local current, max
 
local function OnEvent(self)
 
local r,g,b
 
for i = 1, 11 do
if GetInventoryItemLink("player", Slots[i][1]) ~= nil then
current, max = GetInventoryItemDurability(Slots[i][1])
if current then
Slots[i][3] = current/max
Total = Total + 1
end
end
end
 
table.sort(Slots, function(a, b) return a[3] < b[3] end)
 
if Total > 0 then
local dura = floor(Slots[1][3]*100)
durability:SetValue(dura)
name:SetText(floor(Slots[1][3]*100).."%|cffffffff".."D".."|r")
else
name:SetText("100%|cffffffff".."D".."|r")
end
 
self:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -4, -6)
GameTooltip:ClearLines()
GameTooltip:AddDoubleLine("耐久度",floor(Slots[1][3]*100).." %",1,1,1,r,g,b)
GameTooltip:AddDoubleLine(" ")
for i = 1, 11 do
if Slots[i][3] ~= 1000 then
green = Slots[i][3]*2
red = 1 - green
GameTooltip:AddDoubleLine(Slots[i][2], floor(Slots[i][3]*100).."%",1 ,1 , 1, red + 1, green, 0)
end
end
GameTooltip:AddDoubleLine(" ")
GameTooltip:AddDoubleLine("--==右击发送角色数据到聊天框==--","",0.92, 0.94, 0.15,1,1,1)
GameTooltip:Show()
end)
self:SetScript("OnLeave", function() GameTooltip:Hide() end)
Total = 0
end
 
durability:RegisterEvent("UPDATE_INVENTORY_DURABILITY")
durability:RegisterEvent("MERCHANT_SHOW")
durability:RegisterEvent("PLAYER_ENTERING_WORLD")
durability:SetScript("OnEvent", OnEvent)
durability:SetScript("OnMouseDown", function(self,arg1)
if arg1=='LeftButton' then
ToggleCharacter("PaperDollFrame")
else
--发送状态报告
local msg = ""
StatReport_UpdateMyData()
msg = msg..MyData.CLASS;
msg = msg..", ";
msg = msg..MyData.TKEY.."天赋"..MyData.TDATA;
msg = msg..", ";
msg = msg.."装备等级"..MyData.ILVL;
 
msg = msg..", ";
if MyData.CLASS_EN == "MAGE" or MyData.CLASS_EN == "WARLOCK" then
msg = msg..StatReport_GetSpellText();
end
if MyData.CLASS_EN == "ROGUE" then
msg = msg..StatReport_GetMeleeText();
end
if MyData.CLASS_EN == "HUNTER" then
msg = msg..StatReport_GetRangedText();
end
if MyData.CLASS_EN == "DRUID" then
if MyData.TKEY == GetTalentTabInfo(1) then
msg = msg..StatReport_GetSpellText();
elseif MyData.TKEY == GetTalentTabInfo(2) then
if MyData.DODGE > 30 then
msg = msg..StatReport_GetTankText();
else
msg = msg..StatReport_GetMeleeText();
end
elseif MyData.TKEY == GetTalentTabInfo(3) then
msg = msg..StatReport_GetHealText();
else
msg = msg..StatReport_GetMeleeText();
end
end
if MyData.CLASS_EN == "SHAMAN" then
if MyData.TKEY == GetTalentTabInfo(1) then
msg = msg..StatReport_GetSpellText();
elseif MyData.TKEY == GetTalentTabInfo(2) then
msg = msg..StatReport_GetMeleeText();
elseif MyData.TKEY == GetTalentTabInfo(3) then
msg = msg..StatReport_GetHealText();
else
msg = msg..StatReport_GetMeleeText();
end
end
if MyData.CLASS_EN == "PALADIN" then
if MyData.TKEY == GetTalentTabInfo(1) then
msg = msg..StatReport_GetHealText();
elseif MyData.TKEY == GetTalentTabInfo(2) then
msg = msg..StatReport_GetTankText();
elseif MyData.TKEY == GetTalentTabInfo(3) then
msg = msg..StatReport_GetMeleeText();
else
msg = msg..StatReport_GetMeleeText();
end
end
if MyData.CLASS_EN == "PRIEST" then
if MyData.TKEY == GetTalentTabInfo(1) then
msg = msg..StatReport_GetSpellAndHealText();
elseif MyData.TKEY == GetTalentTabInfo(2) then
msg = msg..StatReport_GetHealText();
elseif MyData.TKEY == GetTalentTabInfo(3) then
msg = msg..StatReport_GetSpellText();
else
msg = msg..StatReport_GetSpellText();
end
end
if MyData.CLASS_EN == "WARRIOR" then
if MyData.TKEY == GetTalentTabInfo(1) then
msg = msg..StatReport_GetMeleeText();
elseif MyData.TKEY == GetTalentTabInfo(2) then
msg = msg..StatReport_GetMeleeText();
elseif MyData.TKEY == GetTalentTabInfo(3) then
msg = msg..StatReport_GetTankText();
else
msg = msg..StatReport_GetMeleeText();
end
end
if MyData.CLASS_EN == "DEATHKNIGHT" then
if (MyData.DODGE + MyData.PARRY) > 35 then
msg = msg..StatReport_GetTankText();
else
msg = msg..StatReport_GetMeleeText();
end
end
 
if MyData.CRDEF > (200*(MyData.LV/70)) then
msg = msg..", ";
msg = msg..MyData.CRDEF.."韧性";
end
 
if IsAddOnLoaded("GearScoreLite") then
msg = msg..", ";
msg = msg.."GS:"..GearScore_GetScore(UnitName("player"), "player");
end
 
if ChatFrame1EditBox:IsShown() then
ChatFrame1EditBox:Insert(msg);
else
local ExistMSG = ChatFrame1EditBox:GetText() or "";
ChatFrame1EditBox:SetText(ExistMSG..msg);
ChatEdit_SendText(ChatFrame1EditBox);
ChatFrame1EditBox:Hide();
end
end
end)
 
E.EuiInfo(C["info"].durability,durability)
\ No newline at end of file
Eui/info/memory.lua New file
0,0 → 1,101
local E, C = unpack(select(2, ...))
if C["info"].memory == 0 or C["info"].enable == false then return end
 
local memory = CreateFrame ("StatusBar",nil,UIParent)
memory:SetWidth(70)
memory:SetHeight(10)
memory:SetStatusBarTexture(E.normTex)
memory:SetStatusBarColor(.7,.7,.9,.2)
memory:SetMinMaxValues(0,1)
memory:SetValue(1)
memory:EnableMouse(true)
 
local name = memory:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
 
local function formatMem(memory, color)
if color then
statColor = { "", "" }
else
statColor = { "", "" }
end
 
local mult = 10^1
if memory > 999 then
local mem = floor((memory/1024) * mult + 0.5) / mult
if mem % 1 == 0 then
return mem..string.format(".0%smb%s", unpack(statColor))
else
return mem..string.format("%smb%s", unpack(statColor))
end
else
local mem = floor(memory * mult + 0.5) / mult
if mem % 1 == 0 then
return mem..string.format(".0%skb%s", unpack(statColor))
else
return mem..string.format("%skb%s", unpack(statColor))
end
end
 
end
 
local Total, Mem, MEMORY_TEXT, LATENCY_TEXT, Memory
local function RefreshMem(self)
Memory = {}
UpdateAddOnMemoryUsage()
Total = 0
for i = 1, GetNumAddOns() do
Mem = GetAddOnMemoryUsage(i)
Memory[i] = { select(2, GetAddOnInfo(i)), Mem, IsAddOnLoaded(i) }
Total = Total + Mem
end
 
MEMORY_TEXT = formatMem(Total, true)
table.sort(Memory, function(a, b)
if a and b then
return a[2] > b[2]
end
end)
 
-- Setup Memory tooltip
self:SetScript("OnEnter", function()
--if not InCombatLockdown() then
GameTooltip:SetOwner(this, "ANCHOR_CURSOR");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -4, -6)
GameTooltip:ClearLines()
for i = 1, #Memory do
if Memory[i][3] then
local red = Memory[i][2]/Total*2
local green = 1 - red
GameTooltip:AddDoubleLine(Memory[i][1], formatMem(Memory[i][2], false), 1, 1, 1, red, green+1, 0)
end
end
GameTooltip:Show()
--end
end)
self:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
 
local int, int2 = 5, 1
local function Update(self, t)
int = int - t
int2 = int2 - t
if int < 0 then
RefreshMem(self)
int = 5
end
if int2 < 0 then
name:SetText(MEMORY_TEXT)
int2 = 1
end
end
 
memory:SetScript("OnMouseDown", function() collectgarbage("collect") Update(memory, 10) end)
memory:SetScript("OnUpdate", Update)
Update(memory, 10)
 
E.EuiInfo(C["info"].memory,memory)
\ No newline at end of file
Eui/info/bag.lua New file
0,0 → 1,133
local E, C = unpack(select(2, ...))
if C["info"].bag == 0 or C["info"].enable == false then return end
 
local bag = CreateFrame ("StatusBar",nil,UIParent)
bag:SetWidth(70)
bag:SetHeight(10)
bag:SetStatusBarTexture(E.normTex)
bag:SetStatusBarColor(.7,.7,.9,.2)
bag:EnableMouse(true)
 
local name = bag:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
 
local function formatMoney(money)
local gold = floor(math.abs(money) / 10000)
local silver = mod(floor(math.abs(money) / 100), 100)
local copper = mod(floor(math.abs(money)), 100)
 
if gold ~= 0 then
return format("|cffffd700%s|r.|cffc7c7cf%s|r", gold, silver, copper)
elseif silver ~= 0 then
return format("|cffc7c7cf%s|r.|cffeda55f%s|r", silver, copper)
else
return format("|cffeda55f%s|r", copper)
end
end
 
local function FormatTooltipMoney(money)
local gold, silver, copper = abs(money / 10000), abs(mod(money / 100, 100)), abs(mod(money, 100))
local cash = ""
cash = format("%d|cffffd700g|r %d|cffc7c7cfs|r %d|cffeda55fc|r", gold, silver, copper)
return cash
end
 
local free,total,used = 0, 0, 0
local profit,spent,oldmoney = 0, 0 ,0
 
local function OnEvent(self, event)
free,total,used = 0, 0, 0
for i = 0, NUM_BAG_SLOTS do
free, total = free + GetContainerNumFreeSlots(i), total + GetContainerNumSlots(i)
end
used = total - free
self:SetMinMaxValues(0,total)
self:SetValue(used)
 
local myPlayerRealm = GetCVar("realmName");
local myPlayerName = UnitName("player");
if (tgoldDB == nil) then tgoldDB = {}; end
if (tgoldDB[myPlayerRealm]==nil) then tgoldDB[myPlayerRealm]={}; end
tgoldDB[myPlayerRealm][myPlayerName] = GetMoney();
local totalGold = 0
local thisRealmList = tgoldDB[myPlayerRealm];
for k,v in pairs(thisRealmList) do
totalGold=totalGold+v;
end
 
if event == "ADDON_LOADED" then
oldmoney = tgoldDB[myPlayerRealm][myPlayerName]
end
 
local newmoney = GetMoney()
local change = newmoney-oldmoney -- Positive if we gain money
 
if oldmoney>newmoney then -- Lost Money
spent = spent - change
else -- Gained Moeny
profit = profit + change
end
 
name:SetText(formatMoney(newmoney))
 
self:SetScript("OnEnter", function()
if not InCombatLockdown() then
self.hovered = true
GameTooltip:SetOwner(this, "ANCHOR_CURSOR");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOP", this, "BOTTOM", -4, -26)
GameTooltip:ClearLines()
GameTooltip:AddDoubleLine("包裹: ",free.."/"..total,1,1,1,1,1,1)
GameTooltip:AddLine("会话: ")
GameTooltip:AddDoubleLine("挣取:", FormatTooltipMoney(profit), 1, 1, 1, 1, 1, 1)
GameTooltip:AddDoubleLine("花费:", FormatTooltipMoney(spent), 1, 1, 1, 1, 1, 1)
if profit < spent then
GameTooltip:AddDoubleLine("赤字:", FormatTooltipMoney(profit-spent), 1, 0, 0, 1, 1, 1)
elseif (profit-spent)>0 then
GameTooltip:AddDoubleLine("利润:", FormatTooltipMoney(profit-spent), 0, 1, 0, 1, 1, 1)
end
GameTooltip:AddLine' '
GameTooltip:AddLine("角色: ")
for k,v in pairs(thisRealmList) do
GameTooltip:AddDoubleLine(k, FormatTooltipMoney(v), 1, 1, 1, 1, 1, 1)
end
GameTooltip:AddLine' '
GameTooltip:AddLine("服务器: ")
GameTooltip:AddDoubleLine("合计: ", FormatTooltipMoney(totalGold), 1, 1, 1, 1, 1, 1)
 
local numWatched = GetNumWatchedTokens()
if numWatched > 0 then
GameTooltip:AddLine(" ")
GameTooltip:AddLine("货币:")
 
for i = 1, numWatched do
local name, count, extraCurrencyType, icon, itemID = GetBackpackCurrencyInfo(i)
local r, g, b, hex = GetItemQualityColor(select(3, GetItemInfo(itemID)))
 
GameTooltip:AddDoubleLine(name, count, r, g, b, 1, 1, 1)
end
end
GameTooltip:Show()
end
end)
self:SetScript("OnLeave", function() GameTooltip:Hide() end)
 
oldmoney = newmoney
end
 
bag:RegisterEvent("PLAYER_LOGIN")
bag:RegisterEvent("BAG_UPDATE")
bag:RegisterEvent("PLAYER_MONEY")
bag:RegisterEvent('ADDON_LOADED')
bag:RegisterEvent("SEND_MAIL_MONEY_CHANGED")
bag:RegisterEvent("SEND_MAIL_COD_CHANGED")
bag:RegisterEvent("PLAYER_TRADE_MONEY")
bag:RegisterEvent("TRADE_MONEY_CHANGED")
bag:RegisterEvent("PLAYER_ENTERING_WORLD")
bag:SetScript("OnEvent", OnEvent)
bag:SetScript("OnMouseDown", function() OpenAllBags() end)
 
E.EuiInfo(C["info"].bag,bag)
\ No newline at end of file
Eui/info/info.xml New file
0,0 → 1,13
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="wowtime.lua"/>
<Script file="ping.lua"/>
<Script file="bag.lua"/>
<Script file="durability.lua"/>
<Script file="memory.lua"/>
<Script file="xp.lua"/>
<Script file="setting.lua"/>
<Script file="guild.lua"/>
<Script file="friend.lua"/>
<Script file="apsp.lua"/>
<Script file="dps.lua"/>
</Ui>
\ No newline at end of file
Eui/info/wowtime.lua New file
0,0 → 1,132
local E, C = unpack(select(2, ...))
if C["info"].wowtime == 0 or C["info"].enable == false then return end
 
local clocks = CreateFrame ("StatusBar",nil,UIParent)
clocks:SetWidth(70)
clocks:SetHeight(10)
clocks:SetStatusBarTexture(E.normTex)
clocks:SetStatusBarColor(.7,.7,.9,.2)
clocks:SetMinMaxValues(0,9000)
clocks:EnableMouse(true)
 
local atime = clocks:CreateFontString (nil,"OVERLAY")
atime:SetFont(E.fontn,12,"OUTLINE")
atime:SetJustifyH("LEFT")
atime:SetShadowOffset(2,-2)
atime:SetPoint("BOTTOMLEFT",0,-4)
 
local dateval = clocks:CreateFontString (nil,"OVERLAY")
dateval:SetFont(E.fontn,10,"OUTLINE")
dateval:SetJustifyH("RIGHT")
dateval:SetShadowOffset(2,-2)
dateval:SetPoint("BOTTOMRIGHT",1.3,-4)
 
local mess_f = CreateFrame("Frame",nil,UIParent)
mess_f:SetScript("OnUpdate", FadingFrame_OnUpdate)
mess_f:Hide()
mess_f.fadeInTime = .2
mess_f.holdTime = 1
mess_f.fadeOutTime = .3
mess_f:SetFrameStrata("TOOLTIP")
mess_f:SetFrameLevel(30)
 
local text_f = mess_f:CreateFontString(nil,"OVERLAY")
text_f:SetFont(E.fontn,18)
text_f:SetShadowOffset(1,-1)
text_f:SetPoint("TOPLEFT",clocks,"BOTTOMLEFT",.3,-8)
text_f:SetJustifyH("LEFT")
text_f:SetHeight(18)
 
local int = 1
local time_sesion = 0
 
local clocks_update = function(self,t)
int = int - t
if int > 0 then return end
 
int = 1
time_sesion = time_sesion + 1
 
local wgtime = GetWintergraspWaitTime() or 9000
local pendingCalendarInvites = CalendarGetNumPendingInvites() or 0
 
self:SetValue(wgtime)
atime:SetText(date("%H")..":"..date("%M"))
dateval:SetText(date("%a"))
 
if C["info"].wgtimenoti == true then
if wgtime == 60 then
E.EuiAlertRun ("冬握即将在1分钟内开始")
elseif wgtime == 900 then
E.EuiAlertRun ("冬握即将在15分钟内开始")
end
end
end
 
clocks:SetScript("OnUpdate",clocks_update)
 
local form_time = function(target)
local hour = tonumber(format("%01.f", floor(target/3600)))
local min = format(hour>0 and "%02.f" or "%01.f", floor(target/60 - (hour*60)))
local sec = format("%02.f", floor(target - hour*3600 - min*60))
return ((hour>0 and hour..":" or "")..min..":"..sec)
end
 
local switch_wgtime_a = function()
if C["info"].wgtimenoti then
C["info"].wgtimenoti = false
text_f:SetTextColor(1,.1,.1)
text_f:SetText("冬握提示关闭")
FadingFrame_Show(mess_f)
else
C["info"].wgtimenoti = true
text_f:SetTextColor(.1,1,.1)
text_f:SetText("冬握提示开启")
FadingFrame_Show(mess_f)
end
end
 
clocks:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(this, "ANCHOR_CURSOR");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -4, -6)
GameTooltip:ClearLines()
 
local wgtime = GetWintergraspWaitTime()
local inInstance, instanceType = IsInInstance()
if not ( instanceType == "none" ) then
wgtime = "不可用"
elseif wgtime == nil then
wgtime = "正在进行"
else
wgtime = form_time(wgtime)
end
 
GameTooltip:AddDoubleLine("冬握开始时间",wgtime,1,1,1,1,1,1)
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine("游戏时间:",form_time(time_sesion),1,1,1,1,1,1)
if C["info"].wgtimenoti then
GameTooltip:AddDoubleLine("冬握提示:","启用",1,1,1,.1,1,.1)
else
GameTooltip:AddDoubleLine("冬握提示:" ,"禁用",1,1,1,1,.1,.1)
end
GameTooltip:AddLine(" ")
GameTooltip:AddLine("点左键显示日历")
GameTooltip:AddLine("点右键改变提醒设置")
GameTooltip:Show()
 
end)
 
clocks:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
 
clocks:SetScript("OnMouseDown", function(self,button)
if button == "LeftButton" then
GameTimeFrame:Click()
elseif button == "RightButton" then
switch_wgtime_a()
end
end)
 
E.EuiInfo(C["info"].wowtime,clocks)
\ No newline at end of file
Eui/info/ping.lua New file
0,0 → 1,48
local E, C = unpack(select(2, ...))
if C["info"].latency == 0 or C["info"].enable == false then return end
 
local int, r, g, pg = 0
 
local latency = CreateFrame ("StatusBar",nil,UIParent)
latency:SetWidth(70)
latency:SetHeight(10)
latency:SetStatusBarTexture(E.normTex)
latency:SetMinMaxValues(0,300)
latency:SetValue(300)
 
local fps = latency:CreateFontString (nil,"OVERLAY")
fps:SetFont(E.fontn,12,"OUTLINE")
fps:SetJustifyH("LEFT")
fps:SetShadowOffset(2,-2)
fps:SetPoint("BOTTOMLEFT",0,-4)
 
local ping = latency:CreateFontString (nil,"OVERLAY")
ping:SetFont(E.fontn,10,"OUTLINE")
ping:SetJustifyH("RIGHT")
ping:SetShadowOffset(2,-2)
ping:SetPoint("BOTTOMRIGHT",1.3,-4)
 
latency:SetScript("OnUpdate", function(self,t)
int = int - t
if int <0 then
fps:SetText(floor(GetFramerate()).."|cfffffffff|r")
ping:SetText(select(3, GetNetStats()).."|cffffffffms|r")
int = 2
 
pg = select(3, GetNetStats())
self:SetValue(pg)
if pg < 150 then
r,g,b = (pg/150),1,0
latency:SetStatusBarColor(r,g,b)
elseif pg >= 150 and pg<300 then
r,g,b = 1,((300-pg)/150),0
latency:SetStatusBarColor(r,g,b)
else
r,g,b = 1,0,0
latency:SetStatusBarColor(r,g,b)
end
 
end
end)
 
E.EuiInfo(C["info"].latency,latency)
\ No newline at end of file
Eui/info/setting.lua New file
0,0 → 1,139
local E, C = unpack(select(2, ...))
if C["info"].setting == 0 or C["info"].enable == false then return end
 
local setting = CreateFrame ("Button",nil,UIParent)
setting:SetWidth(70)
setting:SetHeight(10)
setting:SetBackdropColor(.7,.7,.9,.2)
 
local name = setting:CreateFontString (nil,"OVERLAY")
name:SetFont(E.fontn,12,"OUTLINE")
name:SetJustifyH("RIGHT")
name:SetShadowOffset(2,-2)
name:SetPoint("BOTTOMRIGHT",1.3,-4)
name:SetText("设 置")
 
setting:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" and IsAddOnLoaded("EuiSet") then
HideUIPanel(GameMenuFrame)
PlaySound("igMainMenuOption")
if not EuiSetGui or not EuiSetGui:IsShown() then
CreateEuiSetGui()
else
EuiSetGui:Hide()
end
elseif button == "RightButton" then
ToggleDropDownMenu(1, nil, settingMenuDrop, self, 0, -5)
GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
end
end)
 
local function addDrop(array)
local info = array
 
local function dropDown_create(self, level)
for i, j in pairs(info) do
UIDropDownMenu_AddButton(j, level)
end
end
 
local setting = CreateFrame("Frame", "setting", nil, "UIDropDownMenuTemplate")
UIDropDownMenu_Initialize(setting, dropDown_create, "MENU", level)
return setting
end
 
settingMenuDrop = addDrop({
{ text = "EUI ", isTitle = 1, notCheckable = 1, keepShownOnClick = 0 },
{ text = "切换天赋 ", func = function()
local spec = GetActiveTalentGroup()
if spec == 1 then
SetActiveTalentGroup(2)
DEFAULT_CHAT_FRAME:AddMessage("已启用副天赋!");
elseif spec == 2 then
SetActiveTalentGroup(1)
DEFAULT_CHAT_FRAME:AddMessage("已启用主天赋!");
end
end },
{ text = "清除战斗记录 ", func = function() CombatLogClearEntries() end },
{ text = "开关战斗日志 ", func = function()
if LoggingCombat() then
DEFAULT_CHAT_FRAME:AddMessage("战斗记录将关闭!");
LoggingCombat(0);
else
DEFAULT_CHAT_FRAME:AddMessage("战斗记录将开启!");
LoggingCombat(1);
end
end },
{ text = "加入冬拥湖 ", func = function() BattlefieldMgrQueueRequest(1) end },
{ text = "重设UI界面 ", func = function()
EuiUFpos=nil
BaudBag_Cfg=nil
BaudBag_Cache=nil
JPackDB=nil
LjxxuiInstallV335=nil
filter=nil
tgoldDB=nil
raidtarget=nil
EuiData[E.myrealm][E.MyName]=nil
filterdb=nil
SetChat()
eSetUI()
ReloadUI()
end },
{text = "开/关LFW频道", func=function()
if LFW_SHOW then
LFW_SHOW = false
DEFAULT_CHAT_FRAME:AddMessage("关闭LFW频道");
else
LFW_SHOW = true
DEFAULT_CHAT_FRAME:AddMessage("打开LFW频道");
end;
end},
{text = "--------", func=function() end},
{text = CHARACTER_BUTTON,
func = function() ToggleCharacter("PaperDollFrame") end},
{text = SPELLBOOK_ABILITIES_BUTTON,
func = function() ToggleSpellBook("spell") end},
{text = TALENTS_BUTTON,
func = function() ToggleTalentFrame() end},
{text = ACHIEVEMENT_BUTTON,
func = function() ToggleAchievementFrame() end},
{text = QUESTLOG_BUTTON,
func = function() ToggleFrame(QuestLogFrame) end},
{text = SOCIAL_BUTTON,
func = function() ToggleFriendsFrame(1) end},
{text = PLAYER_V_PLAYER,
func = function() ToggleFrame(PVPParentFrame) end},
{text = LFG_TITLE,
func = function() ToggleFrame(LFDParentFrame) end},
{text = "团队浏览器",
func = function() ToggleFrame(LFRParentFrame) end},
{text = "游戏选项",
func = function() ToggleFrame(GameMenuFrame) end},
{text = HELP_BUTTON,
func = function() ToggleHelpFrame() end},
})
 
----------------
--Setup Exp Tooltip
setting:SetScript("OnEnter", function()
local lg
local tltext
if LoggingCombat() then
lg = "启用"
else
lg = "禁用"
end
GameTooltip:SetOwner(this, "ANCHOR_CURSOR")
GameTooltip:ClearLines()
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", setting, "BOTTOMLEFT", -4, -6)
GameTooltip:AddLine(" ")
GameTooltip:AddLine(string.format('战斗日志: %s', lg))
GameTooltip:AddLine("左击打开插件设置界面")
GameTooltip:AddLine("右击设置有更多功能!!!")
GameTooltip:Show()
end)
setting:SetScript("OnLeave", function() GameTooltip:Hide() end)
 
E.EuiInfo(C["info"].setting,setting)
\ No newline at end of file
Eui/layout/move.lua New file
0,0 → 1,117
local E, C = unpack(select(2, ...))
local Eui_Frames = {
"EuiActionBarBackground",
"EuiActionBarBackground",
"EuiLeftActionBarBackground",
"EuiRightActionBarBackground",
"EuiActionBarBackgroundRight",
"EuiActionBarBackgroundRight",
"EuiPetActionBarBackground",
}
E.ABlock = true
 
E.applyDragFunctionality = function(f,userplaced,locked)
f:SetScript("OnDragStart", function(s) s:StartMoving() end)
f:SetScript("OnDragStop", function(s) s:StopMovingOrSizing() end)
local t = f:CreateTexture(nil,"OVERLAY",nil,6)
t:SetAllPoints(f)
t:SetTexture(0,1,0)
t:SetAlpha(0)
f.dragtexture = t
f:SetHitRectInsets(-15,-15,-15,-15)
f:SetClampedToScreen(true)
 
if not userplaced then
f:SetMovable(false)
else
f:SetMovable(true)
f:SetUserPlaced(true)
if not locked then
f.dragtexture:SetAlpha(0.2)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnEnter", function(s)
GameTooltip:SetOwner(s, "ANCHOR_TOP")
GameTooltip:AddLine(s:GetName(), 0, 1, 0.5, 1, 1, 1)
GameTooltip:AddLine("左键拖动!", 1, 1, 1, 1, 1, 1)
GameTooltip:Show()
end)
f:SetScript("OnLeave", function(s) GameTooltip:Hide() end)
else
f.dragtexture:SetAlpha(0)
f:EnableMouse(nil)
f:RegisterForDrag(nil)
f:SetScript("OnEnter", nil)
f:SetScript("OnLeave", nil)
end
end
end
 
for _, v in pairs(Eui_Frames) do
f = _G[v]
E.applyDragFunctionality(f,true,true)
end
 
function E.Eui_unlockFrames()
if E.ABLock == true then
print("Eui: 框体解锁")
for _, v in pairs(Eui_Frames) do
f = _G[v]
if f and f:IsUserPlaced() then
--print(f:GetName())
f.dragtexture:SetAlpha(0.2)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnEnter", function(s)
GameTooltip:SetOwner(s, "ANCHOR_TOP")
GameTooltip:AddLine(s:GetName(), 0, 1, 0.5, 1, 1, 1)
GameTooltip:AddLine("按下 ALT+SHIFT 来拖动!", 1, 1, 1, 1, 1, 1)
GameTooltip:Show()
end)
f:SetScript("OnLeave", function(s) GameTooltip:Hide() end)
end
end
E.ABLock = false
else
print("Eui: 框体锁定")
for _, v in pairs(Eui_Frames) do
f = _G[v]
if f and f:IsUserPlaced() then
f.dragtexture:SetAlpha(0)
f:EnableMouse(nil)
f:RegisterForDrag(nil)
f:SetScript("OnEnter", nil)
f:SetScript("OnLeave", nil)
end
end
E.ABLock = true
end
end
 
--[[ function E.Eui_lockFrames()
print("Eui: 框体锁定")
for _, v in pairs(Eui_Frames) do
f = _G[v]
if f and f:IsUserPlaced() then
f.dragtexture:SetAlpha(0)
f:EnableMouse(nil)
f:RegisterForDrag(nil)
f:SetScript("OnEnter", nil)
f:SetScript("OnLeave", nil)
end
end
end
 
local function SlashCmd(cmd)
if (cmd:match"unlock") then
E.Eui_unlockFrames()
elseif (cmd:match"lock") then
E.Eui_lockFrames()
else
print("|c0000FF00\框体移动命令:")
print("|c0000FF00\/barmss lock|r, 锁定框体")
print("|c0000FF00\/barmss unlock|r, 解锁框体")
end
end
SlashCmdList["euibar"] = SlashCmd;
SLASH_euibar1 = "/barmss"; ]]
\ No newline at end of file
Eui/layout/layout.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="layout.lua"/>
 
</Ui>
\ No newline at end of file
Eui/layout/layout.lua New file
0,0 → 1,163
--¶¨ÒåÕû¸ö½çÃæµÄ±³¾°°å
local E, C = unpack(select(2, ...))
--͸Ã÷±³¾°
local alpha
if C["main"].alpha == true then
alpha = 0.1
else
alpha = 0.7
end
 
--Minimap
local mini = CreateFrame("Frame", "EuiMinimap", Minimap)
E.EuiCreatePanel(mini, E.Scale(144+4), E.Scale(144+4), "CENTER", Minimap, "CENTER", 0, 0)
mini:ClearAllPoints()
mini:SetPoint("TOPLEFT", E.Scale(-2), E.Scale(2))
mini:SetPoint("BOTTOMRIGHT", E.Scale(2), E.Scale(-2))
E.EuiCreateShadow(EuiMinimap)
 
if C["info"].apsp ~= 0 then
local leftstat = CreateFrame("Frame", "EuiLeftStatBackground", UIParent)
E.EuiCreatePanel(leftstat, E.Scale(1), E.Scale(1), "TOPLEFT", EuiMinimap, "BOTTOMLEFT", 0, - E.Scale(4))
E.EuiSetTemplate(leftstat,alpha)
E.EuiCreateShadow(leftstat)
leftstat:SetHeight(18)
if C["info"].dps == 0 then
leftstat:SetWidth(EuiMinimap:GetWidth())
else
leftstat:SetWidth(EuiMinimap:GetWidth() / 2 - E.Scale(4))
end
function E.InfoapspPostion(frame)
if E.Movers["Infoapsp"]["moved"] ~= true then
Infoapsp:ClearAllPoints()
Infoapsp:SetPoint("TOPLEFT", EuiMinimap, "BOTTOMLEFT", 0, - E.Scale(4))
end
end
E.CreateMover(EuiLeftStatBackground, "Infoapsp", "AP/SP", false, E.InfoapspPostion)
 
end
if C["info"].dps ~= 0 then
local rightstat = CreateFrame("Frame", "EuiRightStatBackground", UIParent)
E.EuiCreatePanel(rightstat, E.Scale(1), E.Scale(1), "TOPRIGHT", EuiMinimap, "BOTTOMRIGHT", 0, - E.Scale(4))
E.EuiSetTemplate(rightstat,alpha)
E.EuiCreateShadow(rightstat)
rightstat:SetHeight(18)
if C["info"].apsp == 0 then
rightstat:SetWidth(EuiMinimap:GetWidth())
else
rightstat:SetWidth(EuiMinimap:GetWidth() / 2 - E.Scale(4))
end
function E.InfodpsPostion(frame)
if E.Movers["Infodps"]["moved"] ~= true then
Infodps:ClearAllPoints()
Infodps:SetPoint("TOPRIGHT", EuiMinimap, "BOTTOMRIGHT", 0, - E.Scale(4))
end
end
E.CreateMover(EuiRightStatBackground, "Infodps", "DPS/HPS", false, E.InfodpsPostion)
end
 
--chatlayout
if C["chat"].enable == true then
local bottomchatbg = CreateFrame("Frame", "EuiBottomBackground", UIParent)
E.EuiCreatePanel(bottomchatbg, C["chat"].chatw - 60, 18, "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 4)
E.EuiSetTemplate(bottomchatbg, alpha)
E.EuiCreateShadow(bottomchatbg)
 
local leftchatbg = CreateFrame("Frame", "EuiLeftChatBackground", EuiBottomBackground)
E.EuiCreatePanel(leftchatbg, C["chat"].chatw, C["chat"].chath, "BOTTOMLEFT", EuiBottomBackground, "TOPLEFT", 0, 2)
E.EuiSetTemplate(leftchatbg,alpha)
E.EuiCreateShadow(leftchatbg)
 
local topchatbg = CreateFrame("Frame", "EuiTopChatBackground", EuiBottomBackground)
E.EuiCreatePanel(topchatbg, C["chat"].chatw, 22, "BOTTOMLEFT", EuiLeftChatBackground, "TOPLEFT", 0, 2)
E.EuiSetTemplate(topchatbg, alpha)
E.EuiCreateShadow(topchatbg)
 
local infoleftRbutton = CreateFrame("Button", "EuiInfoLeftRButton", EuiInfoLeft)
E.EuiSetTemplate(infoleftRbutton)
infoleftRbutton:SetPoint("BOTTOMLEFT", EuiBottomBackground, "BOTTOMRIGHT", 2, 0)
infoleftRbutton:SetPoint("TOPRIGHT", EuiLeftChatBackground, "BOTTOMRIGHT", 0, -2)
infoleftRbutton.text = E.EuiSetFontn(infoleftRbutton)
infoleftRbutton.text:SetText("UnLock")
infoleftRbutton.text:SetPoint("CENTER")
end
 
--actionbar layout
 
-- BUTTON SIZES
E.buttonsize = E.Scale(C["actionbar"].buttonsize)
E.buttonspacing = E.Scale(C["actionbar"].buttonspacing)
E.petbuttonsize = E.Scale(C["actionbar"].petbuttonsize)
 
-- MAIN ACTION BAR
local barbg = CreateFrame("Frame", "EuiActionBarBackground", UIParent)
if C["actionbar"].bottompetbar ~= true then
E.EuiCreatePanel(barbg, 1, 1, "BOTTOM", UIParent, "BOTTOM", 0, E.Scale(4))
else
E.EuiCreatePanel(barbg, 1, 1, "BOTTOM", UIParent, "BOTTOM", 0, (E.buttonsize + (E.buttonspacing * 2)) + E.Scale(8))
end
barbg:SetWidth(((E.buttonsize * 12) + (E.buttonspacing * 13)))
barbg:SetFrameStrata("LOW")
barbg:SetHeight(E.buttonsize + (E.buttonspacing * 2))
E.EuiSetTemplate(barbg,alpha)
E.EuiCreateShadow(barbg)
 
if C["actionbar"].enable ~= true then
barbg:SetAlpha(0)
end
 
--SPLIT BAR PANELS
local splitleft = CreateFrame("Frame", "EuiSplitActionBarLeftBackground", EuiActionBarBackground)
E.EuiCreatePanel(splitleft, (E.buttonsize * 3) + (E.buttonspacing * 4), EuiActionBarBackground:GetHeight(), "RIGHT", EuiActionBarBackground, "LEFT", E.Scale(-4), 0)
splitleft:SetFrameLevel(EuiActionBarBackground:GetFrameLevel())
splitleft:SetFrameStrata(EuiActionBarBackground:GetFrameStrata())
 
local splitright = CreateFrame("Frame", "EuiSplitActionBarRightBackground", EuiActionBarBackground)
E.EuiCreatePanel(splitright, (E.buttonsize * 3) + (E.buttonspacing * 4), EuiActionBarBackground:GetHeight(), "LEFT", EuiActionBarBackground, "RIGHT", E.Scale(4), 0)
splitright:SetFrameLevel(EuiActionBarBackground:GetFrameLevel())
splitright:SetFrameStrata(EuiActionBarBackground:GetFrameStrata())
E.EuiSetTemplate(splitleft, alpha)
E.EuiSetTemplate(splitright, alpha)
E.EuiCreateShadow(splitleft)
E.EuiCreateShadow(splitright)
 
-- RIGHT BAR
if C["actionbar"].enable == true then
local barbgr = CreateFrame("Frame", "EuiActionBarBackgroundRight", EuiActionBarBackground)
E.EuiCreatePanel(barbgr, 1, (E.buttonsize * 12) + (E.buttonspacing * 13), "RIGHT", UIParent, "RIGHT", E.Scale(-4), E.Scale(-8))
barbgr:Hide()
E.AnimGroup(EuiActionBarBackgroundRight, E.Scale(350), 0, 0.4)
 
local petbg = CreateFrame("Frame", "EuiPetActionBarBackground", UIParent)
if C["actionbar"].bottompetbar ~= true then
E.EuiCreatePanel(petbg, E.petbuttonsize + (E.buttonspacing * 2), (E.petbuttonsize * 10) + (E.buttonspacing * 11), "RIGHT", UIParent, "RIGHT", E.Scale(-6), E.Scale(-13.5))
else
E.EuiCreatePanel(petbg, (E.petbuttonsize * 10) + (E.buttonspacing * 11), E.petbuttonsize + (E.buttonspacing * 2), "BOTTOM", UIParent, "BOTTOM", 0, E.Scale(4))
end
 
local ltpetbg = CreateFrame("Frame", "EuiLineToPetActionBarBackground", petbg)
if C["actionbar"].bottompetbar ~= true then
E.EuiCreatePanel(ltpetbg, 30, 265, "LEFT", petbg, "RIGHT", 0, 0)
else
E.EuiCreatePanel(ltpetbg, 265, 30, "BOTTOM", petbg, "TOP", 0, 0)
end
 
ltpetbg:SetScript("OnShow", function(self)
self:SetFrameStrata("BACKGROUND")
self:SetFrameLevel(0)
end)
E.EuiSetTemplate(barbgr, alpha)
E.EuiSetTemplate(petbg, alpha)
E.EuiCreateShadow(barbgr)
E.EuiCreateShadow(petbg)
end
 
-- VEHICLE BAR
if C["actionbar"].enable == true then
local vbarbg = CreateFrame("Frame", "EuiVehicleBarBackground", UIParent)
E.EuiCreatePanel(vbarbg, 1, 1, "BOTTOM", UIParent, "BOTTOM", 0, E.Scale(4))
vbarbg:SetWidth(((E.buttonsize * 11) + (E.buttonspacing * 12))*1.2)
vbarbg:SetHeight((E.buttonsize + (E.buttonspacing * 2))*1.2)
E.EuiSetTemplate(vbarbg, alpha)
E.EuiCreateShadow(vbarbg)
end
\ No newline at end of file
Eui/media/gray.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/simplesquare_glow.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/statusbar.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/vehicleexit.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/borderBackground.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/raidicons.blp Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/backdrop.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/iconborder.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/raidbg.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/highlightTex.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/glowTex.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/fontc.ttf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/flash.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/blackTex.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/Party.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/nameTex.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/fontn.ttf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/NamePlate.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/textureShadow.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/backdrop_edge.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/textureNormal.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/border.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/Raid.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/dM2.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/mail.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/shadowBorder.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/buttonnormal.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/blank.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/cross.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/normTex.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/normtexc.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/media/Cabaret.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Eui/init.lua New file
0,0 → 1,14
local addons, engine = ...
engine[1] = {}
engine[2] = {}
 
EUI = engine
 
--[[
 
local E,C = unpack(select(2, ...))
 
other addons
 
local E,C = unpack(EUI)
]]
\ No newline at end of file