Skip to content

Commit

Permalink
Clean-up: remove deprecated functions from OvaleGUID.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnylam88 committed Apr 10, 2015
1 parent cca91bb commit d33088a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 54 deletions.
26 changes: 13 additions & 13 deletions Aura.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function OvaleAura:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, cleuEvent, hide

local mine = (sourceGUID == self_playerGUID or self_petGUID and sourceGUID == self_petGUID)
if CLEU_AURA_EVENTS[cleuEvent] then
local unitId = OvaleGUID:GetUnitId(destGUID)
local unitId = OvaleGUID:GUIDUnit(destGUID)
if unitId then
-- Only update auras on the unit if it is not a unit type that receives UNIT_AURA events.
if not OvaleGUID.UNIT_AURA_UNIT[unitId] then
Expand Down Expand Up @@ -481,7 +481,7 @@ end

function OvaleAura:UNIT_PET(event, unitId)
if unitId == "player" then
self_petGUID = OvaleGUID:GetGUID("pet")
self_petGUID = OvaleGUID:UnitGUID("pet")
end
end

Expand All @@ -496,7 +496,7 @@ function OvaleAura:RemoveAurasOnInactiveUnits()
-- Remove all auras from GUIDs that can no longer be referenced by a unit ID,
-- i.e., not in the group or not targeted by anyone in the group or focus.
for guid in pairs(self.aura) do
local unitId = OvaleGUID:GetUnitId(guid)
local unitId = OvaleGUID:GUIDUnit(guid)
if not unitId then
self:Debug("Removing auras from GUID %s", guid)
RemoveAurasOnGUID(self.aura, guid)
Expand Down Expand Up @@ -707,7 +707,7 @@ end
-- Scan auras on the given GUID and update the aura database.
function OvaleAura:ScanAuras(unitId, guid)
self:StartProfiling("OvaleAura_ScanAuras")
guid = guid or OvaleGUID:GetGUID(unitId)
guid = guid or OvaleGUID:UnitGUID(unitId)
if guid then
self:DebugTimestamp("Scanning auras on %s (%s)", guid, unitId)

Expand All @@ -732,7 +732,7 @@ function OvaleAura:ScanAuras(unitId, guid)
break
end
else
local casterGUID = OvaleGUID:GetGUID(unitCaster)
local casterGUID = OvaleGUID:UnitGUID(unitCaster)
if debuffType == "" then
-- Empty string for the debuff type means this is an Enrage effect.
debuffType = "Enrage"
Expand Down Expand Up @@ -768,7 +768,7 @@ end
function OvaleAura:GetAuraByGUID(guid, auraId, filter, mine)
-- If this GUID has no auras in the database, then do an aura scan.
if not self.serial[guid] then
local unitId = OvaleGUID:GetUnitId(guid)
local unitId = OvaleGUID:GUIDUnit(guid)
self:ScanAuras(unitId, guid)
end

Expand All @@ -787,7 +787,7 @@ function OvaleAura:GetAuraByGUID(guid, auraId, filter, mine)
end

function OvaleAura:GetAura(unitId, auraId, filter, mine)
local guid = OvaleGUID:GetGUID(unitId)
local guid = OvaleGUID:UnitGUID(unitId)
return self:GetAuraByGUID(guid, auraId, filter, mine)
end

