illarion-content/lte/inlinetutorial.lua

104 lines
4 KiB
Lua
Raw Permalink Normal View History

--[[
Illarion Server
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
]]
2020-12-06 02:14:13 +01:00
-- Long Time Effect Script: Inline Tutorial
2010-05-28 21:25:06 +00:00
-- Effect ID: 13
2012-03-31 20:01:32 +02:00
2021-06-19 23:41:23 +02:00
local common = require("base.common")
2021-06-28 16:08:56 +02:00
local areas = require("content.areas")
local tutorial = require("content.tutorial")
local character = require("base.character")
local M = {}
2012-04-01 19:50:32 +02:00
2020-12-06 02:14:13 +01:00
function M.addEffect(inlineTutorial, Character)
2012-04-01 19:50:32 +02:00
end
2020-12-06 02:14:13 +01:00
function M.callEffect(inlineTutorial,Character)
2021-06-28 16:04:46 +02:00
if Character:getQuestProgress(325) == 2 then --Declined tutorial
return false --removing the effect
end
2021-06-28 16:04:46 +02:00
if Character:getQuestProgress(325) == 1 then --Accepted tutorial
--Low on health
if character.GetHP(Character) < 2000 and Character:getQuestProgress(326) == 0 then
Character:inform(tutorial.getTutorialInformDE("hitpoints"),tutorial.getTutorialInformEN("hitpoints"))
2021-06-28 16:04:46 +02:00
Character:setQuestProgress(326,1)
end
2020-12-14 10:21:07 +01:00
2021-06-28 16:04:46 +02:00
--Low on food
if Character:increaseAttrib("foodlevel",0) < 10000 and Character:getQuestProgress(327) == 0 then
Character:inform(tutorial.getTutorialInformDE("foodlevel"),tutorial.getTutorialInformEN("foodlevel"))
2021-06-28 16:04:46 +02:00
Character:setQuestProgress(327,1)
end
2020-12-14 10:21:07 +01:00
2021-06-28 16:04:46 +02:00
--Agressive monster nearby
if Character:getQuestProgress(328) == 0 and not areas.PointInArea(Character.pos,"trollshaven") then --Orchard rat covered by other message below
2021-06-28 16:04:46 +02:00
local monsters = world:getMonstersInRangeOf(Character.pos, 5)
if (#monsters > 0) then
for i, monster in pairs(monsters) do
2021-06-28 16:46:18 +02:00
if not common.IsMonsterDocile(monster:getMonsterType()) then
Character:inform(tutorial.getTutorialInformDE("monsters"),tutorial.getTutorialInformEN("monsters"))
2021-06-28 16:04:46 +02:00
Character:setQuestProgress(328,1)
break
end
2021-06-19 23:41:23 +02:00
end
end
end
--Orchard rat
if Character:getQuestProgress(354) == 0 and areas.PointInArea(Character.pos,"trollshaven") then
local monsters = world:getMonstersInRangeOf(Character.pos, 5)
if (#monsters > 0) then
for i, monster in pairs(monsters) do
if monster:getMonsterType() == 1111 then
tutorial.tutorialDialog(Character,354,"orchard rat")
break
end
end
end
end
2021-06-28 16:04:46 +02:00
--First encounter
2021-06-28 16:08:56 +02:00
if Character:getQuestProgress(329) == 0 and not areas.PointInArea(Character.pos,"trollshaven") then --Not near the noob spawn to avoid spamming the player
2021-06-28 16:04:46 +02:00
local dudes = world:getPlayersInRangeOf(Character.pos, 5)
if (#dudes > 1) then
tutorial.tutorialDialog(Character,329,"first encounter")
2021-06-28 16:04:46 +02:00
end
2021-06-19 23:41:23 +02:00
end
--Housing
if Character:getQuestProgress(359) == 0 then
if common.GetFrontItemID(Character) == 3772 or common.GetFrontItemID(Character) == 3773 then
tutorial.tutorialDialog(Character,359,"housing")
end
end
2021-06-19 23:41:23 +02:00
end
2020-12-14 10:21:07 +01:00
2020-12-06 02:14:13 +01:00
inlineTutorial.nextCalled=10 --One second
return true --bailing out in any case
2010-05-28 21:25:06 +00:00
end
2020-12-06 02:14:13 +01:00
function M.removeEffect(inlineTutorial, Character)
Character:inform(tutorial.getTutorialInformDE("end"),tutorial.getTutorialInformEN("end"))
2020-12-06 02:14:13 +01:00
2013-05-27 20:06:04 +02:00
end
return M