From df24bd878ff3b8ce58ad9c96f85324014e2fc8f2 Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Tue, 14 Nov 2023 16:09:39 -0300 Subject: [PATCH] exercise_training: improved msg. broadcast: removed unnecessary Webhook.sendMessage. reward: fixes charges. prision bosses: created flag to enable minus players. removed functions already created. login: removed create torch when player login. bosses teleports: fixes in 'clearBossRoom' function usage. --- config.lua.dist | 1 - .../actions/roshamuul/prison/golden.lua | 36 +++++++++++-------- .../scripts/actions/roshamuul/prison/keys.lua | 26 +------------- .../scripts/creaturescripts/others/login.lua | 2 +- .../quests/first_dragon/entrance_teleport.lua | 2 +- .../movement-cave_spider_room.lua | 2 +- data/libs/exercise_training.lua | 2 +- data/scripts/talkactions/gm/broadcast.lua | 1 - data/scripts/talkactions/player/reward.lua | 13 +++---- 9 files changed, 34 insertions(+), 51 deletions(-) diff --git a/config.lua.dist b/config.lua.dist index 42fee22344e..0a962dfea9f 100644 --- a/config.lua.dist +++ b/config.lua.dist @@ -165,7 +165,6 @@ pvpRateDamageTakenPerLevel = 0.0 -- recommended to start with 0.1 pvpRateDamageReductionPerLevel = 0.0 -- recommended to start with 0.1 pvpMaxLevelDifference = 0 - -- Wheel of destiny system -- NOTE: set wheelSystemEnabled = false to disable the wheel of destiny -- NOTE: only the wheel points are modified, all other data is on the client executable and cannot be modified diff --git a/data-otservbr-global/scripts/actions/roshamuul/prison/golden.lua b/data-otservbr-global/scripts/actions/roshamuul/prison/golden.lua index 40258b086d2..404a13c3cc4 100644 --- a/data-otservbr-global/scripts/actions/roshamuul/prison/golden.lua +++ b/data-otservbr-global/scripts/actions/roshamuul/prison/golden.lua @@ -1,26 +1,28 @@ local setting = { timeToFightAgain = 10, - clearRoomTime = 60, -- In hour - centerRoom = { x = 33528, y = 32334, z = 12 }, + ignorePlayersCount = true, + clearRoomTime = 60, -- In minutes + leverPosition = Position(33606, 32362, 11), + centerRoom = Position(33528, 32334, 12), range = 10, storage = Storage.PrinceDrazzakTime, clearRoomStorage = GlobalStorage.PrinceDrazzakEventTime, - bossName = "prince drazzak", - bossPosition = { x = 33528, y = 32333, z = 12 }, + bossName = "Prince Drazzak", + bossPosition = Position(33528, 32333, 12), } local playerPositions = { - { fromPos = { x = 33607, y = 32362, z = 11 }, toPos = { x = 33526, y = 32341, z = 12 } }, - { fromPos = { x = 33608, y = 32362, z = 11 }, toPos = { x = 33527, y = 32341, z = 12 } }, - { fromPos = { x = 33609, y = 32362, z = 11 }, toPos = { x = 33528, y = 32341, z = 12 } }, - { fromPos = { x = 33610, y = 32362, z = 11 }, toPos = { x = 33529, y = 32341, z = 12 } }, - { fromPos = { x = 33611, y = 32362, z = 11 }, toPos = { x = 33530, y = 32341, z = 12 } }, + { fromPos = Position(33607, 32362, 11), toPos = Position(33526, 32341, 12) }, + { fromPos = Position(33608, 32362, 11), toPos = Position(33527, 32341, 12) }, + { fromPos = Position(33609, 32362, 11), toPos = Position(33528, 32341, 12) }, + { fromPos = Position(33610, 32362, 11), toPos = Position(33529, 32341, 12) }, + { fromPos = Position(33611, 32362, 11), toPos = Position(33530, 32341, 12) }, } local golden = Action() -function golden.onUse(player, item, fromPosition, target, toPosition, monster, isHotkey) - if toPosition == Position(33606, 32362, 11) then +function golden.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if toPosition == setting.leverPosition and not setting.ignorePlayersCount then for i = 1, #playerPositions do local creature = Tile(playerPositions[i].fromPos):getTopCreature() if not creature then @@ -30,11 +32,15 @@ function golden.onUse(player, item, fromPosition, target, toPosition, monster, i end end - if toPosition == Position(33606, 32362, 11) then - if roomIsOccupied(setting.centerRoom, setting.range, setting.range) or Game.getStorageValue(setting.clearRoomStorage) == 1 then + if toPosition == setting.leverPosition then + if roomIsOccupied(setting.centerRoom, setting.range, setting.range) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.") return true end + if Game.getStorageValue(setting.clearRoomStorage) == 1 then + Game.setStorageValue(setting.clearRoomStorage, 0) + clearRoom(setting.centerRoom, setting.range, setting.range, setting.clearRoomStorage) + end for i = 1, #playerPositions do local creature = Tile(playerPositions[i].fromPos):getTopCreature() @@ -49,7 +55,9 @@ function golden.onUse(player, item, fromPosition, target, toPosition, monster, i creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end else - return false + if not setting.ignorePlayersCount then + return false + end end end item:remove() diff --git a/data-otservbr-global/scripts/actions/roshamuul/prison/keys.lua b/data-otservbr-global/scripts/actions/roshamuul/prison/keys.lua index f84fc173750..376a45fd82e 100644 --- a/data-otservbr-global/scripts/actions/roshamuul/prison/keys.lua +++ b/data-otservbr-global/scripts/actions/roshamuul/prison/keys.lua @@ -37,30 +37,6 @@ local config = { }, } -local function roomIsOccupied(centerPosition, rangeX, rangeY) - local spectators = Game.getSpectators(centerPosition, false, false, rangeX, rangeX, rangeY, rangeY) - if #spectators ~= 0 then - return true - end - - return false -end - -local function clearBossRoom(playerId, centerPosition, rangeX, rangeY, exitPosition) - local spectators, spectator = Game.getSpectators(centerPosition, false, false, rangeX, rangeX, rangeY, rangeY) - for i = 1, #spectators do - spectator = spectators[i] - if spectator:isPlayer() and spectator.uid == playerId then - spectator:teleportTo(exitPosition) - exitPosition:sendMagicEffect(CONST_ME_TELEPORT) - end - - if spectator:isMonster() then - spectator:remove() - end - end -end - local keys = Action() function keys.onUse(player, item, fromPosition, target, toPosition, isHotkey) @@ -93,7 +69,7 @@ function keys.onUse(player, item, fromPosition, target, toPosition, isHotkey) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have fifteen minutes to kill and loot this boss, else you will lose that chance.") -- Let's roll - addEvent(clearBossRoom, 60 * tmpConfig.time * 1000, player:getId(), tmpConfig.centerPosition, tmpConfig.rangeX, tmpConfig.rangeY, tmpConfig.exitPosition) + addEvent(clearBossRoom, 60 * tmpConfig.time * 1000, player:getId(), monster.uid, tmpConfig.centerPosition, tmpConfig.rangeX, tmpConfig.rangeY, tmpConfig.exitPosition) item:remove() player:teleportTo(tmpConfig.newPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) diff --git a/data-otservbr-global/scripts/creaturescripts/others/login.lua b/data-otservbr-global/scripts/creaturescripts/others/login.lua index 45e2cabc7fc..43914430533 100644 --- a/data-otservbr-global/scripts/creaturescripts/others/login.lua +++ b/data-otservbr-global/scripts/creaturescripts/others/login.lua @@ -33,7 +33,7 @@ function playerLogin.onLogin(player) backpack:addItem(items[i][1], items[i][2]) end end - player:addItem(2920, 1, true, 1, CONST_SLOT_AMMO) + db.query("UPDATE `players` SET `istutorial` = 0 where `id`=" .. player:getGuid()) -- Open channels if table.contains({ TOWNS_LIST.DAWNPORT, TOWNS_LIST.DAWNPORT_TUTORIAL }, player:getTown():getId()) then diff --git a/data-otservbr-global/scripts/movements/quests/first_dragon/entrance_teleport.lua b/data-otservbr-global/scripts/movements/quests/first_dragon/entrance_teleport.lua index f0d30494c8c..10873c7d574 100644 --- a/data-otservbr-global/scripts/movements/quests/first_dragon/entrance_teleport.lua +++ b/data-otservbr-global/scripts/movements/quests/first_dragon/entrance_teleport.lua @@ -84,7 +84,7 @@ function entranceTeleport.onStepIn(creature, item, position, fromPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:say("You have ten minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.", TALKTYPE_MONSTER_SAY) player:setBossCooldown(setting.bossName, os.time() + 2 * 3600) - addEvent(clearBossRoom, 60 * 30 * 1000, player.uid, monster.uid, setting.bossPos, setting.range, fromPosition) + addEvent(clearBossRoom, 60 * 30 * 1000, player.uid, monster.uid, setting.bossPos, setting.range, setting.range, fromPosition) return true end return true diff --git a/data-otservbr-global/scripts/quests/hidden_threats/movement-cave_spider_room.lua b/data-otservbr-global/scripts/quests/hidden_threats/movement-cave_spider_room.lua index 6e3f722929b..bf4145ae427 100644 --- a/data-otservbr-global/scripts/quests/hidden_threats/movement-cave_spider_room.lua +++ b/data-otservbr-global/scripts/quests/hidden_threats/movement-cave_spider_room.lua @@ -54,7 +54,7 @@ function caveSpiderRoom.onStepIn(creature, item, position, fromPosition) position:sendMagicEffect(CONST_ME_TELEPORT) player:teleportTo(room.newPos) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - addEvent(clearBossRoom, 60 * room.time * 1000, player.uid, room.centerPos, room.rangeX, room.rangeY, room.exitPos) + addEvent(clearBossRoom, 60 * room.time * 1000, player.uid, monster.uid, room.centerPos, room.rangeX, room.rangeY, room.exitPos) player:setStorageValue(room.access, 10) return true end diff --git a/data/libs/exercise_training.lua b/data/libs/exercise_training.lua index 3fcbf89dd87..74ea2492f46 100644 --- a/data/libs/exercise_training.lua +++ b/data/libs/exercise_training.lua @@ -55,7 +55,7 @@ function ExerciseEvent(playerId, tilePosition, weaponId, dummyId) end if player:isTraining() == 0 then - player:sendTextMessage(MESSAGE_FAILURE, "You left training!") + player:sendTextMessage(MESSAGE_FAILURE, "You've stopped training!") return LeaveTraining(playerId) end diff --git a/data/scripts/talkactions/gm/broadcast.lua b/data/scripts/talkactions/gm/broadcast.lua index ca8171e3635..503462e4f6f 100644 --- a/data/scripts/talkactions/gm/broadcast.lua +++ b/data/scripts/talkactions/gm/broadcast.lua @@ -11,7 +11,6 @@ function broadcast.onSay(player, words, param) local text = player:getName() .. " broadcasted: " .. param logger.info(text) - Webhook.sendMessage("Broadcast", text, WEBHOOK_COLOR_WARNING, announcementChannels["serverAnnouncements"]) for _, targetPlayer in ipairs(Game.getPlayers()) do targetPlayer:sendPrivateMessage(player, param, TALKTYPE_BROADCAST) end diff --git a/data/scripts/talkactions/player/reward.lua b/data/scripts/talkactions/player/reward.lua index a1ad754a309..8a2e89930f8 100644 --- a/data/scripts/talkactions/player/reward.lua +++ b/data/scripts/talkactions/player/reward.lua @@ -1,11 +1,12 @@ local config = { items = { - { id = 35284, charges = 64000 }, - { id = 35279, charges = 64000 }, - { id = 35281, charges = 64000 }, - { id = 35283, charges = 64000 }, - { id = 35282, charges = 64000 }, - { id = 35280, charges = 64000 }, + { id = 35284, charges = 64400 }, + { id = 35279, charges = 64400 }, + { id = 35281, charges = 64400 }, + { id = 35283, charges = 64400 }, + { id = 35282, charges = 64400 }, + { id = 35280, charges = 64400 }, + { id = 44066, charges = 64400 }, }, storage = tonumber(Storage.PlayerWeaponReward), -- storage key, player can only win once }