magnus_blackwater.lua

main 76 lines · 5 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1local keywordHandler = KeywordHandler:new()
2local npcHandler = NpcHandler:new(keywordHandler)
3NpcSystem.parseParameters(npcHandler)
4
5function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
6function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
7function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
8function onThink() npcHandler:onThink() end
9
10local function creatureSayCallback(cid, type, msg)
11 if(not npcHandler:isFocused(cid)) then
12 return false
13 end
14 local player = Player(cid)
15 if msg:lower() == "discover" then
16 npcHandler:say("Ssshh puff, ssshh puff, so ahem, ahem, sorry about that, you want {explore} the ocean and found lost treasures ?.", cid)
17 elseif msg:lower() == "explore" then
18 npcHandler:say("Before explore the ocean, you need a boat, let's construct a boat, for this you need some {materials}, some exquisite planks for the hull and deck, some nails to hold the boat together, metal fittings to reinforce and connect various components, a silk, important to stretch the sail of the boat, a small golden anchor to keep the boat in place when not sailing and some paint to protect the wood. Of course, you can buy all of this items to an old merchant. A whimsical merchant, an elusive ally, hoarding every ship part to sell to any daring enough to brave the tumultuous seas, called Shipwright Trader. You can found him on at north of Thais at exit.", cid)
19 elseif msg:lower() == "materials" then
20 npcHandler:say("Here is the list about what we need. You can found Shipwright Trader at north of Thais, come back when you get the materials for we start construction of the boat.\nFor Start we need some exquisite {planks}, for the hull and deck.", cid)
21 player:addItem(7844, 1)
22 elseif msg:lower() == "planks" then
23 if player:removeItem(12503, 10) then
24 npcHandler:say("Now for hold the boat together we need some {nails}", cid)
25 player:setStorageValue(BoatMissions.MagnusBlackWaterFirst, 1)
26 else
27 npcHandler:say("For this you need 10 exquisite planks.", cid)
28 end
29 elseif msg:lower() == "nails" then
30 if player:removeItem(8309, 10) and player:getStorageValue(BoatMissions.MagnusBlackWaterFirst) == 1 then
31 npcHandler:say("We need also some extra {metal} fitting parts.", cid)
32 player:setStorageValue(BoatMissions.MagnusBlackWaterSecond, 1)
33 else
34 npcHandler:say("You need 10 nails to continue the construction.", cid)
35 end
36 elseif msg:lower() == "metal" then
37 if player:removeItem(10034, 5) and player:getStorageValue(BoatMissions.MagnusBlackWaterSecond) == 1 then
38 npcHandler:say("Great, to continue we need one exquisite {silk} to connect various components.", cid)
39 player:setStorageValue(BoatMissions.MagnusBlackWaterThird, 1)
40 else
41 npcHandler:say("You need 5 mettal fitting to reinforce the boat.", cid)
42 end
43 elseif msg:lower() == "silk" then
44 if player:removeItem(12501, 1) and player:getStorageValue(BoatMissions.MagnusBlackWaterThird) == 1 then
45 npcHandler:say("It's taking a while to construct the boat, is not so easy, well now we need a small golden {anchor} to keep the boat in place.", cid)
46 player:setStorageValue(BoatMissions.MagnusBlackWaterFourth, 1)
47 else
48 npcHandler:say("You need 1 Silk to connect various components.", cid)
49 end
50 elseif msg:lower() == "anchor" then
51 if player:removeItem(15432, 1) and player:getStorageValue(BoatMissions.MagnusBlackWaterFourth) == 1 then
52 npcHandler:say("Perfect, now the last thing we need some red {paint} to protect the wood.", cid)
53 player:setStorageValue(BoatMissions.MagnusBlackWaterFifth, 1)
54 else
55 npcHandler:say("You need 1 small golden anchor to keep the boat in place.", cid)
56 end
57 elseif msg:lower() == "paint" then
58 if player:getStorageValue(BoatMissions.MagnusBlackWaterSixth) == 1 then
59 npcHandler:say("You already have construct your boat.", cid)
60 elseif player:removeItem(25308, 1) and player:getStorageValue(BoatMissions.MagnusBlackWaterFifth) == 1 then
61 npcHandler:say("Fantastic! The boat is now ready, to start navigating, place the explorer to the boat slot on your inventory and walk through the deck that leads to the water.", cid)
62 player:say("Get ready to explore the ocean. Equip the explorer on the Boat Slot of your inventory, and walk to the ocean through the deck that leads to the water.", TALKTYPE_MONSTER_SAY)
63 player:setStorageValue(BoatMissions.MagnusBlackWaterSixth, 1)
64 player:addItem(27799, 1)
65 else
66 npcHandler:say("You need 1 Red Paint to protect the wood.", cid)
67 end
68 end
69 return true
70end
71
72npcHandler:setMessage(MESSAGE_GREET, "Psst.... Come here... You want {discover} the vast ocean and found treasures ?.")
73npcHandler:setMessage(MESSAGE_FAREWELL, "Venture forth, my hearty crew! The boundless ocean awaits, where treasures lie hidden beneath each cresting wave. Hoist the sails high and let the winds of fortune guide our course to riches beyond measure!")
74npcHandler:setMessage(MESSAGE_WALKAWAY, "Psst.... Come here... You want {discover} the vast ocean and found treasures ?")
75npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
76npcHandler:addModule(FocusModule:new())
Top