local rewardItems = {
--[{chance}] = itemid
--[{low, high}] -- if chance is equal to or inbetween these 2 numbers, then give item.
-- example chance 1/1700
--[{1, 1}] = 13537, -- Bag of Apple Slices
-- example chance 100/1700 aka 1/17
--[{1, 100}] = 13537, -- Bag of Apple Slices
[{ 1, 100}] = 13537, -- Bag of Apple Slices
[{ 101, 200}] = 22609, -- Dream Warden Claw
[{ 201, 300}] = 2355, -- Stuffed Bunny
[{ 301, 400}] = 5792, -- Dice
[{ 401, 500}] = 7459, -- Pair of Earmuffs
[{ 501, 600}] = 2111, -- Snowball
[{ 601, 700}] = 2114, -- Piggy Bank
[{ 701, 800}] = 2657, -- Simple Dress
[{ 801, 900}] = 1990, -- Present
[{ 901, 1000}] = 2745, -- Blue Rose
[{1001, 1100}] = 2072, -- Lute
[{1101, 1200}] = 22606, -- Bronze Prison Key
[{1201, 1300}] = 22604, -- Silver Prison Key
[{1301, 1400}] = 22607, -- Golden Prison Key
[{1401, 1500}] = 22396, -- Cluster of Solace
[{1501, 1600}] = 7735, -- Spellwand
[{1601, 1700}] = 22605 -- Copper Prision Key
}
function onUse(cid, item, frompos, item2, topos)
local rand = math.random(1700)
for chance, item_id in pairs(rewardItems) do
if chance[1] <= rand and chance[2] >= rand then
doPlayerAddItem(cid, item_id, 1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 26)
return true
end
end
return true
end