From 0887c779d1f2e0cd99ada80a130720e9c4995117 Mon Sep 17 00:00:00 2001 From: pitis91 Date: Fri, 22 May 2015 13:31:48 +0200 Subject: [PATCH] My last work Added to take a root task Renamed dice to die like RL Tibia Added Rathleton Elevator Prepaired Captain Haba OpenSea to second part of Hunt for a Sea Serpent Quest Added Rathleton Temple to Citizenship Mov Added and adjusted the adventurer's stone to all temple masters Fixed and Added Storages to LIB Added to items Cake Cabinet Right and Left ITEM Added Decrease and Increase Items from Rathleton like street lamps. Added unrealized Dream function --- data/XML/quests.xml | 3 + data/actions/actions.xml | 16 ++- .../adventurers guild/adventurers_stone.lua | 3 +- .../scripts/other/{dice.lua => die.lua} | 0 .../scripts/other/rathletonElevator.lua | 90 +++++++++++++++ .../scripts/quests/oramond/totakeroots.lua | 54 +++++++++ .../scripts/valuables/unrealizedDream.lua | 105 ++++++++++++++++++ data/items/items.xml | 14 ++- data/lib/miscellaneous/051-storages.lua | 42 ++++--- data/movements/movements.xml | 5 + data/movements/scripts/citizen.lua | 3 +- .../scripts/quests/oramond/enterOramond.lua | 31 ++++++ data/npc/Captain HabaOpenSea.xml | 2 - data/npc/scripts/Amanda.lua | 6 +- data/npc/scripts/Azalea.lua | 77 +++++++++++++ data/npc/scripts/Brewster.lua | 6 +- data/npc/scripts/Captain Bluebear.lua | 13 ++- data/npc/scripts/Captain Gulliver.lua | 21 +++- data/npc/scripts/Captain HabaOpenSea.lua | 26 +++++ data/npc/scripts/Captain Max.lua | 2 +- data/npc/scripts/Chavis.lua | 68 +++++++++++- data/npc/scripts/Isimov.lua | 6 +- data/npc/scripts/Kasmir.lua | 6 +- data/npc/scripts/Kevin.lua | 4 +- data/npc/scripts/Kjesse.lua | 6 +- data/npc/scripts/Lorietta.lua | 6 +- data/npc/scripts/Maealil.lua | 6 +- data/npc/scripts/Prezil.lua | 81 +++++++++++++- data/npc/scripts/Quentin.lua | 6 +- data/npc/scripts/Rahkem.lua | 6 +- data/npc/scripts/Tyrias.lua | 6 +- data/npc/scripts/Yberius.lua | 6 +- data/npc/scripts/Zedrulon The Fallen.lua | 77 +++++++++++++ 33 files changed, 728 insertions(+), 75 deletions(-) rename data/actions/scripts/other/{dice.lua => die.lua} (100%) create mode 100644 data/actions/scripts/other/rathletonElevator.lua create mode 100644 data/actions/scripts/quests/oramond/totakeroots.lua create mode 100644 data/actions/scripts/valuables/unrealizedDream.lua create mode 100644 data/movements/scripts/quests/oramond/enterOramond.lua diff --git a/data/XML/quests.xml b/data/XML/quests.xml index a952216..085eec5 100644 --- a/data/XML/quests.xml +++ b/data/XML/quests.xml @@ -1334,4 +1334,7 @@ + + + diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 236d9df..32f3d97 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -480,6 +480,14 @@ + + + + + + + + @@ -665,7 +673,7 @@ - + @@ -703,5 +711,11 @@ + + + + + + diff --git a/data/actions/scripts/adventurers guild/adventurers_stone.lua b/data/actions/scripts/adventurers guild/adventurers_stone.lua index 95523f1..b1b7556 100644 --- a/data/actions/scripts/adventurers guild/adventurers_stone.lua +++ b/data/actions/scripts/adventurers guild/adventurers_stone.lua @@ -13,7 +13,8 @@ local config = { {fromPos = Position(32785, 31274, 7), toPos = Position(32789, 31279, 7), townId = 13}, {fromPos = Position(33018, 31514, 11), toPos = Position(33032, 31531, 11), townId = 14}, {fromPos = Position(33442, 31312, 9), toPos = Position(33454, 31326, 9), townId = 28}, - {fromPos = Position(33510, 32360, 6), toPos = Position(33516, 32366, 6), townId = 29} + {fromPos = Position(33510, 32360, 6), toPos = Position(33516, 32366, 6), townId = 29}, + {fromPos = Position(33586, 31895, 6), toPos = Position(33603, 31903, 6), townId = 33} } function onUse(player, item, fromPosition, target, toPosition, isHotkey) diff --git a/data/actions/scripts/other/dice.lua b/data/actions/scripts/other/die.lua similarity index 100% rename from data/actions/scripts/other/dice.lua rename to data/actions/scripts/other/die.lua diff --git a/data/actions/scripts/other/rathletonElevator.lua b/data/actions/scripts/other/rathletonElevator.lua new file mode 100644 index 0000000..3e567a8 --- /dev/null +++ b/data/actions/scripts/other/rathletonElevator.lua @@ -0,0 +1,90 @@ +local elevatorPosition = { + Position(33638, 31903, 5), + Position(33638, 31903, 6) +} + +local config = { + [1] = { + fromPosition = elevatorPosition[1], + toPosition = elevatorPosition[2], + itemIds = { 23432, 23421 }, + transform = { + position = { elevatorPosition[1], elevatorPosition[2] }, + itemId = { 23421, 23421 }, + transformId = { 23424, 23428 } + }, + sound = 'Srrrt!', + soundPosition = Position(33639, 31903, 5), + relocatePosition = Position(33638, 31902, 5) + }, + [2] = { + fromPosition = elevatorPosition[2], + toPosition = elevatorPosition[1], + itemIds = { 23432, 23428 }, + transform = { + position = { elevatorPosition[1], elevatorPosition[1] }, + itemId = { 23424, 23428 }, + transformId = { 23421, 23421 }, + }, + sound = 'Zrrrt!', + soundPosition = Position(33639, 31903, 6), + relocatePosition = Position(33638, 31904, 6) + } +} + +local winch = { + [23422] = { config[2], config[1] }, + [23429] = { config[1], config[2] } +} + +local relocate = true + +local function moveElevator(config, player) + for i = 1, #config.itemIds do + local item = Tile(config.fromPosition):getItemById(config.itemIds[i]) + if item then + item:moveTo(config.toPosition) + end + end + + for i = 1, #config.transform.position do + local item = Tile(config.transform.position[i]):getItemById(config.transform.itemId[i]) + if item then + item:transform(config.transform.transformId[i]) + end + end + + if player then + player:say(config.sound, TALKTYPE_MONSTER_YELL, false, player, config.soundPosition) + end +end + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local useItem = winch[item.itemid] + if not useItem then + return true + end + + toPosition.x = toPosition.x - 1 + local tile = Tile(toPosition) + if not tile:getItemById(23432) then + local option = useItem[1] + if relocate then + Tile(option.fromPosition):relocateTo(option.relocatePosition) + end + + moveElevator(option, player) + return true + end + + local creature = tile:getTopCreature() + if not creature or creature.uid ~= player.uid then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Step inside the elevator to use it.') + return true + end + + local option = useItem[2] + moveElevator(option, player) + player:teleportTo(option.toPosition) + return true +end diff --git a/data/actions/scripts/quests/oramond/totakeroots.lua b/data/actions/scripts/quests/oramond/totakeroots.lua new file mode 100644 index 0000000..be837ef --- /dev/null +++ b/data/actions/scripts/quests/oramond/totakeroots.lua @@ -0,0 +1,54 @@ +local function revertRoot(position, itemId, transformId) + local item = Tile(position):getItemById(itemId) + if item then + item:transform(transformId) + end +end + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local harvestedCount = player:getStorageValue(Storage.Oramond.HarvestedRootCount) + local rand = math.random(1, 100) + if item.itemid == 23475 then + if((rand >= 1) and (rand < 50)) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You successfully harvest some juicy roots.') + player:addItem(23662, 1) + item:transform(item.itemid + 2) + addEvent(revertRoot, 300000, toPosition, 23477, 23475) + toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN) + if player:getStorageValue(Storage.Oramond.MissionToTakeRoots) < 0 then + player:setStorageValue(Storage.Oramond.HarvestedRootCount, 1) + player:setStorageValue(Storage.Oramond.MissionToTakeRoots, 1) + player:setStorageValue(Storage.Oramond.QuestLine, 1) + elseif player:getStorageValue(Storage.Oramond.MissionToTakeRoots) == 1 then + player:setStorageValue(Storage.Oramond.HarvestedRootCount, harvestedCount + 1) + end + elseif((rand >= 50) and (rand < 100)) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Your harvesting attempt destroyed more of the juicy roots than you could salvage.') + item:transform(item.itemid + 2) + addEvent(revertRoot, 300000, toPosition, 23477, 23475) + toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN) + end + end + if item.itemid == 23476 then + if((rand >= 1) and (rand < 50)) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You successfully harvest some juicy roots.') + player:addItem(23662, 1) + item:transform(item.itemid + 2) + addEvent(revertRoot, 300000, toPosition, 23478, 23476) + toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN) + if player:getStorageValue(Storage.Oramond.MissionToTakeRoots) < 0 then + player:setStorageValue(Storage.Oramond.HarvestedRootCount, 1) + player:setStorageValue(Storage.Oramond.MissionToTakeRoots, 1) + player:setStorageValue(Storage.Oramond.QuestLine, 1) + elseif player:getStorageValue(Storage.Oramond.MissionToTakeRoots) == 1 then + player:setStorageValue(Storage.Oramond.HarvestedRootCount, harvestedCount + 1) + end + elseif((rand >= 50) and (rand < 100)) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Your harvesting attempt destroyed more of the juicy roots than you could salvage.') + item:transform(item.itemid + 2) + addEvent(revertRoot, 300000, toPosition, 23478, 23476) + toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN) + end + end + return true +end diff --git a/data/actions/scripts/valuables/unrealizedDream.lua b/data/actions/scripts/valuables/unrealizedDream.lua new file mode 100644 index 0000000..ef71bdc --- /dev/null +++ b/data/actions/scripts/valuables/unrealizedDream.lua @@ -0,0 +1,105 @@ +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + +local amountOfPlayers = 1 +local spectators = Game.getSpectators(Position(33628, 32370, 5), false, true, 20, 20, 20, 20) + if #spectators < amountOfPlayers then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "you need a dreamcatcher device.") + return true +end + +--Unrealized Dream-- +chance = math.random(1,22) + +if chance == 1 then +player:addItem(2111,1) -- Snowball +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You wished for something cool.") + +elseif chance == 2 then +player:addItem(2223,1) -- Rubbish +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You knew it would be some rubbish!") + +elseif chance == 3 then +player:addItem(2114,1) -- Piggy Bank +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about your wealth.") + +elseif chance == 4 then +player:addItem(2745,1) -- Blue Rose +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about spring.") + +elseif chance == 5 then +player:addItem(2072,1) -- Lute +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Well, part of. You thought about getting rich and a pile of loot...") + +elseif chance == 6 then +player:addItem(9074,1) -- Present (Explosive) +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You were that curious for the surprise.") + +elseif chance == 7 then +player:addItem(2657,1) -- Simple Dress +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and ... Oops, where did that dream come from?") + +elseif chance == 8 then +player:addItem(22604,1) -- Silver Prison Key +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.") + +elseif chance == 9 then +player:addItem(7735,1) -- Spellwand +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Somehow you seemed to get distracted when you thought of Ferumbras.") + +elseif chance == 10 then +player:addItem(5792,1) -- Die +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just wondered if you\'d be lucky this time.") + +elseif chance == 11 then +player:addItem(2560,1) -- Mirror +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You shouldn\'t really think about yourself that often.") + +elseif chance == 12 then +player:addItem(22396,1) -- Cluster of Solace +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You thought of your last night\'s dream, You try to concentrate and your dream comes true. You couldn\'t focus on anything specific.") + +elseif chance == 13 then +player:addItem(2666,1) -- Meat +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Unfortunately you were subconsciouly thinking about something to eat.") + +elseif chance == 14 then +player:addItem(5929,1) -- Goldfish Bowl +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a loyal companion.") + +elseif chance == 15 then +player:addItem(22605,1) -- Copper Prison Key +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.") + +elseif chance == 16 then +player:addItem(22606,1) -- Bronze Prison Key +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.") + +elseif chance == 17 then +player:addItem(22607,1) -- Golden Prison Key +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.") + +elseif chance == 18 then +player:addItem(2121,1) -- Wedding Ring +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You wonder what were you thinking about.") + +elseif chance == 19 then +player:addItem(2355,1) -- Stuffed Bunny +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about having a true friend.") + +elseif chance == 20 then +player:addItem(22609,1) -- Dream Warden Claw +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You wonder what were you thinking about.") + +elseif chance == 21 then +player:addItem(7459,1) -- Pair of Earmuffs +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Sadly you had cold ears just in that moment.") + +elseif chance == 22 then +player:addItem(13537,1) -- Bag of Apple Slices +player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You thought about your sore feet.") +end + +item:getPosition():sendMagicEffect(26) +item:remove(1) +return true +end diff --git a/data/items/items.xml b/data/items/items.xml index 54d4ef0..ac1df2c 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -9001,7 +9001,7 @@ - + @@ -24106,9 +24106,13 @@ - - - + + + + + + + @@ -30648,7 +30652,7 @@ - + diff --git a/data/lib/miscellaneous/051-storages.lua b/data/lib/miscellaneous/051-storages.lua index e78c3e7..202d946 100644 --- a/data/lib/miscellaneous/051-storages.lua +++ b/data/lib/miscellaneous/051-storages.lua @@ -214,6 +214,19 @@ Storage = { Mission73 = 9949, Mission74 = 9876 }, + Oramond = { + QuestLine = 10060, + VotingPoints = 10061, + + MissionToTakeRoots = 20060, + HarvestedRootCount = 20061, + }, + RathletonQuest = { + QuestLine = 10080, + VotesCasted = 10081, + + Rank = 10082, + }, OutfitQuest = { DefaultStart = 12010, -- until all outfit quests are completed Ref = 12010, @@ -752,10 +765,6 @@ Storage = { ParchmentRoomQuest = 60994, - WarzoneReward1 = 9172, - WarzoneReward2 = 9173, - WarzoneReward3 = 9174, - FathersBurdenQuestWood = 3500, FathersBurdenQuestIron = 3501, FathersBurdenQuestRoot = 3502, @@ -911,17 +920,20 @@ Storage = { FreeStone = { Alia = 50704, Amanda = 50705, - Brewster = 50706, - Isimov = 50707, - Kasmir = 50708, - Kjesse = 50709, - Lorietta = 50710, - Maealil = 50711, - Quentin = 50712, - RockWithASoftSpot = 50713, - Tyrias = 50714, - Yberius = 50715, - Rahkem = 50716 + Azalea = 50706, + Brewster = 50707, + Isimov = 50708, + Kasmir = 50709, + Kjesse = 50710, + Lorietta = 50711, + Maealil = 50712, + Prezil = 50713, + Quentin = 50714, + RockWithASoftSpot = 50715, + Tyrias = 50723, + Yberius = 50724, + Rahkem = 50725, + ZedrulonTheFallen = 50726 } }, diff --git a/data/movements/movements.xml b/data/movements/movements.xml index 63ac17c..8b8e81f 100644 --- a/data/movements/movements.xml +++ b/data/movements/movements.xml @@ -227,6 +227,11 @@ + + + + + diff --git a/data/movements/scripts/citizen.lua b/data/movements/scripts/citizen.lua index 7492f18..a84b7f0 100644 --- a/data/movements/scripts/citizen.lua +++ b/data/movements/scripts/citizen.lua @@ -13,7 +13,8 @@ local config = { [9067] = 13, [9068] = 14, [9240] = 28, - [9500] = 29 + [9500] = 29, + [9501] = 33 } function onStepIn(creature, item, position, fromPosition) diff --git a/data/movements/scripts/quests/oramond/enterOramond.lua b/data/movements/scripts/quests/oramond/enterOramond.lua new file mode 100644 index 0000000..de22947 --- /dev/null +++ b/data/movements/scripts/quests/oramond/enterOramond.lua @@ -0,0 +1,31 @@ +function onStepIn(player, item, position, fromPosition) + if item.actionid == 42626 and player:getStorageValue(Storage.RathletonQuest.Rank) < 300 then + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:teleportTo(Position(33539, 32014, 6)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say('Slrrp!', TALKTYPE_MONSTER_SAY) + elseif item.actionid == 42626 and player:getStorageValue(Storage.RathletonQuest.Rank) >= 300 then + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:teleportTo(Position(33636, 31891, 6)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say('Slrrp!', TALKTYPE_MONSTER_SAY) + end + if item.actionid == 42627 then + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:teleportTo(Position(33491, 31985,7)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say('Slrrp!', TALKTYPE_MONSTER_SAY) + end + if item.actionid == 42628 and player:getStorageValue(Storage.RathletonQuest.Rank) < 300 then + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:teleportTo(Position(33636, 31891, 6)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say('Slrrp!', TALKTYPE_MONSTER_SAY) + elseif item.actionid == 42628 and player:getStorageValue(Storage.RathletonQuest.Rank) >= 300 then + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:teleportTo(Position(33491, 31985, 7)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say('Slrrp!', TALKTYPE_MONSTER_SAY) + end + return true +end diff --git a/data/npc/Captain HabaOpenSea.xml b/data/npc/Captain HabaOpenSea.xml index 7de1053..87af2b4 100644 --- a/data/npc/Captain HabaOpenSea.xml +++ b/data/npc/Captain HabaOpenSea.xml @@ -3,8 +3,6 @@ - - diff --git a/data/npc/scripts/Amanda.lua b/data/npc/scripts/Amanda.lua index 42c81fd..38962cc 100644 --- a/data/npc/scripts/Amanda.lua +++ b/data/npc/scripts/Amanda.lua @@ -47,12 +47,12 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Amanda) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Amanda) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Amanda, 1) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Azalea.lua b/data/npc/scripts/Azalea.lua index 022d960..f49c32a 100644 --- a/data/npc/scripts/Azalea.lua +++ b/data/npc/scripts/Azalea.lua @@ -7,4 +7,81 @@ function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end +-- Twist of Fate +local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, {npcHandler = npcHandler, + text = { + 'This is a special blessing I can bestow upon you once you have obtained at least one of the other blessings and which functions a bit differently. ...', + 'It only works when you\'re killed by other adventurers, which means that at least half of the damage leading to your death was caused by others, not by monsters or the environment. ...', + 'The {twist of fate} will not reduce the death penalty like the other blessings, but instead prevent you from losing your other blessings as well as the amulet of loss, should you wear one. It costs the same as the other blessings. ...', + 'Would you like to receive that protection for a sacrifice of |PVPBLESSCOST| gold, child?' + }}) + blessKeyword:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, text = 'So receive the protection of the twist of fate, pilgrim.', cost = '|PVPBLESSCOST|', bless = 6}) + blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) + +-- Adventurer Stone +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) + +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Azalea) ~= 1 end) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Azalea, 1) end) + stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) + +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, + function(player) return player:getMoney() >= 30 end, + function(player) player:removeMoney(30) player:addItem(18559, 1) end + ) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Sorry, you don\'t have enough money.', reset = true}) + stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) + +-- Healing +local function addHealKeyword(text, condition, effect) + keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = text}, + function(player) return player:getCondition(condition) ~= nil end, + function(player) + player:removeCondition(condition) + player:getPosition():sendMagicEffect(effect) + end + ) +end + +addHealKeyword('You are burning. Let me quench those flames.', CONDITION_FIRE, CONST_ME_MAGIC_GREEN) +addHealKeyword('You are poisoned. Let me soothe your pain.', CONDITION_POISON, CONST_ME_MAGIC_RED) +addHealKeyword('You are electrified, my child. Let me help you to stop trembling.', CONDITION_ENERGY, CONST_ME_MAGIC_GREEN) + +keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You are hurt, my child. I will heal your wounds.'}, + function(player) return player:getHealth() < 40 end, + function(player) + local health = player:getHealth() + if health < 40 then player:addHealth(40 - health) end + player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN) + end +) +keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You aren\'t looking that bad. Sorry, I can\'t help you. But if you are looking for additional protection you should go on the {pilgrimage} of ashes or get the protection of the {twist of fate} here.'}) + +-- Basic +keywordHandler:addKeyword({'pilgrimage'}, StdModule.say, {npcHandler = npcHandler, text = 'Whenever you receive a lethal wound, your vital force is damaged and there is a chance that you lose some of your equipment. With every single of the five {blessings} you have, this damage and chance of loss will be reduced.'}) +keywordHandler:addKeyword({'blessings'}, StdModule.say, {npcHandler = npcHandler, text = 'There are five blessings available in five sacred places: the {spiritual} shielding, the spark of the {phoenix}, the {embrace} of Tibia, the fire of the {suns} and the wisdom of {solitude}. Additionally, you can receive the {twist of fate} here.'}) +keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'I see you received the spiritual shielding in the whiteflower temple south of Thais.'}, function(player) return player:hasBlessing(1) end) +keywordHandler:addAliasKeyword({'shield'}) +keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the druids north of Carlin have provided you with the Embrace of Tibia.'}, function(player) return player:hasBlessing(2) end) +keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'I can see you received the blessing of the two suns in the suntower near Ab\'Dendriel.'}, function(player) return player:hasBlessing(3) end) +keywordHandler:addAliasKeyword({'fire'}) +keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the spark of the phoenix already was given to you by the dwarven priests of earth and fire in Kazordoon.'}, function(player) return player:hasBlessing(4) end) +keywordHandler:addAliasKeyword({'spark'}) +keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense you already talked to the hermit Eremo on the isle of Cormaya and received this blessing.'}, function(player) return player:hasBlessing(5) end) +keywordHandler:addAliasKeyword({'wisdom'}) +keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of spiritual shielding in the whiteflower temple south of Thais.'}) +keywordHandler:addAliasKeyword({'shield'}) +keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'The druids north of Carlin will provide you with the embrace of Tibia.'}) +keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of the two suns in the suntower near Ab\'Dendriel.'}) +keywordHandler:addAliasKeyword({'fire'}) +keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.'}) +keywordHandler:addAliasKeyword({'spark'}) +keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'Talk to the hermit Eremo on the isle of Cormaya about this blessing.'}) +keywordHandler:addAliasKeyword({'wisdom'}) + +npcHandler:setMessage(MESSAGE_GREET, 'Welcome, young |PLAYERNAME|! If you are heavily wounded or poisoned, I can {heal} you for free.') +npcHandler:setMessage(MESSAGE_WALKAWAY, 'Remember: If you are heavily wounded or poisoned, I can heal you for free.') +npcHandler:setMessage(MESSAGE_FAREWELL, 'May the gods bless you, |PLAYERNAME|!') + npcHandler:addModule(FocusModule:new()) diff --git a/data/npc/scripts/Brewster.lua b/data/npc/scripts/Brewster.lua index b5b5cf1..cd35ab1 100644 --- a/data/npc/scripts/Brewster.lua +++ b/data/npc/scripts/Brewster.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Brewster) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Brewster) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Brewster, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Captain Bluebear.lua b/data/npc/scripts/Captain Bluebear.lua index c4a8703..94cc0da 100644 --- a/data/npc/scripts/Captain Bluebear.lua +++ b/data/npc/scripts/Captain Bluebear.lua @@ -26,6 +26,7 @@ addTravelKeyword('roshamuul', 210, Position(33494, 32567, 7)) addTravelKeyword('svargrond', 180, Position(32341, 31108, 6)) addTravelKeyword('liberty bay', 180, Position(32285, 32892, 6)) addTravelKeyword('yalahar', 200, Position(32816, 31272, 6)) +addTravelKeyword('oramond', 210, Position(33481, 31986, 7)) -- Kick keywordHandler:addKeyword({'kick'}, StdModule.kick, {npcHandler = npcHandler, destination = {Position(32320, 32219, 6), Position(32321, 32210, 6)}}) @@ -41,12 +42,12 @@ keywordHandler:addKeyword({'route'}, StdModule.say, {npcHandler = npcHandler, te keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'}) keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, text = 'We can transport everything you want.'}) keywordHandler:addKeyword({'passenger'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to welcome you on board.'}) -keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'}) -keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'}) -keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'}) -keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'}) -keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'}) -keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'}) +keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul}, {Oramond} or {Svargrond}?'}) +keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul}, {Oramond} or {Svargrond}?'}) +keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul}, {Oramond} or {Svargrond}?'}) +keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul}, {Oramond} or {Svargrond}?'}) +keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul}, {Oramond} or {Svargrond}?'}) +keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul}, {Oramond} or {Svargrond}?'}) keywordHandler:addKeyword({'ice'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'}) keywordHandler:addKeyword({'senja'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'}) keywordHandler:addKeyword({'folda'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'}) diff --git a/data/npc/scripts/Captain Gulliver.lua b/data/npc/scripts/Captain Gulliver.lua index 022d960..4f5c1fd 100644 --- a/data/npc/scripts/Captain Gulliver.lua +++ b/data/npc/scripts/Captain Gulliver.lua @@ -5,6 +5,25 @@ NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end -function onThink() npcHandler:onThink() end +function onThink() npcHandler:onThink() end + +local voices = { {text = 'Passages to Thais.'} } +npcHandler:addModule(VoiceModule:new(voices)) + +-- Travel +local function addTravelKeyword(keyword, cost, destination, action) + local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'}) + travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = cost, discount = 'postman', destination = destination}, nil, action) + travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true}) +end + +addTravelKeyword('thais', 160, Position(32310, 32210, 6)) + +-- Basic +keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Thais}?'}) + +npcHandler:setMessage(MESSAGE_GREET, 'Welcome on board, |PLAYERNAME|. Where can I {sail} you today?') +npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye. Recommend us if you were satisfied with our service.') +npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.') npcHandler:addModule(FocusModule:new()) diff --git a/data/npc/scripts/Captain HabaOpenSea.lua b/data/npc/scripts/Captain HabaOpenSea.lua index 022d960..a51319b 100644 --- a/data/npc/scripts/Captain HabaOpenSea.lua +++ b/data/npc/scripts/Captain HabaOpenSea.lua @@ -7,4 +7,30 @@ function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end + -- TO-DO Second Step from Hunt for a Sea Serpent Quest -- +local function creatureSayCallback(cid, type, msg) + if not npcHandler:isFocused(cid) then + return false + end + local player = Player(cid) + if msgcontains(msg, "go") or msgcontains(msg, "svargrond") then + npcHandler:say("A'right, wanna put out from sea?", cid) + npcHandler.topic[cid] = 1 + end + if msgcontains(msg, "yes") then + if npcHandler.topic[cid] == 1 then + npcHandler:say("Let's go fo' a hunt and bring the beast down!", cid) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:teleportTo(Position(32341, 31117, 7), false) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + npcHandler.topic[cid] = 2 + end + end + return true +end + +npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) +npcHandler:setMessage(MESSAGE_GREET, "Wha'd'ya want? Ask me 'bout the instructions if you don't know what to do! If you wanna head back to {Svargrond}, let me know.") +npcHandler:setMessage(MESSAGE_FAREWELL, "Bye.") +npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye.") npcHandler:addModule(FocusModule:new()) diff --git a/data/npc/scripts/Captain Max.lua b/data/npc/scripts/Captain Max.lua index 21f34ba..93aca2e 100644 --- a/data/npc/scripts/Captain Max.lua +++ b/data/npc/scripts/Captain Max.lua @@ -11,7 +11,7 @@ local voices = { {text = 'Whoah. That was a large shadow passing by.'} } npcHandler:addModule(VoiceModule:new(voices)) local travelNode = keywordHandler:addKeyword({'calassa'}, StdModule.say, {npcHandler = npcHandler, text = 'That is quite a long unprofitable travel. I\'ll bring you to Calassa though. Do you want me to do it?'}) - travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 200, destination = Position(31911, 32710, 6) }) + travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 200, destination = Position(31921, 32710, 7) }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, reset = true, text = 'Maybe another time, then.'}) local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, text = 'That is quite a long unprofitable travel. I\'ll bring you to Yalahar. Is that ok with you?'}) diff --git a/data/npc/scripts/Chavis.lua b/data/npc/scripts/Chavis.lua index 022d960..4ca1774 100644 --- a/data/npc/scripts/Chavis.lua +++ b/data/npc/scripts/Chavis.lua @@ -2,9 +2,67 @@ local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end -function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end -function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end -function onThink() npcHandler:onThink() end +function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end +function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end +function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end +function onThink() npcHandler:onThink() end -npcHandler:addModule(FocusModule:new()) +local function greetCallback(cid) + npcHandler:setMessage(MESSAGE_GREET,'Greetings! I guess you are here for the {food}.') + return true +end + +local function creatureSayCallback(cid, type, msg) + if not npcHandler:isFocused(cid) then + return false + end + + local player = Player(cid) + local harvestedCount = player:getStorageValue(Storage.Oramond.HarvestedRootCount) + local votingPoints = player:getStorageValue(Storage.Oramond.VotingPoints) + -- START TASK + if msgcontains(msg, "food") then + if player:getStorageValue(Storage.Oramond.MissionToTakeRoots) < 0 then + npcHandler:say({ + 'Hey there, just to let you know - I am not a man of many words. I prefer \'deeds\', you see? The poor of this city will not feed themselves. ...', + 'So in case you\'ve got nothing better to do - and it sure looks that way judging by how long you\'re already loitering around in front of my nose - please help us. ...', + 'If you can find some of the nutritious, juicy {roots} in the outskirts of Rathleton, bring them here. We will gladly take bundles of five roots each, and hey - helping us, helps you in the long term, trust me.' + }, cid) + player:setStorageValue(Storage.Oramond.QuestLine, 1) + player:setStorageValue(Storage.Oramond.MissionToTakeRoots, 1) + player:setStorageValue(Storage.Oramond.HarvestedRootCount, 0) + npcHandler.topic[cid] = 1 + elseif player:getStorageValue(Storage.Oramond.MissionToTakeRoots) == 1 then + npcHandler:say("Yes? You brought some juicy roots? How nice of you - That's one additional voice in the {magistrate} of {Rathleton} for you!... ", cid) + npcHandler.topic[cid] = 2 + end + end + --ANSWER YES + if(msgcontains(msg, "yes")) then + if npcHandler.topic[cid] == 1 and player:getStorageValue(Storage.Oramond.HarvestedRootCount) >= 5 then + npcHandler:say("Come when you are done.", cid) + npcHandler.topic[cid] = 0 + elseif npcHandler.topic[cid] == 2 and player:getStorageValue(Storage.Oramond.HarvestedRootCount) >= 5 then + npcHandler:say("Spend it wisley, thought, put in a word for the poor, will ye? Sure you will. ", cid) + npcHandler.topic[cid] = 3 + elseif npcHandler.topic[cid] == 3 then + player:setStorageValue(Storage.Oramond.VotingPoints, votingPoints + 1) + player:setStorageValue(Storage.Oramond.HarvestedRootCount, harvestedCount - 5) + player:removeItem(23662, 5) + npcHandler.topic[cid] = 0 + end + end + -- ANSWER NO + if(msgcontains(msg, "no")) then + if npcHandler.topic[cid] == 3 then + npcHandler:say("Take care out there!", cid) + npcHandler.topic[cid] = 0 + end + end + return true +end + +npcHandler:setCallback(CALLBACK_GREET, greetCallback) +npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) +local focusModule = FocusModule:new() +npcHandler:addModule(focusModule) diff --git a/data/npc/scripts/Isimov.lua b/data/npc/scripts/Isimov.lua index 5c368f4..9556877 100644 --- a/data/npc/scripts/Isimov.lua +++ b/data/npc/scripts/Isimov.lua @@ -20,13 +20,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Isimov) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Isimov) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Isimov, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Kasmir.lua b/data/npc/scripts/Kasmir.lua index 26363d9..9ef38ff 100644 --- a/data/npc/scripts/Kasmir.lua +++ b/data/npc/scripts/Kasmir.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Kasmir) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Kasmir) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Kasmir, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Kevin.lua b/data/npc/scripts/Kevin.lua index e886510..643a982 100644 --- a/data/npc/scripts/Kevin.lua +++ b/data/npc/scripts/Kevin.lua @@ -120,7 +120,7 @@ local function creatureSayCallback(cid, type, msg) npcHandler:say("Good! Finally, find the technomancer Brodrosch and travel with him to the Isle of Cormaya. After this passage report back to me here. Understood?", cid) npcHandler.topic[cid] = 7 elseif npcHandler.topic[cid] == 7 then - npcHandler:say("Ok, remember: the Tibian mail service puts trust in you! Don't fail and report back soon. Just tell me about your {MISSION}.", cid) + npcHandler:say("Ok, remember: the Tibian mail service puts trust in you! Don't fail and report back soon. Just tell me about your {mission}.", cid) player:setStorageValue(Storage.postman.Mission01, 1) npcHandler.topic[cid] = 0 elseif npcHandler.topic[cid] == 8 then @@ -195,7 +195,7 @@ local function creatureSayCallback(cid, type, msg) player:addItem(2078, 1) npcHandler.topic[cid] = 0 elseif npcHandler.topic[cid] == 25 then - npcHandler:say("So listen well. Behind the lower left door you will find a bag. The letters in the bag are for none other than Santa Claus! Deliver them to his house on the isle of Vega, USE thebag on his mailbox and report back here.", cid) + npcHandler:say("So listen well. Behind the lower left door you will find a bag. The letters in the bag are for none other than Santa Claus! Deliver them to his house on the isle of Vega, USE the bag on his mailbox and report back here.", cid) player:setStorageValue(Storage.postman.Mission09, 1) npcHandler.topic[cid] = 0 elseif npcHandler.topic[cid] == 26 then diff --git a/data/npc/scripts/Kjesse.lua b/data/npc/scripts/Kjesse.lua index 3deaca1..028f449 100644 --- a/data/npc/scripts/Kjesse.lua +++ b/data/npc/scripts/Kjesse.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Kjesse) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Kjesse) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Kjesse, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Lorietta.lua b/data/npc/scripts/Lorietta.lua index 659a24e..faff3fe 100644 --- a/data/npc/scripts/Lorietta.lua +++ b/data/npc/scripts/Lorietta.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Lorietta) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Lorietta) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Lorietta, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Maealil.lua b/data/npc/scripts/Maealil.lua index 81b53dc..e32ee28 100644 --- a/data/npc/scripts/Maealil.lua +++ b/data/npc/scripts/Maealil.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Maealil) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Maealil) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Maealil, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Prezil.lua b/data/npc/scripts/Prezil.lua index 022d960..7978d7e 100644 --- a/data/npc/scripts/Prezil.lua +++ b/data/npc/scripts/Prezil.lua @@ -5,6 +5,83 @@ NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end -function onThink() npcHandler:onThink() end +function onThink() npcHandler:onThink() end -npcHandler:addModule(FocusModule:new()) +-- Twist of Fate +local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, {npcHandler = npcHandler, + text = { + 'This is a special blessing I can bestow upon you once you have obtained at least one of the other blessings and which functions a bit differently. ...', + 'It only works when you\'re killed by other adventurers, which means that at least half of the damage leading to your death was caused by others, not by monsters or the environment. ...', + 'The {twist of fate} will not reduce the death penalty like the other blessings, but instead prevent you from losing your other blessings as well as the amulet of loss, should you wear one. It costs the same as the other blessings. ...', + 'Would you like to receive that protection for a sacrifice of |PVPBLESSCOST| gold, child?' + }}) + blessKeyword:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, text = 'So receive the protection of the twist of fate, pilgrim.', cost = '|PVPBLESSCOST|', bless = 6}) + blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) + +-- Adventurer Stone +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) + +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Prezil) ~= 1 end) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Prezil, 1) end) + stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) + +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, + function(player) return player:getMoney() >= 30 end, + function(player) player:removeMoney(30) player:addItem(18559, 1) end + ) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Sorry, you don\'t have enough money.', reset = true}) + stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) + +-- Healing +local function addHealKeyword(text, condition, effect) + keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = text}, + function(player) return player:getCondition(condition) ~= nil end, + function(player) + player:removeCondition(condition) + player:getPosition():sendMagicEffect(effect) + end + ) +end + +addHealKeyword('You are burning. Let me quench those flames.', CONDITION_FIRE, CONST_ME_MAGIC_GREEN) +addHealKeyword('You are poisoned. Let me soothe your pain.', CONDITION_POISON, CONST_ME_MAGIC_RED) +addHealKeyword('You are electrified, my child. Let me help you to stop trembling.', CONDITION_ENERGY, CONST_ME_MAGIC_GREEN) + +keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You are hurt, my child. I will heal your wounds.'}, + function(player) return player:getHealth() < 40 end, + function(player) + local health = player:getHealth() + if health < 40 then player:addHealth(40 - health) end + player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN) + end +) +keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You aren\'t looking that bad. Sorry, I can\'t help you. But if you are looking for additional protection you should go on the {pilgrimage} of ashes or get the protection of the {twist of fate} here.'}) + +-- Basic +keywordHandler:addKeyword({'pilgrimage'}, StdModule.say, {npcHandler = npcHandler, text = 'Whenever you receive a lethal wound, your vital force is damaged and there is a chance that you lose some of your equipment. With every single of the five {blessings} you have, this damage and chance of loss will be reduced.'}) +keywordHandler:addKeyword({'blessings'}, StdModule.say, {npcHandler = npcHandler, text = 'There are five blessings available in five sacred places: the {spiritual} shielding, the spark of the {phoenix}, the {embrace} of Tibia, the fire of the {suns} and the wisdom of {solitude}. Additionally, you can receive the {twist of fate} here.'}) +keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'I see you received the spiritual shielding in the whiteflower temple south of Thais.'}, function(player) return player:hasBlessing(1) end) +keywordHandler:addAliasKeyword({'shield'}) +keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the druids north of Carlin have provided you with the Embrace of Tibia.'}, function(player) return player:hasBlessing(2) end) +keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'I can see you received the blessing of the two suns in the suntower near Ab\'Dendriel.'}, function(player) return player:hasBlessing(3) end) +keywordHandler:addAliasKeyword({'fire'}) +keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the spark of the phoenix already was given to you by the dwarven priests of earth and fire in Kazordoon.'}, function(player) return player:hasBlessing(4) end) +keywordHandler:addAliasKeyword({'spark'}) +keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense you already talked to the hermit Eremo on the isle of Cormaya and received this blessing.'}, function(player) return player:hasBlessing(5) end) +keywordHandler:addAliasKeyword({'wisdom'}) +keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of spiritual shielding in the whiteflower temple south of Thais.'}) +keywordHandler:addAliasKeyword({'shield'}) +keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'The druids north of Carlin will provide you with the embrace of Tibia.'}) +keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of the two suns in the suntower near Ab\'Dendriel.'}) +keywordHandler:addAliasKeyword({'fire'}) +keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.'}) +keywordHandler:addAliasKeyword({'spark'}) +keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'Talk to the hermit Eremo on the isle of Cormaya about this blessing.'}) +keywordHandler:addAliasKeyword({'wisdom'}) + +npcHandler:setMessage(MESSAGE_GREET, 'Welcome, young |PLAYERNAME|! If you are heavily wounded or poisoned, I can {heal} you for free.') +npcHandler:setMessage(MESSAGE_WALKAWAY, 'Remember: If you are heavily wounded or poisoned, I can heal you for free.') +npcHandler:setMessage(MESSAGE_FAREWELL, 'May the gods bless you, |PLAYERNAME|!') + +npcHandler:addModule(FocusModule:new()) \ No newline at end of file diff --git a/data/npc/scripts/Quentin.lua b/data/npc/scripts/Quentin.lua index 2131c1a..cd22165 100644 --- a/data/npc/scripts/Quentin.lua +++ b/data/npc/scripts/Quentin.lua @@ -42,13 +42,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Quentin) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Quentin) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Quentin, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Rahkem.lua b/data/npc/scripts/Rahkem.lua index 50492f5..7ade928 100644 --- a/data/npc/scripts/Rahkem.lua +++ b/data/npc/scripts/Rahkem.lua @@ -22,13 +22,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Rahkem) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Rahkem) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Rahkem, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Tyrias.lua b/data/npc/scripts/Tyrias.lua index a981a31..9295e24 100644 --- a/data/npc/scripts/Tyrias.lua +++ b/data/npc/scripts/Tyrias.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Tyrias) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Tyrias) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Tyrias, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Yberius.lua b/data/npc/scripts/Yberius.lua index bc4f4be..d52fac1 100644 --- a/data/npc/scripts/Yberius.lua +++ b/data/npc/scripts/Yberius.lua @@ -19,13 +19,13 @@ local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) -- Adventurer Stone -keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Yberius) ~= 1 end) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.Yberius) ~= 1 end) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.Yberius, 1) end) stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) -local stoneKeyword = keywordHandler:addKeyword({'adventurer stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, function(player) return player:getMoney() >= 30 end, function(player) player:removeMoney(30) player:addItem(18559, 1) end diff --git a/data/npc/scripts/Zedrulon The Fallen.lua b/data/npc/scripts/Zedrulon The Fallen.lua index 022d960..0bb6207 100644 --- a/data/npc/scripts/Zedrulon The Fallen.lua +++ b/data/npc/scripts/Zedrulon The Fallen.lua @@ -7,4 +7,81 @@ function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end +-- Twist of Fate +local blessKeyword = keywordHandler:addKeyword({'twist of fate'}, StdModule.say, {npcHandler = npcHandler, + text = { + 'This is a special blessing I can bestow upon you once you have obtained at least one of the other blessings and which functions a bit differently. ...', + 'It only works when you\'re killed by other adventurers, which means that at least half of the damage leading to your death was caused by others, not by monsters or the environment. ...', + 'The {twist of fate} will not reduce the death penalty like the other blessings, but instead prevent you from losing your other blessings as well as the amulet of loss, should you wear one. It costs the same as the other blessings. ...', + 'Would you like to receive that protection for a sacrifice of |PVPBLESSCOST| gold, child?' + }}) + blessKeyword:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, text = 'So receive the protection of the twist of fate, pilgrim.', cost = '|PVPBLESSCOST|', bless = 6}) + blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true}) + +-- Adventurer Stone +keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Keep your adventurer\'s stone well.'}, function(player) return player:getItemById(18559, true) end) + +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for free?'}, function(player) return player:getStorageValue(Storage.AdventurersGuild.FreeStone.ZedrulonTheFallen) ~= 1 end) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, nil, function(player) player:addItem(18559, 1) player:setStorageValue(Storage.AdventurersGuild.FreeStone.ZedrulonTheFallen, 1) end) + stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) + +local stoneKeyword = keywordHandler:addKeyword({'adventurer\'s stone'}, StdModule.say, {npcHandler = npcHandler, text = 'Ah, you want to replace your adventurer\'s stone for 30 gold?'}) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Here you are. Take care.', reset = true}, + function(player) return player:getMoney() >= 30 end, + function(player) player:removeMoney(30) player:addItem(18559, 1) end + ) + stoneKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'Sorry, you don\'t have enough money.', reset = true}) + stoneKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'No problem.', reset = true}) + +-- Healing +local function addHealKeyword(text, condition, effect) + keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = text}, + function(player) return player:getCondition(condition) ~= nil end, + function(player) + player:removeCondition(condition) + player:getPosition():sendMagicEffect(effect) + end + ) +end + +addHealKeyword('You are burning. Let me quench those flames.', CONDITION_FIRE, CONST_ME_MAGIC_GREEN) +addHealKeyword('You are poisoned. Let me soothe your pain.', CONDITION_POISON, CONST_ME_MAGIC_RED) +addHealKeyword('You are electrified, my child. Let me help you to stop trembling.', CONDITION_ENERGY, CONST_ME_MAGIC_GREEN) + +keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You are hurt, my child. I will heal your wounds.'}, + function(player) return player:getHealth() < 40 end, + function(player) + local health = player:getHealth() + if health < 40 then player:addHealth(40 - health) end + player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN) + end +) +keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You aren\'t looking that bad. Sorry, I can\'t help you. But if you are looking for additional protection you should go on the {pilgrimage} of ashes or get the protection of the {twist of fate} here.'}) + +-- Basic +keywordHandler:addKeyword({'pilgrimage'}, StdModule.say, {npcHandler = npcHandler, text = 'Whenever you receive a lethal wound, your vital force is damaged and there is a chance that you lose some of your equipment. With every single of the five {blessings} you have, this damage and chance of loss will be reduced.'}) +keywordHandler:addKeyword({'blessings'}, StdModule.say, {npcHandler = npcHandler, text = 'There are five blessings available in five sacred places: the {spiritual} shielding, the spark of the {phoenix}, the {embrace} of Tibia, the fire of the {suns} and the wisdom of {solitude}. Additionally, you can receive the {twist of fate} here.'}) +keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'I see you received the spiritual shielding in the whiteflower temple south of Thais.'}, function(player) return player:hasBlessing(1) end) +keywordHandler:addAliasKeyword({'shield'}) +keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the druids north of Carlin have provided you with the Embrace of Tibia.'}, function(player) return player:hasBlessing(2) end) +keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'I can see you received the blessing of the two suns in the suntower near Ab\'Dendriel.'}, function(player) return player:hasBlessing(3) end) +keywordHandler:addAliasKeyword({'fire'}) +keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the spark of the phoenix already was given to you by the dwarven priests of earth and fire in Kazordoon.'}, function(player) return player:hasBlessing(4) end) +keywordHandler:addAliasKeyword({'spark'}) +keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense you already talked to the hermit Eremo on the isle of Cormaya and received this blessing.'}, function(player) return player:hasBlessing(5) end) +keywordHandler:addAliasKeyword({'wisdom'}) +keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of spiritual shielding in the whiteflower temple south of Thais.'}) +keywordHandler:addAliasKeyword({'shield'}) +keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'The druids north of Carlin will provide you with the embrace of Tibia.'}) +keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of the two suns in the suntower near Ab\'Dendriel.'}) +keywordHandler:addAliasKeyword({'fire'}) +keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.'}) +keywordHandler:addAliasKeyword({'spark'}) +keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'Talk to the hermit Eremo on the isle of Cormaya about this blessing.'}) +keywordHandler:addAliasKeyword({'wisdom'}) + +npcHandler:setMessage(MESSAGE_GREET, 'Welcome, young |PLAYERNAME|! If you are heavily wounded or poisoned, I can {heal} you for free.') +npcHandler:setMessage(MESSAGE_WALKAWAY, 'Remember: If you are heavily wounded or poisoned, I can heal you for free.') +npcHandler:setMessage(MESSAGE_FAREWELL, 'May the gods bless you, |PLAYERNAME|!') + npcHandler:addModule(FocusModule:new())