1
0
Bifurcation 0

Added functionality to detect when a Pandaren chooses his or her faction.

Cette révision appartient à :
Nathanial.C.Jones 2012-09-25 23:52:08 +00:00
Parent c9fe3f99cc
révision f471a963fa
14 fichiers modifiés avec 114 ajouts et 73 suppressions

Voir le fichier

@ -86,45 +86,19 @@ QH_Collect_LZW_Init(nil, API)
local CompressCollection
function QH_Collector_Init()
-- Dunno why, but these statements cause the 1% issue.
--[[
QH_Collector_UpgradeAll(QuestHelper_Collector)
for _, v in pairs(QuestHelper_Collector) do
if not v.modified then v.modified = time() - 7 * 24 * 60 * 60 end -- eugh. Yeah, we set it to be a week ago. It's pretty grim.
end
--]]
QuestHelper_Collector_Version = QuestHelper_Collector_Version_Current
function QH_Collector_SetupData()
local svnversion = "$svnversion$"
local buildInfo, locale, faction = GetBuildInfo(), GetLocale(), QuestHelper:PlayerFaction()
local altfaction = ""
if faction == ALLIANCE then
if faction == "Alliance" then
altfaction = "Alliance"
else
elseif faction == "Horde" then
altfaction = "Horde"
else
altfaction = "Neutral"
end
local realm = GetRealmName()
local remove_sigs = {}
for k, v in pairs(QuestHelper_Collector) do
local sig = k:match("^(%d)a$") or k:match("^(%d)b$") or k:match("^(%d)r$")
if sig then
if tonumber(sig) < MINSVNVERSION then
table.insert(remove_sigs, sig)
end
elseif k ~= svnversion then
table.insert(remove_sigs, k)
elseif k == "$svnversion\$" and PURGEDEV then
table.insert(remove_sigs, k)
end
end
for _, v in ipairs(remove_sigs) do
QuestHelper_Collector[v] = nil
end
if not QuestHelper_Collector.created then
QuestHelper_Collector.created = time();
end
@ -151,10 +125,61 @@ function QH_Collector_Init()
QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction] = {}
end
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
local QHCData = QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction]
return QuestHelper_Collector[svnversion][realm][buildInfo][locale][altfaction][sessiontime]
end
function QH_Collector_FactionChange()
local QHCData = QH_Collector_SetupData()
QH_Collect_Achievement_FactionChange(QHCData, API)
QH_Collect_Zone_FactionChange(QHCData, API)
QH_Collect_Hearth_FactionChange(QHCData, API)
QH_Collect_Monster_FactionChange(QHCData, API)
QH_Collect_Item_FactionChange(QHCData, API)
QH_Collect_Object_FactionChange(QHCData, API)
QH_Collect_Flight_FactionChange(QHCData, API)
QH_Collect_Quest_FactionChange(QHCData, API)
QH_Collect_Warp_FactionChange(QHCData, API)
end
function QH_Collector_Init()
-- Dunno why, but these statements cause the 1% issue.
--[[
QH_Collector_UpgradeAll(QuestHelper_Collector)
for _, v in pairs(QuestHelper_Collector) do
if not v.modified then v.modified = time() - 7 * 24 * 60 * 60 end -- eugh. Yeah, we set it to be a week ago. It's pretty grim.
end
--]]
QuestHelper_Collector_Version = QuestHelper_Collector_Version_Current
local remove_sigs = {}
for k, v in pairs(QuestHelper_Collector) do
local sig = k:match("^(%d)a$") or k:match("^(%d)b$") or k:match("^(%d)r$")
if sig then
if tonumber(sig) < MINSVNVERSION then
table.insert(remove_sigs, sig)
end
elseif k ~= svnversion then
table.insert(remove_sigs, k)
elseif k == "$svnversion\$" and PURGEDEV then
table.insert(remove_sigs, k)
end
end
for _, v in ipairs(remove_sigs) do
QuestHelper_Collector[v] = nil
end
local QHCData = QH_Collector_SetupData()
QuestHelper: Assert(not QHCData.compressed)
QHCData.modified = time()
QH_Collect_Achievement_Init(QHCData, API)
QH_Collect_Traveled_Init(QHCData, API)
@ -177,26 +202,13 @@ function QH_Collector_Init()
table.insert(QHCData.routing_dump, nt)
QH_Collect_Routing_Dump = nt
end
--[[ NOPE DO NOT DO THIS! IT'LL MESS UP THE NEW SYSTEM.
do -- Clean some stuff up!
local obliterate = {}
for k, v in pairs(QuestHelper_Collector) do
if not v.modified or v.modified + 30 * 24 * 60 * 60 < GetTime() then
table.insert(obliterate, k)
end
end
for _, v in ipairs(obliterate) do
QuestHelper_Collector[v] = nil
end
end
--]]
-- So, why do we delay it?
-- It's simple. People are gonna update to this version, and then they're going to look at the memory usage. Then they will panic because omg this version uses so much more memory, I bet that will somehow hurt my framerates in a way which is not adequately explained!
-- So instead, we just wait half an hour before compressing. Compression will still get done, and I won't have to deal with panicked comments about how bloated QH has gotten.
-- addendum: yeah naturally I'm getting all sorts of panicked comments about how bloated qh has gotten, sigh
--API.Utility_Notifier(GetTime() + (debug_output and 0 or (30 * 60)), function() CompressCollection(QHCData, QuestHelper_Collector[sig_altfaction], API.Utility_Merger, API.Utility_LZW.Compress) end)
QH_Event("NEUTRAL_FACTION_SELECT_RESULT", QH_Collector_FactionChange)
end
QH_OnUpdate(function ()

Voir le fichier

@ -59,10 +59,13 @@ function SetCloc()
cloc = GetLoc() -- yoink
end
function QH_Collect_Achievement_Init(QHCData, API)
function QH_Collect_Achievement_FactionChange(QHCData)
if not QHCData.achievement then QHCData.achievement = {} end
QHCA = QHCData.achievement
end
function QH_Collect_Achievement_Init(QHCData, API)
QH_Collect_Achivement_FactionChange(QHCData)
GetLoc = API.Callback_LocationBolusCurrent
QuestHelper: Assert(GetLoc)

Voir le fichier

@ -114,9 +114,13 @@ local function Looted(message)
end
end
function QH_Collect_Equip_Init(QHCData, API)
function QH_Collect_Equip_FactionChange(QHCData)
if not QHCData.item then QHCData.item = {} end
QHCI = QHCData.item
end
function QH_Collect_Equip_Init(QHCData, API)
QH_Collect_Equip_FactionChange(QHCData)
Patterns = API.Patterns
QuestHelper: Assert(Patterns)

Voir le fichier

@ -99,11 +99,14 @@ local function OnUpdate()
end
end
function QH_Collect_Flight_Init(QHCData, API)
function QH_Collect_Flight_FactionChange(QHCData)
if not QHCData.flight_master then QHCData.flight_master = {} end
if not QHCData.flight_times then QHCData.flight_times = {} end
QHCFM, QHCFT = QHCData.flight_master, QHCData.flight_times
end
function QH_Collect_Flight_Init(QHCData, API)
QH_Collect_Flight_FactionChange(QHCData)
IsMonsterGUID = API.Utility_IsMonsterGUID
GetMonsterType = API.Utility_GetMonsterType
QuestHelper: Assert(IsMonsterGUID)

Voir le fichier

@ -33,10 +33,13 @@ local function OnConfirmBinder(...)
QHCZ[new_home].Innkeeper.ID = GetMonsterType(UnitGUID("target"))
end
function QH_Collect_Hearth_Init(QHCData, API)
function QH_Collect_Hearth_FactionChange(QHCData)
if not QHCData.hearth then QHCData.hearth = {} end
QHCZ = QHCData.hearth
end
function QH_Collect_Hearth_Init(QHCData, API)
QH_Collect_Hearth_FactionChange(QHCData)
QH_Event("ZONE_CHANGED", OnZoneChanged)
QH_Event("ZONE_CHANGED_INDOORS", OnZoneChanged)
QH_Event("ZONE_CHANGED_NEW_AREA", OnZoneChanged)

Voir le fichier

@ -53,10 +53,13 @@ local function Tooltipy(self)
end
end
function QH_Collect_Item_Init(QHCData, API)
function QH_Collect_Item_FactionChange(QHCData)
if not QHCData.item then QHCData.item = {} end
QHCI = QHCData.item
end
function QH_Collect_Item_Init(QHCData, API)
QH_Collect_Item_FactionChange(QHCData)
API.Registrar_TooltipHook(Tooltipy)
GetItemType = API.Utility_GetItemType

Voir le fichier

@ -105,10 +105,14 @@ local function MouseoverUnit()
end
end
function QH_Collect_Monster_Init(QHCData, API)
function QH_Collect_Monster_FactionChange(QHCData)
if not QHCData.monster then QHCData.monster = {} end
QHCM = QHCData.monster
end
function QH_Collect_Monster_Init(QHCData, API)
QH_Collect_Monster_FactionChange(QHCData)
QH_Event("UPDATE_MOUSEOVER_UNIT", MouseoverUnit)
QH_Event("CHAT_MSG_SYSTEM", SystemMessage)

Voir le fichier

@ -88,10 +88,13 @@ local function Tooltipy(self)
end
end
function QH_Collect_Object_Init(QHCData, API)
function QH_Collect_Object_FactionChange(QHCData)
if not QHCData.object then QHCData.object = {} end
QHCO = QHCData.object
end
function QH_Collect_Object_Init(QHCData, API)
QH_Collect_Object_FactionChange(QHCData)
API.Registrar_TooltipHook(Tooltipy)
Patterns = API.Patterns

Voir le fichier

@ -402,10 +402,13 @@ local function MouseoverUnit()
end
end
function QH_Collect_Quest_Init(QHCData, API)
function QH_Collect_Quest_FactionChange(QHCData)
if not QHCData.quest then QHCData.quest = {} end
QHCQ = QHCData.quest
end
function QH_Collect_Quest_Init(QHCData, API)
QH_Collect_Quest_FactionChange(QHCData)
GetQuestType = API.Utility_GetQuestType
GetItemType = API.Utility_GetItemType
IsMonsterGUID = API.Utility_IsMonsterGUID

Voir le fichier

@ -144,7 +144,7 @@ local function QH_Collect_Traveled_Point(c, x, y, rc, rz)
swim, mount, flying, taxi = false, false, false, false
local b = Bolus(c, x, y, rc, rz)
b.faction = QuestHelper:PlayerFaction()
AddDataPrefix(Bolus(c, x, y, rc, rz) .. strchar(tostring(QuestHelper:PlayerFaction()))) -- The playerfaction can be removed, as it's now encoded in the collection shard. Not removing it for compatibility reasons.
AddDataPrefix(Bolus(c, x, y, rc, rz) .. QuestHelper:PlayerFaction()) -- The playerfaction can be removed, as it's now encoded in the collection shard. Not removing it for compatibility reasons.
end
AppendFlag(IsMounted(), 'M')

Voir le fichier

@ -58,10 +58,13 @@ local function OnUpdate()
last_delayed, last_rc, last_rz, last_rx, last_ry, last_valid = now_delayed, now_rc, now_rz, now_rx, now_ry, now_valid
end
function QH_Collect_Warp_Init(QHCData, API)
function QH_Collect_Warp_FactionChange(QHCData)
if not QHCData.warp then QHCData.warp = {} end
QHCW = QHCData.warp
end
function QH_Collect_Warp_Init(QHCData, API)
QH_Collect_Warp_FactionChange(QHCData)
API.Registrar_OnUpdateHook(OnUpdate)
GetLoc = API.Callback_LocationBolusCurrent

Voir le fichier

@ -46,17 +46,18 @@ local function OnUpdate()
end
end
function QH_Collect_Zone_Init(QHCData, API)
do return end -- we really don't need this anymore
function QH_Collect_Zone_FactionChange(QHCData)
if not QHCData.zone then QHCData.zone = {} end
QHCZ = QHCData.zone
end
function QH_Collect_Zone_Init(QHCData, API)
QH_Collect_Zone_FactionChange(QHCData)
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

@ -74,8 +74,7 @@ QuestHelper.quest_objects = {}
QuestHelper.player_level = 1
QuestHelper.locale = QuestHelper_Locale
QuestHelper.faction = (UnitFactionGroup("player") == "Alliance" and 1) or
(UnitFactionGroup("player") == "Horde" and 2)
QuestHelper.faction = UnitFactionGroup("player")
--[[ assert(QuestHelper.faction) ]]

Voir le fichier

@ -277,7 +277,7 @@ function QuestHelper:UnitPosition(unit)
end
function QuestHelper:PlayerFaction()
return UnitFactionGroup("player") == "Alliance" and ALLIANCE or HORDE
return UnitFactionGroup("player")
end
function QuestHelper:LocationString(i, x, y)