mirror of
https://github.com/emagi/eq2emu-content
synced 2026-08-12 20:23:03 -04:00
51 lines
No EOL
1.7 KiB
Lua
51 lines
No EOL
1.7 KiB
Lua
--[[
|
|
Script Name : SpawnScripts/NorthFreeport/ConvertYRal.lua
|
|
Script Author : Xiki
|
|
Script Date : 2025.03.15 11:03:36
|
|
Script Purpose :
|
|
:
|
|
--]]
|
|
|
|
local questsByLevel = {
|
|
["10-14"] = {6218, 6219}, -- Quests for levels 10-14
|
|
["15-19"] = {6220, 6221, 6222} -- Quests for levels 15-19
|
|
}
|
|
|
|
function spawn(NPC)
|
|
|
|
end
|
|
|
|
function hailed(NPC, Spawn)
|
|
local playerLevel = GetLevel(Spawn)
|
|
local quests = nil
|
|
|
|
-- Determine the quests based on the player's level (10-19)
|
|
if playerLevel >= 10 and playerLevel <= 14 then
|
|
quests = questsByLevel["10-14"]
|
|
elseif playerLevel >= 15 and playerLevel <= 19 then
|
|
quests = questsByLevel["15-19"]
|
|
end
|
|
|
|
if quests then
|
|
-- Check if the player already has an active quest
|
|
for _, questID in ipairs(quests) do
|
|
if HasQuest(Spawn, questID) then
|
|
-- If the player has an active quest, inform them and exit
|
|
Say(NPC, "You're already on a task. Finish it first before taking another.")
|
|
return
|
|
elseif HasPendingQuest(Spawn, questID) then
|
|
-- If the player has a pending quest, do nothing and exit
|
|
return
|
|
end
|
|
end
|
|
-- If no quest was found, offer a new one
|
|
local newQuestID = quests[math.random(#quests)]
|
|
OfferQuest(NPC, Spawn, newQuestID)
|
|
Say(NPC, "I have a task for someone of your experience. Will you take it?")
|
|
else
|
|
Say(NPC, "I have no tasks suitable for your level. You may need to seek another challenge.")
|
|
end
|
|
end
|
|
function respawn(NPC)
|
|
spawn(NPC)
|
|
end |