Quest Daily Mission - Misiune zilnica, disponibila o data la 24 ore.
Scris: Sâm Ian 31, 2026 4:28 pm
Cod: Selectaţi tot
quest daily_quest begin
state start begin
when login or levelup begin
if pc.get_level() >= 10 then
set_state(main)
end
end
end
state main begin
-- CONFIG (vizibil peste tot)
function cfg()
local c = {}
c.NPC_VNUM = 20084
c.MONSTER_VNUM = 2101
c.REQ_KILLS = 20
-- Recompensa (buff 24h)
c.REWARD_TIME = 60 * 60 * 24
c.REWARD_HP = 50
c.REWARD_DEF = 5
c.REWARD_ATK = 5
return c
end
function today()
return math.floor(get_time() / 86400)
end
function reset_if_new_day()
local t = daily_quest.today()
if pc.getqf("dq_day") != t then
pc.setqf("dq_day", t)
pc.setqf("dq_done", 0)
pc.setqf("dq_active", 0)
pc.setqf("dq_ready", 0)
pc.setqf("dq_kills", 0)
end
end
when login or levelup begin
daily_quest.reset_if_new_day()
end
when daily_quest.cfg().NPC_VNUM.chat."Ia misiunea zilnica" begin
daily_quest.reset_if_new_day()
local c = daily_quest.cfg()
if pc.getqf("dq_done") == 1 then
say("Ai terminat deja misiunea de azi. Revino maine!")
return
end
pc.setqf("dq_active", 1)
pc.setqf("dq_ready", 0)
pc.setqf("dq_kills", 0)
say("Misiunea ta:")
say("Omoara "..c.REQ_KILLS.." monstri.")
end
when kill begin
daily_quest.reset_if_new_day()
local c = daily_quest.cfg()
if pc.getqf("dq_active") != 1 then
return
end
if npc.get_race() != c.MONSTER_VNUM then
return
end
local k = pc.getqf("dq_kills") + 1
if k > c.REQ_KILLS then
k = c.REQ_KILLS
end
pc.setqf("dq_kills", k)
if k >= c.REQ_KILLS then
pc.setqf("dq_active", 0)
pc.setqf("dq_ready", 1)
chat("Ai terminat kill-urile! Mergi la NPC.")
end
end
when daily_quest.cfg().NPC_VNUM.chat."Finalizeaza misiunea" begin
daily_quest.reset_if_new_day()
local c = daily_quest.cfg()
if pc.getqf("dq_ready") != 1 then
say("Nu ai terminat inca.")
return
end
say("Felicitari! Ai primit buff 24h.")
affect.add(apply.MAX_HP, c.REWARD_HP, c.REWARD_TIME)
affect.add(apply.DEF_GRADE_BONUS, c.REWARD_DEF, c.REWARD_TIME)
affect.add(apply.ATT_GRADE_BONUS, c.REWARD_ATK, c.REWARD_TIME)
pc.setqf("dq_done", 1)
pc.setqf("dq_ready", 0)
end
end
end