1
0
Bifurcation 0

Modified collect.lua

Put all session info into a tab delimited string containing, in order, svnversion (QH build), realm, buildInfo (WoW version), locale and faction. This string is inserted into a sub-table of QuestHelper_Collector called sessions, with a key of session time.
	Put all data into a sub-table of QuestHelper_Collector called data.
	Creates session data table on the new data sub-table and sets the key to session time.
	QH_Collector_SetupData now returns QuestHelper_Collector.data[sessiontime]

	Changed Collector Current Version to 9... This might be useful for future changes to data layout.

Modified collect_location
	Made BolusizeLocation accept the right arguments.
	Calculated the distance from either Azeroth map center or Outland map center to the provided point for inclusion. (See comments in code for what is collected and why.)
	Converted the information into a string. If we couldn't compute a distance to either map center, we leave it out for now, since we are probably in an instance.
Cette révision appartient à :
Nathanial.C.Jones 2013-01-31 01:27:10 +00:00
Parent 1daf6d747c
révision 63efdfe2a2
2 fichiers modifiés avec 341 ajouts et 339 suppressions

Voir le fichier

@ -4,12 +4,12 @@ local GetTime = QuestHelper_GetTime
QuestHelper_File["collect.lua"] = "4.0.1.$svnversion$"
QuestHelper_Loadtime["collect.lua"] = GetTime()
local --[[ static ]] MINSVNVERSION = 255
local --[[ static ]] MINSVNVERSION = 283
local --[[ static ]] PURGEDEV = true
local debug_output = false
if QuestHelper_File["collect.lua"] == "Development Version" then debug_output = true end
local QuestHelper_Collector_Version_Current = 8
local QuestHelper_Collector_Version_Current = 9
QuestHelper_Collector = {}
QuestHelper_Collector_Version = QuestHelper_Collector_Version_Current
@ -103,35 +103,17 @@ function QH_Collector_SetupData()
QuestHelper_Collector.created = time();
end
-- Swap buildInfo and svnversion once first alteration is complete.
-- Perhaps move locale out of the "signature"
if not QuestHelper_Collector[svnversion] then
QuestHelper_Collector[svnversion] = {}
end
local session = string.format("%q\t%q\t%q\t%q\t%q", svnversion, realm, buildInfo, locale, altfaction)
if not QuestHelper_Collector[svnversion][realm] then
QuestHelper_Collector[svnversion][realm] = {}
end
if not QuestHelper_Collector.sessions then QuestHelper_Collector.sessions = {} end
if not QuestHelper_Collector[svnversion][realm][buildInfo] then
QuestHelper_Collector[svnversion][realm][buildInfo] = {}
end
QuestHelper_Collector.sessions[sessiontime] = session
if not QuestHelper_Collector[svnversion][realm][buildInfo][locale] then
QuestHelper_Collector[svnversion][realm][buildInfo][locale] = {}
end
if not QuestHelper_Collector.data then QuestHelper_Collector.data = {} end
if not QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction] then
QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction] = {}
end
QuestHelper_Collector.data[sessiontime] = {}
local sessiontime = time()
if not QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction][sessiontime] then
QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction][sessiontime] = {}
end
--if not QuestHelper_Collector[sig] or QuestHelper_Collector[sig].compressed then QuestHelper_Collector[sig] = {version = QuestHelper_Collector_Version} end -- fuckin' bullshit, man
return QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction][sessiontime]
return QuestHelper_Collector.data[sessiontime]
end
function QH_Collector_FactionChange()

Voir le fichier

@ -73,24 +73,44 @@ local function float(c)
return ret
end
local function BolusizeLocation(delayed, c, z, x, y, dl, mid, mf, f)
-- c and z are *signed* integers that fit within an 8-bit int.
-- x and y are floating-point values, generally between 0 and 1. We'll dedicate 24 bits to the fractional part, largely because we can.
-- Overall we're using a weird 11 bytes on this. Meh.
-- Also, any nil values are being turned into MIN_WHATEVER.
local float_x = x
local float_y = y
local loc = {}
--local locStr = (delayed and 1 or 0) .. lgToHex(mid) .. tohex(dl) .. float(x) .. float(y)
loc["delayed"] = (delayed and 1 or 0)
loc["c"] = c
loc["z"] = z
loc["x"] = float_x
loc["y"] = float_y
loc["dungeonLevel"] = dl
loc["mapid"] = mid
loc["mapfile"] = mf
loc["facing"] = f
local function rep_comma(val)
return string.gsub(tostring(val), ",", ".")
end
local function BolusizeLocation(m, f, x, y)
-- m and f are positive integers.
-- x and y are floating-point values, generally between 0 and 1. We'll convert to string and then replace any "," decimal separator (because it'll be easier later to import on an enUS machine).
local str_x = rep_comma(x)
local str_y = rep_comma(y)
-- Next, we are going to calculate the distance this point is from either Azeroth 50,50 or Outland 50,50.
-- We will only keep the dx and dy values, since we can compute distance from those (dist = sqrt(dx*dx + dy*dy)). We can also compute a bearing from dx and dy, since we are going relative to (50,50)
-- Said bearing is the inverse tangent of dy/dx, trig people, trig. SOHCAHTOA. I have all three values, so I could use any pair, but dx and dy make the most sense.
-- Of course, the bearing DOES need adjusting, since WoW sets 0 to be north. Normally, angles increase counter-clockwise, WoW does the same... SO, all we'd have to do is add 90 degrees, or pi/2 radians to the result of the inverse tangent.
-- This discourse is of no real consequence, beyond explaining the WHY of collecting dx and dy, rather than just the distance.
local _, dxAz, dyAz = QuestHelper.Astrolabe:ComputeDistance( 0, 0, 0.5, 0.5, m, f, x, y)
local _, dxOl, dyOl = QuestHelper.Astrolabe:ComputeDistance(466, 0, 0.5, 0.5, m, f, x, y)
local dx_str, dy_str
local dist_rel
if dxAz then
dx_str = rep_comma(dxAz)
dy_str = rep_comma(dyAz)
dist_rel = "A"
elseif dxOl then
dx_str = rep_comma(dxOl)
dy_str = rep_comma(dyOl)
dist_rel = "A"
end
-- Finally, we are going to go back to doing a string for the location bolus, but it will be tab delimited in the form "m\tf\tx\t\y\tA\tdx\tdy" or "m\tf\tx\t\y\tO\tdx\tdy" where A means dx,dy are relative to Azeroth (50,50) (in yards) and O means they are relative to Outland (50,50)
-- Note: if only four values are present, then we couldn't compute a distance... Probably because we are in an instance of some kind.
local loc = string.format("%d\t%d\t%s\t%s", m, f, str_x, str_y)
if dxAz or dxOl then
loc = string.format("%s\t%s\t%s\t%s", loc, dist_rel, dx_str, dy_str)
end
return loc;
--return string.format("%s,%s,%s,%s,%s", signed(delayed and 1 or 0), signed(c), signed(z), float_x, float_y)
--return signed(delayed and 1 or 0) .. signed(c) .. signed(z) .. float_x .. float_y