Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
319 changes: 230 additions & 89 deletions data-otservbr-global/npc/a_sweaty_cyclops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,140 +60,281 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

-- uth'lokr (Bast Skirts)
if MsgContains(message, "uth'lokr") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) < 1 then
npcHandler:say("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 1)
elseif MsgContains(message, "yes") then
if npcHandler:getTopic(playerId) == 1 then
npcHandler:say("Wait. Me work no cheap is. Do favour for me first, yes?", npc, creature)
npcHandler:setTopic(playerId, 2)
elseif npcHandler:getTopic(playerId) == 2 then
npcHandler:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.", npc, creature)
if player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.DefaultStart) ~= 1 then
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.DefaultStart, 1)
end
player:setStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops, 1)
npcHandler:setTopic(playerId, 3)
elseif npcHandler:getTopic(playerId) == 4 then
if player:removeItem(3560, 3) then
npcHandler:say("Good good! Woman happy will be. Now me happy too and help you.", npc, creature)
player:setStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops, 2)
npcHandler:setTopic(playerId, 0)
else
npcHandler:say("Lil' one bring three bast skirts.", npc, creature)
npcHandler:setTopic(playerId, 3)
end
local msg = string.lower(message)
local isYes = (msg == "yes")

-- uth'lokr
if MsgContains(msg, "uth'lokr") then
local stor = player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops)

-- Step 1 - Deal with A Sweaty Cyclops
if stor < 1 then
npcHandler:say("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 1)
return true
end
elseif MsgContains(message, "bast skirt") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) == 1 then
if npcHandler:getTopic(playerId) == 3 then
npcHandler:say("Lil' one bring three bast skirts?", npc, creature)

-- Bast skirt delivery (storage == 1)
if stor == 1 then
npcHandler:say("Lil' one bring three bast skirts.", npc, creature)
npcHandler:setTopic(playerId, 4)
return true
end

-- Dragon shield Trade (storage == 2)
if stor == 2 then
npcHandler:say("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 6)
return true
end
end
-- uth'lokr (Bast Skirts)
if MsgContains(message, "uth'lokr") and player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops) < 1 then
npcHandler:say("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 1)
elseif MsgContains(message, "yes") then
if npcHandler:getTopic(playerId) == 1 then
npcHandler:say("Wait. Me work no cheap is. Do favour for me first, yes?", npc, creature)
npcHandler:setTopic(playerId, 2)
elseif npcHandler:getTopic(playerId) == 2 then
npcHandler:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.", npc, creature)
if player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.DefaultStart) ~= 1 then
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.DefaultStart, 1)
end
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops, 1)

-- Yes Handlers (uth'lokr (bast skirts))
-- uth'lokr - Step 1
if isYes and npcHandler:getTopic(playerId) == 1 then
npcHandler:say("Wait. Me work no cheap is. Do favour for me first, yes?", npc, creature)
npcHandler:setTopic(playerId, 2)
return true
end

-- uth'lokr - Step 2
if isYes and npcHandler:getTopic(playerId) == 2 then
npcHandler:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.", npc, creature)
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.DefaultStart, 1)
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops, 1)
npcHandler:setTopic(playerId, 3)
return true
end

-- bast skirts delivery
if isYes and npcHandler:getTopic(playerId) == 4 then
if player:removeItem(3560, 3) then
npcHandler:say("Good good! Woman happy will be. Now me happy too and help you.", npc, creature)
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops, 2)
npcHandler:setTopic(playerId, 0)
else
npcHandler:say("Lil' one bring three bast skirts.", npc, creature)
npcHandler:setTopic(playerId, 3)
elseif npcHandler:getTopic(playerId) == 4 then
if player:removeItem(3560, 3) then
npcHandler:say("Good good! Woman happy will be. Now me happy too and help you.", npc, creature)
player:setStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops, 2)
npcHandler:setTopic(playerId, 0)
else
npcHandler:say("Lil' one bring three bast skirts.", npc, creature)
npcHandler:setTopic(playerId, 3)
end
end
elseif MsgContains(message, "bast skirt") and player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops) == 1 then
if npcHandler:getTopic(playerId) == 3 then
npcHandler:say("Lil' one bring three bast skirts?", npc, creature)
npcHandler:setTopic(playerId, 4)
end
return true
end

