Cebulka02
New Member
- Joined
- Jan 5, 2008
- Messages
- 56
- Reaction score
- 0
Hey I need add to this script only request for trade if player got storage only. I want add it to 3 rest djins so remmeber 2 of them got quests. So storage only request in trade.
Code:
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
-- XVX FORGER START --
function obsidian(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('Here is your item!', cid)
doPlayerAddItem(cid,5891,1)
end
else
npcHandler:say('You don\'t have these items!', cid)
end
end
function crude(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2498) >= 2 then
if doPlayerRemoveItem(cid,2498,2) then
npcHandler:say('Here is your item!', cid)
doPlayerAddItem(cid,5884,1)
end
else
npcHandler:say('You don\'t have these items!', cid)
end
end
function hell(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('Here is your item!', cid)
doPlayerAddItem(cid,5904,1)
end
else
npcHandler:say('You don\'t have these items!', cid)
end
end
function royal(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2475) >= 4 then
if doPlayerRemoveItem(cid,2475,4) then
npcHandler:say('Here is your item!', cid)
doPlayerAddItem(cid,5885,1)
end
else
npcHandler:say('You don\'t have these items!', cid)
end
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msg:lower() == "cookie" and (getPlayerStorageValue(cid, jes_s.m10) > 0 and getPlayerStorageValue(cid, jes_s.m10) < 12) and getPlayerStorageValue(cid, jes_s.djin) < 0 then
selfSay("You brought cookies! How nice of you! Can I have one?", cid)
ts = 1
elseif msg:lower() == "yes" and ts == 1 then
if getPlayerItemCount(cid, jes_i.cookie) > 0 then
doPlayerSetStorageValue(cid, jes_s.djin, 1)----------------------
doPlayerRemoveItem(cid, jes_i.cookie, 1)
doPlayerSetStorageValue(cid, jes_s.m10, getPlayerStorageValue(cid, jes_s.m10)+1)
selfSay("You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!", cid)
ts = 0
else
selfSay("Where is my cookie?", cid)
ts = 0
end
end
end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addSellableItem({'Dwarven Ring'},2213,100,'Dwarvem Ring')
shopModule:addSellableItem({'Energy Ring'},2167,100,'Energy Ring')
shopModule:addSellableItem({'Life Ring'},2168,50,'Life Ring')
shopModule:addSellableItem({'Might Ring'},2164,250,'Might Ring')
shopModule:addSellableItem({'Ring of Healing'},2214,100,'Ring of Healing')
shopModule:addSellableItem({'Time Ring'},2169,100,'Time Ring')
shopModule:addSellableItem({'Dragon Necklace'},2201,100,'Dragon Necklace')
shopModule:addSellableItem({'Protection Amulet'},2200,100,'Protection Amulet')
shopModule:addSellableItem({'Strange Talisman'},2161,30,'Strange Talisman')
shopModule:addSellableItem({'Silver Amulet'},2170,50,'Silver Amulet')
shopModule:addSellableItem({'Hailstorm Rod'},2183,3000,'Hailstorm Rod')
shopModule:addSellableItem({'Moonlight Rod'},2186,200,'Moonlight Rod')
shopModule:addSellableItem({'Necrotic Rod'},2185,1000,'Necrotic Rod')
shopModule:addSellableItem({'Snakebite Rod'},2182,100,'Snakebite Rod')
shopModule:addSellableItem({'Terra Rod'},2181,2000,'Terra Rod')
shopModule:addSellableItem({'Springsprout Rod'},8912,3600,'Springsprout Rod')
shopModule:addSellableItem({'Northwind Rod'},8911,1500,'Nortwind Rod')
shopModule:addSellableItem({'Underworld Rod'},8910,4400,'Underworld Rod')
shopModule:addSellableItem({'Ankh'},2427,100,'Ankh')
shopModule:addSellableItem({'Mysterious Fetish'},2194,50,'Mysterious Fetish')
shopModule:addSellableItem({'Muck Rod'},18411,6000,'Muck Rod')
shopModule:addSellableItem({'Glacial Rod'},18412,5400,'Glacial Rod')
shopModule:addBuyableItem({'Dwarven Ring'},2213,2000,'Dwarven Ring')
shopModule:addBuyableItem({'Life Ring'},2168,900,'Life Ring')
shopModule:addBuyableItem({'Energy Ring'},2167,2000,'Energy Ring')
shopModule:addBuyableItem({'Ring of Healing'},2214,2000,'Ring of Healing')
shopModule:addBuyableItem({'Time Ring'},2169,2000,'Time Ring')
shopModule:addBuyableItem({'Dwarven Ring'},2164,5000,'Might Ring')
shopModule:addBuyableItem({'Silver Amulet'},2170,100,'Silver Amulet')
shopModule:addBuyableItem({'Strange Amulet'},2161,100,'Strange Talisman')
shopModule:addBuyableItem({'Protection Amulet'},2200,700,'Protection Amulet')
shopModule:addBuyableItem({'Dragon Neckle'},2201,1000,'Dragon Neckle')
-- XVX FORGER END --
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can exchange with you for enchanted chicken wing, fighting spirit, magic sulphur and warrior sweat"})
local node2 = keywordHandler:addKeyword({'enchanted chicken wing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a boots of haste for enchanted chicken wing?'})
node2:addChildKeyword({'yes'}, obsidian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
local node3 = keywordHandler:addKeyword({'fighting spirit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a 2 royal helmets for fighting spirit?'})
node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
local node5 = keywordHandler:addKeyword({'magic sulphur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a 3 fire swords for magic sulphur?'})
node5:addChildKeyword({'yes'}, hell, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
local node6 = keywordHandler:addKeyword({'flask of warrior/s sweat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a 4 warrior helmets for warrior sweat?'})
node6:addChildKeyword({'yes'}, royal, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())