daily pastebin goal
21%
SHARE
TWEET

Daily Quest

a guest Jun 11th, 2015 450 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local config = {
  2.         storage = 45392,
  3.         exstorage = 40822,
  4.         days = {
  5.                 ["Monday"] = {
  6.                         {itemid = 8839, count = {1, 3}},
  7.                 },
  8.                 ["Tuesday"] = {
  9.                         {itemid = 2681, count = 1},
  10.                         {itemid = 2682, count = 1},
  11.                         {itemid = 2683, count = 1}
  12.                 },
  13.                 ["Wednesday"] = {
  14.                         {itemid = 2674, count = {1, 10}},
  15.                         {itemid = 2675, count = {1, 10}},
  16.                         {itemid = 2676, count = {1, 10}},
  17.                         {itemid = 2673, count = {1, 10}}
  18.                 },
  19.                 ["Thursday"] = {
  20.                         {itemid = 2679, count = {2, 15}},
  21.                         {itemid = 2680, count = {1, 5}},
  22.                 },
  23.                 ["Friday"] = {
  24.                         {itemid = 2788, count = {1, 3}},
  25.                 },
  26.                 ["Saturday"] = {
  27.                         {itemid = 6393, count = 1},
  28.                 },
  29.                 ["Sunday"] = {
  30.                         {itemid = 2389, count = {2, 12}},
  31.                         {itemid = 2690, count = {1, 5}},
  32.                 }
  33.         }
  34. }
  35.  
  36. function onUse(cid, item, fromPosition, itemEx, toPosition)
  37.                 local x = config.days[os.date("%A")]
  38.                 if getPlayerStorageValue(cid, config.storage) == tonumber(os.date("%w")) and exhaustion.check(cid, config.exstorage) then
  39.                                 return doPlayerSendCancel(cid, "The chest is empty, come back tomorrow for a new reward.")
  40.                 end
  41.                 local c = math.random(#x)
  42.                 local info, count = getItemInfo(x[c].itemid), x[c].count[2] and math.random(x[c].count[1], x[c].count[2]) or x[c].count[1]
  43.                 if count > 1 then
  44.                                 text = count .. " " .. info.plural
  45.                 else
  46.                                 text = info.article .. " " .. info.name
  47.                 end
  48.                 local itemx = doCreateItemEx(x[c].itemid, count)
  49.                 if doPlayerAddItemEx(cid, itemx, false) ~= RETURNVALUE_NOERROR then
  50.                                 doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  51.                                 text = "You have found a reward weighing " .. getItemWeight(itemx) .. " oz. It is too heavy or you have not enough space."
  52.                 else
  53.                                 text = "You have received " .. text .. "."
  54.                                 setPlayerStorageValue(cid, config.storage, tonumber(os.date("%w")))
  55.                                 exhaustion.set(cid, config.exstorage, 24*60*60)
  56.                 end
  57.                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
  58.                 return true
  59. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top