2012-01-01 04:01:18 +01:00
local GetTime = QuestHelper_GetTime
2011-01-28 03:12:26 +01:00
QuestHelper_File [ " collect_hearth.lua " ] = " 4.0.1.$svnversion$ "
QuestHelper_Loadtime [ " collect_hearth.lua " ] = GetTime ( )
local debug_output = false
if QuestHelper_File [ " collect_hearth.lua " ] == " Development Version " then debug_output = true end
local QHCZ
local GetLoc
local Merger
local last_hearth = 0
2011-01-29 02:22:27 +01:00
local function OnZoneChanged ( )
2011-01-28 03:12:26 +01:00
local start , cd , _ = GetItemCooldown ( 6948 )
2012-01-01 03:22:56 +01:00
if last_hearth + 1800 < GetTime ( ) and cd == 1800 then
2011-01-28 03:12:26 +01:00
last_hearth = start
2011-01-29 04:00:43 +01:00
local home = GetBindLocation ( )
if not QHCZ [ home ] then QHCZ [ home ] = { } end
2011-06-19 04:33:02 +02:00
QHCZ [ home ] . Landing = GetLoc ( )
2011-01-28 03:12:26 +01:00
end
end
2011-01-29 03:40:17 +01:00
local GetMonsterType
2011-01-29 02:22:27 +01:00
local function OnConfirmBinder ( ... )
2011-01-29 22:42:50 +01:00
local new_home = ...
2011-01-29 03:40:17 +01:00
if not QHCZ [ new_home ] then QHCZ [ new_home ] = { } end
2011-01-29 02:22:27 +01:00
if not QHCZ [ new_home ] . Innkeeper then QHCZ [ new_home ] . Innkeeper = { } end
2011-01-29 22:45:13 +01:00
QHCZ [ new_home ] . Innkeeper.ID = GetMonsterType ( UnitGUID ( " target " ) )
2011-01-28 03:12:26 +01:00
end
2012-09-26 01:52:08 +02:00
function QH_Collect_Hearth_FactionChange ( QHCData )
2011-01-28 03:12:26 +01:00
if not QHCData.hearth then QHCData.hearth = { } end
QHCZ = QHCData.hearth
2012-09-26 01:52:08 +02:00
end
function QH_Collect_Hearth_Init ( QHCData , API )
QH_Collect_Hearth_FactionChange ( QHCData )
2011-01-29 02:22:27 +01:00
QH_Event ( " ZONE_CHANGED " , OnZoneChanged )
QH_Event ( " ZONE_CHANGED_INDOORS " , OnZoneChanged )
QH_Event ( " ZONE_CHANGED_NEW_AREA " , OnZoneChanged )
QH_Event ( " CONFIRM_BINDER " , OnConfirmBinder )
2011-01-28 03:12:26 +01:00
--API.Registrar_OnUpdateHook(OnUpdate)
GetLoc = API.Callback_LocationBolusCurrent
QuestHelper : Assert ( GetLoc )
Merger = API.Utility_Merger
QuestHelper : Assert ( Merger )
2011-01-29 03:40:17 +01:00
GetMonsterType = API.Utility_GetMonsterType
QuestHelper : Assert ( GetMonsterType )
2011-01-28 03:12:26 +01:00
end