rename var, throttle bar onUpdate

This commit is contained in:
pepopo978
2025-06-20 10:54:31 -07:00
committed by pmaccamp
parent 8cf7b2e45a
commit 7e81cd7558
4 changed files with 30 additions and 24 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
## Interface: 11200
## Title: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.0
## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.0
## Title: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.1
## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.1
## Author: Pepopo
## Notes: Uses SuperWoW GUIDs to show units in combat and track curses
## Notes-zhCN: 使用SuperWoW的GUID功能来显示战斗中的单位并监视诅咒等
## Version: 1.2.0
## Version: 1.2.1
## SavedVariablesPerCharacter: CursiveDB
## X-Embeds: Ace2, FuBarPlugin-2.0, CompostLib, DewDropLib, TabletLib
+10 -10
View File
@@ -353,7 +353,7 @@ local function passedOptionFilters(guid, options)
return true
end
local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options)
local function pickTarget(selectedPriority, lowercaseSpellNameNoRank, checkRange, options)
-- Curse the target that best matches the selected priority
local highestPrimaryValue = -10
local highestSecondaryValue = -10
@@ -383,7 +383,7 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
local passedRangeCheck = false
if IsSpellInRange then
-- use IsSpellInRange from nampower if available
local result = IsSpellInRange(spellNameNoRank, guid)
local result = IsSpellInRange(lowercaseSpellNameNoRank, guid)
if result == -1 then
passedRangeCheck = checkRange == false or CheckInteractDistance(guid, 4) -- fallback to old range check
else
@@ -396,7 +396,7 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
end
if passedRangeCheck then
-- check if the target has the curse
if not Cursive.curses:HasCurse(spellNameNoRank, guid, refreshTime) and not isMobCrowdControlled(guid) then
if not Cursive.curses:HasCurse(lowercaseSpellNameNoRank, guid, refreshTime) and not isMobCrowdControlled(guid) then
local mobHp = UnitHealth(guid)
if not minHp or mobHp >= minHp then
local primaryValue = -1
@@ -461,18 +461,18 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
-- run again if no target found ignoring range (only if IsSpellInRange is not available)
if not targetedGuid and checkRange == true and not IsSpellInRange then
targetedGuid = pickTarget(selectedPriority, spellNameNoRank, false, options)
targetedGuid = pickTarget(selectedPriority, lowercaseSpellNameNoRank, false, options)
end
return targetedGuid
end
local function castSpellWithOptions(spellName, spellNameNoRank, targetedGuid, options)
local function castSpellWithOptions(spellName, lowercaseSpellNameNoRank, targetedGuid, options)
if options["resistsound"] then
Cursive.curses:EnableResistSound(targetedGuid)
end
if options["expiringsound"] then
Cursive.curses:RequestExpiringSound(spellNameNoRank, targetedGuid)
Cursive.curses:RequestExpiringSound(lowercaseSpellNameNoRank, targetedGuid)
end
CastSpellByName(spellName, targetedGuid)
end
@@ -534,16 +534,16 @@ 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.GetLowercaseSpellNameNoRank(spellName)
local lowercaseSpellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName)
return pickTarget(selectedPriority, spellNameNoRank, true, options)
return pickTarget(selectedPriority, lowercaseSpellNameNoRank, true, options)
end
function Cursive:Multicurse(spellName, priority, options)
local targetedGuid = getSpellTarget(spellName, priority, options)
if targetedGuid then
local spellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName)
castSpellWithOptions(string.lower(spellName), spellNameNoRank, targetedGuid, options)
local lowercaseSpellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName)
castSpellWithOptions(string.lower(spellName), lowercaseSpellNameNoRank, targetedGuid, options)
return true
elseif options["warnings"] then
DEFAULT_CHAT_FRAME:AddMessage(curseNoTarget)
+11 -11
View File
@@ -391,31 +391,31 @@ function curses:EnableResistSound(guid)
curses.resistSoundGuids[guid] = true
end
function curses:EnableExpiringSound(spellNameNoRank, guid)
if curses.requestedExpiringSoundGuids[guid] and curses.requestedExpiringSoundGuids[guid][spellNameNoRank] then
curses.requestedExpiringSoundGuids[guid][spellNameNoRank] = nil
function curses:EnableExpiringSound(lowercaseSpellNameNoRank, guid)
if curses.requestedExpiringSoundGuids[guid] and curses.requestedExpiringSoundGuids[guid][lowercaseSpellNameNoRank] then
curses.requestedExpiringSoundGuids[guid][lowercaseSpellNameNoRank] = nil
end
if not curses.expiringSoundGuids[guid] then
curses.expiringSoundGuids[guid] = {}
end
curses.expiringSoundGuids[guid][spellNameNoRank] = true
curses.expiringSoundGuids[guid][lowercaseSpellNameNoRank] = true
end
function curses:RequestExpiringSound(spellNameNoRank, guid)
function curses:RequestExpiringSound(lowercaseSpellNameNoRank, guid)
if not curses.requestedExpiringSoundGuids[guid] then
curses.requestedExpiringSoundGuids[guid] = {}
end
curses.requestedExpiringSoundGuids[guid][spellNameNoRank] = true
curses.requestedExpiringSoundGuids[guid][lowercaseSpellNameNoRank] = true
end
function curses:HasRequestedExpiringSound(spellNameNoRank, guid)
return curses.requestedExpiringSoundGuids[guid] and curses.requestedExpiringSoundGuids[guid][spellNameNoRank]
function curses:HasRequestedExpiringSound(lowercaseSpellNameNoRank, guid)
return curses.requestedExpiringSoundGuids[guid] and curses.requestedExpiringSoundGuids[guid][lowercaseSpellNameNoRank]
end
function curses:ShouldPlayExpiringSound(spellNameNoRank, guid)
if curses.expiringSoundGuids[guid] and curses.expiringSoundGuids[guid][spellNameNoRank] then
curses.expiringSoundGuids[guid][spellNameNoRank] = nil -- remove entry to avoid playing sound multiple times
function curses:ShouldPlayExpiringSound(lowercaseSpellNameNoRank, guid)
if curses.expiringSoundGuids[guid] and curses.expiringSoundGuids[guid][lowercaseSpellNameNoRank] then
curses.expiringSoundGuids[guid][lowercaseSpellNameNoRank] = nil -- remove entry to avoid playing sound multiple times
return true
end
+6
View File
@@ -181,6 +181,12 @@ ui.BarUpdate = function()
return
end
if (this.tick or 1) > GetTime() then
return
else
this.tick = GetTime() + 0.05
end
-- update statusbar values if it exists
if this.healthBar then
this.healthBar:SetMinMaxValues(0, UnitHealthMax(this.guid))