Automated update from: http://smariot.no-ip.org/translate
[QuestHelper.git] / collect_zone.lua
blob99e90c680ca99b906bab57cbe4baca78293d5ce7
1 QuestHelper_File["collect_zone.lua"] = "Development Version"
2 QuestHelper_Loadtime["collect_zone.lua"] = GetTime()
4 local debug_output = false
5 if QuestHelper_File["collect_zone.lua"] == "Development Version" then debug_output = true end
7 local QHCZ
9 local GetLoc
10 local Merger
12 local function DoZoneUpdate(label, debugverbose)
13 local zname = string.format("%s@@%s@@%s", GetZoneText(), GetRealZoneText(), GetSubZoneText()) -- I don't *think* any zones will have a @@ in them :D
14 if zname == "@@@@" then return end -- denied
15 if not QHCZ[zname] then QHCZ[zname] = {} end
16 if not QHCZ[zname][label] then QHCZ[zname][label] = {} end
17 local znl = QHCZ[zname][label]
19 if debugverbose and debug_output then
20 --QuestHelper:TextOut("zoneupdate " .. zname .. " type " .. label)
21 end
23 QHCZ[zname].mapname = GetMapInfo()
25 local loc = GetLoc()
26 if loc == "€\000\000\000\000\000\000€€€" then return end -- this is kind of the "null value"
28 Merger.Add(znl, loc, true)
29 end
31 local function OnEvent()
32 DoZoneUpdate("border", true)
33 end
35 local lastupdate = 0
36 local function OnUpdate()
37 if lastupdate + 15 <= GetTime() then
38 DoZoneUpdate("update")
39 lastupdate = GetTime()
40 end
41 end
43 function QH_Collect_Zone_Init(QHCData, API)
44 do return end -- we really don't need this anymore
46 if not QHCData.zone then QHCData.zone = {} end
47 QHCZ = QHCData.zone
49 QH_Event("ZONE_CHANGED", OnEvent)
50 QH_Event("ZONE_CHANGED_INDOORS", OnEvent)
51 QH_Event("ZONE_CHANGED_NEW_AREA", OnEvent)
53 API.Registrar_OnUpdateHook(OnUpdate)
55 GetLoc = API.Callback_LocationBolusCurrent
56 QuestHelper: Assert(GetLoc)
58 Merger = API.Utility_Merger
59 QuestHelper: Assert(Merger)
60 end