📄 decursive.lua
字号:
SkipList = { },
SkipClassList = { },
Show_LiveList = true,
Print_ChatFrame = true,
Print_CustomFrame = false,
Print_Error = false,
Check_For_Abolish = true,
Random_Order = false,
Scan_Pets = true,
Ingore_Stealthed = false,
Show_NoCleaned = true,
targetPrio = false;
targetPrioPos = 2;
Amount_Of_Afflicted = 10,
CureBlacklist = 1.0,
ScanTime = 0.2,
Cure_Magic = true,
Cure_Curse = true,
Cure_Poison = true,
Cure_Disease = true,
showDebuffMonitor = false,
showQuickPrioList = true,
QuickPrioList={
[1]={On = 0,Class = DCR_CLASS_WARRIOR},
[2]={On = 0,Class = DCR_CLASS_PRIEST},
[3]={On = 0,Class = DCR_CLASS_MAGE},
[4]={On = 0,Class = DCR_CLASS_WARLOCK},
[5]={On = 0,Class = DCR_CLASS_HUNTER},
[6]={On = 0,Class = DCR_CLASS_ROGUE},
[7]={On = 0,Class = DCR_CLASS_DRUID},
[8]={On = 0,Class = DCR_CLASS_SHAMAN},},
-- this is something i use for remote debugging
DCR_DEBUG_STUFF = { },};
end
if not Dcr_vars.Show_LiveList then
Dcr_ShowHideAfflictedListUI();
end
if not Dcr_vars.showDebuffMonitor then
DecursiveDebuffMonitorListFrame:Hide();
end
if not Dcr_vars.showQuickPrioList then
DcrQuickPriorityListFrame:Hide();
end
Dcr_vars.DCR_DEBUG_STUFF = { };
end
function Dcr_EnterWorld()
--DEFAULT_CHAT_FRAME:AddMessage(DCR_ON_ENTER,0.1, 1, 0.1);
if (UnitName("player") and UnitName("player") ~= UNKNOWNOBJECT) then
if(UnitClass("player") == "圣骑士" or UnitClass("player") == "德鲁伊" or UnitClass("player") == "牧师" or UnitClass("player") == "法师" or UnitClass("player") == "术士" or UnitClass("player") == "萨满祭司") then
local i;
local _, faction = UnitFactionGroup("player");
if faction == DCR_FACTION_ALLIANCE then
for i = 1, 8 do
if Dcr_vars.QuickPrioList[i].Class == DCR_CLASS_SHAMAN then
Dcr_vars.QuickPrioList[i].Class = DCR_CLASS_PALADIN;
break;
end
end
end
else
this:UnregisterEvent("VARIABLES_LOADED");
this:UnregisterEvent("SPELLS_CHANGED");
this:UnregisterEvent("PLAYER_ENTER_COMBAT");
this:UnregisterEvent("PLAYER_LEAVE_COMBAT");
this:UnregisterEvent("PLAYER_REGEN_DISABLED");
this:UnregisterEvent("UI_ERROR_MESSAGE");
this:UnregisterEvent("PLAYER_ENTERING_WORLD");
DecursiveListFrame:Hide();
DcrOptionsFrame:Hide();
DecursiveDebuffMonitorListFrame:Hide();
Dcr_vars.showDebuffMonitor = false;
DcrQuickPriorityListFrame:Hide();
Dcr_vars.showQuickPrioList = false;
DecursiveAfflictedListFrame:Hide();
DecursiveName:Hide();
Dcr_vars.Show_LiveList = false;
end
end
end
function Dcr_OnUpdate(arg1)
-- arg1 = 时间流逝
-- clean up the Dcr_NotInSight_Array
local unit;
for unit in Dcr_NotInSight_Array do
Dcr_NotInSight_Array[unit] = Dcr_NotInSight_Array[unit] - arg1;
if (Dcr_NotInSight_Array[unit] < 0) then
Dcr_NotInSight_Array[unit] = nil;
end
end
if Dcr_CheckAfterCast_On then
if Dcr_TargetNotInSight then
if not Dcr_NotInSight_Array[Dcr_Casting_Unit] then
Dcr_NotInSight_Array[Dcr_Casting_Unit] = 5;--加入到黑名单
Dcr_printlnForMaxDebug(UnitName(Dcr_Casting_Unit) .. "进入黑名单,时间为" ..Dcr_NotInSight_Array[Dcr_Casting_Unit]);
Dcr_printlnForMaxDebug(UnitName(Dcr_Casting_Unit) .. " now in blacklist for " ..Dcr_NotInSight_Array[Dcr_Casting_Unit].." seconds.");
elseif Dcr_NotInSight_Array[Dcr_Casting_Unit] < 20 then
Dcr_NotInSight_Array[Dcr_Casting_Unit] = Dcr_NotInSight_Array[Dcr_Casting_Unit] + 5;
Dcr_printlnForMaxDebug(UnitName(Dcr_Casting_Unit) .. "进入黑名单,时间为" ..Dcr_NotInSight_Array[Dcr_Casting_Unit]);
Dcr_printlnForMaxDebug(UnitName(Dcr_Casting_Unit) .. " now in blacklist for " ..Dcr_NotInSight_Array[Dcr_Casting_Unit].." seconds.");
end
Dcr_CheckAfterCast_On = false;
Dcr_TargetNotInSight = false;
end
if Dcr_CheckAfterCast_LeftTime <= 0 then
Dcr_CheckAfterCast_On = false;
end
Dcr_CheckAfterCast_LeftTime = Dcr_CheckAfterCast_LeftTime - arg1;
end
if (Dcr_DelayTimer > 0) then
Dcr_DelayTimer = Dcr_DelayTimer - arg1;
if (Dcr_DelayTimer <= 0) then
if (not Dcr_CombatMode) then
Dcr_printlnForMaxDebug("重新开始攻击!");
Dcr_printlnForMaxDebug("resume auto attack");
AttackTarget();
end
end
end
end
function Dcr_Configure()
-- parse through the entire library...
-- look for known cleaning spells...
-- this will be called everytime the spellbook changes
-- this is just used to make things simpler in the checking
local Dcr_Name_Array = {
[DCR_SPELL_CURE_DISEASE] = true,
[DCR_SPELL_ABOLISH_DISEASE] = true,
[DCR_SPELL_PURIFY] = true,
[DCR_SPELL_CLEANSE] = true,
[DCR_SPELL_DISPELL_MAGIC] = true,
[DCR_SPELL_CURE_POISON] = true,
[DCR_SPELL_ABOLISH_POISON] = true,
[DCR_SPELL_REMOVE_LESSER_CURSE] = true,
[DCR_SPELL_REMOVE_CURSE] = true,
[DCR_SPELL_PURGE] = true,
}
local i = 1;
while (true) do
local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL);
if (not spellName) then
do break end
end
if (Dcr_Name_Array[spellName]) then
Dcr_printlnForMaxDebug( string.gsub(DCR_SPELL_FOUND, "$s", spellName));
if ((spellName == DCR_SPELL_CURE_DISEASE) or (spellName == DCR_SPELL_ABOLISH_DISEASE) or
(spellName == DCR_SPELL_PURIFY) or (spellName == DCR_SPELL_CLEANSE)) then
DCR_CAN_CURE_DISEASE = true;
if ((spellName == DCR_SPELL_CURE_DISEASE) or (spellName == DCR_SPELL_PURIFY)) then
DCR_SPELL_DISEASE_1 = i;
else
DCR_SPELL_DISEASE_2 = i;
end
end
if ((spellName == DCR_SPELL_CURE_POISON) or (spellName == DCR_SPELL_ABOLISH_POISON) or
(spellName == DCR_SPELL_PURIFY) or (spellName == DCR_SPELL_CLEANSE)) then
DCR_CAN_CURE_POISON = true;
if ((spellName == DCR_SPELL_CURE_POISON) or (spellName == DCR_SPELL_PURIFY)) then
DCR_SPELL_POISON_1 = i;
else
DCR_SPELL_POISON_2 = i;
end
end
if ((spellName == DCR_SPELL_REMOVE_CURSE) or (spellName == DCR_SPELL_REMOVE_LESSER_CURSE)) then
DCR_CAN_CURE_CURSE = true;
DCR_SPELL_CURSE = i;
end
if ((spellName == DCR_SPELL_DISPELL_MAGIC) or (spellName == DCR_SPELL_CLEANSE)) then
DCR_CAN_CURE_MAGIC = true;
if (spellName == DCR_SPELL_CLEANSE) then
DCR_SPELL_MAGIC_1 = i;
else
if (spellRank == DCR_SPELL_RANK_1) then
DCR_SPELL_MAGIC_1 = i;
else
DCR_SPELL_MAGIC_2 = i;
end
end
end
if ((spellName == DCR_SPELL_DISPELL_MAGIC) or (spellName == DCR_SPELL_PURGE)) then
DCR_CAN_CURE_CHARMED = true;
if (spellRank == DCR_SPELL_RANK_1) then
DCR_SPELL_CHARMED_1 = i;
else
DCR_SPELL_CHARMED_2 = i;
end
end
end
i = i + 1
end
end
function Dcr_GetSpellSlot(spell,slotToCheck)
local spellTexture = GetSpellTexture(spell , BOOKTYPE_SPELL);
local spellName = GetSpellName(spell, BOOKTYPE_SPELL);
if slotToCheck > 0 then
if (spellTexture == GetActionTexture(slotToCheck)) and (not GetActionText(slotToCheck)) then
Dcr_printlnForMaxDebug(spellName .. "在第" .. slotToCheck .. "个技能栏里");
Dcr_printlnForMaxDebug(spellName .. " in slot " .. slotToCheck);
return slotToCheck;
end
end
local slot,icon;
for slot = 1, 120 do
if HasAction(slot) then
icon = GetActionTexture(slot);
if icon == spellTexture then
if (GetActionText(slot) == nil) then
Dcr_Tooltip:SetOwner(Decursive, "ANCHOR_NONE");
Dcr_Tooltip:ClearLines();
Dcr_Tooltip:SetAction(slot);
if spellName == (Dcr_TooltipTextLeft1:GetText()) then
Dcr_Tooltip:Hide();
Dcr_printlnForMaxDebug(spellName .. "在第" .. slot .. "个技能栏里" );
Dcr_printlnForMaxDebug(spellName .. " in slot " .. slotToCheck);
return slot;
end
Dcr_Tooltip:Hide();
end
end
end
end
Dcr_printlnForMaxDebug("Decursive没能在技能栏里找到净化技能。" );
Dcr_printlnForMaxDebug("Decursive has not found the decurse spell in your bars.");
for slot = 120 , 1 , -1 do
if not (HasAction(slot) == 1) then
PutItemInBackpack();
PickupSpell(spell, BOOKTYPE_SPELL);
PlaceAction(slot);
Dcr_println("技能栏中未能找到技能|cff00ff00".. spellName .. "|r,此技能被自动放置到第" .. slot .. "个技能格!");
Dcr_println(spellName .. " has been placed in slot " .. slot );
return slot;
end
end
Dcr_println("技能栏中未能找到技能|cff00ff00".. spellName .. "|r!\n大哥您的120个技能栏居然全满了,请把净化技能放到技能栏中再尝试净化");
Dcr_println("Decursive has not found empty slot in your bars. Please place the decurse spell to your bars or the UI would not work.");
return 0;
end
-- Raid/Party Name Check Function"
-- this returns the UnitID that the Name points to
function Dcr_GetUnitArray()
-- create the array of curable units
local unitArray = {};
local classAdded = {};
unitArray = {};
-- first add your self (you are never skipped)添加自己
table.insert(unitArray, "player");
local i,id;
local raidnum = GetNumRaidMembers();
local currentGroup = 0;
if raidnum > 0 then
local name = UnitName("player");
for i = 1, raidnum do
local rName, _, rGroup = GetRaidRosterInfo(i);
if rName == name then
currentGroup = rGroup;
break;
end
end
end
-- then... the priority list... names that go first!
local pname;
for _, pname in Dcr_vars.PriorityList do
local unit = Dcr_NameToUnit(pname);
if (unit) then
table.insert(unitArray,unit);
end
end
-- then add group member by QuickPrioList
for id = 1, 8 do
if Dcr_vars.QuickPrioList[id].On == 1 then
local prioClass = Dcr_vars.QuickPrioList[id].Class;
classAdded[prioClass] = true;
for i = 1, 4 do
if UnitExists("party"..i) then
if prioClass == UnitClass("party"..i) then
if not Dcr_IsInSkipOrPriorList(UnitName("party"..i)) then
table.insert(unitArray, "party"..i);
end
end
end
end
if raidnum > 0 then
for i = 1, raidnum do
local name, _, group, _, class = GetRaidRosterInfo(i);
if class == prioClass and group ~= currentGroup and (not Dcr_IsInSkipOrPriorList(name)) then
table.insert(unitArray, "raid"..i);
end
end
end
end
end
-- then everything else
for i = 1, 4 do
if UnitExists("party"..i) then
local class = UnitClass("party"..i);
if not (classAdded[class] or Dcr_IsInSkipOrPriorList(UnitName("party"..i))) then
table.insert(unitArray,"party"..i);
end
end
end
-- add the raid IDs that are valid...
if raidnum > 0 then
-- first the groups that are before yours
for i = 1, raidnum do
local name, _, group, _, class = GetRaidRosterInfo(i);
if not (group == currentGroup or classAdded[class] or Dcr_IsInSkipOrPriorList(name)) then
table.insert(unitArray,"raid"..i);
end
end
-- don't bother with your own group... since its also party 1-4
end
-- now the pets
-- no need to cure the pet whose master is not hunter or warlock
local classHasPet = {[DCR_CLASS_HUNTER] = true,[DCR_CLASS_WARLOCK] = true,};
-- Decursive do not support warlock, so no need to add your pet
--if (UnitExists("pet")) and classHasPet[UnitClass("player")] then
-- table.insert(unitArray,"pet");
--end
-- the parties pets if they have them
for i = 1, 4 do
if UnitExists("partypet"..i) then
local class = UnitClass("party"..i);
if classHasPet[class] then
table.insert(unitArray,"partypet"..i);
end
end
end
if raidnum > 0 then
for i = 1, raidnum do
local _, _, group, _, class = GetRaidRosterInfo(i);
if group ~= currentGroup and UnitExists("raidpet"..i) and classHasPet[class] then
table.insert(unitArray,"raidpet"..i);
end
end
end
-- now add target 最后添加目标
if Dcr_vars.targetPrio and Dcr_vars.targetPrioPos == 2 then
if UnitExists("target") and UnitIsVisible("target") then
if UnitIsPlayer("target") and (UnitFactionGroup("target") == UnitFactionGroup("player")) then
local max = table.getn(unitArray);
local targetID = 0;
for i = 2 , max do
if UnitIsUnit("target",unitArray[i]) then
targetID = i;
break;
end
end
if targetID == 0 then
table.insert(unitArray,2,"target");
else
table.insert(unitArray,2,table.remove(unitArray,targetID));
end
end
end
end
-- finally, add unit in monitors to very first of the array
for id = 5, 1, -1 do
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -