1
0
Bifurcation 0

Added an assertion to help diagnose the repeated rearing of the 'Coord[1] = 181' error. Created a collector for hearthing.

Cette révision appartient à :
Nathanial.C.Jones 2011-01-28 02:12:26 +00:00
Parent a5cdb3dd52
révision 79b7c7b378
8 fichiers modifiés avec 120 ajouts et 35 suppressions

Voir le fichier

@ -213,6 +213,7 @@ collect_lzw.lua
collect_traveled.lua
collect_location.lua
collect_zone.lua
collect_hearth.lua
collect_merger.lua
collect_monster.lua
collect_item.lua

74
QuestHelper/collect_hearth.lua Fichier normal
Voir le fichier

@ -0,0 +1,74 @@
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 function DoZoneUpdate(label, debugverbose)
local zname = string.format("%s@@%s@@%s", GetZoneText(), GetRealZoneText(), GetSubZoneText()) -- I don't *think* any zones will have a @@ in them :D
if zname == "@@@@" then return end -- denied
if not QHCZ[zname] then QHCZ[zname] = {} end
if not QHCZ[zname][label] then QHCZ[zname][label] = {} end
local znl = QHCZ[zname][label]
if debugverbose and debug_output then
--QuestHelper:TextOut("zoneupdate " .. zname .. " type " .. label)
end
QHCZ[zname].mapname = GetMapInfo()
local loc = GetLoc()
if loc.delayed == 128 and loc.c == 0 and loc.z == 0 and loc.x == -128 and loc.y == -128 then return end
--if loc == "€\000\000\000€\000\000\000€€€" then return end -- this is kind of the "null value"
local found = false
-- Commented out, 'cause this module isn't really loaded anymore. I'll remove it after the next commit.
--Merger.Add(znl, loc, true)
end
local last_hearth = 0
local function CollectHearth()
local start, cd, _ = GetItemCooldown(6948)
if last_hearth + 1800 < GetTime() and cd == 1800 then
last_hearth = start
QHCZ[GetBindLocation()] = GetLoc()
end
end
local function OnEvent()
-- DoZoneUpdate("border", true)
CollectHearth()
end
local lastupdate = 0
local function OnUpdate()
if lastupdate + 15 <= GetTime() then
DoZoneUpdate("update")
lastupdate = GetTime()
end
end
function QH_Collect_Zone_Init(QHCData, API)
do return end -- we really don't need this anymore
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)
--API.Registrar_OnUpdateHook(OnUpdate)
GetLoc = API.Callback_LocationBolusCurrent
QuestHelper: Assert(GetLoc)
Merger = API.Utility_Merger
QuestHelper: Assert(Merger)
end

Voir le fichier

@ -9,51 +9,32 @@ local QHCZ
local GetLoc
local Merger
local function DoZoneUpdate(label, debugverbose)
local zname = string.format("%s@@%s@@%s", GetZoneText(), GetRealZoneText(), GetSubZoneText()) -- I don't *think* any zones will have a @@ in them :D
if zname == "@@@@" then return end -- denied
if not QHCZ[zname] then QHCZ[zname] = {} end
if not QHCZ[zname][label] then QHCZ[zname][label] = {} end
local znl = QHCZ[zname][label]
if debugverbose and debug_output then
--QuestHelper:TextOut("zoneupdate " .. zname .. " type " .. label)
local last_hearth = 0
local function CollectHearth()
local start, cd, _ = GetItemCooldown(6948)
if last_hearth + 1800 < GetTime() and cd == 1800 then
last_hearth = start
QHCZ[GetBindLocation()] = GetLoc()
end
QHCZ[zname].mapname = GetMapInfo()
local loc = GetLoc()
if loc.delayed == 128 and loc.c == 0 and loc.z == 0 and loc.x == -128 and loc.y == -128 then return end
--if loc == "€\000\000\000€\000\000\000€€€" then return end -- this is kind of the "null value"
local found = false
-- Commented out, 'cause this module isn't really loaded anymore. I'll remove it after the next commit.
--Merger.Add(znl, loc, true)
end
local function OnEvent()
DoZoneUpdate("border", true)
-- DoZoneUpdate("border", true)
CollectHearth()
end
local lastupdate = 0
local function OnUpdate()
if lastupdate + 15 <= GetTime() then
DoZoneUpdate("update")
lastupdate = GetTime()
end
end
function QH_Collect_Zone_Init(QHCData, API)
function QH_Collect_Hearth_Init(QHCData, API)
do return end -- we really don't need this anymore
if not QHCData.zone then QHCData.zone = {} end
QHCZ = QHCData.zone
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)
API.Registrar_OnUpdateHook(OnUpdate)
--API.Registrar_OnUpdateHook(OnUpdate)
GetLoc = API.Callback_LocationBolusCurrent
QuestHelper: Assert(GetLoc)

