From 481dfa67a624d38214ad9a6095ff6b4b253ea845 Mon Sep 17 00:00:00 2001 From: Leonardo Macedo <34727091+LeeoMacedo@users.noreply.github.com> Date: Sat, 19 Aug 2023 23:43:20 -0300 Subject: [PATCH 01/10] add command !flask and fix eradicator name (#1448) Co-authored-by: Eduardo Dantas --- .../scripts/actions/other/potions.lua | 10 +++++--- .../heart_of_destruction/eradicator_lever.lua | 2 +- data/XML/storages.xml | 1 + data/scripts/talkactions/player/flask.lua | 24 +++++++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 data/scripts/talkactions/player/flask.lua diff --git a/data-otservbr-global/scripts/actions/other/potions.lua b/data-otservbr-global/scripts/actions/other/potions.lua index 28be4bbae37..1110c85a1c5 100644 --- a/data-otservbr-global/scripts/actions/other/potions.lua +++ b/data-otservbr-global/scripts/actions/other/potions.lua @@ -267,12 +267,16 @@ function flaskPotion.onUse(player, item, fromPosition, target, toPosition, isHot target:say("Aaaah...", MESSAGE_POTION) if fromPosition.x == CONTAINER_POSITION and not container == store_inbox then local container = Container(item:getParent().uid) - container:addItem(potion.flask, 1) + if player:getStorageValueByName("talkaction.potions.flask") ~= 1 then + container:addItem(potion.flask, 1) + end else - player:addItem(potion.flask, 1) + if player:getStorageValueByName("talkaction.potions.flask") ~= 1 then + player:addItem(potion.flask, 1) + end end player:addCondition(exhaust) - player:setStorageValue(38412, player:getStorageValue(38412)+1) + player:setStorageValue(38412, player:getStorageValue(38412) + 1) end player:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ITEM_USE_POTION, player:isInGhostMode() and nil or player) diff --git a/data-otservbr-global/scripts/actions/quests/heart_of_destruction/eradicator_lever.lua b/data-otservbr-global/scripts/actions/quests/heart_of_destruction/eradicator_lever.lua index c8b3212e732..e8807f6ba4d 100644 --- a/data-otservbr-global/scripts/actions/quests/heart_of_destruction/eradicator_lever.lua +++ b/data-otservbr-global/scripts/actions/quests/heart_of_destruction/eradicator_lever.lua @@ -104,7 +104,7 @@ function heartDestructionEradicator.onUse(player, item, fromPosition, itemEx, to Game.createMonster("Spark of Destruction", {x = 32305, y = 31287, z = 14}, false, true) Game.createMonster("Spark of Destruction", {x = 32312, y = 31287, z = 14}, false, true) Game.createMonster("Spark of Destruction", {x = 32314, y = 31282, z = 14}, false, true) - Game.createMonster("Eradicator", {x = 32309, y = 31283, z = 14}, false, true) + Game.createMonster("Eradicator1", {x = 32309, y = 31283, z = 14}, false, true) local vortex = Tile({x = 32318, y = 31284, z = 14}):getItemById(23482) if vortex then diff --git a/data/XML/storages.xml b/data/XML/storages.xml index 735b4c62ed8..171eec35a7a 100644 --- a/data/XML/storages.xml +++ b/data/XML/storages.xml @@ -29,5 +29,6 @@ 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 new file mode 100644 index 00000000000..577df46a120 --- /dev/null +++ b/data/scripts/talkactions/player/flask.lua @@ -0,0 +1,24 @@ +local flask = TalkAction("!flask") + +function flask.onSay(player, words, param) + if param == "" then + player:sendCancelMessage("You need to specify on/off param.") + return true + end + if param == "on" and player:getStorageValueByName("talkaction.potions.flask") ~= 1 then + player:setStorageValue(STORAGEVALUE_EMOTE, 1) + player:setStorageValueByName("talkaction.potions.flask", 1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You will not receive flasks!") + player:getPosition():sendMagicEffect(CONST_ME_REDSMOKE) + elseif param == "off" then + player:setStorageValue(STORAGEVALUE_EMOTE, 0) + player:setStorageValueByName("talkaction.potions.flask", 0) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You will receive flasks.") + player:getPosition():sendMagicEffect(CONST_ME_REDSMOKE) + end + return true +end + +flask:separator(" ") +flask:groupType("normal") +flask:register() From 297f7d0258e8074c0bd4343f81783939c754671e Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 1 Sep 2023 00:00:43 -0300 Subject: [PATCH 02/10] Update daily_reward.lua --- data/modules/scripts/daily_reward/daily_reward.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/modules/scripts/daily_reward/daily_reward.lua b/data/modules/scripts/daily_reward/daily_reward.lua index 5eb64d2baf1..1a24a07fa31 100644 --- a/data/modules/scripts/daily_reward/daily_reward.lua +++ b/data/modules/scripts/daily_reward/daily_reward.lua @@ -241,7 +241,7 @@ DailyReward.loadDailyReward = function(playerId, target) end target = REWARD_FROM_PANEL - if target ~= 0 then + if target == 0 then target = REWARD_FROM_SHRINE end From d670f601a8605edea27a3385e7a148a256fc2059 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 8 Sep 2023 02:55:20 -0300 Subject: [PATCH 03/10] fix: error unexpected symbol near '==' --- .../scripts/spells/monster/remorseless_wave.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua b/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua index a58a3b0a8ea..eda1953d287 100644 --- a/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua +++ b/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua @@ -24,7 +24,7 @@ function spellCallback(param) if creatureTop:isPlayer() then creatureTop:addHealth(- math.random(0, 600)) elseif creatureTop:isMonster() and creatureTop:getName():lower() == "stolen soul" then - creatureTop:getName():lower() == "stolen soul" then:addHealth(- math.random(700, 1500)) + addHealth(-math.random(700, 1500)) end end end From b0925c3215da2371fbdf1f1511609a2a4b6117ec Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 8 Sep 2023 02:56:11 -0300 Subject: [PATCH 04/10] Revert "fix: error unexpected symbol near '=='" This reverts commit d670f601a8605edea27a3385e7a148a256fc2059. --- .../scripts/spells/monster/remorseless_wave.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua b/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua index eda1953d287..a58a3b0a8ea 100644 --- a/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua +++ b/data-otservbr-global/scripts/spells/monster/remorseless_wave.lua @@ -24,7 +24,7 @@ function spellCallback(param) if creatureTop:isPlayer() then creatureTop:addHealth(- math.random(0, 600)) elseif creatureTop:isMonster() and creatureTop:getName():lower() == "stolen soul" then - addHealth(-math.random(700, 1500)) + creatureTop:getName():lower() == "stolen soul" then:addHealth(- math.random(700, 1500)) end end end From b52c46d6d67ba072fa497530276b3be9d88a5908 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Sun, 3 Mar 2024 23:48:48 -0300 Subject: [PATCH 05/10] Update task.hpp --- src/game/scheduling/task.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/scheduling/task.hpp b/src/game/scheduling/task.hpp index c6591887c8a..cdee6568a7d 100644 --- a/src/game/scheduling/task.hpp +++ b/src/game/scheduling/task.hpp @@ -70,10 +70,10 @@ class Task { bool hasTraceableContext() const { const static auto tasksContext = std::unordered_set({ - "Creature::checkCreatureWalk", "Decay::checkDecay", "Dispatcher::asyncEvent", "Game::checkCreatureAttack", + "Game::checkCreatureWalk", "Game::checkCreatures", "Game::checkImbuements", "Game::checkLight", From 0be01f57bb7f039bbda940e49058a186f38637b3 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Sun, 3 Mar 2024 23:53:31 -0300 Subject: [PATCH 06/10] Update creature.cpp --- src/creatures/creature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index d17ee454402..c74ac2120b5 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -259,7 +259,7 @@ void Creature::addEventWalk(bool firstStep) { self->eventWalk = g_dispatcher().scheduleEvent( static_cast(ticks), std::bind(&Game::checkCreatureWalk, &g_game(), self->getID()), - "Creature::checkCreatureWalk" + "Game::checkCreatureWalk" ); }); } From 4710e30ddcb7345ac876339718c5370b0c040905 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Sun, 3 Mar 2024 23:54:47 -0300 Subject: [PATCH 07/10] Update protocol.cpp --- src/server/network/protocol/protocol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/network/protocol/protocol.cpp b/src/server/network/protocol/protocol.cpp index 6f6a1c8228e..78cff72fab4 100644 --- a/src/server/network/protocol/protocol.cpp +++ b/src/server/network/protocol/protocol.cpp @@ -50,7 +50,7 @@ bool Protocol::sendRecvMessageCallback(NetworkMessage &msg) { protocol->parsePacket(msg); protocolConnection->resumeWork(); } - } }, __FUNCTION__); + } }, "Protocol::sendRecvMessageCallback"); return true; } From d25c4946c4cfec3f4f2f101d3f74d760f1fff284 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Sun, 3 Mar 2024 23:55:28 -0300 Subject: [PATCH 08/10] Update task.hpp --- src/game/scheduling/task.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/game/scheduling/task.hpp b/src/game/scheduling/task.hpp index cdee6568a7d..7bdc7db8084 100644 --- a/src/game/scheduling/task.hpp +++ b/src/game/scheduling/task.hpp @@ -94,7 +94,6 @@ class Task { "SpawnNpc::checkSpawnNpc", "Webhook::run", "Protocol::sendRecvMessageCallback", - "sendRecvMessageCallback", }); return tasksContext.contains(context); From da00b176b97e0ab9f929bc353d86e45304242a6b Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sun, 24 Mar 2024 07:52:54 +0000 Subject: [PATCH 09/10] Code format - (Clang-format) --- src/game/game.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/game.cpp b/src/game/game.cpp index 6754e990595..94cf75c8cf9 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1649,12 +1649,12 @@ void Game::playerMoveItem(std::shared_ptr player, const Position &fromPo return; } } - + if (isTryingToStow(toPos, toCylinder)) { player->stowItem(item, count, false); return; } - + ReturnValue ret = internalMoveItem(fromCylinder, toCylinder, toIndex, item, count, nullptr, 0, player); if (ret != RETURNVALUE_NOERROR) { player->sendCancelMessage(ret); From 0a08f0cc6ef8e5cae58c9ced604da37e8e22d163 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sun, 28 Apr 2024 23:20:04 +0000 Subject: [PATCH 10/10] Code format - (Clang-format) --- src/creatures/players/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 1f0c9b45dce..a81981bd20c 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -1925,7 +1925,7 @@ void Player::onWalk(Direction &dir) { Creature::onWalk(dir); setNextActionTask(nullptr); - + g_callbacks().executeCallback(EventCallback_t::playerOnWalk, &EventCallback::playerOnWalk, getPlayer(), dir); }