add LOWEST_HP priority
This commit is contained in:
@@ -21,6 +21,7 @@ L:RegisterTranslations("enUS", function()
|
||||
["/cursive multicurse <spellName:str>|<priority?:str>|<options?:List<str>>: Picks target based on priority and casts spell if not already on target"] = true,
|
||||
["/cursive target <spellName:str>|<priority?:str>|<options?:List<str>>: Targets unit based on priority if spell in range and not already on target"] = true,
|
||||
["Target with the highest HP."] = true,
|
||||
["Target with the lowest HP."] = true,
|
||||
["Target with the highest raid mark."] = true,
|
||||
["Target with the highest raid mark with Cross set to -1 and Skull set to -2 (Square highest prio at 6)."] = true,
|
||||
["Target with the lowest raid mark."] = true,
|
||||
@@ -198,6 +199,7 @@ L:RegisterTranslations("zhCN", function()
|
||||
["/cursive multicurse <spellName:str>|<priority?:str>|<options?:List<str>>: Picks target based on priority and casts spell if not already on target"] = "/cursive multicurse <法术名称>|<优先级>|<选项列表,用半角逗号分隔>: 根据优先级选择目标并施放法术,如果目标上没有",
|
||||
["/cursive target <spellName:str>|<priority?:str>|<options?:List<str>>: Targets unit based on priority if spell in range and not already on target"] = "/cursive target <法术名称>|<优先级>|<选项列表,用半角逗号分隔>:如果法术在范围内且目标上没有此法术,则根据优先级选择目标",
|
||||
["Target with the highest HP."] = "选择生命值最高的目标.",
|
||||
["Target with the lowest HP."] = "选择生命值最低的目标.",
|
||||
["Target with the highest raid mark."] = "选择团队标记最高的目标.",
|
||||
["Target with the highest raid mark with Cross set to -1 and Skull set to -2 (Square highest prio at 6)."] = "选择团队标记最高的目标,但是将红叉设为-1,骷髅设为-2(方块标记最高优先级为6).",
|
||||
["Target with the lowest raid mark."] = "选择团队标记优先级最低的目标.(与RAID_MARK顺序相反)",
|
||||
|
||||
@@ -48,6 +48,7 @@ can also do it only if you don't have a target already:
|
||||
## Priority Options
|
||||
|
||||
- HIGHEST_HP - Target highest HP enemy without a curse first.
|
||||
- LOWEST_HP - Target lowest HP enemy without a curse first.
|
||||
- RAID_MARK - Target largest raid mark enemy without a curse first. Priority is as follows:
|
||||
- Skull = 8 (1st priority)
|
||||
- Cross = 7
|
||||
|
||||
+12
-1
@@ -25,6 +25,7 @@ local commands = {
|
||||
}
|
||||
|
||||
local PRIORITY_HIGHEST_HP = "HIGHEST_HP"
|
||||
local PRIORITY_LOWEST_HP = "LOWEST_HP"
|
||||
local PRIORITY_RAID_MARK = "RAID_MARK"
|
||||
local PRIORITY_RAID_MARK_SQUARE = "RAID_MARK_SQUARE"
|
||||
local PRIORITY_INVERSE_RAID_MARK = "INVERSE_RAID_MARK"
|
||||
@@ -34,6 +35,7 @@ local PRIORITY_HIGHEST_HP_INVERSE_RAID_MARK = "HIGHEST_HP_INVERSE_RAID_MARK"
|
||||
|
||||
local priorities = {
|
||||
[PRIORITY_HIGHEST_HP] = L["Target with the highest HP."],
|
||||
[PRIORITY_LOWEST_HP] = L["Target with the lowest HP."],
|
||||
[PRIORITY_RAID_MARK] = L["Target with the highest raid mark."],
|
||||
[PRIORITY_RAID_MARK_SQUARE] = L["Target with the highest raid mark with Cross set to -1 and Skull set to -2 (Square highest prio at 6)."],
|
||||
[PRIORITY_INVERSE_RAID_MARK] = L["Target with the lowest raid mark."],
|
||||
@@ -339,6 +341,10 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
|
||||
local highestSecondaryValue = -10
|
||||
local targetedGuid = nil
|
||||
|
||||
if selectedPriority == PRIORITY_LOWEST_HP then
|
||||
highestPrimaryValue = 999999999999 -- should be bigger than any mob hp
|
||||
end
|
||||
|
||||
local minHp = options["minhp"]
|
||||
local ignoreInFight = options["allowooc"]
|
||||
local refreshTime = options["refreshtime"]
|
||||
@@ -382,6 +388,8 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
|
||||
primaryValue = 999999999999 -- should be bigger than any mob hp
|
||||
elseif selectedPriority == PRIORITY_HIGHEST_HP then
|
||||
primaryValue = UnitHealth(guid) or 0
|
||||
elseif selectedPriority == PRIORITY_LOWEST_HP then
|
||||
primaryValue = UnitHealth(guid) or 999999999999
|
||||
elseif selectedPriority == PRIORITY_RAID_MARK then
|
||||
primaryValue = GetRaidTargetIndex(guid) or 0
|
||||
elseif selectedPriority == PRIORITY_RAID_MARK_SQUARE then
|
||||
@@ -411,7 +419,10 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
|
||||
primaryValue = UnitHealth(guid) or 0
|
||||
end
|
||||
|
||||
if primaryValue > highestPrimaryValue then
|
||||
if selectedPriority == PRIORITY_LOWEST_HP and primaryValue < highestPrimaryValue then
|
||||
highestPrimaryValue = primaryValue
|
||||
targetedGuid = guid
|
||||
elseif primaryValue > highestPrimaryValue then
|
||||
highestPrimaryValue = primaryValue
|
||||
highestSecondaryValue = secondaryValue
|
||||
targetedGuid = guid
|
||||
|
||||
Reference in New Issue
Block a user