Skip to content

Commit

Permalink
database: add skill requirements to gameobjects
Browse files Browse the repository at this point in the history
  • Loading branch information
shagu committed Mar 21, 2023
1 parent feddd46 commit 48e4350
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion database.lua
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,27 @@ function pfDatabase:SearchZone(obj, meta, partial)
return maps
end

function pfDatabase:SearchObjectSkill(id)
if not id or not tonumber(id) then return end
local skill, caption = nil, nil

if (pfDB["meta"]["herbs"][-id]) then
skill = pfDB["meta"]["herbs"][-id]
caption = pfQuest_Loc["Herbalism"]
elseif (pfDB["meta"]["mines"][-id]) then
skill = pfDB["meta"]["mines"][-id]
caption = pfQuest_Loc["Mining"]
end

return skill, caption
end

-- Scans for all objects with a specified ID
-- Adds map nodes for each and returns its map table
function pfDatabase:SearchObjectID(id, meta, maps, prio)
if not objects[id] or not objects[id]["coords"] then return maps end

local skill, caption = pfDatabase:SearchObjectSkill(id)
local maps = maps or {}
local prio = prio or 1

Expand All @@ -805,7 +821,7 @@ function pfDatabase:SearchObjectID(id, meta, maps, prio)
meta["x"] = x
meta["y"] = y

meta["level"] = nil
meta["level"] = skill and string.format("%s [%s]", skill, caption) or nil
meta["spawntype"] = pfQuest_Loc["Object"]
meta["respawn"] = respawn and SecondsToTime(respawn)

Expand Down

0 comments on commit 48e4350

Please sign in to comment.