Voir le fichier

@ -153,7 +153,7 @@ local elders = {
["Bellowrage"] = {33, 54, 49}, --"Blasted Lands 54 49",
["Rumblerock"] = {40, 70, 45}, --"Burning Steppes 70 45",
["Dawnstrider"] = {40, 53, 24}, --"Burning Steppes 53 24",
["Goldwell"] = {28, 53, 49}, --"Dun Morogh 53 49",
["Goldwell"] = {28, 53.9, 49.9}, --"Dun Morogh 53 49",
["Windrun"] = {34, 35.6, 68.8}, --"Eastern Plaguelands 35 68",
["Snowcrown"] = {34, 75.7, 54.5}, --"Eastern Plaguelands 75.7 54.5",
["Stormbrow"] = {37, 40, 63}, --"Elwynn Forest 40 63",
@ -165,7 +165,7 @@ local elders = {
["Winterhoof"] = {38, 37, 39}, --"Stranglethorn Vale 37 79", -- Cape 39 72
["Graveborn"] = {43, 61, 53}, --"Tirisfal Glades 61 53",
["Moonstrike"] = {50, 69, 73}, --"Western Plaguelands 69 73",
["Meadowrun"] = {50, 63, 36}, --"Western Plaguelands 63 36",
["Meadowrun"] = {50, 63.5, 36.2}, --"Western Plaguelands 63 36",
["Skychaser"] = {49, 56, 47}, --"Westfall 56 47"
},
["Northrend"] = {

Voir le fichier

@ -733,6 +733,13 @@ To donate, open up your web browser and go to |cffff8000http://www.quest-helper.
Thanks!]], "Please Donate!", 500, 20, 10)
end
function pos(qh, arg)
local part1 = qh:LocationString(qh.i, qh.x, qh.y)
local part2 = qh:Location_RawString(qh:Location_RawRetrieve())
local part3 = qh:Location_AbsoluteString(qh:Location_AbsoluteRetrieve())
qh:TextOut(string.format("%s %s %s", part1, part2, part3))
end
commands =
{
{ "Common commands", {
@ -941,7 +948,7 @@ commands =
{"POS",
"Prints the player's current position. Exists mainly for my own personal convenience.",
{}, function (qh) qh:TextOut(qh:LocationString(qh.i, qh.x, qh.y) .. " " .. qh:Location_RawString(qh:Location_RawRetrieve()) .. " " .. qh:Location_AbsoluteString(qh:Location_AbsoluteRetrieve())) end, QuestHelper},
{}, pos, QuestHelper},
}},
{ "Help", {

Voir le fichier

@ -290,6 +290,7 @@ QH_Event("ADDON_LOADED", function (addonid)
["collect_lzw.lua"] = true,
["collect_traveled.lua"] = true,
["collect_zone.lua"] = true,
["collect_hearth.lua"] = true,
["collect_location.lua"] = true,
["collect_merger.lua"] = true,
["collect_monster.lua"] = true,

Voir le fichier

@ -28,15 +28,33 @@ local function wraptime(ident, func, ...)
local qhh_adj = 0
if qh_loud_and_annoying then
qhh_nmf = QH_Hook_NotMyFault
--[[
Function nesting == OMFG NO!
What seems to be happening here is that we are setting QH_HOOK_NotMyFault
to be an anonymous function, which returns the result of an internal
anonymous function, which takes the result of func as its argument, does
some work with the outer function's variables and spits its arguments
back out unmodified.
The fix so far...
We can set a variable to represent the result of func, do our data
manipulation and then return the contents of the temp variable.
SO MUCH PRETTIER! AND EASIER TO READ TO BOOT!
--]]
QH_Hook_NotMyFault = function(func, ...)
local zst = GetTime()
local ret = {func(...)}
qhh_adj = qhh_adj + (GetTime() - zst)
return unpack(ret)
--print("a", GetTime())
--[[
return (function(...)
--print("c", GetTime(), GetTime() - zst, qhh_adj)
qhh_adj = qhh_adj + (GetTime() - zst)
--print(qhh_adj)
return ...
end)(func(...))
--]]
end
st = GetTime()
end

Voir le fichier

@ -300,6 +300,9 @@ function load_graph_links()
coord[1] = 181
end
local QHZL = QuestHelper_ZoneLookup
local test = QHZL[181] or QHZL[208] or QHZL[209]
QuestHelper: Assert(test, "Umm, something is seriously wrong... We're missing a LostIsles terrain.")
QuestHelper: Assert(QuestHelper_ZoneLookup[coord[1]], string.format("Coord[1] = %d", coord[1]))
local c, x, y = QuestHelper.Astrolabe:GetAbsoluteContinentPosition(QuestHelper_ZoneLookup[coord[1]][1], QuestHelper_ZoneLookup[coord[1]][2], coord[2], coord[3])
QuestHelper: Assert(c)