From ce509846b18b10be1686622ab193b27e397faf6f Mon Sep 17 00:00:00 2001 From: marcosvf132 <66353315+marcosvf132@users.noreply.github.com> Date: Sun, 26 Jul 2020 22:36:14 -0300 Subject: [PATCH 1/6] Update oberon_lever.lua --- data/actions/scripts/farmine/oberon_lever.lua | 87 +++++++++---------- 1 file changed, 39 insertions(+), 48 deletions(-) diff --git a/data/actions/scripts/farmine/oberon_lever.lua b/data/actions/scripts/farmine/oberon_lever.lua index 0c9438861..7180baf68 100644 --- a/data/actions/scripts/farmine/oberon_lever.lua +++ b/data/actions/scripts/farmine/oberon_lever.lua @@ -1,60 +1,51 @@ local setting = { - timeToFightAgain = 20, - clearRoomTime = 60, -- In hour centerRoom = {x = 33364, y = 31318, z = 9}, - range = 10, storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, - clearRoomStorage = GlobalStorage.OberonEventTime, - bossName = "grand master oberon", - bossPosition = {x = 33364, y = 31317, z = 9} + Pillar1pos = {x = 33361, y = 31316, z = 9}, + bossPosition = {x = 33364, y = 31317, z = 9}, + kickPosition = {x = 33300, y = 31289, z = 9}, + playerTeleport = {x = 33364, y = 31322, z = 9} } - -local playerPositions = { - {fromPos = {x = 33364, y = 31344, z = 9}, toPos = {x = 33364, y = 31321, z = 9}}, - {fromPos = {x = 33363, y = 31344, z = 9}, toPos = {x = 33363, y = 31321, z = 9}}, - {fromPos = {x = 33365, y = 31344, z = 9}, toPos = {x = 33365, y = 31321, z = 9}}, - {fromPos = {x = 33362, y = 31344, z = 9}, toPos = {x = 33362, y = 31321, z = 9}}, - {fromPos = {x = 33366, y = 31344, z = 9}, toPos = {x = 33366, y = 31321, z = 9}} -} - -- Start Script -function onUse(player, item, fromPosition, target, toPosition, isHotkey) +function onUse(creature, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 1945 and item.actionid == 57605 then - for i = 1, #playerPositions do - local creature = Tile(playerPositions[i].fromPos):getTopCreature() - if not creature then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 5 players to fight with this boss.") - return true - end - end - - if roomIsOccupied(setting.centerRoom, setting.range, setting.range) - or Game.getStorageValue(setting.clearRoomStorage) == 1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.") + if roomIsOccupied(setting.centerRoom, 10, 10) then + creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.") return true end - - for i = 1, #playerPositions do - local creature = Tile(playerPositions[i].fromPos):getTopCreature() - if creature and creature:isPlayer() then - if not creature:getStorageValue(setting.storage) >= os.time() then - creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last " .. setting.timeToFightAgain .. " hours.") - return true - end - if creature:getStorageValue(setting.storage) < os.time() then - creature:setStorageValue(setting.storage, os.time() + setting.timeToFightAgain * 60 * 60) - creature:teleportTo(playerPositions[i].toPos) - creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - else - return false - end + local clearOberonRoom = Game.getSpectators(Position(setting.centerRoom), false, false, 10, 10, 10, 10) + for index, removeOberon in ipairs(clearOberonRoom) do + if (removeOberon:isMonster()) then + removeOberon:remove() + end + end + Game.createMonster("Grand Master Oberon", setting.bossPosition, false, true) + Game.createMonster("Oberon's Bile", Position({x = setting.Pillar1pos.x, y = setting.Pillar1pos.y, z = setting.Pillar1pos.z}), false, true) + Game.createMonster("Oberon's Hate", Position({x = setting.Pillar1pos.x + 6, y = setting.Pillar1pos.y, z = setting.Pillar1pos.z}), false, true) + Game.createMonster("Oberon's Spite", Position({x = setting.Pillar1pos.x, y = setting.Pillar1pos.y + 4, z = setting.Pillar1pos.z}), false, true) + Game.createMonster("Oberon's Ire", Position({x = setting.Pillar1pos.x + 6, y = setting.Pillar1pos.y + 4, z = setting.Pillar1pos.z}), false, true) + local players = {} + for i = 0, 4 do + local player1 = Tile({x = (Position(item:getPosition()).x - 2) + i, y = Position(item:getPosition()).y + 1, z = Position(item:getPosition()).z}):getTopCreature() + players[#players+1] = player1 + end + for i, player in ipairs(players) do + player:getPosition():sendMagicEffect(CONST_ME_POFF) + player:teleportTo(Position(setting.playerTeleport), false) + doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT) + setPlayerStorageValue(player,setting.storage, os.time() + 72000) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have 20 minute(s) to defeat the boss.') + addEvent(function() + local spectatorsOberon = Game.getSpectators(Position(setting.centerRoom), false, false, 10, 10, 10, 10) + for i = 1, #spectatorsOberon, 1 do + if spectatorsOberon[i]:isPlayer() and (spectatorsOberon[i]:getName() == player:getName()) then + player:teleportTo(Position(setting.kickPosition)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Time is over.') + end + end + end, 1200000) end - -- One hour for clean the room and other time goto again - addEvent(clearRoom, setting.clearRoomTime * 60 * 1000, setting.centerRoom, - setting.range, setting.range, setting.clearRoomStorage) - Game.createMonster(setting.bossName, setting.bossPosition) - Game.setStorageValue(setting.clearRoomStorage, 1) end return true end From 98333c76fc0fe8a8e231378f4d6ee9c5898b3893 Mon Sep 17 00:00:00 2001 From: marcosvf132 <66353315+marcosvf132@users.noreply.github.com> Date: Sun, 26 Jul 2020 22:38:35 -0300 Subject: [PATCH 2/6] Update falcon_castle.lua --- .../scripts/teleport/falcon_castle.lua | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/data/movements/scripts/teleport/falcon_castle.lua b/data/movements/scripts/teleport/falcon_castle.lua index 3d1e6430b..251b74e20 100644 --- a/data/movements/scripts/teleport/falcon_castle.lua +++ b/data/movements/scripts/teleport/falcon_castle.lua @@ -1,20 +1,28 @@ local config = { - [3255] = Position(33349, 31346, 8), - [57602] = Position(33329, 31332, 9), - [57604] = Position(33363, 31342, 9), - [57699] = Position(33308, 31325, 8) + [3255] = {position = Position(33349, 31346, 8)}, + [57602] = {position = Position(33329, 31332, 9)}, + [57604] = {position = Position(33363, 31342, 9)}, + [57699] = {position = Position(33308, 31325, 8)} } - function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return false end - local teleport = config[item.actionid] - if teleport then - player:teleportTo(teleport) - fromPosition:sendMagicEffect(CONST_ME_TELEPORT) - teleport:sendMagicEffect(CONST_ME_TELEPORT) + for index, value in pairs(config) do + if item.actionid == index then + if(item.actionid == 57604)then + if(player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time())then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.") + player:teleportTo(Position(fromPosition), false) + doSendMagicEffect(Position(fromPosition), CONST_ME_TELEPORT) + return false + end + end + doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT) + player:teleportTo(value.position) + doSendMagicEffect(value.position, CONST_ME_TELEPORT) + end end end From 6063272c087e28edb9858c243e9a1a30f2a46b15 Mon Sep 17 00:00:00 2001 From: marcosvf132 <66353315+marcosvf132@users.noreply.github.com> Date: Sun, 26 Jul 2020 22:54:29 -0300 Subject: [PATCH 3/6] Update falcon_castle.lua --- data/movements/scripts/teleport/falcon_castle.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/movements/scripts/teleport/falcon_castle.lua b/data/movements/scripts/teleport/falcon_castle.lua index 251b74e20..47d2b14bc 100644 --- a/data/movements/scripts/teleport/falcon_castle.lua +++ b/data/movements/scripts/teleport/falcon_castle.lua @@ -15,8 +15,8 @@ function onStepIn(creature, item, position, fromPosition) if(item.actionid == 57604)then if(player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time())then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.") - player:teleportTo(Position(fromPosition), false) - doSendMagicEffect(Position(fromPosition), CONST_ME_TELEPORT) + player:teleportTo(fromPosition, true) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return false end end From ac1d3aa94c90ee2ae2d6b056be1c3301ff3523c4 Mon Sep 17 00:00:00 2001 From: marcosvf132 <66353315+marcosvf132@users.noreply.github.com> Date: Tue, 28 Jul 2020 11:23:09 -0300 Subject: [PATCH 4/6] Update oberon_lever.lua --- data/actions/scripts/farmine/oberon_lever.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/actions/scripts/farmine/oberon_lever.lua b/data/actions/scripts/farmine/oberon_lever.lua index 7180baf68..201fe89dd 100644 --- a/data/actions/scripts/farmine/oberon_lever.lua +++ b/data/actions/scripts/farmine/oberon_lever.lua @@ -33,7 +33,7 @@ function onUse(creature, item, fromPosition, target, toPosition, isHotkey) player:getPosition():sendMagicEffect(CONST_ME_POFF) player:teleportTo(Position(setting.playerTeleport), false) doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT) - setPlayerStorageValue(player,setting.storage, os.time() + 72000) + setPlayerStorageValue(player,setting.storage, os.time() + 20 * 60 * 60) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have 20 minute(s) to defeat the boss.') addEvent(function() local spectatorsOberon = Game.getSpectators(Position(setting.centerRoom), false, false, 10, 10, 10, 10) @@ -44,7 +44,7 @@ function onUse(creature, item, fromPosition, target, toPosition, isHotkey) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Time is over.') end end - end, 1200000) + end, 20 * 60 * 1000) end end return true From d95748aef98e8b8799be2f7dfeeb2c025228a3c2 Mon Sep 17 00:00:00 2001 From: marcosvf132 <66353315+marcosvf132@users.noreply.github.com> Date: Tue, 28 Jul 2020 12:02:47 -0300 Subject: [PATCH 5/6] Update oberon_lever.lua Removed function roomIsOccupied() --- data/actions/scripts/farmine/oberon_lever.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/data/actions/scripts/farmine/oberon_lever.lua b/data/actions/scripts/farmine/oberon_lever.lua index 201fe89dd..71f959908 100644 --- a/data/actions/scripts/farmine/oberon_lever.lua +++ b/data/actions/scripts/farmine/oberon_lever.lua @@ -9,11 +9,13 @@ local setting = { -- Start Script function onUse(creature, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 1945 and item.actionid == 57605 then - if roomIsOccupied(setting.centerRoom, 10, 10) then + local clearOberonRoom = Game.getSpectators(Position(setting.centerRoom), false, false, 10, 10, 10, 10) + for index, spectatorcheckface in ipairs(clearOberonRoom) do + if spectatorcheckface:isPlayer() then creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.") - return true + return false end - local clearOberonRoom = Game.getSpectators(Position(setting.centerRoom), false, false, 10, 10, 10, 10) + end for index, removeOberon in ipairs(clearOberonRoom) do if (removeOberon:isMonster()) then removeOberon:remove() From 0e81f2c94d4ba9043d030f79e77dab1b5e13954e Mon Sep 17 00:00:00 2001 From: marcosvf132 <66353315+marcosvf132@users.noreply.github.com> Date: Wed, 29 Jul 2020 01:47:15 -0300 Subject: [PATCH 6/6] Update oberon_lever.lua --- data/actions/scripts/farmine/oberon_lever.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/actions/scripts/farmine/oberon_lever.lua b/data/actions/scripts/farmine/oberon_lever.lua index 71f959908..308d53872 100644 --- a/data/actions/scripts/farmine/oberon_lever.lua +++ b/data/actions/scripts/farmine/oberon_lever.lua @@ -39,8 +39,8 @@ function onUse(creature, item, fromPosition, target, toPosition, isHotkey) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have 20 minute(s) to defeat the boss.') addEvent(function() local spectatorsOberon = Game.getSpectators(Position(setting.centerRoom), false, false, 10, 10, 10, 10) - for i = 1, #spectatorsOberon, 1 do - if spectatorsOberon[i]:isPlayer() and (spectatorsOberon[i]:getName() == player:getName()) then + for u = 1, #spectatorsOberon, 1 do + if spectatorsOberon[u]:isPlayer() and (spectatorsOberon[u]:getName() == player:getName()) then player:teleportTo(Position(setting.kickPosition)) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Time is over.')