Started "flattening" the collection, which will ultimately make it easier to import into a database. WOOHOO!
Basically, all lua tables will have keys that are equal to their DB table names and their data will have a key that contains the row data in a tab delimited format. Note: This is still a work in progress and some things need to be revisited... i.e. collect_merchant.lua, since we want to extract the currency id from the currency link... no documentation is thus far found for what the type part of a currency link is, so we're going to collect a little data and see.
Cette révision appartient à :
Parent
d3e9acc290
révision
b50a530943
|
@ -99,11 +99,13 @@ function QH_Collector_SetupData()
|
||||||
end
|
end
|
||||||
local realm = GetRealmName()
|
local realm = GetRealmName()
|
||||||
|
|
||||||
|
local sessiontime = time()
|
||||||
|
|
||||||
if not QuestHelper_Collector.created then
|
if not QuestHelper_Collector.created then
|
||||||
QuestHelper_Collector.created = time();
|
QuestHelper_Collector.created = sessiontime;
|
||||||
end
|
end
|
||||||
|
|
||||||
local session = string.format("%q\t%q\t%q\t%q\t%q", svnversion, realm, buildInfo, locale, altfaction)
|
local session = string.format("%s\t%s\t%s\t%s\t%s", svnversion, realm, buildInfo, locale, altfaction)
|
||||||
|
|
||||||
if not QuestHelper_Collector.sessions then QuestHelper_Collector.sessions = {} end
|
if not QuestHelper_Collector.sessions then QuestHelper_Collector.sessions = {} end
|
||||||
|
|
||||||
|
|
|
@ -18,42 +18,53 @@ local GetItemType
|
||||||
local function AddChatType(typ)
|
local function AddChatType(typ)
|
||||||
local target = UnitGUID("target")
|
local target = UnitGUID("target")
|
||||||
if not target then return end
|
if not target then return end
|
||||||
|
|
||||||
if not IsMonsterGUID(target) then return end
|
if not IsMonsterGUID(target) then return end
|
||||||
|
|
||||||
target = GetMonsterType(target)
|
target = GetMonsterType(target)
|
||||||
|
|
||||||
if not QHCM[target] then QHCM[target] = {} end
|
local ret = {}
|
||||||
QHCM[target]["chat_" .. typ] = (QHCM[target]["chat_" .. typ] or 0) + 1
|
ret.base_info = string.format("%d\t%s", target, typ)
|
||||||
return QHCM[target]
|
table.insert(QHCM, ret)
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
local function MerchantShow()
|
local function MerchantShow()
|
||||||
local ct = GetMerchantNumItems()
|
local ct = GetMerchantNumItems()
|
||||||
for i = 1, ct do if not GetMerchantItemLink(i) then return end end -- We want to make sure it's cached, otherwise we'll return wonky data. Technically this biases things away from "yes he's a shopkeeper", but honestly, it doesn't matter that much.
|
for i = 1, ct do if not GetMerchantItemLink(i) then return end end -- We want to make sure it's cached, otherwise we'll return wonky data. Technically this biases things away from "yes he's a shopkeeper", but honestly, it doesn't matter that much.
|
||||||
|
|
||||||
targ = AddChatType("shop")
|
targ = AddChatType("shop")
|
||||||
if not targ then return end -- welllllp
|
if not targ then return end -- welllllp
|
||||||
|
|
||||||
local ct = GetMerchantNumItems()
|
local ct = GetMerchantNumItems()
|
||||||
--QuestHelper:TextOut(string.format("nitems %d", ct))
|
--QuestHelper:TextOut(string.format("nitems %d", ct))
|
||||||
|
|
||||||
for i = 1, ct do
|
for i = 1, ct do
|
||||||
local itemid = GetMerchantItemLink(i)
|
local itemid = GetMerchantItemLink(i)
|
||||||
QuestHelper: Assert(itemid)
|
QuestHelper: Assert(itemid)
|
||||||
itemid = GetItemType(itemid)
|
itemid = GetItemType(itemid)
|
||||||
local _, _, price, quant, avail, _, _ = GetMerchantItemInfo(i)
|
local _, _, price, quant, avail, _, ext_cost = GetMerchantItemInfo(i)
|
||||||
local dstr = {}
|
local shop_item = {}
|
||||||
dstr.quant = quant
|
shop_item.base_info = string.format("%d\t%d\t%d\t%d", itemid, quant, avail, price)
|
||||||
dstr.avail = avail
|
|
||||||
dstr.price = price
|
if ext_cost then
|
||||||
|
ext_costs = {}
|
||||||
|
for curr = 1, GetMerchantItemCostInfo(i) do
|
||||||
|
local tex, val, link, name = GetMerchantItemCostItem(i, curr)
|
||||||
|
local ext_cost_detail = {}
|
||||||
|
ext_cost_detail.base_info = string.format("%s\t%d", name, val)
|
||||||
|
ext_cost_detail.link = link
|
||||||
|
ext_cost_detail.texture = tex
|
||||||
|
table.insert(ext_costs, ext_cost_detail)
|
||||||
|
end
|
||||||
|
|
||||||
|
shop_item.ext_costs = ext_costs
|
||||||
|
end
|
||||||
|
|
||||||
--if debug_output then QuestHelper:TextOut(dstr) end
|
--if debug_output then QuestHelper:TextOut(dstr) end
|
||||||
if not targ.shop then targ.shop = {} end
|
if not targ.shop then targ.shop = {} end
|
||||||
if not targ.shop[itemid] then
|
|
||||||
targ.shop[itemid] = dstr
|
|
||||||
end
|
|
||||||
|
|
||||||
targ.shop[itemid].count = (targ.shop[itemid].count or 0) + 1
|
table.insert(targ.shop, shop_item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -67,13 +78,13 @@ end
|
||||||
|
|
||||||
|
|
||||||
function QH_Collect_Merchant_Init(QHCData, API)
|
function QH_Collect_Merchant_Init(QHCData, API)
|
||||||
if not QHCData.monster then QHCData.monster = {} end
|
if not QHCData.merchant then QHCData.merchant = {} end
|
||||||
QHCM = QHCData.monster
|
QHCM = QHCData.merchant
|
||||||
|
|
||||||
QH_Event("MERCHANT_SHOW", MerchantShow)
|
QH_Event("MERCHANT_SHOW", MerchantShow)
|
||||||
QH_Event("GOSSIP_SHOW", GossipShow)
|
QH_Event("GOSSIP_SHOW", GossipShow)
|
||||||
QH_Event("QUEST_GREETING", QuestGreeting)
|
QH_Event("QUEST_GREETING", QuestGreeting)
|
||||||
|
|
||||||
IsMonsterGUID = API.Utility_IsMonsterGUID
|
IsMonsterGUID = API.Utility_IsMonsterGUID
|
||||||
GetMonsterType = API.Utility_GetMonsterType
|
GetMonsterType = API.Utility_GetMonsterType
|
||||||
GetItemType = API.Utility_GetItemType
|
GetItemType = API.Utility_GetItemType
|
||||||
|
|
|
@ -49,31 +49,39 @@ local function MouseoverUnit()
|
||||||
logon = nil
|
logon = nil
|
||||||
drunk_logon = false
|
drunk_logon = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- First off, we see if it's "interesting".
|
-- First off, we see if it's "interesting".
|
||||||
-- The original code for this filtered out critters. I don't, because critters are cute, and rare.
|
-- The original code for this filtered out critters. I don't, because critters are cute, and rare.
|
||||||
if UnitExists("mouseover") and UnitIsVisible("mouseover") and not UnitIsPlayer("mouseover") and not UnitPlayerControlled("mouseover") then
|
if UnitExists("mouseover") and UnitIsVisible("mouseover") and not UnitIsPlayer("mouseover") and not UnitPlayerControlled("mouseover") then
|
||||||
local guid = UnitGUID("mouseover")
|
local guid = UnitGUID("mouseover")
|
||||||
|
|
||||||
if not IsMonsterGUID(guid) then return end -- pet that isn't controlled by a player? NPC pet? It's kind of unclear, but I'm getting some, so, FIXED
|
if not IsMonsterGUID(guid) then return end -- pet that isn't controlled by a player? NPC pet? It's kind of unclear, but I'm getting some, so, FIXED
|
||||||
local creatureid = GetMonsterUID(guid)
|
local creatureid = GetMonsterUID(guid)
|
||||||
|
|
||||||
if not recentlySeenCritters[creatureid] then
|
if not recentlySeenCritters[creatureid] then
|
||||||
recentlySeenCritters_Recent[creatureid] = true
|
recentlySeenCritters_Recent[creatureid] = true
|
||||||
recentlySeenCritters[creatureid] = true
|
recentlySeenCritters[creatureid] = true
|
||||||
|
|
||||||
-- register the critter here
|
-- register the critter here
|
||||||
local cid = GetMonsterType(guid)
|
local cid = GetMonsterType(guid)
|
||||||
|
|
||||||
if not QHCM[cid] then QHCM[cid] = {} end
|
--if not QHCM[cid] then QHCM[cid] = {} end
|
||||||
local critter = QHCM[cid]
|
--local critter = QHCM[cid]
|
||||||
|
local critter = {}
|
||||||
if cid < 30621 or cid > 30625 then AccumulateFrequency(critter, "name", UnitName("mouseover")) end -- The exceptions are for Herald Volasj's minions, which are named after your partymembers.
|
critter.id = cid
|
||||||
AccumulateFrequency(critter, "reaction", UnitReaction("mouseover", "player"))
|
|
||||||
|
if cid < 30621 or cid > 30625 then
|
||||||
|
--AccumulateFrequency(critter, "name", UnitName("mouseover")) -- The exceptions are for Herald Volasj's minions, which are named after your partymembers.
|
||||||
|
critter.name = UnitName("mouseover")
|
||||||
|
end
|
||||||
|
--AccumulateFrequency(critter, "reaction", UnitReaction("mouseover", "player"))
|
||||||
|
critter.reaction = UnitReaction("mouseover", "player")
|
||||||
|
|
||||||
if not drunk_logon and not drunk_message then
|
if not drunk_logon and not drunk_message then
|
||||||
AccumulateFrequency(critter, "level", UnitLevel("mouseover"))
|
--AccumulateFrequency(critter, "level", UnitLevel("mouseover"))
|
||||||
|
critter.level = UnitLevel("mouseover")
|
||||||
end
|
end
|
||||||
|
|
||||||
local minrange = InteractDistances[1]
|
local minrange = InteractDistances[1]
|
||||||
local maxrange = 255
|
local maxrange = 255
|
||||||
-- Now we try to derive a bound for how far away it is
|
-- Now we try to derive a bound for how far away it is
|
||||||
|
@ -85,19 +93,25 @@ local function MouseoverUnit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
QuestHelper: Assert(minrange >= 0 and minrange < 256 and maxrange >= 0 and maxrange < 256)
|
QuestHelper: Assert(minrange >= 0 and minrange < 256 and maxrange >= 0 and maxrange < 256)
|
||||||
|
critter.loc = GetLoc()
|
||||||
|
critter.minrange = minrange
|
||||||
|
critter.maxrange = maxrange
|
||||||
|
table.insert(QHCM, critter)
|
||||||
|
--[[
|
||||||
local data = {}
|
local data = {}
|
||||||
data.loc = GetLoc()
|
data.loc = GetLoc()
|
||||||
data.minrange = minrange
|
data.minrange = minrange
|
||||||
data.maxrange = maxrange
|
data.maxrange = maxrange
|
||||||
if not critter.encounters then critter.encounters = {} end
|
if not critter.encounters then critter.encounters = {} end
|
||||||
table.insert(critter.encounters, data)
|
table.insert(critter.encounters, data)
|
||||||
|
]]
|
||||||
--Merger.Add(critter, string.format("(%s %s %s),", GetLoc(), tostring(minrange), tostring(maxrange))) --strchar(minrange, maxrange))
|
--Merger.Add(critter, string.format("(%s %s %s),", GetLoc(), tostring(minrange), tostring(maxrange))) --strchar(minrange, maxrange))
|
||||||
|
|
||||||
if #recentlySeenCritters_Recent >= 100 then
|
if #recentlySeenCritters_Recent >= 100 then
|
||||||
for k, v in recentlySeenCritters_NextTrash do
|
for k, v in recentlySeenCritters_NextTrash do
|
||||||
recentlySeenCritters[v] = nil
|
recentlySeenCritters[v] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
recentlySeenCritters_NextTrash = recentlySeenCritters_Recent
|
recentlySeenCritters_NextTrash = recentlySeenCritters_Recent
|
||||||
recentlySeenCritters_Recent = {} -- BAM, garbage collection!
|
recentlySeenCritters_Recent = {} -- BAM, garbage collection!
|
||||||
end
|
end
|
||||||
|
@ -115,10 +129,10 @@ function QH_Collect_Monster_Init(QHCData, API)
|
||||||
|
|
||||||
QH_Event("UPDATE_MOUSEOVER_UNIT", MouseoverUnit)
|
QH_Event("UPDATE_MOUSEOVER_UNIT", MouseoverUnit)
|
||||||
QH_Event("CHAT_MSG_SYSTEM", SystemMessage)
|
QH_Event("CHAT_MSG_SYSTEM", SystemMessage)
|
||||||
|
|
||||||
Patterns = API.Patterns
|
Patterns = API.Patterns
|
||||||
QuestHelper: Assert(Patterns)
|
QuestHelper: Assert(Patterns)
|
||||||
|
|
||||||
API.Patterns_Register("DRUNK_MESSAGE_SELF1", "|c.*|r")
|
API.Patterns_Register("DRUNK_MESSAGE_SELF1", "|c.*|r")
|
||||||
API.Patterns_Register("DRUNK_MESSAGE_SELF2", "|c.*|r")
|
API.Patterns_Register("DRUNK_MESSAGE_SELF2", "|c.*|r")
|
||||||
API.Patterns_Register("DRUNK_MESSAGE_SELF3", "|c.*|r")
|
API.Patterns_Register("DRUNK_MESSAGE_SELF3", "|c.*|r")
|
||||||
|
@ -130,10 +144,10 @@ function QH_Collect_Monster_Init(QHCData, API)
|
||||||
|
|
||||||
GetLoc = API.Callback_LocationBolusCurrent
|
GetLoc = API.Callback_LocationBolusCurrent
|
||||||
QuestHelper: Assert(GetLoc)
|
QuestHelper: Assert(GetLoc)
|
||||||
|
|
||||||
Merger = API.Utility_Merger
|
Merger = API.Utility_Merger
|
||||||
QuestHelper: Assert(Merger)
|
QuestHelper: Assert(Merger)
|
||||||
|
|
||||||
IsMonsterGUID = API.Utility_IsMonsterGUID
|
IsMonsterGUID = API.Utility_IsMonsterGUID
|
||||||
GetMonsterUID = API.Utility_GetMonsterUID
|
GetMonsterUID = API.Utility_GetMonsterUID
|
||||||
GetMonsterType = API.Utility_GetMonsterType
|
GetMonsterType = API.Utility_GetMonsterType
|
||||||
|
|
Référencer dans un nouveau ticket