Skip to content

Commit

Permalink
fix: The New Frontier correct case sensitivity in monster names
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires committed Feb 15, 2024
1 parent 94fced9 commit 077a337
Showing 1 changed file with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,29 @@ local config = {
},

positions = {
-- other bosses
Position(33065, 31035, 3),
Position(33068, 31034, 3),

-- first 2 bosses
Position(33065, 31033, 3),
Position(33066, 31037, 3),
},
}
local TheNewFrontier = Storage.Quest.U8_54.TheNewFrontier

local function summonBoss(name, position)
Game.createMonster(name, position)
local monsterType = MonsterType(name)
if not monsterType then
logger.warn("The New Frontier - Mission 09: Monster with name {} not exist!", name)
return
end

Game.createMonster(monsterType:getName(), position)
position:sendMagicEffect(CONST_ME_TELEPORT)
end

local function clearArena()
local spectators = Game.getSpectators(Position(33063, 31034, 3), false, false, 10, 10, 10, 10)
local exitPosition = Position(33049, 31017, 2)
for i = 1, #spectators do
local spectator = spectators[i]

for _, spectator in ipairs(spectators) do
if spectator:isPlayer() then
spectator:teleportTo(exitPosition)
exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
Expand All @@ -51,35 +53,32 @@ local function clearArena()
end

local theNewFrontierArena = Action()
function theNewFrontierArena.onUse(player, item, fromPosition, target, toPosition, isHotkey)
for a = 1, #config.playerPos do
local creature = Tile(config.playerPos[a]):getTopCreature()
if not creature then
return false
end

if creature:getStorageValue(TheNewFrontier.Questline) >= 26 then
function theNewFrontierArena.onUse(player, item, fromPosition, target, toPosition, isHotkey)
for _, playerPos in ipairs(config.playerPos) do
local creature = Tile(playerPos):getTopCreature()
if not creature or creature:getStorageValue(Storage.Quest.U8_54.TheNewFrontier.Questline) >= 26 then
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already finished this battle.")
end
end

if Game.getStorageValue(TheNewFrontier.Mission09[1]) == 1 then
if Game.getStorageValue(Storage.Quest.U8_54.TheNewFrontier.Mission09[1]) == 1 then
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The arena is already in use.")
end

Game.setStorageValue(TheNewFrontier.Mission09[1], 1)
Game.setStorageValue(Storage.Quest.U8_54.TheNewFrontier.Mission09[1], 1)
addEvent(clearArena, 30 * 60 * 1000)

for b = 1, #config.playerPos do
local creature = Tile(config.playerPos[b]):getTopCreature()
for i, playerPos in ipairs(config.playerPos) do
local creature = Tile(playerPos):getTopCreature()
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
creature:teleportTo(config.teleportPositions[b])
creature:teleportTo(config.teleportPositions[i])
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end

for i = 1, #config.bosses do
for j = 1, #config.bosses[i] do
addEvent(summonBoss, (i - 1) * 90 * 1000, config.bosses[i][j], config.positions[j + (i == 1 and 2 or 0)])
for i, bosses in ipairs(config.bosses) do
for j, boss in ipairs(bosses) do
addEvent(summonBoss, (i - 1) * 90 * 1000, boss, config.positions[j + (i == 1 and 2 or 0)])
end
end
return true
Expand Down

0 comments on commit 077a337

Please sign in to comment.