Skip to content

Commit

Permalink
The Secret Library Quest - The Order of the Falcon
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Oct 22, 2024
1 parent 1db20ba commit e3b5496
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 99 deletions.
3 changes: 2 additions & 1 deletion data-otservbr-global/lib/core/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6588,10 +6588,11 @@ if not Quests then
storageId = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline,
missionId = 10454,
startValue = 1,
endValue = 2,
endValue = 3,
states = {
[1] = "It is said that an ancient order of knights once resided in Edron. The knights disappeared a long time ago but their abandoned outpost is still there. The place may yet hold some surprises.",
[2] = "You defeated Grand Master Oberon in mortal combat. The Falcon Order may have lost its glory a long time ago but you are just getting started.",
[3] = "Congratulations you completed this mission.",
},
},
[5] = {
Expand Down
9 changes: 9 additions & 0 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,15 @@ Storage = {
OberonHeal = 46019,
LastBossMsgInterval = 46020,
OberonSay = 46021,
ChestsTimer = {
Coast = 46022,
Island = 46023,
ThroneHall = 46024,
Shortcut = 46026,
LowerBastion = 46027,
UndergroundBastion = 46028,
Key0909 = 46029,
},
},
Darashia = {
Questline = 46022,
Expand Down
34 changes: 16 additions & 18 deletions data-otservbr-global/npc/dedoras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission)
if currentStorage < 0 then
currentStorage = 0
end

if MsgContains(message, "search") then
npcHandler:say({
"I gathered some lore on my own, but I desperately need more information that you might provide me. ...",
Expand All @@ -102,10 +107,6 @@ local function creatureSayCallback(npc, creature, type, message)
"This is ...",
"An astonishing find to say the least! I'm certain it will help the efforts of accessing the library a lot!",
}, npc, creature)
local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission)
if currentStorage < 0 then
currentStorage = 0
end
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 8)
elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) < 1 then
Expand All @@ -118,10 +119,6 @@ local function creatureSayCallback(npc, creature, type, message)
elseif MsgContains(message, "fishmen") then
if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) == 7 then
npcHandler:say("You brought incredible news. This book proves an invaluable clue!", npc, creature)
local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission)
if currentStorage < 0 then
currentStorage = 0
end
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 8)
elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) < 1 then
Expand All @@ -132,18 +129,20 @@ local function creatureSayCallback(npc, creature, type, message)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 1)
end
elseif MsgContains(message, "order") then
npcHandler:say({
"Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...",
"This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.",
}, npc, creature)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1)
if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) == 2 then
npcHandler:say("You brought incredible news. This book proves an invaluable clue!", npc, creature)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 3)
elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 1 then
npcHandler:say({
"Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...",
"This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.",
}, npc, creature)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1)
end
elseif MsgContains(message, "asuri") then
if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 6 then
npcHandler:say("This is incredible! Thank you so much for digging out that hint!", npc, creature)
local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission)
if currentStorage < 0 then
currentStorage = 0
end
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 7)
elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) < 1 then
Expand All @@ -152,7 +151,6 @@ local function creatureSayCallback(npc, creature, type, message)
"A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.",
}, npc, creature)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1)
startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, 1)
end
elseif MsgContains(message, "isle") then
npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local buckets = {
}

local lowerRoshamuulMixtune = Action()

function lowerRoshamuulMixtune.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (target == nil) or not target:isItem() then
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,46 @@ local defaultTime = 20

local creaturescripts_library_bosses = CreatureEvent("killingLibrary")

function creaturescripts_library_bosses.onDeath(player, creature)
if not player:isPlayer() then
return true
end

if not creature:isMonster() or creature:getMaster() then
return true
end

