Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Luciano committed Jan 15, 2024
1 parent 9aaee3b commit 6049541
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
9 changes: 4 additions & 5 deletions data-otservbr-global/scripts/actions/other/potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion data/XML/storages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ When adding a new range or storage, make sure that the ranges do not overlap, an
<storage name="wheel.scroll.revised" key="3" />
<storage name="wheel.scroll.extended" key="4" />
<storage name="wheel.scroll.advanced" key="5" />
<storage name="talkaction.potions.flask" key="6" />
</range>
</storages>
6 changes: 3 additions & 3 deletions data/scripts/talkactions/player/flask.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6049541

Please sign in to comment.