-- Uth'kean (Crown Armor - Piece of Royal Steel)
if MsgContains(message, "uth'kean") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 5)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 5 then
----------------------------------------------------------------------------
-- uth'kean (crown armor -> piece of royal stell)
if MsgContains(msg, "uth'kean") then
if player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 5)
return true
end
end

if isYes and npcHandler:getTopic(playerId) == 5 then
if player:removeItem(3381, 1) then
npcHandler:say("Cling clang!", npc, creature)
player:addItem(5887, 1)
npcHandler:setTopic(playerId, 0)
end
return true
end

-- uth'lokr (Dragon Shield - Piece of Draconian Steel)
if MsgContains(message, "uth'lokr") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 6)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 6 then
-- uth'lokr (dragon shield -> piece of draconian steel)
if isYes and npcHandler:getTopic(playerId) == 6 then
if player:removeItem(3416, 1) then
npcHandler:say("Cling clang!", npc, creature)
player:addItem(5889, 1)
npcHandler:setTopic(playerId, 0)
end
return true
end

-- za'ralator (Devil Helmet - Piece of Hell Steel)
if MsgContains(message, "za'ralator") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 7)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 7 then
-- za'ralator (devil helmet -> piece of hell steal)
if MsgContains(msg, "za'ralator") then
if player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 7)
return true
end
end

if isYes and npcHandler:getTopic(playerId) == 7 then
if player:removeItem(3356, 1) then
npcHandler:say("Cling clang!", npc, creature)
player:addItem(5888, 1)
npcHandler:setTopic(playerId, 0)
end
return true
end

-- uth'prta (Giant Sword - Huge Chunk of Crude Iron)
if MsgContains(message, "uth'prta") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Good iron is. Me friends use it much for fight. Me can make from weapon. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 8)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 8 then
-- uth'prta (giant sword -> huge chunk of crude iron)
if MsgContains(msg, "uth'prta") then
if player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Good iron is. Me friends use it much for fight. Me can make from weapon. Lil' one want to trade?", npc, creature)
npcHandler:setTopic(playerId, 8)
return true
end
end

if isYes and npcHandler:getTopic(playerId) == 8 then
if player:removeItem(3281, 1) then
npcHandler:say("Cling clang!", npc, creature)
player:addItem(5892, 1)
npcHandler:setTopic(playerId, 0)
end
return true
end