Expand Down Expand Up @@ -819,7 +819,7 @@ function OvaleAura:RequireBuffHandler(spellId, atTime, requirement, tokens, inde
if strsub(requirement, 1, 7) == "target_" then
if targetGUID then
guid = targetGUID
unitId = OvaleGUID:GetUnitId(guid)
unitId = OvaleGUID:GUIDUnit(guid)
else
unitId = self.defaultTarget or "target"
end
Expand All @@ -834,7 +834,7 @@ function OvaleAura:RequireBuffHandler(spellId, atTime, requirement, tokens, inde
filter = (strsub(requirement, 1, 4) == "buff") and "HELPFUL" or "HARMFUL"
mine = not (strsub(requirement, -4) == "_any")
end
guid = guid or OvaleGUID:GetGUID(unitId)
guid = guid or OvaleGUID:UnitGUID(unitId)
local aura = self:GetAuraByGUID(guid, buffName, filter, mine)
local isActiveAura = self:IsActiveAura(aura, atTime) and aura.stacks >= stacks
if not isBang and isActiveAura or isBang and not isActiveAura then
Expand Down Expand Up @@ -1161,7 +1161,7 @@ do

statePrototype.DebugUnitAuras = function(state, unitId, filter)
wipe(array)
local guid = OvaleGUID:GetGUID(unitId)
local guid = OvaleGUID:UnitGUID(unitId)
if OvaleAura.aura[guid] then
for auraId, whoseTable in pairs(OvaleAura.aura[guid]) do
for casterGUID in pairs(whoseTable) do
Expand Down Expand Up @@ -1400,7 +1400,7 @@ statePrototype.GetAuraByGUID = function(state, guid, auraId, filter, mine)
end

statePrototype.GetAura = function(state, unitId, auraId, filter, mine)
local guid = OvaleGUID:GetGUID(unitId)
local guid = OvaleGUID:UnitGUID(unitId)
return state:GetAuraByGUID(guid, auraId, filter, mine)
end

Expand Down Expand Up @@ -1451,7 +1451,7 @@ end
statePrototype.GetAuraWithProperty = function(state, unitId, propertyName, filter, atTime)
atTime = atTime or state.currentTime
local count = 0
local guid = OvaleGUID:GetGUID(unitId)
local guid = OvaleGUID:UnitGUID(unitId)
local start, ending = INFINITY, 0

-- Loop through auras not kept in the simulator that match the criteria.
Expand Down Expand Up @@ -1531,7 +1531,7 @@ do
stacks = 0
startChangeCount, endingChangeCount = INFINITY, INFINITY
startFirst, endingLast = INFINITY, 0
local excludeGUID = excludeUnitId and OvaleGUID:GetGUID(excludeUnitId) or nil
local excludeGUID = excludeUnitId and OvaleGUID:UnitGUID(excludeUnitId) or nil

-- Loop through auras not kept in the simulator that match the criteria.
for guid, auraTable in pairs(OvaleAura.aura) do
Expand Down
2 changes: 1 addition & 1 deletion BestAction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ local function GetActionSpellInfo(element, state, atTime, target)

local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
actionUsable, actionShortcut, actionIsCurrent, actionEnable, actionType, actionId
local targetGUID = OvaleGUID:GetGUID(target)
local targetGUID = OvaleGUID:UnitGUID(target)

local spellId = element.positionalParams[1]
local si = OvaleData.spellInfo[spellId]
Expand Down
2 changes: 1 addition & 1 deletion Cooldown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ statePrototype.GetGCD = function(state, spellId, atTime, targetGUID)
atTime = state.currentTime
end
end
targetGUID = targetGUID or OvaleGUID:GetGUID(state.defaultTarget)
targetGUID = targetGUID or OvaleGUID:UnitGUID(state.defaultTarget)

local gcd = spellId and state:GetSpellInfoProperty(spellId, atTime, "gcd", targetGUID)
if not gcd then
Expand Down
8 changes: 4 additions & 4 deletions Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ end
-- Check "run-time" requirements specified in SpellRequire().
-- NOTE: Mirrored in statePrototype below.
function OvaleData:CheckRequirements(spellId, atTime, tokens, index, targetGUID)
targetGUID = targetGUID or OvaleGUID:GetGUID(self.defaultTarget or "target")
targetGUID = targetGUID or OvaleGUID:UnitGUID(self.defaultTarget or "target")
local name = tokens[index]
index = index + 1
if name then
Expand Down Expand Up @@ -401,7 +401,7 @@ end
NOTE: Mirrored in statePrototype below.
--]]
function OvaleData:CheckSpellAuraData(auraId, spellData, atTime, guid)
guid = guid or OvaleGUID:GetGUID("player")
guid = guid or OvaleGUID:UnitGUID("player")
local index, value, data
if type(spellData) == "table" then
-- Comma-separated value.
Expand Down Expand Up @@ -449,7 +449,7 @@ end
-- Check "run-time" requirements specified in SpellInfo().
-- NOTE: Mirrored in statePrototype below.
function OvaleData:CheckSpellInfo(spellId, atTime, targetGUID)
targetGUID = targetGUID or OvaleGUID:GetGUID(self.defaultTarget or "target")
targetGUID = targetGUID or OvaleGUID:UnitGUID(self.defaultTarget or "target")
local verified = true
local requirement
for name, handler in pairs(self_requirement) do
Expand All @@ -471,7 +471,7 @@ end
-- Get SpellInfo property with run-time checks as specified in SpellRequire().
-- NOTE: Mirrored in statePrototype below.
function OvaleData:GetSpellInfoProperty(spellId, atTime, property, targetGUID)
targetGUID = targetGUID or OvaleGUID:GetGUID(self.defaultTarget or "target")
targetGUID = targetGUID or OvaleGUID:UnitGUID(self.defaultTarget or "target")
local si = OvaleData.spellInfo[spellId]
local value = si and si[property]
local requirements = si and si.require[property]
Expand Down
2 changes: 1 addition & 1 deletion Frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ do
if (node.namedParams.size ~= "small" and not node.namedParams.nocd and profile.apparence.predictif) then
if start then
state:Log("****Second icon %s", start)
state:ApplySpell(actionId, OvaleGUID:GetGUID(actionTarget), start)
state:ApplySpell(actionId, OvaleGUID:UnitGUID(actionTarget), start)
local atTime = state.nextCast
if actionId ~= state.lastGCDSpellId then
-- The previous spell cast did not trigger the GCD, so compute the next action at the current time.
Expand Down
28 changes: 0 additions & 28 deletions GUID.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ OvaleGUID.nameUnit = {}
OvaleGUID.guidName = {}
OvaleGUID.nameGUID = {}

-- Deprecated: legacy mapping from name to GUID.
OvaleGUID.nameToGUID = {}

-- Export UNIT_AURA_UNIT table of units that receive UNIT_AURA events.
OvaleGUID.UNIT_AURA_UNIT = UNIT_AURA_UNIT
--</public-static-properties>
Expand Down Expand Up @@ -342,12 +339,6 @@ function OvaleGUID:UpdateUnit(unitId)
end
end
end
-- Deprecated: legacy mapping from name to GUID.
if not self.nameToGUID[name] then
if guid and guid ~= previousGUID and name and (unitId == "target" or self.unitGUID.target ~= guid) then
self.nameToGUID[name] = guid
end
end
end

function OvaleGUID:UpdateUnitWithTarget(unitId)
Expand Down Expand Up @@ -402,23 +393,4 @@ function OvaleGUID:NameGUID(name)
end
return nil
end

--[[
Deprecated: old method names.
function OvaleGUID:GetGUID(unitId) end
function OvaleGUID:GetUnitId(guid) end
function OvaleGUID:GetGUIDForName(name) end
function OvaleGUID:GetUnitIdForName(name) end
--]]
OvaleGUID.GetGUID = OvaleGUID.UnitGUID
OvaleGUID.GetUnitId = OvaleGUID.GUIDUnit
OvaleGUID.GetUnitIdForName = OvaleGUID.NameUnit

function OvaleGUID:GetGUIDForName(name)
if name then
return self.nameToGUID[name]
end
return nil
end
--</public-static-methods>
12 changes: 6 additions & 6 deletions conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ do
local comparator, limit = positionalParams[1], positionalParams[2]
local target = ParseCondition(positionalParams, namedParams, state, "target")
if state.lastSpellId then
local duration = state:GetGCD(state.lastSpellId, atTime, OvaleGUID:GetGUID(target))
local duration = state:GetGCD(state.lastSpellId, atTime, OvaleGUID:UnitGUID(target))
local start = state.startCast
local ending = start + duration
return TestValue(start, INFINITY, 0, ending, -1, comparator, limit)
Expand Down Expand Up @@ -2632,7 +2632,7 @@ do
local function PersistentMultiplier(positionalParams, namedParams, state, atTime)
local spellId, comparator, limit = positionalParams[1], positionalParams[2], positionalParams[3]
local target = ParseCondition(positionalParams, namedParams, state, "target")
local value = state:GetDamageMultiplier(spellId, OvaleGUID:GetGUID(target), atTime)
local value = state:GetDamageMultiplier(spellId, OvaleGUID:UnitGUID(target), atTime)
return Compare(value, comparator, limit)
end

Expand Down Expand Up @@ -4206,7 +4206,7 @@ do
if OvaleCondition.COMPARATOR[spellId] then
comparator, limit = spellId, positionalParams[i + 1]
break
elseif not usable or state:IsUsableSpell(spellId, atTime, OvaleGUID:GetGUID(target)) then
elseif not usable or state:IsUsableSpell(spellId, atTime, OvaleGUID:UnitGUID(target)) then
local start, duration = state:GetSpellCooldown(spellId)
local t = 0
if start > 0 and duration > 0 then
Expand Down Expand Up @@ -4324,7 +4324,7 @@ do
local function SpellUsable(positionalParams, namedParams, state, atTime)
local spellId, yesno = positionalParams[1], positionalParams[2]
local target = ParseCondition(positionalParams, namedParams, state, "target")
local isUsable, noMana = state:IsUsableSpell(spellId, atTime, OvaleGUID:GetGUID(target))
local isUsable, noMana = state:IsUsableSpell(spellId, atTime, OvaleGUID:UnitGUID(target))
local boolean = isUsable or noMana
return TestBoolean(boolean, yesno)
end
Expand Down Expand Up @@ -4821,7 +4821,7 @@ do
local _, pt = OvalePower:GetSpellCost(spellId)
powerType = pt
end
local seconds = state:TimeToPower(spellId, atTime, OvaleGUID:GetGUID(target), powerType)
local seconds = state:TimeToPower(spellId, atTime, OvaleGUID:UnitGUID(target), powerType)

if seconds == 0 then
return Compare(0, comparator, limit)
Expand Down Expand Up @@ -4883,7 +4883,7 @@ do
local function TimeToSpell(positionalParams, namedParams, state, atTime)
local spellId, comparator, limit = positionalParams[1], positionalParams[2], positionalParams[3]
local target = ParseCondition(positionalParams, namedParams, state, "target")
local seconds = state:GetTimeToSpell(spellId, atTime, OvaleGUID:GetGUID(target))
local seconds = state:GetTimeToSpell(spellId, atTime, OvaleGUID:UnitGUID(target))
if seconds == 0 then
return Compare(0, comparator, limit)
elseif seconds < INFINITY then
Expand Down

0 comments on commit d33088a

Please sign in to comment.