-- This is a mockup function, and does not actually exist.
function onCastAnySpell(cid, spellid, lvl, cooldown, groupcooldown, mana)
if (isPlayer(cid)) then
local player = Player(cid)
-- If player have 25% reduced cooldown
if player:getStorageValue(xxxxx) == 1 then
cooldown = cooldown * 0.75
groupcooldown = groupcooldown * 0.75
end
-- If player have 25% lower mana cost
if player:getStorageValue(yyyy) == 1 then
mana = mana * 0.75
end
-- If player have Witch Hat (10570) and spell id is 9 (Summon Creature / utevo res)
local item = Item(player:getSlotItem(SLOT_HELMET))
if (item.getId() == 10570 AND spellid == 9) then
-- 20% less summon creature spell cost, where the mana cost varies depending on monster
mana = mana * 0.8
end
else
local creature = Creature(cid)
-- Do something cool with monster spells?
end
return cid, spellid, lvl, cooldown, groupcooldown, mana
end