-- soul orb
if MsgContains(msg, "soul orb") then
if player:getStorageValue(Storage.Quest.U7_8.FriendsAndTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Me can make nasty bolt from soul orbs. Trade all?", npc, creature)
npcHandler:setTopic(playerId, 9)
return true
end
end

-- soul orb (soul orb - Infernal Bolts)
if MsgContains(message, "soul orb") and player:getStorageValue(Storage.Quest.U7_8.FriendsandTraders.TheSweatyCyclops) == 2 then
npcHandler:say("Uh. Me can make some nasty lil' bolt from soul orbs. Lil' one want to trade all?", npc, creature)
npcHandler:setTopic(playerId, 9)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 9 then
if player:getItemCount(5944) > 0 then
local count = player:getItemCount(5944)
if isYes and npcHandler:getTopic(playerId) == 9 then
local count = player:getItemCount(5944)
if count > 0 then
player:removeItem(5944, count)

local total = 0
for i = 1, count do
if math.random(100) <= 1 then
player:addItem(6528, 6)
player:removeItem(5944, 1)
npcHandler:say("Cling clang! Me done good work today! Li'l one gets double bolts!", npc, creature)
total = total + 200
else
player:addItem(6528, 3)
player:removeItem(5944, 1)
npcHandler:say("Cling clang!", npc, creature)
total = total + 100
end
end

player:addItem(6528, total)
npcHandler:say("Cling clang!", npc, creature)
end
npcHandler:setTopic(playerId, 0)
return true
end

-- melt gold ingot
if MsgContains(msg, "melt") then
npcHandler:say("Can melt gold ingot for li'l one. You want?", npc, creature)
npcHandler:setTopic(playerId, 10)
return true
end

if isYes and npcHandler:getTopic(playerId) == 10 then
if player:removeItem(9058, 1) then
player:addItem(12804, 1)
npcHandler:say("Whoooosh There!", npc, creature)
npcHandler:setTopic(playerId, 0)
end
npcHandler:setTopic(playerId, 0)
return true
end

return true
-- gear whell
if MsgContains(msg, "gear whell") then
npcHandler:say("Want to make gear wheel from iron ore?", npc, creature)
npcHandler:setTopic(playerId, 11)
return true
end

if isYes and npcHandler:getTopic(playerId) == 11 then
if player:removeItem(5880, 1) then
player:addItem(8775, 1)
npcHandler:say("Cling clang!", npc, creature)
end
npcHandler:setTopic(playerId, 0)
return true
end

----------------------------------------------------------------------------
-- Koshei Amulet Quest

if MsgContains(msg, "amulet") then
-- quest already done
if player:kv():get("koshei-amulet-done") then
npcHandler:say("Lil' one already has mighty amulet. Big Ben no make another!", npc, creature)
npcHandler:setTopic(playerId, 0)
return true
end

-- check timer
if player:kv():get("koshei-amulet-timer") then
local finishTime = player:kv():get("koshei-amulet-timer")

-- amulet still not done
if finishTime > os.time() then
local remaining = finishTime - os.time()

-- time conversion
local hours = math.floor(remaining / 3600)
local minutes = math.floor((remaining % 3600) / 60)
local timeStr = ""

if hours > 0 then
timeStr = hours .. " hour" .. (hours > 1 and "s" or "")
end
if minutes > 0 then
if timeStr ~= "" then timeStr = timeStr .. " and " end
timeStr = timeStr .. minutes .. " minute" .. (minutes > 1 and "s" or "")
end
if timeStr == "" then
timeStr = "less than a minute"
end

npcHandler:say("Big Ben still hammering! Come back in " .. timeStr .. "!", npc, creature)
return true
end

-- amulet done
if finishTime <= os.time() then
player:addItem(7532, 1)
npcHandler:say("Ahh, li'l one wants amulet. Here! Have it! Mighty, mighty amulet li'l one has. Don't know what but mighty, mighty it is!!!", npc, creature)
player:kv():set("koshei-amulet-done", true)
npcHandler:setTopic(playerId, 0)
return true
end
end

-- step 1
npcHandler:say("Me can do unbroken but Big Ben want gold 5000 and all four pieces. Yes?", npc, creature)
npcHandler:setTopic(playerId, 12)
return true
end

-- yes confirmations
if isYes and npcHandler:getTopic(playerId) == 12 then
-- quest already done
if player:kv():get("koshei-amulet-done") then
npcHandler:say("Lil' one already did this! Big Ben no make again!", npc, creature)
npcHandler:setTopic(playerId, 0)
return true
end
-- if not done yet
if player:kv():get("koshei-amulet-timer") then
npcHandler:say("Big Ben already working! Come back later!", npc, creature)
npcHandler:setTopic(playerId, 0)
return true
end
-- remove gold and check itens
if player:removeMoneyBank(5000) then
if player:getItemCount(7528) > 0 and player:getItemCount(7529) > 0 and player:getItemCount(7530) > 0 and player:getItemCount(7531) > 0 then
player:removeItem(7528, 1)
player:removeItem(7529, 1)
player:removeItem(7530, 1)
player:removeItem(7531, 1)
-- timer 24h
player:kv():set("koshei-amulet-timer", os.time() + 24 * 60 * 60)
npcHandler:say("Well, well. I do that! Big Ben makes li'l amulet unbroken with big hammer in big hands! No worry! Come back after sun hits the horizon 24 times and ask me for amulet.", npc, creature)
else
npcHandler:say("Lil' one not have all pieces.", npc, creature)
end
else
npcHandler:say("Lil' one has not enough money.", npc, creature)
end
npcHandler:setTopic(playerId, 0)
return true
end
end

keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I am smith." })
Expand Down
Loading