TotemBar v0.3.0
This commit is contained in:
@@ -59,6 +59,52 @@ function TotemBar.sumActiveCost(activeTotems, elements, now, costFn, remainingFn
|
||||
return total
|
||||
end
|
||||
|
||||
-- Pure: is a KNOWN mana shortfall in front of us? Both halves must be known
|
||||
-- numbers -- an unresolved cost (the normal state until the tooltip scan runs,
|
||||
-- and permanently for a totem that isn't in this character's book) is "I don't
|
||||
-- know", never "too expensive". Greying a bar on "I don't know" would grey the
|
||||
-- whole bar at login; refusing to record a timer on it would silently drop the
|
||||
-- countdown of a totem that is standing. Both callers therefore fail OPEN here,
|
||||
-- the same policy as confidentNoneOut/recallReady in core/cast.lua.
|
||||
function TotemBar.notEnoughMana(cost, mana)
|
||||
if not cost or not mana then
|
||||
return false
|
||||
end
|
||||
return mana < cost
|
||||
end
|
||||
|
||||
-- Clearcasting (Elemental Focus) makes the next damage spell free while the
|
||||
-- tooltip still shows the full price, so every mana verdict has to stand down
|
||||
-- while it is up -- otherwise the bar greys out a totem that casts fine and the
|
||||
-- cast gate drops its timer.
|
||||
--
|
||||
-- Matched by buff ICON, like the out-of-range tint's totem detection (see
|
||||
-- TotemBar.hasBuffWithIcon): 1.12 gives no buff NAME without a tooltip scan per
|
||||
-- buff per check. VERIFY in-game -- if this icon is wrong the only effect is
|
||||
-- that the two features lose their Clearcasting exemption, not that they break.
|
||||
TotemBar.CLEARCAST_ICON = "Spell_Shadow_ManaBurn"
|
||||
|
||||
function TotemBar.hasClearcasting()
|
||||
if not TotemBar.hasBuffWithIcon then
|
||||
return false
|
||||
end
|
||||
return TotemBar.hasBuffWithIcon(TotemBar.CLEARCAST_ICON)
|
||||
end
|
||||
|
||||
-- Live mana verdict for one totem by name: true only when its cost is known,
|
||||
-- the player's mana is below it, and no Clearcasting is up. Reads the cached
|
||||
-- tooltip cost (see getTotemManaCost), so this is a table lookup plus one
|
||||
-- UnitMana call -- cheap enough for the 5Hz display tick that calls it.
|
||||
function TotemBar.totemOutOfMana(name)
|
||||
if not name or type(UnitMana) ~= "function" then
|
||||
return false
|
||||
end
|
||||
if TotemBar.hasClearcasting() then
|
||||
return false
|
||||
end
|
||||
return TotemBar.notEnoughMana(TotemBar.getTotemManaCost(name), UnitMana("player"))
|
||||
end
|
||||
|
||||
-- Pure: floored refund.
|
||||
function TotemBar.refundAmount(pct, activeCost)
|
||||
if not pct or not activeCost then
|
||||
@@ -105,6 +151,21 @@ function TotemBar.isHelpfulTotem(name)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Pure: brings a pfUI-libtotem-reported duration onto the same scale as the
|
||||
-- one recordCast stores. libtotem serves FLAT book durations; own tracking
|
||||
-- applies Totemic Mastery's +20% to helpful totems. ui.lua's timer prefers
|
||||
-- libtotem while it reports the slot active and falls back to own tracking
|
||||
-- once libtotem evicts it -- so at the book duration the display flipped
|
||||
-- source and the countdown jumped back UP (...3, 2, 1, 24) with the duration
|
||||
-- ring re-filling, instead of running out. Scaling both sides by the same
|
||||
-- factor makes them agree on the endpoint.
|
||||
function TotemBar.gtiDurationWithMastery(gtiDuration, gtiName, hasMastery)
|
||||
if not gtiDuration then
|
||||
return nil
|
||||
end
|
||||
return TotemBar.durationWithMastery(gtiDuration, TotemBar.isHelpfulTotem(gtiName), hasMastery)
|
||||
end
|
||||
|
||||
-- ===== WoW-API layer (not offline-executed) =====
|
||||
|
||||
-- TotemBar.findHighestRankSlot(name) used to be defined here as its own
|
||||
|
||||
Reference in New Issue
Block a user