quest daily_quesd begin
state start begin
when login with pc.getqf('daily_day') ~= tonumber(os.date('%d', os.time())) or
pc.getqf('daily_month') ~= tonumber(os.date('%m', os.time())) begin
local w,c = {},daily_quesd.works()
for i = 1, table.getn(c) do
table.insert(w,i)
end
end
if table.getn(w) == 0 then chat('Day Metin Quest not yet available!') return end
pc.setqf('daily_number', w[number(1,table.getn(w))])
pc.setqf('daily_day', tonumber(os.date('%d', os.time())))
pc.setqf('daily_month', tonumber(os.date('%m', os.time())))
pc.setqf('daily_counter', 0)
set_state(daily_run)
end
end
state daily_run begin
when letter begin
send_letter('Day Metin Quest: '..os.date('%A', os.time()))
end
when button or info begin
say("Hello, this is your Daily Metin Quest.")
say("Every day you get a new Quest.")
say("")
say_reward('Kill: '..mob_name(daily_quesd.works()[pc.getqf('daily_number')][3]))
say_reward('Count: '..daily_quesd.works()[pc.getqf('daily_number')][4]..' times')
say_reward('Currently killed: '..pc.getqf('daily_counter'))
end
when kill with npc.get_race() == daily_quesd.works()[pc.getqf('daily_number')][3] begin
pc.setqf('daily_counter', pc.getqf('daily_counter')+1)
if pc.getqf('daily_counter') >= daily_quesd.works()[pc.getqf('daily_number')][4] then
say('Congratulation, Mission successful!')
say('You get:')
local z,u = number(1,table.getn(daily_quesd.rewards()[1])),number(1,table.getn(daily_quesd.rewards()[2]))
say(item_name(daily_quesd.rewards()[1][z])..' and..')
say(daily_quesd.rewards()[2][u]..' Gold!')
pc.give_item2(daily_quesd.rewards()[1][z],1)
pc.change_money(daily_quesd.rewards()[2][u])
pc.setqf('daily_counter', 0)
pc.setqf('daily_number', 0)
clear_letter()
set_state(start)
end
end
function rewards()
local t = {
[1] = {71203,300010,300011,300010,300011,300008,300008,50922,50922,300011,300010},
[2] = {7500000,7500000,7500000,7500000,10000000,15000000,20000000,25000000},
}
return t
end
function works()
local t = {
[1] = {1,25,8001,20},
[2] = {1,25,9055,50},
[3] = {1,25,9058,50},
[4] = {1,25,8004,20},
[5] = {1,25,8005,20},
[6] = {25,40,8006,20},
[7] = {25,40,8007,20},
[8] = {25,40,8008,20},
[9] = {40,55,8009,20},
[10] = {40,55,8010,20},
[11] = {40,55,8011,20},
[12] = {55,70,8012,20},
[13] = {55,70,8013,20},
[14] = {55,70,8014,20},
[15] = {70,99,8024,20},
[16] = {70,99,8025,20},
[17] = {70,99,8026,20},
[18] = {70,99,8027,20},
}
return t
end
end
end