<?xml version="1.0" encoding="UTF-8"?>
<npc name="Haroun" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="80" head="0" body="0" legs="0" feet="0" addons="0"/>
<parameters>
<parameter key="module_shop" value="2"/>
<parameter key="shop_buyable" value="Axe ring,2208,500;Club ring,2209,500;Power ring,2166,100;Stealth ring,2165,5000;Sword ring,2207,500;Bronze amulet,2172,100;Garlic necklace,2199,100;elven amulet,2198,500;Stone skin amulet,2197,5000;Magic Light Wand,2162,120"/>
<parameter key="shop_sellable" value="Axe ring,2208,100;Club ring,2209,100;Power ring,2166,50;Stealth ring,2165,200;Sword ring,2207,100;Bronze amulet,2172,50;Garlic necklace,2199,50;elven amulet,2198,100;Stone skin amulet,2197,500;Wand of cosmic energy,2189,2000;Wand of decay,2188,1000;Wand of dragonbreath,2191,200;Wand of inferno,2187,3000;Wand of vortex,2190,100;Wand of Draconia,8921,1500;Wand of Starstorm,8920,3600;Wand of Voodoo,8922,4400;Magic Light Wand,2162,35;Life Crystal,4851,50;Mind Stone,2178,100;Orb,7493,750"/>
</parameters>
</npc>
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 ChickenWing(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2195) >= 1 then
if doPlayerRemoveItem(cid,2195,1) then
npcHandler:say('A {Boots of haste}! Great. Here, take this enchanted chicken wing, I don\'t need it anyway.', cid)
doPlayerAddItem(cid,5891,1)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end
function FightingSpirit(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2498) >= 2 then
if doPlayerRemoveItem(cid,2498,1) then
npcHandler:say('A {Royal Helmet}! Great. Here, take this fighting spirit, I don\'t need it anyway.', cid)
doPlayerAddItem(cid,5884,1)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end
function MagicSulphur(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2392) >= 3 then
if doPlayerRemoveItem(cid,2392,3) then
npcHandler:say('A 3 {Fire Sword}! Great. Here, take this magic sulphur, I don\'t need it anyway.', cid)
doPlayerAddItem(cid,5904,1)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end
function WarriorsSweat(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2475) >= 4 then
if doPlayerRemoveItem(cid,2475,3) then
npcHandler:say('A 4 {Warrior Helmets}! Great. Here, take this warrior\'s sweat, I don\'t need it anyway.', cid)
doPlayerAddItem(cid,5904,1)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end
node1 = keywordHandler:addKeyword({'enchanted chicken wing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found a {Boots of haste} for me?'})
node1:addChildKeyword({'yes'}, ChickenWing, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
node2 = keywordHandler:addKeyword({'fighting spirit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found a 2 {Royal Helmets} for me?'})
node2:addChildKeyword({'yes'}, FightingSpirit, {})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
node3 = keywordHandler:addKeyword({'magic sulphur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found 3 {fire swords} for me?'})
node3:addChildKeyword({'yes'}, MagicSulphur, {})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
node4 = keywordHandler:addKeyword({'warrior\'s sweat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found a 4 {warrior helmets} for me?'})
node4:addChildKeyword({'yes'}, WarriorsSweat, {})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! I buy and sell rings, amulets, and special items also i can change items.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'change fire swords') then
if getPlayerItemCount(cid,2392) >= 3 then
selfSay('Do you want give me 3 FS?')
talk_state = 1
else
selfSay('I need 3 fire swords to give you magic sulphur.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2392) >= 3 then
if doPlayerRemoveItem(cid,2392, 3) == TRUE then
doPlayerAddItem(cid, 5904, 1)
selfSay('Take this magic sulphur.')
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'change warrior helmets') then
if getPlayerItemCount(cid,2475) >= 4 then
selfSay('Do you want give me 4 Warrior Helmets?')
talk_state = 2
else
selfSay('I need 4 warrior helmets to give you warrior sweat.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2475) >= 4 then
if doPlayerRemoveItem(cid,2475, 4) == TRUE then
doPlayerAddItem(cid, 5885, 1)
selfSay('Take this warrior sweat.')
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'change royal helmets') then
if getPlayerItemCount(cid,2498) >= 2 then
selfSay('Do you want give me 2 royal Helmets?')
talk_state = 3
else
selfSay('I need 2 royal helmets to give you fighting spirit.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2498) >= 2 then
if doPlayerRemoveItem(cid,2498, 2) == TRUE then
doPlayerAddItem(cid, 5884, 1)
selfSay('Take this fighting spirit.')
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'change boh') then
if getPlayerItemCount(cid,2195) >= 1 then
selfSay('Do you want give me boots of haste?')
talk_state = 4
else
selfSay('I need boots of haste to give you enchanted chicken wing.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 4 then
talk_state = 0
if getPlayerItemCount(cid,2195) >= 1 then
if doPlayerRemoveItem(cid,2195, 1) == TRUE then
doPlayerAddItem(cid, 5891, 1)
selfSay('Take this enchanted chicken wing.')
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'sell sword ring') then
sell(cid,2207,getCount(msg),100)
elseif msgcontains(msg, 'sell club ring') then
sell(cid,2209,getCount(msg),100)
elseif msgcontains(msg, 'sell axe ring') then
sell(cid,2208,getCount(msg),100)
elseif msgcontains(msg, 'sell power ring') then
sell(cid,2166,getCount(msg),50)
elseif msgcontains(msg, 'sell stealth ring') then
sell(cid,2165,getCount(msg),200)
elseif msgcontains(msg, 'sell rings') then
selfSay('I buy sword (100gps), club (100gps), axe (100gps), power (50gps) and stealth (200gps).')
elseif msgcontains(msg, 'sell stone skin amulet') and focus == cid then
sell(cid,2197,getCount(msg),500)
elseif msgcontains(msg, 'sell elven amulet') and focus == cid then
sell(cid,2198,getCount(msg),100)
elseif msgcontains(msg, 'sell bronze amulet') and focus == cid then
sell(cid,2172,getCount(msg),50)
elseif msgcontains(msg, 'sell garlic amulet') and focus == cid then
sell(cid,2199,getCount(msg),50)
elseif msgcontains(msg, 'sell amulets') then
selfSay('I buy stone skin amulet (500gps), elven amulet (100gps), bronze amulet (50gps) and garlic amulet (50gps).')
elseif msgcontains(msg, 'sell orb') then
sell(cid,2176,getCount(msg),750)
elseif msgcontains(msg, 'sell mind stone') then
sell(cid,2178,getCount(msg),100)
elseif msgcontains(msg, 'sell life crystal') then
sell(cid,4851,getCount(msg),50)
elseif msgcontains(msg, 'sell special items') then
selfSay('I buy orb (750gps), mind stone (100gps) and life crystal (50gps).')
elseif msgcontains(msg, 'buy sword ring') then
buy(cid,2207,getCount(msg),500)
elseif msgcontains(msg, 'buy club ring') then
buy(cid,2209,getCount(msg),500)
elseif msgcontains(msg, 'buy axe ring') then
buy(cid,2208,getCount(msg),500)
elseif msgcontains(msg, 'buy power ring') then
buy(cid,2166,getCount(msg),100)
elseif msgcontains(msg, 'buy stealth ring') then
buy(cid,2165,getCount(msg),5000)
elseif msgcontains(msg, 'buy rings') then
selfSay('I sell sword (500gps), club (500gps), axe (500gps), power (100gps) and stealth (5k).')
elseif msgcontains(msg, 'buy stone skin amulet') and focus == cid then
buy(cid,2197,getCount(msg),5000)
elseif msgcontains(msg, 'buy elven amulet') and focus == cid then
buy(cid,2198,getCount(msg),500)
elseif msgcontains(msg, 'buy bronze amulet') and focus == cid then
buy(cid,2172,getCount(msg),100)
elseif msgcontains(msg, 'buy garlic amulet') and focus == cid then
buy(cid,2199,getCount(msg),100)
elseif msgcontains(msg, 'buy amulets') then
selfSay('I sell stone skin amulet (5k), elven amulet (500gps), bronze amulet (100gps) and garlic amulet (100gps).')
elseif msgcontains(msg, 'change items') then
selfSay('I can change 1 Magic Sulphur = 3 Fire Swords, 1 Warrior Sweat = 4 Warrior Helmets, 1 Fighting Spirit = 2 Royal Helmets and 1 Enchanted Chicken Wing = 1 Boots of Haste.')
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.',cid)
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! I buy and sell {rings}, {amulets}, and {special items} also i can change items.',cid)
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.',cid)
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'change fire swords') then
if getPlayerItemCount(cid,2392) >= 3 then
selfSay('Do you want give me 3 FS?')
talk_state = 1
else
selfSay('I need 3 fire swords to give you magic sulphur.',cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2392) >= 3 then
if doPlayerRemoveItem(cid,2392, 3) == TRUE then
doPlayerAddItem(cid, 5904, 1)
selfSay('Take this magic sulphur.',cid)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'change warrior helmets') then
if getPlayerItemCount(cid,2475) >= 4 then
selfSay('Do you want give me 4 Warrior Helmets?',cid)
talk_state = 2
else
selfSay('I need 4 warrior helmets to give you warrior sweat.',cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2475) >= 4 then
if doPlayerRemoveItem(cid,2475, 4) == TRUE then
doPlayerAddItem(cid, 5885, 1)
selfSay('Take this warrior sweat.',cid)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'change royal helmets') then
if getPlayerItemCount(cid,2498) >= 2 then
selfSay('Do you want give me 2 royal Helmets?')
talk_state = 3
else
selfSay('I need 2 royal helmets to give you fighting spirit.',cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2498) >= 2 then
if doPlayerRemoveItem(cid,2498, 2) == TRUE then
doPlayerAddItem(cid, 5884, 1)
selfSay('Take this fighting spirit.',cid)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'change boh') then
if getPlayerItemCount(cid,2195) >= 1 then
selfSay('Do you want give me boots of haste?')
talk_state = 4
else
selfSay('I need boots of haste to give you enchanted chicken wing.',cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 4 then
talk_state = 0
if getPlayerItemCount(cid,2195) >= 1 then
if doPlayerRemoveItem(cid,2195, 1) == TRUE then
doPlayerAddItem(cid, 5891, 1)
selfSay('Take this enchanted chicken wing.',cid)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'sell sword ring') then
sell(cid,2207,getCount(msg),100)
elseif msgcontains(msg, 'sell club ring') then
sell(cid,2209,getCount(msg),100)
elseif msgcontains(msg, 'sell axe ring') then
sell(cid,2208,getCount(msg),100)
elseif msgcontains(msg, 'sell power ring') then
sell(cid,2166,getCount(msg),50)
elseif msgcontains(msg, 'sell stealth ring') then
sell(cid,2165,getCount(msg),200)
elseif msgcontains(msg, 'sell rings') then
selfSay('I buy {sword (100gps)}, {club (100gps)}, {axe (100gps)}, {power (50gps)} and {stealth (200gps)}.',cid)
elseif msgcontains(msg, 'sell stone skin amulet') and focus == cid then
sell(cid,2197,getCount(msg),500)
elseif msgcontains(msg, 'sell elven amulet') and focus == cid then
sell(cid,2198,getCount(msg),100)
elseif msgcontains(msg, 'sell bronze amulet') and focus == cid then
sell(cid,2172,getCount(msg),50)
elseif msgcontains(msg, 'sell garlic amulet') and focus == cid then
sell(cid,2199,getCount(msg),50)
elseif msgcontains(msg, 'sell amulets') then
selfSay('I buy {stone skin amulet (500gps)}, {elven amulet (100gps)}, {bronze amulet (50gps)} and {garlic amulet (50gps)}.',cid)
elseif msgcontains(msg, 'sell orb') then
sell(cid,2176,getCount(msg),750)
elseif msgcontains(msg, 'sell mind stone') then
sell(cid,2178,getCount(msg),100)
elseif msgcontains(msg, 'sell life crystal') then
sell(cid,4851,getCount(msg),50)
elseif msgcontains(msg, 'sell special items') then
selfSay('I buy orb (750gps), mind stone (100gps) and life crystal (50gps).',cid)
elseif msgcontains(msg, 'buy sword ring') then
buy(cid,2207,getCount(msg),500)
elseif msgcontains(msg, 'buy club ring') then
buy(cid,2209,getCount(msg),500)
elseif msgcontains(msg, 'buy axe ring') then
buy(cid,2208,getCount(msg),500)
elseif msgcontains(msg, 'buy power ring') then
buy(cid,2166,getCount(msg),100)
elseif msgcontains(msg, 'buy stealth ring') then
buy(cid,2165,getCount(msg),5000)
elseif msgcontains(msg, 'buy rings') then
selfSay('I sell sword (500gps), club (500gps), axe (500gps), power (100gps) and stealth (5k).',cid)
elseif msgcontains(msg, 'buy stone skin amulet') and focus == cid then
buy(cid,2197,getCount(msg),5000)
elseif msgcontains(msg, 'buy elven amulet') and focus == cid then
buy(cid,2198,getCount(msg),500)
elseif msgcontains(msg, 'buy bronze amulet') and focus == cid then
buy(cid,2172,getCount(msg),100)
elseif msgcontains(msg, 'buy garlic amulet') and focus == cid then
buy(cid,2199,getCount(msg),100)
elseif msgcontains(msg, 'buy amulets') then
selfSay('I sell stone skin amulet (5k), elven amulet (500gps), bronze amulet (100gps) and garlic amulet (100gps).',cid)
elseif msgcontains(msg, 'change items') then
selfSay('I can change 1 Magic Sulphur = 3 Fire Swords, 1 Warrior Sweat = 4 Warrior Helmets, 1 Fighting Spirit = 2 Royal Helmets and 1 Enchanted Chicken Wing = 1 Boots of Haste.',cid)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!',cid)
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...',cid)
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.',cid)
focus = 0
end
end
end