mirror of
https://github.com/Blaststar/Questie-Octo-Vanilla.git
synced 2026-10-20 04:10:49 +00:00
Force pushing all my changes
This commit is contained in:
@@ -259,6 +259,11 @@ function DB:GetCreatureFaction(id)
|
||||
return raw and (raw["fac"] or raw["faction"]) or nil
|
||||
end
|
||||
|
||||
function DB:GetObjectFaction(id)
|
||||
local raw=self:GetObjectRaw(id)
|
||||
return raw and (raw["fac"] or raw["faction"]) or nil
|
||||
end
|
||||
|
||||
|
||||
function DB:GetMapIDByName(name)
|
||||
if not self.ready or not name then return nil end
|
||||
|
||||
+88
-4
@@ -9,7 +9,19 @@ QM.cache = {}
|
||||
local function CopyArray(src)
|
||||
if not src then return nil end
|
||||
local out={}
|
||||
for _,v in pairs(src) do table.insert(out,v) end
|
||||
local keys={}
|
||||
|
||||
-- These sources are arrays, but pairs() does not guarantee their numeric
|
||||
-- order on Lua 5.0. Preserve the database/compiler order explicitly so
|
||||
-- objective #1/#2 cannot be swapped before BuildObjectiveData consumes it.
|
||||
for k in pairs(src) do
|
||||
if type(k)=="number" then table.insert(keys,k) end
|
||||
end
|
||||
table.sort(keys)
|
||||
|
||||
for i=1,table.getn(keys) do
|
||||
table.insert(out,src[keys[i]])
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
@@ -29,12 +41,37 @@ local ITEM_OBJECTIVE_FIRST={
|
||||
[5088]=true,
|
||||
}
|
||||
|
||||
-- Quests that are not normal static NPC offers. Questie 6 blacklists 7946
|
||||
-- because Morja only exposes it after the Dark Iron Ale/Jubjub interaction.
|
||||
-- Quests that are not normal static NPC offers. Questie 6 blacklists these
|
||||
-- because the NPC only exposes the quest after a scripted world interaction.
|
||||
-- Keeping the real starter relation is useful for quest truth/tooltips, but it
|
||||
-- must not become a permanent map pickup marker.
|
||||
local CONDITIONAL_OFFERS={
|
||||
[3861]="Use /chicken on a Chicken until it temporarily offers CLUCK!.",
|
||||
[7946]="Requires Jubjub to be lured back with Dark Iron Ale.",
|
||||
}
|
||||
|
||||
-- Some situational quests benefit from one deliberately chosen discovery marker
|
||||
-- without pretending every scripted source is a permanent questgiver. CLUCK! can
|
||||
-- be triggered from many Chickens, but the Westfall Chicken at 55.6,30.9 is used
|
||||
-- as the single representative pickup/turn-in marker so new players can discover
|
||||
-- that the quest exists without covering every Chicken spawn with quest icons.
|
||||
-- The underlying starter/finisher relation remains NPC 620 and server truth is
|
||||
-- unchanged; this table is presentation only.
|
||||
local CONDITIONAL_MAP_MARKERS={
|
||||
[3861]={
|
||||
creatureID=620,
|
||||
coords={{55.6,30.9,40,300}},
|
||||
},
|
||||
}
|
||||
|
||||
-- Server repeatability and map presentation are separate. CLUCK! is technically
|
||||
-- repeatable, but Questie-Octo already treats it as one-and-done after the first
|
||||
-- completion. Present any marker that is legitimately shown for it as an
|
||||
-- ordinary yellow quest rather than a blue repeatable quest.
|
||||
local NORMAL_REPEATABLE_PRESENTATION={
|
||||
[3861]=true,
|
||||
}
|
||||
|
||||
local function AddObjectiveData(list,kind,id)
|
||||
if not id then return end
|
||||
|
||||
@@ -51,6 +88,30 @@ local function AddObjectiveData(list,kind,id)
|
||||
})
|
||||
end
|
||||
|
||||
-- 1+4+8+64=77 Alliance races, 2+16+32+128=178 Horde races (pfQuest bitraces).
|
||||
local function NoteFaction(fac,seen)
|
||||
if fac=="A" then seen.a=true
|
||||
elseif fac=="H" then seen.h=true
|
||||
elseif fac=="AH" or fac=="HA" then seen.a=true; seen.h=true end
|
||||
end
|
||||
|
||||
-- Mirror pfQuest's GetRaceMaskByID starter fallback so a faction-specific quest
|
||||
-- with no explicit race field is derived from its quest giver's faction.
|
||||
local function StarterRaceMask(starts)
|
||||
if not starts then return 0 end
|
||||
local seen={}
|
||||
for _,id in pairs(starts.creature or {}) do
|
||||
NoteFaction(QuestieOcto.DatabaseAPI:GetCreatureFaction(id),seen)
|
||||
end
|
||||
for _,id in pairs(starts.gameObject or {}) do
|
||||
NoteFaction(QuestieOcto.DatabaseAPI:GetObjectFaction(id),seen)
|
||||
end
|
||||
if seen.a and seen.h then return 255 end
|
||||
if seen.a then return 77 end
|
||||
if seen.h then return 178 end
|
||||
return 0
|
||||
end
|
||||
|
||||
local function BuildObjectiveData(questID,objectives)
|
||||
local result={}
|
||||
local itemFirst=ITEM_OBJECTIVE_FIRST[questID] and true or false
|
||||
@@ -96,7 +157,10 @@ function QM:MarkObservedRepeatable(questID)
|
||||
local db=ObservedRepeatables()
|
||||
if db[questID] then return false end
|
||||
db[questID]=true
|
||||
if self.cache[questID] then self.cache[questID].repeatable=true end
|
||||
if self.cache[questID] then
|
||||
self.cache[questID].repeatable=true
|
||||
self.cache[questID].presentationRepeatable=not NORMAL_REPEATABLE_PRESENTATION[questID]
|
||||
end
|
||||
if QuestieOcto.AvailableQuests and QuestieOcto.AvailableQuests.Schedule then
|
||||
QuestieOcto.AvailableQuests:Schedule(true,0.02)
|
||||
end
|
||||
@@ -154,6 +218,7 @@ function QM:Get(questID)
|
||||
timed=raw["timed"] and true or false,
|
||||
disabled=raw["disabled"] and true or false,
|
||||
conditionalOffer=CONDITIONAL_OFFERS[tonumber(questID)],
|
||||
conditionalMapMarker=CONDITIONAL_MAP_MARKERS[tonumber(questID)],
|
||||
exclusive=raw["exclusive"] and true or false,
|
||||
nextChain=tonumber(raw["nextChain"]),
|
||||
|
||||
@@ -184,14 +249,33 @@ function QM:Get(questID)
|
||||
gameObject=raw["obj"] and CopyArray(raw["obj"]["O"]) or nil,
|
||||
item=raw["obj"] and CopyArray(raw["obj"]["I"]) or nil,
|
||||
irItems=raw["obj"] and CopyArray(raw["obj"]["IR"]) or nil,
|
||||
-- A = quest-bound AreaTrigger objective. This is deliberately distinct
|
||||
-- from generic map exploration/fog data: only triggers referenced by an
|
||||
-- actual quest are retained here.
|
||||
areaTrigger=raw["obj"] and CopyArray(raw["obj"]["A"]) or nil,
|
||||
},
|
||||
}
|
||||
|
||||
-- Keep server repeatability authoritative for completion/filtering while
|
||||
-- allowing a narrow presentation exception such as CLUCK!.
|
||||
q.presentationRepeatable=q.repeatable and not NORMAL_REPEATABLE_PRESENTATION[tonumber(questID)] and true or false
|
||||
-- CLUCK! was explicitly chosen to stay an ordinary yellow discovery marker.
|
||||
-- Keep that presentation exception independent from the Turtle low-level gray
|
||||
-- marker rule so a high-level player does not turn its representative marker gray.
|
||||
q.presentationAlwaysNormal=NORMAL_REPEATABLE_PRESENTATION[tonumber(questID)] and true or false
|
||||
|
||||
-- IR items are intentionally NOT added to objectiveData. They are a
|
||||
-- pfQuest-special interaction relationship that becomes target guidance
|
||||
-- only while the player actually possesses the required item.
|
||||
q.objectiveData=BuildObjectiveData(questID,q.objectives)
|
||||
|
||||
-- A neutral race field lets faction-only quests leak to the wrong faction;
|
||||
-- fall back to the quest starter's faction just like pfQuest does.
|
||||
if not q.raceMask or tonumber(q.raceMask)==0 then
|
||||
local starterMask=StarterRaceMask(q.starts)
|
||||
if starterMask>0 then q.raceMask=starterMask end
|
||||
end
|
||||
|
||||
self.cache[questID]=q
|
||||
return q
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user