📄 decursive.lua
字号:
end
end
return false;
end
-- check after clean function
function Dcr_SpellCastFailed(arg1)
Dcr_printlnForMaxDebug(arg1);
if Dcr_CheckAfterCast_On and (arg1 == SPELL_FAILED_LINE_OF_SIGHT) then
Dcr_TargetNotInSight = true;
end
end
-------------------------------------------------------------------------------
-- the combat saver functions and events. These keep us in combat mode
-------------------------------------------------------------------------------
function Dcr_EnterCombat()
Dcr_CombatMode = true;
end
function Dcr_LeaveCombat()
Dcr_CombatMode = false;
end
-- cure target function
function Dcr_CureTarget(unit)
if Dcr_CheckUnitForDebuff("player",DCR_STUNNED) then--DCR_STUNNED="昏迷。";
return;
end
local cureMagicRdySlot = Dcr_CheckCureMagicRdy();--如果可以净化,且技能准备好了,则返回技能的slot id,若不行则返回0
local cureCurseRdySlot = Dcr_CheckCureCurseRdy();
local cureDiseaseRdySlot = Dcr_CheckCureDiseaseRdy();
local curePoisonRdySlot = Dcr_CheckCurePoisonRdy();
local cureCharmedRdySlot = Dcr_CheckCureCharmedRdy();
if not ( (cureMagicRdySlot > 0) or (cureCurseRdySlot > 0) or (cureDiseaseRdySlot > 0) or (curePoisonRdySlot > 0) or (cureCharmedRdySlot > 0)) then
return ;
end
local hasTarget = true;
if UnitIsCharmed(unit) and cureCharmedRdySlot > 0 then
if Dcr_UnitInRange(unit,cureCharmedRdySlot,hasTarget) then
local spell;
if DCR_SPELL_CHARMED_2 > 0 then
spell = DCR_SPELL_CHARMED_2;
else
spell = DCR_SPELL_CHARMED_1;
end
Dcr_println( string.gsub( string.gsub( string.gsub(DCR_CLEAN_STRING, "$t", (UnitName(unit))), "$a", "媚惑"), "$s", (GetSpellName(spell, SpellBookFrame.bookType))));
Dcr_CastSpell_Client(spell, SpellBookFrame.bookType);
SpellStopCasting();
end
return;
end
local class = UnitClass(unit);
local hasDebuff = {};
local debuffIndex;
for debuffIndex = 1 , 16 do
local debuffTexture = UnitDebuff(unit , debuffIndex);
if debuffTexture then
Dcr_Tooltip:SetOwner(Decursive, "ANCHOR_NONE");
Dcr_TooltipTextRight1:SetText(nil);
Dcr_Tooltip:SetUnitDebuff(unit, debuffIndex);
local debuffType = Dcr_TooltipTextRight1:GetText();
local debuffName = Dcr_TooltipTextLeft1:GetText();
if debuffType and (not DCR_SKIP_LIST[debuffName]) and (not DCR_SKIP_BY_CLASS_LIST[class][debuffName]) then --有可解的debuff才记录
if DCR_IGNORELIST[debuffName] then
return false;
end
hasDebuff[debuffType] = true;
end
else
break;
end
end
if hasDebuff[DCR_MAGIC] and cureMagicRdySlot > 0 then
if Dcr_UnitInRange(unit, cureMagicRdySlot,hasTarget) then
local spell;
if DCR_SPELL_MAGIC_2 > 0 then
spell = DCR_SPELL_MAGIC_2;
else
spell = DCR_SPELL_MAGIC_1;
end
Dcr_println( string.gsub( string.gsub( string.gsub(DCR_CLEAN_STRING, "$t", (UnitName(unit))), "$a", DCR_MAGIC), "$s", (GetSpellName(spell, SpellBookFrame.bookType))));
Dcr_CastSpell_Client(spell, SpellBookFrame.bookType);
SpellStopCasting();
end
elseif hasDebuff[DCR_CURSE] and cureCurseRdySlot > 0 then
if Dcr_UnitInRange(unit, cureCurseRdySlot,hasTarget) then
Dcr_println( string.gsub( string.gsub( string.gsub(DCR_CLEAN_STRING, "$t", (UnitName(unit))), "$a", DCR_CURSE), "$s", (GetSpellName(DCR_SPELL_CURSE, SpellBookFrame.bookType))));
Dcr_CastSpell_Client(DCR_SPELL_CURSE, SpellBookFrame.bookType);
SpellStopCasting();
end
elseif hasDebuff[DCR_DISEASE] and cureDiseaseRdySlot > 0 then
if Dcr_UnitInRange(unit, cureDiseaseRdySlot,hasTarget) then
local spell;
if DCR_SPELL_DISEASE_2 > 0 then
spell = DCR_SPELL_DISEASE_2;
else
spell = DCR_SPELL_DISEASE_1;
end
Dcr_println( string.gsub( string.gsub( string.gsub(DCR_CLEAN_STRING, "$t", (UnitName(unit))), "$a", DCR_DISEASE), "$s", (GetSpellName(spell, SpellBookFrame.bookType))));
Dcr_CastSpell_Client(spell, SpellBookFrame.bookType);
SpellStopCasting();
end
elseif hasDebuff[DCR_POISON] and curePoisonRdySlot > 0 then
if Dcr_UnitInRange(unit, curePoisonRdySlot,hasTarget) then
local spell;
if DCR_SPELL_POISON_2 > 0 then
spell = DCR_SPELL_POISON_2;
else
spell = DCR_SPELL_POISON_1;
end
Dcr_println( string.gsub( string.gsub( string.gsub(DCR_CLEAN_STRING, "$t", (UnitName(unit))), "$a", DCR_POISON), "$s", (GetSpellName(spell, SpellBookFrame.bookType))));
Dcr_CastSpell_Client(spell, SpellBookFrame.bookType);
SpellStopCasting();
end
end
end
-------------------------------------------------------------------------------
--Frame and List part
-------------------------------------------------------------------------------
-- this resets the location of the windows
function Dcr_ResetWindow()
DecursiveName:ClearAllPoints();
DecursiveName:SetPoint("CENTER", "UIParent");
DecursiveListFrame:ClearAllPoints();
DecursiveListFrame:SetPoint("CENTER", "UIParent");
DcrOptionsFrame:ClearAllPoints();
DcrOptionsFrame:SetPoint("CENTER", "UIParent");
--DcrCureTargetFrame:ClearAllPoints();
--DcrCureTargetFrame:SetPoint("CENTER", "UIParent");
DecursiveDebuffMonitorListFrame:ClearAllPoints();
DecursiveDebuffMonitorListFrame:SetPoint("CENTER", "UIParent");
end
-- display tip
function Dcr_DisplayTooltip( Message)
DcrDisplay_Tooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT");
DcrDisplay_Tooltip:ClearLines();
DcrDisplay_Tooltip:SetText(Message);
DcrDisplay_Tooltip:Show();
end
-- Main window and Live list part
function Dcr_ShowHideAfflictedListUI()
if DecursiveAfflictedListFrame:IsVisible() then
DecursiveAfflictedListFrame:Hide();
DecursiveName:Hide();
Dcr_vars.Show_LiveList = false;
DEFAULT_CHAT_FRAME:AddMessage(DCR_RESHOW_MSG,0.1, 0.1, 1);
else
DecursiveName:Show();
DecursiveAfflictedListFrame:Show();
Dcr_vars.Show_LiveList = true;
end
end
function Dcr_MainDropDownMenu_OnLoad()
UIDropDownMenu_Initialize(this, Dcr_MainCreateDropDown, "MENU");
UIDropDownMenu_SetButtonWidth(80);
UIDropDownMenu_SetWidth(80);
end
function Dcr_MainCreateDropDown()
UIDropDownMenu_AddButton({notCheckable = 1,text = DCR_MAINMENU_NAME,func = nil,isTitle = 1,});
--DCR_MAINMENU_NAME="主菜单";
UIDropDownMenu_AddButton({notCheckable = 1,text = DCR_MAINMENU_OPENLIST,func = Dcr_ShowHideListFrame,arg1=1,});
--DCR_MAINMENU_OPENLIST="开启/关闭优先设置列表";
UIDropDownMenu_AddButton({notCheckable = 1,text = DCR_MAINMENU_OPTION,func = Dcr_ShowHideOptionsUI,arg1=1,});
--DCR_MAINMENU_OPTION="选项设置";
UIDropDownMenu_AddButton({notCheckable = 1,text = DCR_MAINMENU_MONITOR,func = Dcr_ShowHideMonitor,arg1=1,});
--DCR_MAINMENU_MONITOR="开启/关闭监视器";
UIDropDownMenu_AddButton({notCheckable = 1,text = DCR_MAINMENU_QUICKPRIOLIST,func = Dcr_ShowHideQuickPrioList,arg1=1,});
--DCR_MAINMENU_QUICKPRIOLIST="开启/关闭快速优先设置";
UIDropDownMenu_AddButton({notCheckable = 1,text = DCR_MAINMENU_CLSLIVELIST,func = Dcr_ShowHideAfflictedListUI,arg1=1,});
--DCR_MAINMENU_CLSLIVELIST="关闭实时列表";
end
function Dcr_ShowHideMonitor()
if DecursiveDebuffMonitorListFrame:IsVisible() then
DecursiveDebuffMonitorListFrame:Hide();
Dcr_vars.showDebuffMonitor = false;
else
DecursiveDebuffMonitorListFrame:Show();
Dcr_vars.showDebuffMonitor = true;
end
end
function Dcr_ShowHideQuickPrioList()
if DcrQuickPriorityListFrame:IsVisible() then
DcrQuickPriorityListFrame:Hide();
Dcr_vars.showQuickPrioList = false;
else
DcrQuickPriorityListFrame:Show();
Dcr_vars.showQuickPrioList = true;
end
end
function Dcr_AfflictedListFrame_Update(arg1)
timeLeft = timeLeft - arg1;
if (timeLeft <= 0) then
timeLeft = Dcr_vars.ScanTime;
Dcr_Scan();
local debuffName_Array = {};
local debuffName_List = {};
local debuffTexture_List = {};
local debuffType_List = {};
local debuffIndex_List = {};
local debuffUnit_List = {};
local index = 1;
local unit,debuffIndex,debuffType;
if DCR_CAN_CURE_CHARMED and Dcr_vars.Cure_Magic then
for unit in Dcr_Charmed_Array do
for debuffIndex,debuffType in Dcr_Debuff[unit].Type do
if debuffType == DCR_MAGIC then
if not debuffName_List[Dcr_Debuff[unit].Name[debuffIndex]] then
debuffName_List[Dcr_Debuff[unit].Name[debuffIndex]] = true;
table.insert(debuffName_Array,Dcr_Debuff[unit].Name[debuffIndex]);
debuffTexture_List[Dcr_Debuff[unit].Name[debuffIndex]]
= Dcr_Debuff[unit].Texture[debuffIndex];
debuffIndex_List[Dcr_Debuff[unit].Name[debuffIndex]]= debuffIndex;
debuffType_List[Dcr_Debuff[unit].Name[debuffIndex]] = debuffType;
debuffUnit_List[Dcr_Debuff[unit].Name[debuffIndex]] = unit;
end
end
end
end
end
for _,unit in Dcr_Afflicted_Array do
for debuffIndex , debuffType in Dcr_Debuff[unit].Type do
if (debuffType == DCR_MAGIC and DCR_CAN_CURE_MAGIC and Dcr_vars.Cure_Magic)
or (debuffType == DCR_CURSE and DCR_CAN_CURE_CURSE and Dcr_vars.Cure_Curse)
or (debuffType == DCR_POISON and DCR_CAN_CURE_POISON and Dcr_vars.Cure_Poison)
or (debuffType == DCR_DISEASE and DCR_CAN_CURE_DISEASE and Dcr_vars.Cure_Disease) then
if not debuffName_List[Dcr_Debuff[unit].Name[debuffIndex]] then
debuffName_List[Dcr_Debuff[unit].Name[debuffIndex]] = true;
table.insert(debuffName_Array,Dcr_Debuff[unit].Name[debuffIndex]);
debuffTexture_List[Dcr_Debuff[unit].Name[debuffIndex]]
= Dcr_Debuff[unit].Texture[debuffIndex];
debuffIndex_List[Dcr_Debuff[unit].Name[debuffIndex]]= debuffIndex;
debuffUnit_List[Dcr_Debuff[unit].Name[debuffIndex]] = unit;
debuffType_List[Dcr_Debuff[unit].Name[debuffIndex]] = debuffType;
end
end
end
end
local debuffName;
for _,debuffName in debuffName_Array do
local item = getglobal("DecursiveAfflictedListFrameListItem"..index);
item.DebuffIndex = 99 + debuffIndex_List[debuffName];
item.DebuffName = debuffName;
item.DebuffType = debuffType_List[debuffName];
item.DebuffTexture = debuffTexture_List[debuffName];
item.unit = debuffUnit_List[debuffName];
item:Show();
index = index + 1;
if (index > Dcr_vars.Amount_Of_Afflicted) then
break;
end
end
if DCR_CAN_CURE_CHARMED and Dcr_vars.Cure_Magic then
for unit in Dcr_Charmed_Array do
for debuffIndex,debuffType in Dcr_Debuff[unit].Type do
if debuffType == DCR_MAGIC then
local item = getglobal("DecursiveAfflictedListFrameListItem"..index);
item.unit = unit;
item.DebuffIndex = debuffIndex;
item.DebuffTexture = Dcr_Debuff[unit].Texture[debuffIndex];
item.DebuffName = Dcr_Debuff[unit].Name[debuffIndex];
item.DebuffType = debuffType;
item:Show();
index = index + 1;
if (index > Dcr_vars.Amount_Of_Afflicted) then
break;
end
end
end
end
end
for _,unit in Dcr_Afflicted_Array do
if (index > Dcr_vars.Amount_Of_Afflicted) then
break;
end
for debuffIndex , debuffType in Dcr_Debuff[unit].Type do
if (debuffType == DCR_MAGIC and DCR_CAN_CURE_MAGIC and Dcr_vars.Cure_Magic)
or (debuffType == DCR_CURSE and DCR_CAN_CURE_CURSE and Dcr_vars.Cure_Curse)
or (debuffType == DCR_POISON and DCR_CAN_CURE_POISON and Dcr_vars.Cure_Poison)
or (debuffType == DCR_DISEASE and DCR_CAN_CURE_DISEASE and Dcr_vars.Cure_Disease) then
local item = getglobal("DecursiveAfflictedListFrameListItem"..index);
item.unit = unit;
item.DebuffType = debuffType;
item.DebuffIndex = debuffIndex;
item.DebuffTexture = Dcr_Debuff[unit].Texture[debuffIndex];
item.DebuffName = Dcr_Debuff[unit].Name[debuffIndex];
item:Show();
index = index + 1;
if (index > Dcr_vars.Amount_Of_Afflicted) then
break;
end
end
end
end
if index < 15 then
for index = index, DCR_MAX_LIVE_SLOTS do
local item = getglobal("DecursiveAfflictedListFrameListItem"..index);
item.unit = "player";
item:Hide();
item.DebuffIndex = 0;
item.DebuffTexture = nil;
item.DebuffName = nil;
item.DebuffType = nil;
end
end
end
end
function Dcr_LiveListItem_OnUpdate()
local baseFrame = this:GetName();
if this.DebuffIndex >= 90 then
getglobal(baseFrame.."Name"):SetText(this.DebuffName);
--getglobal(baseFrame.."Affliction"):SetText("位置" .. this.DebuffIndex .. " " .. this.DebuffType .. " " .. this.DebuffName);
getglobal(baseFrame.."Icon"):SetTexture(this.DebuffTexture);
getglobal(baseFrame.."Icon"):SetPoint("LEFT","$Parent","LEFT",15,0);
getglobal(baseFrame.."Class"):Hide();
else
getglobal(baseFrame.."Name"):SetText(UnitName(this.unit));
--getglobal(baseFrame.."Affliction"):SetText("位置" .. this.DebuffIndex .. " " .. this.DebuffType .. " " .. this.DebuffName);
getglobal(baseFrame.."Icon"):SetTexture(this.DebuffTexture);
getglobal(baseFrame.."Icon"):SetPoint("LEFT","$Parent","LEFT",5,0);
local class = UnitClass(this.unit);
getglobal(baseFrame.."Class"):SetTexCoord(Dcr_ClassPosRight(class), Dcr_ClassPosLeft(class), Dcr_ClassPosTop(class), Dcr_ClassPosBottom(class));
getglobal(baseFrame.."Class"):Show();
end
end
function Dcr_LiveListItem_OnClick(rightButton)
--local baseFrame = getglobal(string.gsub( this:GetName(),"(%w+)Button","%1"));
Dcr_Clean(this.unit,this.DebuffType,rightButton);
end
function Dcr_DebuffTemplate_OnEnter()
if this.DebuffIndex >= 90 then
DcrDisplay_Tooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT");
DcrDisplay_Tooltip:ClearLines();
DcrDisplay_Tooltip:SetUnitDebuff(this.unit,(this.DebuffIndex-99));
DcrDisplay_Tooltip:Show();
else
DcrDisplay_Tooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT");
DcrDisplay_Tooltip:ClearLines();
DcrDisplay_Tooltip:SetUnitDebuff(this.unit,this.DebuffIndex);
DcrDisplay_Tooltip:Show();
end
end
---------------------------------
--Class Icon Location Functions--
---------------------------------
function Dcr_ClassPosRight (class)
if(class==DCR_CLASS_WARRIOR) then return 0; end
if(class==DCR_CLASS_MAGE) then return 0.25; end
if(class==DCR_CLASS_ROGUE) then return 0.5; end
if(class==DCR_CLASS_DRUID) then return 0.75; end
if(class==DCR_CLASS_HUNTER) then return 0; end
if(class==DCR_CLASS_SHAMAN) then return 0.25; end
if(class==DCR_CLASS_PRIEST) then return 0.5; end
if(class==DCR_CLASS_WARLOCK) then return 0.75; end
if(class==DCR_CLASS_PALADIN) then return 0; end
return nil;
end
function Dcr_ClassPosLeft (class)
if(class==DCR_CLASS_WARRIOR) then return 0.25; end
if(class==DCR_CLASS_MAGE) then return 0.5; end
if(class==DCR_CLASS_ROGUE) then return 0.75; end
if(class==DCR_CLASS_DRUID) then return 1; end
if(class==DCR_CLASS_HUNTER) then return 0.25; end
if(cla
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -