From 60495417475afdf16b3f9dcef1ae9f8071dd0d91 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Mon, 15 Jan 2024 09:10:06 -0300 Subject: [PATCH] update --- data-otservbr-global/scripts/actions/other/potions.lua | 9 ++++----- data/XML/storages.xml | 1 - data/scripts/talkactions/player/flask.lua | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/data-otservbr-global/scripts/actions/other/potions.lua b/data-otservbr-global/scripts/actions/other/potions.lua index febc3ed9d3e..d32db13e30a 100644 --- a/data-otservbr-global/scripts/actions/other/potions.lua +++ b/data-otservbr-global/scripts/actions/other/potions.lua @@ -268,13 +268,12 @@ function flaskPotion.onUse(player, item, fromPosition, target, toPosition, isHot player:addAchievementProgress("Potion Addict", 100000) target:say("Aaaah...", MESSAGE_POTION) - if fromPosition.x == CONTAINER_POSITION and not container == store_inbox then + local deactivatedFlasks = player:kv():get("talkaction.potions.flask") or false + if not deactivatedFlasks then local container = Container(item:getParent().uid) - if player:getStorageValueByName("talkaction.potions.flask") ~= 1 then + if fromPosition.x == CONTAINER_POSITION and not container == store_inbox then container:addItem(potion.flask, 1) - end - else - if player:getStorageValueByName("talkaction.potions.flask") ~= 1 then + else player:addItem(potion.flask, 1) end end diff --git a/data/XML/storages.xml b/data/XML/storages.xml index 171eec35a7a..735b4c62ed8 100644 --- a/data/XML/storages.xml +++ b/data/XML/storages.xml @@ -29,6 +29,5 @@ When adding a new range or storage, make sure that the ranges do not overlap, an - diff --git a/data/scripts/talkactions/player/flask.lua b/data/scripts/talkactions/player/flask.lua index f3ccdb0bb7a..232b9485602 100644 --- a/data/scripts/talkactions/player/flask.lua +++ b/data/scripts/talkactions/player/flask.lua @@ -5,12 +5,12 @@ function flask.onSay(player, words, param) player:sendCancelMessage("You need to specify on/off param.") return true end - if param == "on" and player:getStorageValueByName("talkaction.potions.flask") ~= 1 then - player:setStorageValueByName("talkaction.potions.flask", 1) + if param == "on" then + player:kv():set("talkaction.potions.flask", true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You will not receive flasks!") player:getPosition():sendMagicEffect(CONST_ME_REDSMOKE) elseif param == "off" then - player:setStorageValueByName("talkaction.potions.flask", 0) + player:kv():remove("talkaction.potions.flask") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You will receive flasks.") player:getPosition():sendMagicEffect(CONST_ME_REDSMOKE) end