📄 titanclasstracker.lua
字号:
TITAN_CLASSTRACKER_FREQUENCY=1.0;
-- Version information
local TitanClassTrackerName = "TitanClassTracker";
local TitanClassTrackerVersion = "2.6";
-- Declare our warning thresholds
SHARD_WARNING = 3;
ANKH_WARNING = 1;
RUNE_WARNING = 1;
ROGUE_WARNING = 1;
DRUID_WARNING = 1;
PRIEST_WARNING = 1;
PALADIN_WARNING = 1;
-- WARLOCK
local shardCount = 0;
local healthCount = 0;
local soulCount = 0;
local spellCount = 0;
local fireCount = 0;
-- SHAMAN
local ankhCount = 0;
local scalesCount = 0;
local oilCount = 0;
-- MAGE
local teleCount = 0;
local portalCount = 0;
local arcaneCount = 0;
-- ROGUE
local flashCount = 0;
local blindCount = 0;
local instantCount = 0;
local deadlyCount = 0;
local cripplingCount = 0;
local mindnumbCount = 0;
local woundCount = 0;
local thistleCount = 0;
-- DRUID
local mseedCount = 0;
local sseedCount = 0;
local aseedCount = 0;
local hseedCount = 0;
local iseedCount = 0;
local berriesCount = 0;
local thornrootCount = 0;
-- PRIEST
local featherCount = 0;
local hcandleCount = 0;
local scandleCount = 0;
-- PALADIN
local symbolCount = 0;
function TitanPanelClassTrackerButton_OnLoad()
this.registry={
id="ClassTracker",
builtIn_t=1,
menuText=TITAN_CLASSTRACKER_MENU_TEXT,
buttonTextFunction="TitanPanelClassTrackerButton_GetButtonText",
tooltipTitle = TITAN_CLASSTRACKER_TOOLTIP,
tooltipTextFunction = "TitanPanelClassTrackerButton_GetTooltipText",
frequency=TITAN_CLASSTRACKER_FREQUENCY,
savedVariables = {
ShowLabelText = 1,
}
}
-- Register for inventory change events
this:RegisterEvent("VARIABLES_LOADED");
this:RegisterEvent("PLAYER_ENTERING_WORLD");
this:RegisterEvent("BAG_UPDATE");
this:RegisterEvent("BANKFRAME_CLOSED");
this:RegisterEvent("UNIT_INVENTORY_CHANGED");
-- this:RegisterEvent("UNIT_NAME_UPDATE");
end
-- Event handling code
function TitanPanelClassTrackerButton_OnEvent()
TitanClassTracker_Count();
TitanPanelButton_UpdateButton("ClassTracker");
TitanPanelButton_UpdateTooltip();
end
-- Function to count Shards
function TitanClassTracker_Count()
-- Reset the count so we can count them again
-- WARLOCK
if (shardCount ~= 0) then
shardCount = 0;
end
if (healthCount ~= 0) then
healthCount = 0;
end
if (soulCount ~= 0) then
soulCount = 0;
end
if (spellCount ~= 0) then
spellCount = 0;
end
if (fireCount ~= 0) then
fireCount = 0;
end
-- SHAMAN
if (ankhCount ~= 0) then
ankhCount = 0;
end
if (scalesCount ~= 0) then
scalesCount = 0;
end
if (oilCount ~= 0) then
oilCount = 0;
end
-- MAGE
if (teleCount ~= 0) then
teleCount = 0;
end
if (portalCount ~= 0) then
portalCount = 0;
end
if (arcaneCount ~= 0) then
arcaneCount = 0;
end
-- ROGUE
if (flashCount ~= 0) then
flashCount = 0;
end
if (blindCount ~= 0) then
blindCount = 0;
end
if (instantCount ~= 0) then
instantCount = 0;
end
if (deadlyCount ~= 0) then
deadlyCount = 0;
end
if (cripplingCount ~= 0) then
cripplingCount = 0;
end
if (mindnumbCount ~= 0) then
mindnumbCount = 0;
end
if (woundCount ~= 0) then
woundCount = 0;
end
if (thistleCount ~= 0) then
thistleCount = 0;
end
-- DRUID
if (mseedCount ~= 0) then
mseedCount = 0;
end
if (sseedCount ~= 0) then
sseedCount = 0;
end
if (aseedCount ~= 0) then
aseedCount = 0;
end
if (hseedCount ~= 0) then
hseedCount = 0;
end
if (iseedCount ~= 0) then
iseedCount = 0;
end
if (berriesCount ~= 0) then
berriesCount = 0;
end
if (thornrootCount ~= 0) then
thornrootCount = 0;
end
-- PRIEST (featherCount for MAGE also)
if (featherCount ~= 0) then
featherCount = 0;
end
if (hcandleCount ~= 0) then
hcandleCount = 0;
end
if (scandleCount ~= 0) then
scandleCount = 0;
end
-- PALADIN
if (symbolCount ~= 0) then
symbolCount = 0;
end
local bag;
local slot;
local idx;
local itemName = nil;
local size;
local count = 0;
local texture = 0;
for bag = 0, 4, 1 do
if (bag == 0) then
size = 16;
else
size = GetContainerNumSlots(bag);
end
if (size and size > 0) then
for slot = 1, size, 1 do
itemType = nil; itemIdx = nil; itemName=nil;
itemName = GetContainerItemLink(bag,slot);
if (itemName) then
local idx = string.find(itemName,"[[]");
itemName = string.sub (itemName,idx+1);
idx = string.find(itemName,"]");
itemName = string.sub (itemName,1,idx-1);
end
if (itemName == "灵魂碎片") then
texture, count = GetContainerItemInfo(bag,slot);
shardCount = shardCount + count;
end
if (itemName == "治疗石") or (itemName == "初级治疗石") or (itemName == "次级治疗石") or (itemName == "强效治疗石") or (itemName == "极效治疗石") then
texture, count = GetContainerItemInfo(bag,slot);
healthCount = healthCount + count;
end
if (itemName == "灵魂石") or (itemName == "初级灵魂石") or (itemName == "次级灵魂石") or (itemName == "强效灵魂石") or (itemName == "极效灵魂石") then
texture, count = GetContainerItemInfo(bag,slot);
soulCount = soulCount + count;
end
if (itemName == "法术石") or (itemName == "强效法术石") then
texture, count = GetContainerItemInfo(bag,slot);
spellCount = spellCount + count;
end
if (itemName == "火焰石") or (itemName == "次级火焰石") or (itemName == "强效火焰石") or (itemName == "极效火焰石") then
texture, count = GetContainerItemInfo(bag,slot);
fireCount = fireCount + count;
end
if (itemName == "十字章") then
texture, count = GetContainerItemInfo(bag,slot);
ankhCount = ankhCount + count;
end
if (itemName == "闪亮的鱼鳞") then
texture, count = GetContainerItemInfo(bag,slot);
scalesCount = scalesCount + count;
end
if (itemName == "鱼油") then
texture, count = GetContainerItemInfo(bag,slot);
oilCount = oilCount + count;
end
if (itemName == "传送符文") then
texture, count = GetContainerItemInfo(bag,slot);
teleCount = teleCount + count;
end
if (itemName == "传送门符文") then
texture, count = GetContainerItemInfo(bag,slot);
portalCount = portalCount + count;
end
if (itemName == "魔粉") then
texture, count = GetContainerItemInfo(bag,slot);
arcaneCount = arcaneCount + count;
end
if (itemName == "闪光粉") then
texture, count = GetContainerItemInfo(bag,slot);
flashCount = flashCount + count;
end
if (itemName == "致盲粉") then
texture, count = GetContainerItemInfo(bag,slot);
blindCount = blindCount + count;
end
if (itemName == "速效毒药 VI") or (itemName == "速效毒药 V") or (itemName == "速效毒药 IV") or (itemName == "速效毒药 III") or (itemName == "速效毒药 II") or (itemName == "速效毒药") then
texture, count = GetContainerItemInfo(bag,slot);
instantCount = instantCount + count;
end
if (itemName == "致命毒药 IV") or (itemName == "致命毒药 III") or (itemName == "致命毒药 II") or (itemName == "致命毒药") then
texture, count = GetContainerItemInfo(bag,slot);
deadlyCount = deadlyCount + count;
end
if (itemName == "致残毒药 II") or (itemName == "致残毒药") then
texture, count = GetContainerItemInfo(bag,slot);
cripplingCount = cripplingCount + count;
end
if (itemName == "麻痹毒药 III") or (itemName == "麻痹毒药 II") or (itemName == "麻痹毒药") then
texture, count = GetContainerItemInfo(bag,slot);
mindnumbCount = mindnumbCount + count;
end
if (itemName == "致伤毒药 IV") or (itemName == "致伤毒药 III") or (itemName == "致伤毒药 II") or (itemName == "致伤毒药") then
texture, count = GetContainerItemInfo(bag,slot);
woundCount = woundCount + count;
end
if (itemName == "菊花茶") then
texture, count = GetContainerItemInfo(bag,slot);
thistleCount = thistleCount + count;
end
if (itemName == "枫树种子") then
texture, count = GetContainerItemInfo(bag,slot);
mseedCount = mseedCount + count;
end
if (itemName == "荆棘种子") then
texture, count = GetContainerItemInfo(bag,slot);
sseedCount = sseedCount + count;
end
if (itemName == "灰木种子") then
texture, count = GetContainerItemInfo(bag,slot);
aseedCount = aseedCount + count;
end
if (itemName == "角树种子") then
texture, count = GetContainerItemInfo(bag,slot);
hseedCount = hseedCount + count;
end
if (itemName == "铁木种子") then
texture, count = GetContainerItemInfo(bag,slot);
iseedCount = iseedCount + count;
end
if (itemName == "野生浆果") then
texture, count = GetContainerItemInfo(bag,slot);
berriesCount = berriesCount + count;
end
if (itemName == "野生棘根草") then
texture, count = GetContainerItemInfo(bag,slot);
thornrootCount = thornrootCount + count;
end
if (itemName == "轻羽毛") then
texture, count = GetContainerItemInfo(bag,slot);
featherCount = featherCount + count;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -