1function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2 if player:getStorageValue(PlayerStorageKeys.delayLargeSeaShell) <= os.time() then
3 local chance = math.random(100)
4 local msg = ""
5 if chance <= 16 then
6 doTargetCombat(0, player, COMBAT_PHYSICALDAMAGE, -200, -200, CONST_ME_NONE)
7 msg = "Ouch! You squeezed your fingers."
8 elseif chance > 16 and chance <= 64 then
9 Game.createItem(math.random(7632, 7633), 1, player:getPosition())
10 msg = "You found a beautiful pearl."
11 player:addAchievementProgress("Shell Seeker", 100)
12 else
13 msg = "Nothing is inside."
14 end
15 player:say(msg, TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
16 item:transform(7553)
17 item:decay()
18 player:setStorageValue(PlayerStorageKeys.delayLargeSeaShell, os.time() + 20 * 60 * 60)
19 item:getPosition():sendMagicEffect(CONST_ME_BUBBLES)
20 else
21 player:say("You have already opened a shell today.", TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
22 end
23 return true
24end
25