📄 decursive.lua
字号:
-------------------------------------------------------------------------------
-- TODO add a debuff priority list... "IE look for these first"(实现上难度不能说太大,但是似乎只有战场有用)
-- TODO add warlock support(太难,考虑作成单独的部分)
-- TODO add more macro and keybidnings(我更希望是“一键”)
-------------------------------------------------------------------------------
--function list
-------------------------------------------------------------------------------
--main
-------------------------------------------------------------------------------
--Todo和变量部分
--Dcr_printlnForMaxDebug
--Dcr_println
--Dcr_Init 初始化
--Dcr_OnUpdate 主frame之时间流逝
--Dcr_Configure 寻找技能
--Dcr_GetSpellSlot 功能函数,按照技能寻找slot
--Dcr_GetUnitArray 取得检查顺序列表
--Dcr_NameToUnit 功能函数,按照名字在团队中寻找列表中玩家
--Dcr_Scan 取得净化顺序列表
--Dcr_CheckCureMagicRdy 检查施法准备是否完成
--Dcr_CheckCureCurseRdy
--Dcr_CheckCureDiseaseRdy
--Dcr_CheckCurePoisonRdy
--Dcr_CheckCureCharmedRdy
--Dcr_CheckUnitForDebuff 监测自身debuff是否含有特定内容,现在主要检测"昏迷。"
--Dcr_Clean 按净化列表检查并施放净化技能
--Dcr_UnitInRange 功能函数:检查目标是否在施法范围内
--Dcr_CastSpell_Client 施法的手套,免得失败导致整个函数中断
--Dcr_Cure_Charmed 功能函数:施法净化技能
--Dcr_Cure_Magic
--Dcr_Cure_Curse
--Dcr_Cure_Poison
--Dcr_Cure_Disease
--Dcr_CheckUnitForBuff 功能函数:检查目标是否有特定buff(quu)
--Dcr_SpellCastFailed 施法后检查,制作黑名单
--Dcr_CureTarget 检查并治疗当前目标,因为目标不一定在团队中,所以只能做成单独部分。
--Dcr_CleanByDebuffName 按照debuff名字来净化团队
--Dcr_EnterCombat 进出自动战斗状态的函数
--Dcr_LeaveCombat(quu)
-------------------------------------------------------------------------------
--Frame and List part
--Dcr_ResetWindow
--Dcr_DisplayTooltip
--Dcr_ShowHideAfflictedListUI
--Dcr_MainDropDownMenu_OnLoad
--Dcr_MainCreateDropDown
--Dcr_ShowHideMonitor
--Dcr_ShowHideQuickPrioList
-------------------------------------------------------------------------------
--Live list
--Dcr_AfflictedListFrame_Update
--Dcr_LiveListItem_OnUpdate
--Dcr_LiveListItem_OnClick
--Dcr_DebuffTemplate_OnEnter
--Dcr_ClassPosRight 职业图标
--Dcr_ClassPosLeft
--Dcr_ClassPosTop
--Dcr_ClassPosBottom
-------------------------------------------------------------------------------
--Prio & Skip list
--Dcr_ShowHideListFrame
--prio
--Dcr_AddTargetToPriorityList
--Dcr_AddTargetToTopPosOfPriorityList
--DcrAddUnitToPriorityList
--Dcr_ClearPriorityList
--skip
--Dcr_AddTargetToSkipList
--DcrAddUnitToSkipList
--Dcr_ClearSkipList
--Dcr_HideSkipIndex
--Dcr_HidePrioIndex
-- for both prio and skip list
--Dcr_ListFrame_Update
--Dcr_IsInSkipOrPriorList
--Dcr_PopulateButtonPress
--Dcr_PriorityListEntryTemplate_OnClick 只有prio是因为skip是继承prio的
--Dcr_PriorityListEntryTemplate_OnUpdate
--Dcr_GetUnitClassAbName
-------------------------------------------------------------------------------
--Option part
--Dcr_ShowHideOptionsUI
--Dcr_ShowHideTextAnchor
--Dcr_AmountOfAfflictedSlider_OnShow
--Dcr_AmountOfAfflictedSlider_OnValueChanged
--Dcr_ScanTimeSlider_OnShow
--Dcr_ScanTimeSlider_OnValueChanged
-------------------------------------------------------------------------------
--monitor part
--Dcr_DebuffMonitor_UpDate
--Dcr_AddUnitToDebuffMonitor
--Dcr_ClearDebuffMonitor
--Dcr_DebuffMonitorDropDownMenu_OnLoad
--Dcr_DebuffMonitorCreateDropDown
--Dcr_DebuffMonitorListFrame_OnClick
-------------------------------------------------------------------------------
--quick prio list part
--Dcr_QuickPriorityListItem_Update
--Dcr_QuickPriorityListItem_Click
--Dcr_QuickPriorityListFrame_Click
-------------------------------------------------------------------------------
-- here is the global variables, these should not be changed. These basically
-- are the limits of WoW client.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- and any internal HARD settings for decursive
DCR_MAX_LIVE_SLOTS = 15;--考虑改成20
DCR_TEXT_LIFETIME = 2;
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- The stored variables
-------------------------------------------------------------------------------
Dcr_vars = {
-- this is the items that are stored... I might later do this per account.
-- this is the priority list of people to cure
PriorityList = { };
PriorityClassList = { };
-- this is the people to skip
SkipList = { };
SkipClassList = { };
-- this is wiether or not to show the "live" list
Show_LiveList = true;
-- This will turn on and off the sending of messages to the default chat frame
Print_ChatFrame = true;
-- this will send the messages to a custom frame that is moveable
Print_CustomFrame = false;
-- this will disable error messages
Print_Error = false;
-- check for abolish XXX before curing poison or disease
Check_For_Abolish = true;
-- this is "fix" for the fact that rank 1 of dispell magic does not always remove
-- the high level debuffs properly. This carrys over to other things.
-- AlwaysUseBestSpell = true;
-- should we do the orders randomly?
Random_Order = false;
-- should we scan pets
Scan_Pets = true;
-- should we scan pets
Ingore_Stealthed = false;
Show_NoCleaned = true;
targetPrio = false;
targetPrioPos = 2;
-- how many to show in the livelist
Amount_Of_Afflicted = 10;
-- how many seconds to "black list" someone with a failed spell
CureBlacklist = 1.0;
-- how often to poll for afflictions in seconds
ScanTime = 0.2;
-- do a range check
--RangeCheck = true;
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 = { };
};
-------------------------------------------------------------------------------
function gLimAutoCure_Register()
gLim_RegisterButton (
"AutoCure",
"清除减益设置",
"Interface\\AddOns\\Decursive\\Icon",
function()
gLimModSecBookShowConfig("gLimAutoCure");
end,
2,
3
);
gLim_RegisterConfigClass(
"gLimAutoCure",
"AutoCure",
"Quu"
);
gLim_RegisterConfigSection(
"gLimAutoCure",
"清除减益",
"清除减益设置 Modified CraZy aPpLe(gLim)",
"CraZy aPpLe",
"gLimAutoCure"
);
gLim_RegisterConfigButton(
"gLimDBList",
"设置清除减益",
"调出清除减益",
"设置列表",
function()
Dcr_ShowHideAfflictedListUI();
end,
"gLimAutoCure"
);
gLim_RegisterConfigButton(
"gLimDOList",
"打开/关闭优先列表",
"打开/关闭优先列表",
"优先列表设置",
function()
Dcr_ShowHideListFrame();
end,
"gLimAutoCure"
);
gLim_RegisterConfigButton(
"gLimDMList",
"打开/关闭VIP监视器",
"打开/关闭VIP监视器",
"VIP监视器设置",
function()
Dcr_ShowHideMonitor();
end,
"gLimAutoCure"
);
gLim_RegisterConfigButton(
"gLimDAList",
"设置清除减益",
"调出清除减益",
"设置列表",
function()
Dcr_ShowHideAfflictedListUI();
end,
"gLimAutoCure"
);
gLim_RegisterConfigButton(
"gLimDBBinding",
"设置清除减益快捷键",
"调出清除减益快捷键设置栏",
"快捷键设置",
function()
gLimKeyBinding("HEADER_DECURSIVE");
gLimConfigSubFrame:Hide();
end,
"gLimAutoCure"
);
end
-------------------------------------------------------------------------------
-- and the printing functions
-------------------------------------------------------------------------------
function Dcr_printlnForMaxDebug( Message)
if (Dcr_vars.Print_Error) then
--table.insert(Dcr_vars.DCR_DEBUG_STUFF, Message);
DEFAULT_CHAT_FRAME:AddMessage(Message, 0.8, 0.8, 0.8);
end
end
function Dcr_println( Message)
if (Dcr_vars.Print_ChatFrame) then
DEFAULT_CHAT_FRAME:AddMessage(Message, 1, 1, 1);
end
if (Dcr_vars.Print_CustomFrame) then
DecursiveTextFrame:AddMessage(Message, 1, 1, 1, 0.9, DCR_TEXT_LIFETIME);
end
end
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- local variables
-------------------------------------------------------------------------------
local timeLeft = 0;--live list 时间流逝变量
-- 一个关于列表添加按钮的辅助变量
local Dcr_AutoAdd = false;
--关于是否从顶部添加到优先列表的变量
local Dcr_IfToTop = false;
--被媚惑玩家的的列表
local Dcr_Charmed_Array = {};
--中debuff玩家列表
local Dcr_Afflicted_Array = {};
--debuff列表,检查到的unit的debuff信息都在里面
local Dcr_Debuff = {};
--使用净化技能后检测用的
local Dcr_CheckAfterCast_On = false;
local Dcr_CheckAfterCast_LeftTime = 0;
local Dcr_Casting_Unit = nil;
local Dcr_TargetNotInSight = false;
--视野外玩家的名单
local Dcr_NotInSight_Array = {};
-- the new spellbook (made it simpler due to localization problems)
local DCR_SPELL_MAGIC_1 = 0;
local DCR_SPELL_MAGIC_2 = 0;
local DCR_CAN_CURE_MAGIC = false;
local DCR_SPELL_CHARMED_1 = 0;
local DCR_SPELL_CHARMED_2 = 0;
local DCR_CAN_CURE_CHARMED = false;
local DCR_SPELL_DISEASE_1 = 0;
local DCR_SPELL_DISEASE_2 = 0;
local DCR_CAN_CURE_DISEASE = false;
local DCR_SPELL_POISON_1 = 0;
local DCR_SPELL_POISON_2 = 0;
local DCR_CAN_CURE_POISON = false;
local DCR_SPELL_CURSE = 0;
local DCR_CAN_CURE_CURSE = false;
local Dcr_Disease_1_Slot = 0;
local Dcr_Disease_2_Slot = 0;
local Dcr_Poison_1_Slot = 0;
local Dcr_Poison_2_Slot = 0;
local Dcr_Curse_Slot = 0;
local Dcr_Magic_1_Slot = 0;
local Dcr_Magic_2_Slot = 0;
local Dcr_Charmed_1_Slot =0;
local Dcr_Charmed_2_Slot =0;
local Dcr_DelayTimer = 0;--重置自动攻击的等待时间
local Dcr_DebuffMonitor_TimeDelay = {[1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0,};
local Dcr_CombatMode = false;--是否在自动攻击状态
-------------------------------------------------------------------------------
-- init functions and configuration functions
-------------------------------------------------------------------------------
function Dcr_Init()
SLASH_DECURSIVE1 = DCR_MACRO_COMMAND;
SlashCmdList["DECURSIVE"] = function(msg)
Dcr_Clean();
end
SLASH_DECURSIVESHOW1 = DCR_MACRO_SHOW;
SlashCmdList["DECURSIVESHOW"] = function(msg)
Dcr_ShowHideAfflictedListUI();
end
SLASH_DECURSIVERESET1 = DCR_MACRO_RESET;
SlashCmdList["DECURSIVERESET"] = function(msg)
Dcr_ResetWindow();
end
if not (Dcr_vars.PriorityList
and Dcr_vars.PriorityClassList
and Dcr_vars.SkipList
and Dcr_vars.SkipClassList
and Dcr_vars.QuickPrioList
and Dcr_vars.targetPrioPos) then
Dcr_vars = {
PriorityList = { },
PriorityClassList = { },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -