Skip to content

Commit

Permalink
Merge pull request #1 from Zod-/master
Browse files Browse the repository at this point in the history
6.4.3 Release
  • Loading branch information
Zeffuro authored Feb 22, 2017
2 parents 48173d4 + 5b86748 commit 8c2afbe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 16 deletions.
19 changes: 12 additions & 7 deletions Encounters/RMT/Starmap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ mod:RegisterDefaultSetting("MarkDebrisField")
mod:RegisterDefaultSetting("MarkSolarWindTimer")
mod:RegisterDefaultSetting("CrosshairCosmicDebris")
mod:RegisterDefaultSetting("MarkWorldEnder")
mod:RegisterDefaultSetting("MarkWormhole", false)
mod:RegisterDefaultSetting("MarkWormholePosition")
-- Sounds.
mod:RegisterDefaultSetting("CountdownWorldEnder")
mod:RegisterDefaultSetting("SoundWorldEnderSpawn")
Expand Down Expand Up @@ -225,7 +225,7 @@ local CARDINAL_MARKERS = {
}

--Where the Wormhole needs to be places
local WORM_HOLE_POSITION = Vector3.New(-47.13, -96.21, 356.96)
local WORM_HOLE_POSITION = Vector3.New(-47.501198, -96.222008, 354.7)

----------------------------------------------------------------------------------------------------
-- Locals.
Expand Down Expand Up @@ -423,17 +423,21 @@ function mod:OnWorldEnderCreated(id, unit)
mod:StartAsteroidTimer()
mod:DropWorldMarker("WORLD_ENDER_MARKER_" .. worldEnderCount)

if worldEnderCount == 4 and mod:GetSetting("MarkWormhole") then
if worldEnderCount == 3 and mod:GetSetting("MarkWormholePosition") then
mod:SetWorldMarker("WORM_HOLE_POSITION", "mark.worm.hole", WORM_HOLE_POSITION)
elseif worldEnderCount == 4 then
wormHoleId = id
mod:SetWorldMarker("WORM_HOLE_"..id, "mark.worm.hole", WORM_HOLE_POSITION)
end

end

function mod:OnWorldEnderDestroyed(id, unit)
function mod:RemoveWormholePosition(id)
if wormHoleId == id then
mod:DropWorldMarker("WORM_HOLE_"..id)
mod:DropWorldMarker("WORM_HOLE_POSITION")
end
end

function mod:OnWorldEnderDestroyed(id, unit)
mod:RemoveWormholePosition(id)
core:RemoveLineBetweenUnits("WORLD_ENDER_" .. id)
worldEnders[id] = nil
end
Expand Down Expand Up @@ -570,6 +574,7 @@ function mod:OnWorldEnderEnterWormhole(id)
mod:AddMsg("WORLD_ENDER_FALLING", "msg.world_ender.falling", 5, "Beware", "xkcdOrange")
mod:OnWorldEnderTarget(worldEnder, self.L["unit.alpha"])
end
mod:RemoveWormholePosition(id)
end

