add gettarget command that returns guid of mob it would target
This commit is contained in:
+3
-3
@@ -1,10 +1,10 @@
|
||||
## Interface: 11200
|
||||
## Title: [|CFF33AAFFSUPERWOW|R] Cursive 1.1.0
|
||||
## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 1.1.0
|
||||
## Title: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.0
|
||||
## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.0
|
||||
## Author: Pepopo
|
||||
## Notes: Uses SuperWoW GUIDs to show units in combat and track curses
|
||||
## Notes-zhCN: 使用SuperWoW的GUID功能来显示战斗中的单位并监视诅咒等
|
||||
## Version: 1.1.0
|
||||
## Version: 1.2.0
|
||||
## SavedVariablesPerCharacter: CursiveDB
|
||||
## X-Embeds: Ace2, FuBarPlugin-2.0, CompostLib, DewDropLib, TabletLib
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ EXAMPLE: `/cursive target Icicles|HIGHEST_HP` will target the enemy with the hig
|
||||
can also do it only if you don't have a target already:
|
||||
`/run if not UnitName("target") then SlashCmdList.CURSIVE("target Icicles|HIGHEST_HP") end`
|
||||
|
||||
`/cursive gettarget <spellName:str>|<priority?:str>|<options?:comma separated str>`: Returns guid of the unit that would be targeted based on priority and options.
|
||||
|
||||
EXAMPLE: `/cursive gettarget Corruption|HIGHEST_HP` will return guid of the enemy with the highest HP in range of the spell Corruption that doesn't already have Corruption.
|
||||
|
||||
## Priority Options
|
||||
|
||||
- HIGHEST_HP - Target highest HP enemy without a curse first.
|
||||
|
||||
+20
-6
@@ -89,7 +89,7 @@ end
|
||||
local function handleSlashCommands(msg, editbox)
|
||||
if not msg or msg == "" then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(curseCommands)
|
||||
for command, description in pairs(commands) do
|
||||
for _, description in pairs(commands) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(description)
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(priorityChoices)
|
||||
@@ -117,6 +117,16 @@ local function handleSlashCommands(msg, editbox)
|
||||
local spellName, priority, optionsStr = Cursive.utils.strsplit("|", args)
|
||||
local options = parseOptions(optionsStr)
|
||||
Cursive:Target(spellName, priority, options)
|
||||
elseif command == "gettarget" then
|
||||
local spellName, optionsStr = Cursive.utils.strsplit("|", args)
|
||||
local options = parseOptions(optionsStr)
|
||||
Cursive:GetSpellTarget(spellName, options)
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00Cursive:|cffffaaaa Unknown command."])
|
||||
DEFAULT_CHAT_FRAME:AddMessage(curseCommands)
|
||||
for _, description in pairs(commands) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(description)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -499,10 +509,10 @@ function Cursive:Curse(spellName, targetedGuid, options)
|
||||
end
|
||||
|
||||
-- remove (Rank x) from spellName if it exists
|
||||
local spellNameNoRank = Cursive.utils.GetSpellNameNoRank(spellName)
|
||||
local lowercaseSpellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName)
|
||||
|
||||
if targetedGuid and not Cursive.curses:HasCurse(spellNameNoRank, targetedGuid, options["refreshtime"]) and not isMobCrowdControlled(targetedGuid) then
|
||||
castSpellWithOptions(string.lower(spellName), spellNameNoRank, targetedGuid, options)
|
||||
if targetedGuid and not Cursive.curses:HasCurse(lowercaseSpellNameNoRank, targetedGuid, options["refreshtime"]) and not isMobCrowdControlled(targetedGuid) then
|
||||
castSpellWithOptions(string.lower(spellName), lowercaseSpellNameNoRank, targetedGuid, options)
|
||||
return true
|
||||
elseif options["warnings"] then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(curseNoTarget)
|
||||
@@ -528,7 +538,7 @@ local function getSpellTarget(spellName, priority, options)
|
||||
local selectedPriority = priority or PRIORITY_HIGHEST_HP
|
||||
|
||||
-- remove (Rank x) from spellName if it exists
|
||||
local spellNameNoRank = Cursive.utils.GetSpellNameNoRank(spellName)
|
||||
local spellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName)
|
||||
|
||||
return pickTarget(selectedPriority, spellNameNoRank, true, options)
|
||||
end
|
||||
@@ -536,7 +546,7 @@ end
|
||||
function Cursive:Multicurse(spellName, priority, options)
|
||||
local targetedGuid = getSpellTarget(spellName, priority, options)
|
||||
if targetedGuid then
|
||||
local spellNameNoRank = Cursive.utils.GetSpellNameNoRank(spellName)
|
||||
local spellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName)
|
||||
castSpellWithOptions(string.lower(spellName), spellNameNoRank, targetedGuid, options)
|
||||
return true
|
||||
elseif options["warnings"] then
|
||||
@@ -545,6 +555,10 @@ function Cursive:Multicurse(spellName, priority, options)
|
||||
return false
|
||||
end
|
||||
|
||||
function Cursive:GetTarget(spellName, priority, options)
|
||||
return getSpellTarget(spellName, priority, options)
|
||||
end
|
||||
|
||||
function Cursive:Target(spellName, priority, options)
|
||||
local targetedGuid = getSpellTarget(spellName, priority, options)
|
||||
if targetedGuid then
|
||||
|
||||
+6
-6
@@ -438,19 +438,19 @@ function curses:HasAnyCurse(guid)
|
||||
return nil
|
||||
end
|
||||
|
||||
function curses:HasCurse(spellName, targetGuid, minRemaining)
|
||||
function curses:HasCurse(lowercaseSpellNameNoRank, targetGuid, minRemaining)
|
||||
if not minRemaining then
|
||||
minRemaining = 0 -- default to 0
|
||||
end
|
||||
|
||||
-- handle faerie fire special case
|
||||
if curses.isDruid and string.find(spellName, L["faerie fire"]) then
|
||||
if curses.isDruid and string.find(lowercaseSpellNameNoRank, L["faerie fire"]) then
|
||||
-- remove (feral) or (bear) from spell name
|
||||
spellName = L["faerie fire"]
|
||||
lowercaseSpellNameNoRank = L["faerie fire"]
|
||||
end
|
||||
|
||||
if curses.guids[targetGuid] and curses.guids[targetGuid][spellName] then
|
||||
local remaining = Cursive.curses:TimeRemaining(curses.guids[targetGuid][spellName])
|
||||
if curses.guids[targetGuid] and curses.guids[targetGuid][lowercaseSpellNameNoRank] then
|
||||
local remaining = Cursive.curses:TimeRemaining(curses.guids[targetGuid][lowercaseSpellNameNoRank])
|
||||
if remaining > minRemaining then
|
||||
return true
|
||||
end
|
||||
@@ -461,7 +461,7 @@ function curses:HasCurse(spellName, targetGuid, minRemaining)
|
||||
curses.pendingCast.targetGuid == targetGuid and
|
||||
curses.pendingCast.spellID and
|
||||
curses.trackedCurseIds[curses.pendingCast.spellID] and
|
||||
curses.trackedCurseIds[curses.pendingCast.spellID].name == spellName then
|
||||
curses.trackedCurseIds[curses.pendingCast.spellID].name == lowercaseSpellNameNoRank then
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user