下面是插件代码!三个功能,进副本切天赋自动换装,屏蔽切天赋技能提示,登陆提示本周获取勇气点数等信息
代码:
Code (c):
--优化自zanelocker的代码
-- 按住转换键再点动作栏的专精图标,直接切换专精并通报,然后切换到跟专精同名的套装(shift ctrl alt)
-- 功能键+左击专精图标 切换专精
TalentMicroButton:SetScript("OnClick", function ()
if IsModifierKeyDown() then
SetActiveSpecGroup(GetActiveSpecGroup(false, false) == 1 and 2 or 1)
else
ToggleTalentFrame()
end
end)
-- 提示切换专精 和 套装
local SpecName = CreateFrame("Frame")
SpecName:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") --切天赋提示
--SpecName:RegisterEvent("PLAYER_LOGIN") --登陆提示
SpecName:RegisterEvent("PLAYER_ENTERING_WORLD") --切换地图提示
SpecName:SetScript(
"OnEvent", function( self, event, ...)
local currentSpec = GetSpecialization()
local currentSpecName = currentSpec and select(2, GetSpecializationInfo(currentSpec))
local roleToken = GetSpecialization()
local roleTokenName = roleToken and select(6, GetSpecializationInfo(roleToken))
if currentSpecName ~= nil then
data1 = format("[|cff00ff00%s|r]", currentSpecName)
data2 = format("|cff00ff00%s|r", roleTokenName and _G[roleTokenName])
if event == "PLAYER_ENTERING_WORLD" then
print("专精:", data1, data2)
elseif event == "ACTIVE_TALENT_GROUP_CHANGED" then
print("切换:", data1, date2)
end
-- 切换套装
for i=1, GetNumEquipmentSets() do
if GetEquipmentSetInfo(i) == currentSpecName then
UseEquipmentSet(currentSpecName) -- 切换专精套装名称与专精相同
print("套装:",data1)
end
end
end
end);
Code (c):
-- 屏蔽遗忘技能和学到新技能
TSSF_addon = {};
-- these localized patterns match the ways you learn/unlearn talents
TSSF_addon.patterns = {};
-- the localized strings for the TSSF_addon.patterns table
TSSF_addon.globalPatterns = {
[1] = _G["ERR_SPELL_UNLEARNED_S"], -- 遗忘技能 %s.
[2] = _G["ERR_LEARN_ABILITY_S"], -- 学会新法术 : %s.
[3] = _G["ERR_LEARN_SPELL_S"], -- 学会新技能 : %s.
[4] = _G["ERR_LEARN_PASSIVE_S"], --学会被动技能 : %s.
};
function TSSF_addon.addBetterStuff(in_string)
local temp = string.gsub(in_string, "%%1$s", "(%%S+)");
toReturn = string.gsub(temp, "%%s", "(%%S+)");
return toReturn;
end
for index, globalString in ipairs (TSSF_addon.globalPatterns) do
TSSF_addon.patterns[index] = TSSF_addon.addBetterStuff(globalString);
end
function TSSF_addon.TalentSpecSpamFilter(self, event, msg)
for i=1, #(TSSF_addon.patterns) do
if (msg:find(TSSF_addon.patterns[i])) then
local tempString, finalString = "", "";
TSSF_addon.frame:SetScript("OnUpdate", TSSF_addon.summarize);
return true;
end
end
return false;
end
-- Create a frame so we can OnUpdate it
TSSF_addon.frame = CreateFrame("Frame", "TalentSpecSpamFilterFrame", UIParent);
-- Add the Talent Spec Spam Filter to the Chat Frame's Message Event Filter
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", TSSF_addon.TalentSpecSpamFilter);
Code (c):
-- 货币信息提示
--感谢kurapica的帮助
local currencyfm = CreateFrame("Frame")
currencyfm:RegisterEvent("PLAYER_LOGIN")
currencyfm:SetScript(
"OnEvent", function(self, event)
for i = 1, GetNumWatchedTokens() do
name, count, icon, itemid = GetBackpackCurrencyInfo(i)
name, amount, texturePath, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo(itemid)
name = format("[|cff00ff00%s|r]",name)
if totalMax > 1000 then
totalMax = floor(totalMax/100)
end
if weeklyMax > 1000 then
weeklyMax = floor(weeklyMax/100)
end
cuall = format("总数(|cff00ff00%s|r)",count)
cuallx = format("总数(|cff00ff00%s|r/|cff00ff00%s|r)",count,totalMax)
cuweek = format("本周(|cff00ff00%s|r)",earnedThisWeek)
cuweekx = format("本周(|cff00ff00%s|r/|cff00ff00%s|r)",earnedThisWeek,weeklyMax)
if totalMax == 0 then
if weeklyMax == 0 then
print(name,cuall)
else
print(name,cuall,cuweekx)
end
else
if weeklyMax == 0 then
print(name,cuallx)
else
print(name,cuallx,cuweekx)
end
end
--print(GetCurrencyInfo(itemid))
end
end)
注意:红色的字符部分是代码,你需要复制红字部分代码来使用就可以了