function mod:OnMidphaseStart()
Expand Down
4 changes: 2 additions & 2 deletions RaidCore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ local next, pcall = next, pcall
-- Constants.
----------------------------------------------------------------------------------------------------
-- Should be 5.23 when replacement tokens will works (see #88 issue).
local RAIDCORE_CURRENT_VERSION = "6.4.1"
local RAIDCORE_CURRENT_VERSION = "6.4.3"
-- Should be deleted.
local ADDON_DATE_VERSION = 17020118
local ADDON_DATE_VERSION = 17022221

-- State Machine.
local MAIN_FSM__SEARCH = 1
Expand Down
4 changes: 2 additions & 2 deletions RaidCore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
</Control>
</Control>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="10" TAnchorPoint="0" TAnchorOffset="220" RAnchorPoint="1" RAnchorOffset="-10" BAnchorPoint="0" BAnchorOffset="280" RelativeToClient="1" Font="Nameplates" Text="Development and issues tracker:" BGColor="UI_WindowBGDefault" TextColor="UI_WindowTextDefault" Template="Default" TooltipType="OnCursor" Name="web_site" TooltipColor="" TextId="">
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="10" TAnchorPoint="0" TAnchorOffset="20" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="1" BAnchorOffset="0" RelativeToClient="1" Font="Nameplates" Text="https://github.com/Zod-/RaidCore" BGColor="UI_WindowBGDefault" TextColor="xkcdClearBlue" Template="Default" TooltipType="OnCursor" Name="url" TooltipColor="" TextId="" Tooltip=""/>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="10" TAnchorPoint="0" TAnchorOffset="20" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="1" BAnchorOffset="0" RelativeToClient="1" Font="Nameplates" Text="https://github.com/NielsH/RaidCore" BGColor="UI_WindowBGDefault" TextColor="xkcdClearBlue" Template="Default" TooltipType="OnCursor" Name="url" TooltipColor="" TextId="" Tooltip=""/>
</Control>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="10" TAnchorPoint="0" TAnchorOffset="280" RAnchorPoint="1" RAnchorOffset="-10" BAnchorPoint="0" BAnchorOffset="407" RelativeToClient="1" Font="Nameplates" Text="" BGColor="UI_WindowBGDefault" TextColor="UI_WindowTextDefault" Template="Default" TooltipType="OnCursor" Name="history" TooltipColor="" TextId="AccountInventory_History">
<Pixie LAnchorPoint="0" LAnchorOffset="10" TAnchorPoint="0" TAnchorOffset="100" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="0" BAnchorOffset="120" Sprite="WhiteFill" BGColor="00000000" TextColor="gray" Rotation="0" Font="Default" Text="- The addon was originally made by Ninjouz of Eugenic, then continue by Kami Nuvini and now by Immé sama." TextId=""/>
Expand Down Expand Up @@ -2345,7 +2345,7 @@
<Event Name="ButtonUncheck" Function="OnButtonCheckBoxSwitched"/>
<Event Name="WindowLoad" Function="OnWindowLoad"/>
</Control>
<Control Class="Button" Base="HologramSprites:HoloCheckBoxBtn" Font="Nameplates" ButtonType="Check" RadioGroup="" LAnchorPoint="0.5" LAnchorOffset="5" TAnchorPoint="0" TAnchorOffset="205" RAnchorPoint="1" RAnchorOffset="-10" BAnchorPoint="0" BAnchorOffset="227" DT_VCENTER="1" DT_CENTER="0" BGColor="UI_BtnBGDefault" TextColor="gray" NormalTextColor="UI_BtnTextDefault" PressedTextColor="UI_BtnTextDefault" FlybyTextColor="UI_BtnTextDefault" PressedFlybyTextColor="UI_BtnTextDefault" DisabledTextColor="UI_BtnTextDefault" TooltipType="OnCursor" Name="Encounters_Starmap_MarkWormhole" TooltipColor="" FocusedTextColor="ffffffff" Text="Mark wormhole location for last phase" TextId="" Template="HologramControl1" DrawAsCheckbox="1" DT_SINGLELINE="1">
<Control Class="Button" Base="HologramSprites:HoloCheckBoxBtn" Font="Nameplates" ButtonType="Check" RadioGroup="" LAnchorPoint="0.5" LAnchorOffset="5" TAnchorPoint="0" TAnchorOffset="205" RAnchorPoint="1" RAnchorOffset="-10" BAnchorPoint="0" BAnchorOffset="227" DT_VCENTER="1" DT_CENTER="0" BGColor="UI_BtnBGDefault" TextColor="gray" NormalTextColor="UI_BtnTextDefault" PressedTextColor="UI_BtnTextDefault" FlybyTextColor="UI_BtnTextDefault" PressedFlybyTextColor="UI_BtnTextDefault" DisabledTextColor="UI_BtnTextDefault" TooltipType="OnCursor" Name="Encounters_Starmap_MarkWormholePosition" TooltipColor="" FocusedTextColor="ffffffff" Text="Mark wormhole location for last phase" TextId="" Template="HologramControl1" DrawAsCheckbox="1" DT_SINGLELINE="1">
<Event Name="ButtonCheck" Function="OnButtonCheckBoxSwitched"/>
<Event Name="ButtonUncheck" Function="OnButtonCheckBoxSwitched"/>
<Event Name="WindowLoad" Function="OnWindowLoad"/>
Expand Down
53 changes: 48 additions & 5 deletions RaidCore_CombatInterface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ local binaryAnd = bit32.band
-- Constants.
----------------------------------------------------------------------------------------------------
local SCAN_PERIOD = 0.1 -- in seconds.
local TRACKED_BUFFS_PERIOD = 0.25 -- in seconds.
-- Array with chat permission.
local CHANNEL_HANDLERS = {
[ChatSystemLib.ChatChannel_Say] = nil,
Expand Down Expand Up @@ -80,10 +81,12 @@ local _bDetectAllEnable = false
local _bUnitInCombatEnable = false
local _bRunning = false
local _tScanTimer = nil
local _tTrackedDebuffTimer = nil
local _CommChannelTimer = nil
local _nCommChannelRetry = 5
local _tAllUnits = {}
local _tTrackedUnits = {}
local _tTrackedBuffs = {}
local _RaidCoreChannelComm = nil
local _nNumShortcuts
local _CI_State
Expand Down Expand Up @@ -331,23 +334,50 @@ function RaidCore:CI_OnBuff(tUnit, tBuff, sMsgBuff, sMsgDebuff)
return sEvent, nUnitId, nSpellId, sName
end

local function UpdateTrackedBuff(sEvent, nUnitId, nSpellId, sName, tBuff)
_tTrackedBuffs[nUnitId..nSpellId] = {
sEvent = sEvent,
nUnitId = nUnitId,
nSpellId = nSpellId,
sName = sName,
tBuff = tBuff,
nEndTime = GetGameTime() + tBuff.fTimeRemaining + TRACKED_BUFFS_PERIOD * 2,
}
end

local function DeleteTrackedBuff(nUnitId, nSpellId)
_tTrackedBuffs[nUnitId..nSpellId] = nil
end

local function DelayFireTrackedDebuff(tTrackedBuff)
local sEvent = RaidCore.E.DEBUFF_REMOVE
if tTrackedBuff.sEvent == RaidCore.E.BUFF_ADD or tTrackedBuff.sEvent == RaidCore.E.BUFF_UPDATE then
sEvent = RaidCore.E.BUFF_REMOVE
end
ManagerCall(sEvent, tTrackedBuff.nUnitId, tTrackedBuff.nSpellId, tTrackedBuff.sName, tTrackedBuff.tBuff.unitCaster)
DeleteTrackedBuff(tTrackedBuff.nUnitId, tTrackedBuff.nSpellId)
end

function RaidCore:CI_OnBuffAdded(tUnit, tBuff)
local sEvent, nUnitId, nSpellId, sName = self:CI_OnBuff(tUnit, tBuff, RaidCore.E.BUFF_ADD, RaidCore.E.DEBUFF_ADD)
if nUnitId then
UpdateTrackedBuff(sEvent, nUnitId, nSpellId, sName, tBuff)
ManagerCall(sEvent, nUnitId, nSpellId, tBuff.nCount, tBuff.fTimeRemaining, sName, tBuff.unitCaster)
end
end

function RaidCore:CI_OnBuffUpdated(tUnit, tBuff)
local sEvent, nUnitId, nSpellId, sName = self:CI_OnBuff(tUnit, tBuff, RaidCore.E.BUFF_UPDATE, RaidCore.E.DEBUFF_UPDATE)
if nUnitId then
UpdateTrackedBuff(sEvent, nUnitId, nSpellId, sName, tBuff)
ManagerCall(sEvent, nUnitId, nSpellId, tBuff.nCount, tBuff.fTimeRemaining, sName, tBuff.unitCaster)
end
end

function RaidCore:CI_OnBuffRemoved(tUnit, tBuff)
local sEvent, nUnitId, nSpellId, sName = self:CI_OnBuff(tUnit, tBuff, RaidCore.E.BUFF_REMOVE, RaidCore.E.DEBUFF_REMOVE)
if nUnitId then
DeleteTrackedBuff(nUnitId, nSpellId)
ManagerCall(sEvent, nUnitId, nSpellId, sName, tBuff.unitCaster)
end
end
Expand Down Expand Up @@ -388,8 +418,10 @@ local function FullActivate(bEnable)
RegisterEventHandler(RaidCore.E.EVENT_BUFF_UPDATED, "CI_OnBuffUpdated", RaidCore)
RegisterEventHandler(RaidCore.E.EVENT_BUFF_REMOVED, "CI_OnBuffRemoved", RaidCore)
_tScanTimer:Start()
_tTrackedDebuffTimer:Start()
elseif _bRunning == true and bEnable == false then
_tScanTimer:Stop()
_tTrackedDebuffTimer:Stop()
RemoveEventHandler(RaidCore.E.EVENT_CHAT_MESSAGE, RaidCore)
RemoveEventHandler(RaidCore.E.EVENT_SHOW_ACTION_BAR_SHORTCUT, RaidCore)
RemoveEventHandler(RaidCore.E.EVENT_BUFF_ADDED, RaidCore)
Expand All @@ -399,6 +431,7 @@ local function FullActivate(bEnable)
-- Clear private data.
_tTrackedUnits = {}
_tAllUnits = {}
_tTrackedBuffs = {}
end
_bRunning = bEnable
end
Expand Down Expand Up @@ -489,6 +522,8 @@ function RaidCore:CombatInterface_Init()
_tTrackedUnits = {}
_tScanTimer = ApolloTimer.Create(SCAN_PERIOD, true, "CI_OnScanUpdate", self)
_tScanTimer:Stop()
_tTrackedDebuffTimer = ApolloTimer.Create(TRACKED_BUFFS_PERIOD, true, "CI_OnCheckTrackedBuffs", self)
_tTrackedDebuffTimer:Stop()

-- Permanent registering.
RegisterEventHandler(RaidCore.E.EVENT_CHANGE_WORLD, "CI_OnChangeWorld", self)
Expand Down Expand Up @@ -618,16 +653,14 @@ function RaidCore:CI_UpdateBuffs(myUnit)
self:HandlePcallResult(s, e)
end

function RaidCore:CI_UpdateCasts(myUnit, nId)
function RaidCore:CI_UpdateCasts(myUnit, nId, nCurrentTime)
-- Process cast tracking.
local bCasting = myUnit.tUnit:IsCasting()
local nCurrentTime
local sCastName
local nCastDuration
local nCastElapsed
local nCastEndTime
if bCasting then
nCurrentTime = GetGameTime()
sCastName = myUnit.tUnit:GetCastName()
nCastDuration = myUnit.tUnit:GetCastDuration()
nCastElapsed = myUnit.tUnit:GetCastElapsed()
Expand Down Expand Up @@ -674,7 +707,7 @@ function RaidCore:CI_UpdateCasts(myUnit, nId)
elseif myUnit.tCast.bCasting then
if not myUnit.tCast.bSuccess then
-- Let's compare with the nCastEndTime
local nThreshold = GetGameTime() + SCAN_PERIOD
local nThreshold = nCurrentTime + SCAN_PERIOD
local bIsInterrupted
if nThreshold < myUnit.tCast.nCastEndTime then
bIsInterrupted = true
Expand Down Expand Up @@ -705,7 +738,17 @@ function RaidCore:CI_UpdateHealth(myUnit, nId)
end
end

function RaidCore:CI_OnCheckTrackedBuffs()
local nCurrentTime = GetGameTime()
for id, tTrackedBuff in next, _tTrackedBuffs do
if tTrackedBuff.nEndTime < nCurrentTime then
DelayFireTrackedDebuff(tTrackedBuff)
end
end
end

function RaidCore:CI_OnScanUpdate()
local nCurrentTime = GetGameTime()
for nId, data in next, _tTrackedUnits do
if data.tUnit:IsValid() then
-- Process name update.
Expand All @@ -715,7 +758,7 @@ function RaidCore:CI_OnScanUpdate()
self:CI_UpdateBuffs(data, nId)
end
if data.bTrackCasts then
self:CI_UpdateCasts(data, nId)
self:CI_UpdateCasts(data, nId, nCurrentTime)
end
if data.bTrackHealth then
self:CI_UpdateHealth(data, nId)
Expand Down

0 comments on commit 8c2afbe

Please sign in to comment.