From 5d13c37e3e21575b06be91e7c47df6705330e3d3 Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Mon, 4 Dec 2023 13:15:10 -0300 Subject: [PATCH 1/3] changed return 'false' to 'true' in talkaction (when return is true, the command isn't showed in chat). adjusted '/listplayers' command. when player is in training room, the food is infinite. fixed ids from 'Darkfire Devourer' and 'Spirit of Purity' mounts. --- data-otservbr-global/scripts/actions/other/food.lua | 5 ++++- .../ferumbras_ascendant/rift_invader_death.lua | 9 +++------ data/modules/scripts/gamestore/gamestore.lua | 4 ++-- .../talkactions/gm/teleport_to_active_player.lua | 4 ++-- data/scripts/talkactions/gm/teleport_to_player.lua | 9 +++++---- data/scripts/talkactions/god/add_addon.lua | 8 ++++---- data/scripts/talkactions/god/add_bosstiary_kills.lua | 4 ++-- data/scripts/talkactions/god/add_money.lua | 6 +++--- data/scripts/talkactions/god/goto_house.lua | 2 +- data/scripts/talkactions/god/inbox_command.lua | 2 +- data/scripts/talkactions/god/zones.lua | 12 ++++++------ data/scripts/talkactions/player/buy_house.lua | 2 +- .../player/hidden_npc_sell_shop_items.lua | 2 +- data/scripts/talkactions/player/leave_house.lua | 2 +- 14 files changed, 36 insertions(+), 35 deletions(-) diff --git a/data-otservbr-global/scripts/actions/other/food.lua b/data-otservbr-global/scripts/actions/other/food.lua index 3c6b5290fed..98a0816511f 100644 --- a/data-otservbr-global/scripts/actions/other/food.lua +++ b/data-otservbr-global/scripts/actions/other/food.lua @@ -141,7 +141,10 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey) end player:feed(itemFood[1] * 12) player:say(itemFood[2], TALKTYPE_MONSTER_SAY) - item:remove(1) + -- do not remove food in trainers + if not isInRange(player:getPosition(), Position(1015, 1109, 7), Position(1094, 1738, 7)) then + item:remove(1) + end player:updateSupplyTracker(item) player:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_EAT, player:isInGhostMode() and nil or player) if effect then diff --git a/data-otservbr-global/scripts/creaturescripts/quests/ferumbras_ascendant/rift_invader_death.lua b/data-otservbr-global/scripts/creaturescripts/quests/ferumbras_ascendant/rift_invader_death.lua index ae000aaf097..a3d049f4581 100644 --- a/data-otservbr-global/scripts/creaturescripts/quests/ferumbras_ascendant/rift_invader_death.lua +++ b/data-otservbr-global/scripts/creaturescripts/quests/ferumbras_ascendant/rift_invader_death.lua @@ -48,12 +48,9 @@ function riftInvaderDeath.onDeath(creature, corpse, lasthitkiller, mostdamagekil end end - local tilePool = Tile(creature:getPosition()) - if tilePool then - local pool = tilePool:getItemById(2886) - if pool then - pool:remove() - end + local pool = Tile(creature:getPosition()):getItemById(2886) + if pool then + pool:remove() end local vortex = Game.createItem(config.vortex, 1, creature:getPosition()) diff --git a/data/modules/scripts/gamestore/gamestore.lua b/data/modules/scripts/gamestore/gamestore.lua index 712660e4820..afaffcb0b6a 100644 --- a/data/modules/scripts/gamestore/gamestore.lua +++ b/data/modules/scripts/gamestore/gamestore.lua @@ -1320,7 +1320,7 @@ GameStore.Categories = { icons = { "Darkfire_Devourer.png" }, name = "Darkfire Devourer", price = 1300, - id = 213, + id = 216, description = "{character}\n{speedboost}\n\nA wild, ancient creature, which had been hiding in the depths of the shadows for a very long time, has been spotted in Tibia again! The almighty Shadow Draptor has returned and only the bravest Tibians can control such a beast!", type = GameStore.OfferTypes.OFFER_TYPE_MOUNT, }, @@ -2092,7 +2092,7 @@ GameStore.Categories = { icons = { "Spirit_of_Purity.png" }, name = "Spirit of Purity", price = 1000, - id = 215, + id = 217, description = "{character}\n{speedboost}\n\nA wild, ancient creature, which had been hiding in the depths of the shadows for a very long time, has been spotted in Tibia again! The almighty Shadow Draptor has returned and only the bravest Tibians can control such a beast!", type = GameStore.OfferTypes.OFFER_TYPE_MOUNT, }, diff --git a/data/scripts/talkactions/gm/teleport_to_active_player.lua b/data/scripts/talkactions/gm/teleport_to_active_player.lua index abb71116a37..028c14c4610 100644 --- a/data/scripts/talkactions/gm/teleport_to_active_player.lua +++ b/data/scripts/talkactions/gm/teleport_to_active_player.lua @@ -19,12 +19,12 @@ function teleportToCreature.onSay(player, words, param) if #activePlayers == 0 then player:sendCancelMessage("There are no active players.") - return false + return true end local targetPlayer = activePlayers[math.random(#activePlayers)] player:teleportTo(targetPlayer:getPosition()) - return false + return true end teleportToCreature:separator(" ") diff --git a/data/scripts/talkactions/gm/teleport_to_player.lua b/data/scripts/talkactions/gm/teleport_to_player.lua index 04bcdf0dc91..1a59a0ffd12 100644 --- a/data/scripts/talkactions/gm/teleport_to_player.lua +++ b/data/scripts/talkactions/gm/teleport_to_player.lua @@ -4,7 +4,7 @@ function teleportToCreature.onSay(player, words, param) -- create log logCommand(player, words, param) - local onlyActive = param == "active" and true or false + local showAll = param == "all" and true or false local players = Game.getPlayers() local playerList = {} @@ -14,13 +14,14 @@ function teleportToCreature.onSay(player, words, param) goto continue end - if not onlyActive then + if showAll then table.insert(playerList, targetPlayer) else local isGhost = targetPlayer:isInGhostMode() local isTraining = _G.OnExerciseTraining[targetPlayer:getId()] local isIdle = targetPlayer:getIdleTime() >= 5 * 60 * 1000 - local isActive = not isGhost and not isTraining and not isIdle + local isInTrainingRoom = isInRange(targetPlayer:getPosition(), Position(1015, 1109, 7), Position(1094, 1738, 7)) + local isActive = not isGhost and not isTraining and not isIdle and not isInTrainingRoom if isActive then table.insert(playerList, targetPlayer) end @@ -30,7 +31,7 @@ function teleportToCreature.onSay(player, words, param) if #playerList == 0 then player:sendCancelMessage("There are no active players.") - return false + return true end local window = ModalWindow({ diff --git a/data/scripts/talkactions/god/add_addon.lua b/data/scripts/talkactions/god/add_addon.lua index c9f7003ee77..026336e270e 100644 --- a/data/scripts/talkactions/god/add_addon.lua +++ b/data/scripts/talkactions/god/add_addon.lua @@ -20,24 +20,24 @@ function addons.onSay(player, words, param) if not target then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Player " .. name .. " is currently not online.") - return false + return true end local looktype = tonumber(split[2]) if not looktype then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Invalid looktype.") - return false + return true end local addons = tonumber(split[3]) if not addons or addons < 0 or addons > 3 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Invalid addon.") - return false + return true end target:addOutfitAddon(looktype, addons) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Addon for looktype " .. looktype .. "a for " .. target:getName() .. " set to " .. addons .. ".") - return false + return true end addons:separator(" ") diff --git a/data/scripts/talkactions/god/add_bosstiary_kills.lua b/data/scripts/talkactions/god/add_bosstiary_kills.lua index 583b02fa8fe..4e5aecdfbd4 100644 --- a/data/scripts/talkactions/god/add_bosstiary_kills.lua +++ b/data/scripts/talkactions/god/add_bosstiary_kills.lua @@ -13,13 +13,13 @@ function talkaction.onSay(player, words, param) if not kills or kills < 1 then player:sendCancelMessage("Invalid kill count.") - return false + return true end local target = targetName ~= "" and Player(targetName) or player if not target then player:sendCancelMessage("Target player not found.") - return false + return true end local message = "Added received kills: " .. kills .. ", for boss: " .. monsterName diff --git a/data/scripts/talkactions/god/add_money.lua b/data/scripts/talkactions/god/add_money.lua index 57670abd90e..fa37aa9a8b9 100644 --- a/data/scripts/talkactions/god/add_money.lua +++ b/data/scripts/talkactions/god/add_money.lua @@ -20,7 +20,7 @@ function addMoney.onSay(player, words, param) local normalizedName = Game.getNormalizedPlayerName(name) if not normalizedName then player:sendCancelMessage("A player with name " .. name .. " does not exist.") - return false + return true end name = normalizedName @@ -32,14 +32,14 @@ function addMoney.onSay(player, words, param) -- Check if the coins is valid if amount <= 0 or amount == nil then player:sendCancelMessage("Invalid amount.") - return false + return true end if not Bank.credit(name, amount) then player:sendCancelMessage("Failed to add money to " .. name .. ".") -- Distro log logger.error("[addMoney.onSay] - Failed to add money to player") - return false + return true end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Successfull added " .. amount .. " gold coins to " .. name .. ".") diff --git a/data/scripts/talkactions/god/goto_house.lua b/data/scripts/talkactions/god/goto_house.lua index 407649c8329..503ebd65a34 100644 --- a/data/scripts/talkactions/god/goto_house.lua +++ b/data/scripts/talkactions/god/goto_house.lua @@ -20,7 +20,7 @@ function sellHouse.onSay(player, words, param) player:teleportTo(house:getExitPosition()) end - return false + return true end sellHouse:separator(" ") diff --git a/data/scripts/talkactions/god/inbox_command.lua b/data/scripts/talkactions/god/inbox_command.lua index 59d7dbec3a8..b9834aa2384 100644 --- a/data/scripts/talkactions/god/inbox_command.lua +++ b/data/scripts/talkactions/god/inbox_command.lua @@ -28,7 +28,7 @@ function inboxCommand.onSay(player, words, param) player:sendCancelMessage("Creature not found.") end - return false + return true end inboxCommand:separator(" ") diff --git a/data/scripts/talkactions/god/zones.lua b/data/scripts/talkactions/god/zones.lua index 75f70af6507..fd2530c6ff8 100644 --- a/data/scripts/talkactions/god/zones.lua +++ b/data/scripts/talkactions/god/zones.lua @@ -5,7 +5,7 @@ function zones.onSay(player, words, param) local cmd = params[1] if not cmd then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command not found.") - return false + return true end if cmd == "list" then @@ -21,12 +21,12 @@ function zones.onSay(player, words, param) local zoneName = params[2]:trim() if not zoneName then player:sendTextMessage(MESSAGE_HEALED, "Zone not found.") - return false + return true end local zone = Zone.getByName(zoneName) if not zone then player:sendTextMessage(MESSAGE_HEALED, "Zone not found.") - return false + return true end return zone end @@ -36,7 +36,7 @@ function zones.onSay(player, words, param) local pos = zone:randomPosition() if not pos then player:sendTextMessage(MESSAGE_HEALED, "No position found.") - return false + return true end player:teleportTo(pos) player:sendTextMessage(MESSAGE_HEALED, "You have been teleported to " .. zone:getName() .. ".") @@ -82,11 +82,11 @@ function zones.onSay(player, words, param) local command = commands[cmd] if not command then player:sendTextMessage(MESSAGE_HEALED, "Command not found.") - return false + return true end local zone = zoneFromParam() if not zone then - return false + return true end return command(zone) end diff --git a/data/scripts/talkactions/player/buy_house.lua b/data/scripts/talkactions/player/buy_house.lua index ee0ce8da5ee..1d50956e71b 100644 --- a/data/scripts/talkactions/player/buy_house.lua +++ b/data/scripts/talkactions/player/buy_house.lua @@ -42,7 +42,7 @@ function buyHouse.onSay(player, words, param) if house:hasItemOnTile() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot buy this house, as there are items inside it. Please, contact an administrator.") - return false + return true end local price = house:getPrice() diff --git a/data/scripts/talkactions/player/hidden_npc_sell_shop_items.lua b/data/scripts/talkactions/player/hidden_npc_sell_shop_items.lua index 6812de99e47..1d7e3b2106d 100644 --- a/data/scripts/talkactions/player/hidden_npc_sell_shop_items.lua +++ b/data/scripts/talkactions/player/hidden_npc_sell_shop_items.lua @@ -10,7 +10,7 @@ function talkaction.onSay(player, words, param) player:sendTextMessage(MESSAGE_LOOK, "You activated hidden sell shop items.") elseif param == "off" then player:kv():set("npc-shop-hidden-sell-item", false) - player:sendTextMessage(MESSAGE_LOOK, "You desactivated hidden sell shop items") + player:sendTextMessage(MESSAGE_LOOK, "You deactivated hidden sell shop items") end return true end diff --git a/data/scripts/talkactions/player/leave_house.lua b/data/scripts/talkactions/player/leave_house.lua index 8743ed17a23..20ad186f2d2 100644 --- a/data/scripts/talkactions/player/leave_house.lua +++ b/data/scripts/talkactions/player/leave_house.lua @@ -19,7 +19,7 @@ function leaveHouse.onSay(player, words, param) if house:hasNewOwnership() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot leave this house. Ownership is already scheduled to be transferred upon the next server restart.") playerPosition:sendMagicEffect(CONST_ME_POFF) - return false + return true end -- Move hireling back to lamp From 069f578ec42d9fe295f0d4725c521511d4ed69e3 Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Mon, 4 Dec 2023 13:20:33 -0300 Subject: [PATCH 2/3] fix typos. --- data-otservbr-global/monster/raids/fernfang.lua | 2 +- src/canary_server.cpp | 2 +- src/io/iologindata.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data-otservbr-global/monster/raids/fernfang.lua b/data-otservbr-global/monster/raids/fernfang.lua index 70e03ff04fb..f33b998345c 100644 --- a/data-otservbr-global/monster/raids/fernfang.lua +++ b/data-otservbr-global/monster/raids/fernfang.lua @@ -66,7 +66,7 @@ monster.summon = { monster.voices = { interval = 5000, chance = 10, - { text = "You desacrated this place!", yell = false }, + { text = "You desecrated this place!", yell = false }, { text = "Yoooohuuuu!", yell = false }, { text = "I will cleanse this isle!", yell = false }, { text = "Grrrrrrr", yell = false }, diff --git a/src/canary_server.cpp b/src/canary_server.cpp index 5b644d4ed10..a809188f19f 100644 --- a/src/canary_server.cpp +++ b/src/canary_server.cpp @@ -208,7 +208,7 @@ void CanaryServer::logInfos() { /** *It is preferable to keep the close button off as it closes the server without saving (this can cause the player to lose items from houses and others informations, since windows automatically closes the process in five seconds, when forcing the close) * Choose to use "CTROL + C" or "CTROL + BREAK" for security close - * To activate/desactivate window; + * To activate/deactivate window; * \param MF_GRAYED Disable the "x" (force close) button * \param MF_ENABLED Enable the "x" (force close) button */ diff --git a/src/io/iologindata.cpp b/src/io/iologindata.cpp index 584f36e2085..e0b7be6c58a 100644 --- a/src/io/iologindata.cpp +++ b/src/io/iologindata.cpp @@ -83,7 +83,7 @@ void IOLoginData::updateOnlineStatus(uint32_t guid, bool login) { Database::getInstance().executeQuery(query.str()); } -// The boolean "disableIrrelevantInfo" will desactivate the loading of information that is not relevant to the preload, for example, forge, bosstiary, etc. None of this we need to access if the player is offline +// The boolean "disableIrrelevantInfo" will deactivate the loading of information that is not relevant to the preload, for example, forge, bosstiary, etc. None of this we need to access if the player is offline bool IOLoginData::loadPlayerById(std::shared_ptr player, uint32_t id, bool disableIrrelevantInfo /* = true*/) { Database &db = Database::getInstance(); std::ostringstream query; From 997293e38a6c4e96eb0fe5bf2aa6435178a62d0d Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Fri, 8 Dec 2023 00:33:22 -0300 Subject: [PATCH 3/3] redo check (move to other pr). --- data-otservbr-global/scripts/actions/other/food.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/data-otservbr-global/scripts/actions/other/food.lua b/data-otservbr-global/scripts/actions/other/food.lua index 98a0816511f..3c6b5290fed 100644 --- a/data-otservbr-global/scripts/actions/other/food.lua +++ b/data-otservbr-global/scripts/actions/other/food.lua @@ -141,10 +141,7 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey) end player:feed(itemFood[1] * 12) player:say(itemFood[2], TALKTYPE_MONSTER_SAY) - -- do not remove food in trainers - if not isInRange(player:getPosition(), Position(1015, 1109, 7), Position(1094, 1738, 7)) then - item:remove(1) - end + item:remove(1) player:updateSupplyTracker(item) player:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_EAT, player:isInGhostMode() and nil or player) if effect then