diff --git a/QuestHelper/collect_hearth.lua b/QuestHelper/collect_hearth.lua index d2555fd..df350f6 100644 --- a/QuestHelper/collect_hearth.lua +++ b/QuestHelper/collect_hearth.lua @@ -11,7 +11,7 @@ local Merger local last_hearth = 0 -local function CollectHearth() +local function OnZoneChanged() local start, cd, _ = GetItemCooldown(6948) if last_hearth + 1800 < GetTime() and cd == 1800 then last_hearth = start @@ -19,18 +19,23 @@ local function CollectHearth() end end -local function OnEvent() --- DoZoneUpdate("border", true) - CollectHearth() +local function OnConfirmBinder(...) + local new_home = unpack(...) + if not QHCZ[new_home].Innkeeper then QHCZ[new_home].Innkeeper = {} end + QHCZ[new_home].Innkeeper.Name = UnitName("target") + if not QHCZ[new_home].Innkeeper.Loc then QHCZ[new_home].Innkeeper.Loc = {} end + table.insert(QHCZ[new_home].Innkeeper.Loc, GetLoc()) + QuestHelper:TextOut(UnitName("target") .. " wants to set your hearth location to " .. new_home) end function QH_Collect_Hearth_Init(QHCData, API) if not QHCData.hearth then QHCData.hearth = {} end QHCZ = QHCData.hearth - QH_Event("ZONE_CHANGED", OnEvent) - QH_Event("ZONE_CHANGED_INDOORS", OnEvent) - QH_Event("ZONE_CHANGED_NEW_AREA", OnEvent) + QH_Event("ZONE_CHANGED", OnZoneChanged) + QH_Event("ZONE_CHANGED_INDOORS", OnZoneChanged) + QH_Event("ZONE_CHANGED_NEW_AREA", OnZoneChanged) + QH_Event("CONFIRM_BINDER", OnConfirmBinder) --API.Registrar_OnUpdateHook(OnUpdate)