local ITEM_ID = 44272 -- Item ID that the player can click to add auras
local STORAGE_KEY = 941002 -- Unique storage key for tracking usage
local STORAGE_VALUE = 90700 -- Specific storage value to set
local addAuraSystem = Action()
function addAuraSystem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid ~= ITEM_ID then
return true
end
if player:getStorageValue(STORAGE_KEY) == 1 then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have already used this item.")
return true
end
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have received an aura with storage: " .. STORAGE_VALUE .. ".")
player:setStorageValue(STORAGE_KEY, 1)
player:setStorageValue(STORAGE_VALUE, 1)
item:remove(1)
return true
end
addAuraSystem:id(ITEM_ID)
addAuraSystem:register()