local monsterStorages = {
["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 1 },
["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 2 },
["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 3 },
["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 4 },
["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5 },
["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true },
["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 },
["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.flammingOrchid, value = 1 },
}

local monsterName = creature:getName():lower()
local monsterStorage = monsterStorages[monsterName]

if monsterStorage then
for playerid, damage in pairs(creature:getDamageMap()) do
local p = Player(playerid)
if p then
if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then
p:setStorageValue(monsterStorage.stg, monsterStorage.value)
end
if monsterStorage.achievements then
for i = 1, #monsterStorage.achievements do
p:addAchievement(monsterStorage.achievements[i])
end
end
if monsterStorage.lastBoss then
if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then
p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2)
end
end
end
end
end
return true
function creaturescripts_library_bosses.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified)
if not creature:isMonster() or creature:getMaster() then
return true
end

local monsterStorages = {
["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 1 },
["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 2 },
["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 3 },
["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 4 },
["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 5 },
["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true },
["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 },
["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, value = 1 },
}

local monsterName = creature:getName():lower()
local monsterStorage = monsterStorages[monsterName]

if monsterStorage then
for playerid, damage in pairs(creature:getDamageMap()) do
local p = Player(playerid)
if p then
if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then
p:setStorageValue(monsterStorage.stg, monsterStorage.value)
end
if monsterStorage.achievements then
for i = 1, #monsterStorage.achievements do
p:addAchievement(monsterStorage.achievements[i])
end
end
if monsterStorage.lastBoss then
if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then
p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2)
end
end
end
end
end
return true
end

creaturescripts_library_bosses:register()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
local doors = {
[1] = { doorPosition = Position(33376, 31323, 2), value = -1 },
[2] = { doorPosition = Position(33376, 31335, 3), value = 1 },
[1] = { doorPosition = Position(33376, 31335, 3), value = 1 },
[2] = { doorPosition = Position(33371, 31349, 4), value = 2 },
[3] = { doorPosition = Position(33376, 31349, 4), value = 2 },
[4] = { doorPosition = Position(33363, 31346, 7), value = 4 },
[4] = { doorPosition = Position(33375, 31346, 5), value = 2 },
[5] = { doorPosition = Position(33363, 31346, 7), value = 4 },
[6] = { doorPosition = Position(33366, 31343, 7), value = 4 },
}

local boats = {
[1] = { boatPosition = Position(33373, 31309, 7), value = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." },
[2] = { boatPosition = Position(33381, 31294, 7), value = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle." },
[3] = { boatPosition = Position(33344, 31348, 7), value = 3, toPosition = Position(33326, 31352, 7) },
[4] = { boatPosition = Position(33328, 31352, 7), value = 3, toPosition = Position(33346, 31348, 7) },
[1] = {
boatPosition = Position(33373, 31309, 7), value = 3,
toPosition = Position(33382, 31292, 7),
message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel."
},
[2] = {
boatPosition = Position(33382, 31294, 7), value = 3,
toPosition = Position(33374, 31310, 7),
message = "Your heart lightens as you return from the gloomy isle."
},
[3] = {
boatPosition = Position(33344, 31348, 7), value = 3,
toPosition = Position(33326, 31352, 7)
},
[4] = {
boatPosition = Position(33328, 31352, 7), value = 3,
toPosition = Position(33346, 31348, 7)
},
}

local actions_falcon_doors = Action()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
local actions_entrance = Action()

function actions_entrance.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (target == nil) or not target:isItem() then
return false
end

local currentTime = os.date("*t")
local currentMinute = currentTime.min

local isNightTime = (currentMinute >= 45 or currentMinute < 15)

if isNightTime then
if target:getPosition() == Position(33201, 31763, 1) then
player:teleportTo(Position(33356, 31309, 4), true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Once more you mix the chalk with a drop of your blood and a bit of water and renew the symbol on the floor...")
item:transform(2873, 0)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use this entrance during the night.")
end

return true
end

actions_entrance:id(28468)
actions_entrance:register()
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t
local playersTable = {}
local fromPosition_ = Position(33356, 31311, 9)
local toPosition_ = Position(33376, 31328, 9)
local exitPosition = Position(33297, 31286, 9)
local exitPosition = Position(33297, 31285, 9)

if item:getId() == 2772 then
if doCheckBossRoom(player:getId(), bossName, fromPosition_, toPosition_) then
for i = 33358, 33362, 1 do
local newpos = Position(i, 31342, 9)
for i = 33362, 33366, 1 do
local newpos = Position(i, 31344, 9)
local nplayer = Tile(newpos):getTopCreature()
if nplayer and nplayer:isPlayer() then
nplayer:teleportTo(Position(33365, 31323, 9), true)
nplayer:teleportTo(Position(33364, 31322, 9), true)
nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
table.insert(playersTable, nplayer:getId())
nplayer:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer, os.time() + 20 * 60 * 60)
Expand All @@ -24,10 +24,10 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t
oberon:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0)
end
Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonSay, -1)
Game.createNpc("Oberon's Spite", Position(33363, 31321, 9))
Game.createNpc("Oberon's Ire", Position(33368, 31321, 9))
Game.createNpc("Oberon's Bile", Position(33363, 31317, 9))
Game.createNpc("Oberon's Hate", Position(33368, 31317, 9))
Game.createNpc("Oberon's Spite", Position(33361, 31320, 9))
Game.createNpc("Oberon's Ire", Position(33367, 31320, 9))
Game.createNpc("Oberon's Bile", Position(33361, 31316, 9))
Game.createNpc("Oberon's Hate", Position(33367, 31316, 9))
addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, fromPosition_, toPosition_, exitPosition)
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local config = {
entrance = Position(33310, 31325, 8),
exit = Position(33330, 31334, 9),
exit = Position(33329, 31333, 9),
}

local movements_falcon_bossEntrance = MoveEvent()
Expand Down Expand Up @@ -29,15 +29,15 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo
local blockedPositions = {
Position(33328, 31352, 7),
Position(33373, 31309, 7),
Position(33381, 31294, 7),
Position(33382, 31294, 7),
Position(33344, 31348, 7),
}
if creature then
if isInArray(blockedPositions, position) then
return true
else
if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer) <= os.time() then
creature:teleportTo(Position(33359, 31340, 9), true)
creature:teleportTo(Position(33363, 31341, 9), true)
else
creature:teleportTo(fromPosition, true)
creature:sendCancelMessage("You are still exhausted from your last battle.")
Expand Down
Loading

0 comments on commit e3b5496

Please sign in to comment.