Daew galera
eu tenho uma duvida que é como eu faço para arrumar um bug aqui no npc
ele nao quer vender a wand ou rod pro player mais os outros items vende normalmente...
Tfs 0.4.0.0
NPC:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Frans" script="data/npc/scripts/Frans.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look typeex="2229" corpse="3128"/>
<voices>
<voice text="Aaaaah... ruuunes... waaaaaands... rooooods... spellboooooks..." interval2="100" margin="1" yell="no"/>
</voices>
<parameters>
<parameter key="message_greet" value="Beeee Greeeeted |PLAYERNAME|. What is your neeeed?"/>
<parameter key="message_farewell" value="Bye."/>
<parameter key="message_walkaway" value="Bye." />
<parameter key="message_sendtrade" value="Heeeeeeeeeeeeeere. Or loooook only at {wands},{runes} or {potions}?" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="job;frans;name;runes;wands;offer;potions;" />
<parameter key="keyword_reply1" value="I am selliiiing ruuuunes, wands, roooods and spellbooooooks." />
<parameter key="keyword_reply2" value="Floating ReeeeAnimated Necromantic Seeeervant ... FRANS." />
<parameter key="keyword_reply3" value="I am a FRANS." />
<parameter key="keyword_reply4" value="Heeeeeeeeere. Also loooooook at {wands}." />
<parameter key="keyword_reply5" value="Heeeeeeeeere. Also loooooook at {runes}." />
<parameter key="keyword_reply6" value="What do youuuu think I am? A lousy barberrrr? I'm selliiiing ruuuunes, waaaaaands, roooods and spellbooks if youuuuu neeeeed a {trader}." />
<parameter key="keyword_reply7" value="Heeeeeeeeere. Also loooooook at {Potions}." />
</parameters>
</npc>
Script do npc:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 1, 'spellbook')
shopModule:addBuyableItem({'magic lightwand'}, 2163, 400, 1, 'magic lightwand')
shopModule:addBuyableItem({'energy bomb'}, 2262, 162, 1, 'energy bomb rune')
shopModule:addBuyableItem({'convince creature'}, 2290, 80, 1, 'convince creature rune')
shopModule:addBuyableItem({'animate dead'}, 2316, 375, 1, 'animate dead rune')
shopModule:addBuyableItem({'instense healing'}, 2265, 95, 1, 'intense healing rune')
shopModule:addBuyableItem({'ultimate healing'}, 2273, 175, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'fire bomb'}, 2305, 117, 2, 'fire bomb')
shopModule:addBuyableItem({'destroy field'}, 2261, 15, 3, 'destroy field rune')
shopModule:addBuyableItem({'light magic missile'}, 2287, 4, 10, 'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile'}, 2311, 12, 10, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball'}, 2304, 45, 4, 'great fireball rune')
shopModule:addBuyableItem({'explosion'}, 2313, 31, 6, 'explosion rune')
shopModule:addBuyableItem({'sudden death'}, 2268, 108, 3, 'sudden death rune')
shopModule:addBuyableItem({'convince creature'}, 2290, 80, 1, 'convince creature rune')
shopModule:addBuyableItem({'chameleon'}, 2291, 210, 1, 'chameleon rune')
shopModule:addBuyableItem({'desintegrate'}, 2310, 80, 3, 'desintegreate rune')
shopModule:addBuyableItem({'fire field'}, 2301, 28, 3, 'fire field rune')
shopModule:addBuyableItem({'energy field'}, 2301, 38, 3, 'energy field rune')
shopModule:addBuyableItem({'avalanche'}, 2274, 45, 4, 'avalanche rune')
shopModule:addBuyableItem({'antidote rune'}, 2266, 65, 1, 'antidote rune')
shopModule:addBuyableItem({'energy wall'}, 2279, 85, 4, 'energy wall rune')
shopModule:addBuyableItem({'stalagmite'}, 2292, 130, 1, 'stalagmite rune')
shopModule:addBuyableItem({'icicle'}, 2271, 30, 5, 'icicle rune')
shopModule:addBuyableItem({'poison field'}, 2285, 21, 3, 'poison field rune')
shopModule:addBuyableItem({'poison wall'}, 2289, 52, 4, 'poison wall rune')
shopModule:addBuyableItem({'blank'}, 2260, 10, 1, 'blank rune')
shopModule:addBuyableItem({'fire ball'}, 2302, 30, 5, 'fire ball rune')
shopModule:addBuyableItem({'firebomb'}, 2305, 117, 2, 'firebomb rune')
shopModule:addBuyableItem({'fire wall'}, 2303, 61, 4, 'fire wall rune')
shopModule:addBuyableItem({'holy missile'}, 2295, 16, 5, 'holy missile rune')
shopModule:addBuyableItem({'magic wall'}, 2295, 116, 3, 'magic wall rune')
shopModule:addBuyableItem({'paralyze'}, 2278, 700, 1, 'paralyze rune')
shopModule:addBuyableItem({'poison bomb'}, 2286, 85, 2, 'poison bomb rune')
shopModule:addBuyableItem({'soulfire rune'}, 2308, 46, 3, 'soulfire rune')
shopModule:addBuyableItem({'stone shower'}, 2288, 47, 4, 'stone shower rune')
shopModule:addBuyableItem({'thunderstorm'}, 2315, 37, 4, 'thunderstorm rune')
shopModule:addBuyableItem({'wild growth'}, 2269, 160, 2, 'wild growth rune')
shopModule:addBuyableItem({'antidote'}, 8474, 50, 1, 'antidote potion')
shopModule:addBuyableItem({'small health'}, 8704, 20, 1, 'small health potion')
shopModule:addBuyableItemContainer({'bp blank'}, 1998, 2260, 220, 1, 'bp blank rune')
shopModule:addBuyableItemContainer({'bp animate dead'}, 1998, 2316, 7520, 1, 'bp animate dead rune')
shopModule:addBuyableItemContainer({'bp antidote'}, 2003, 2266, 1320, 1, 'bp antidote rune')
shopModule:addBuyableItemContainer({'bp avalanche'}, 2002, 2274, 3600,4, 'bp avalanche rune')
shopModule:addBuyableItemContainer({'bp chameleon'}, 1998, 2291, 4220,1, 'bp chameleon rune')
shopModule:addBuyableItemContainer({'bp convince creature'}, 1998, 2290, 1620,1, 'bp convince creature rune')
shopModule:addBuyableItemContainer({'bp desintegrate'}, 2001, 2310, 1620,3, 'bp desintegrate rune')
shopModule:addBuyableItemContainer({'bp destroy field'}, 2003, 2261, 920,3, 'bp destroy field')
shopModule:addBuyableItemContainer({'bp energy bomb'}, 2003, 2262, 6520,2, 'bp energy bomb rune')
shopModule:addBuyableItemContainer({'bp energy field'}, 1998, 2277, 2320,3, 'bp energy field')
shopModule:addBuyableItemContainer({'bp energy wall'}, 2002, 2279, 6820,4, 'bp energy wall rune')
shopModule:addBuyableItemContainer({'bp explosion'}, 2001, 2313, 3820,6, 'bp explosion rune')
shopModule:addBuyableItemContainer({'bp fire bomb'}, 2000, 2305, 4720,2, 'bp fire bomb rune')
shopModule:addBuyableItemContainer({'bp fire field'}, 2000, 2301, 1720,3, 'bp fire field rune')
shopModule:addBuyableItemContainer({'bp fireball'}, 2000, 2302, 3020,5, 'bp fire ball')
shopModule:addBuyableItemContainer({'bp gfb'}, 2000, 2304, 3620,4, 'bp gfb')
shopModule:addBuyableItemContainer({'bp hmm'}, 2001, 2311, 2420,10, 'bp hmm')
shopModule:addBuyableItemContainer({'bp icicle'}, 2002, 2271, 3020,5, 'bp icicle')
shopModule:addBuyableItemContainer({'bp ih'}, 2003, 2265, 1920,1, 'bp ih')
shopModule:addBuyableItemContainer({'bp lmm'}, 1998, 2287, 820,10, 'bp lmm')
shopModule:addBuyableItemContainer({'bp poison field'}, 1998, 2285, 1320,3, 'bp poison field')
shopModule:addBuyableItemContainer({'bp poison wall'}, 1998, 2289, 4220,4, 'bp poison wall rune')
shopModule:addBuyableItemContainer({'bp sd'}, 2003, 2268, 6500 ,10, 'bp sd')
shopModule:addBuyableItemContainer({'bp uh'}, 2002, 2273, 3520,3, 'bp uh')
shopModule:addBuyableItemContainer({'bp hp'}, 2000, 7618, 900, 1, 'backpack of health potions')
shopModule:addBuyableItemContainer({'bp mp'}, 2001, 7620, 1000, 1, 'backpack of mana potions')
shopModule:addBuyableItemContainer({'bp shp'}, 2000, 7588, 2000, 1, 'backpack of strong health potions')
shopModule:addBuyableItemContainer({'bp smp'}, 2001, 7589, 1600, 1, 'backpack of strong mana potions')
shopModule:addBuyableItemContainer({'bp ghp'}, 2000, 7591, 3800, 1, 'backpack of great health potions')
shopModule:addBuyableItemContainer({'bp gmp'}, 2001, 7590, 2400, 1, 'backpack of great mana potions')
shopModule:addBuyableItemContainer({'bp gsp'}, 1999, 8472, 3820, 1, 'backpack of great spirit potions')
shopModule:addBuyableItemContainer({'bp uhp'}, 2000, 8473, 6200, 1, 'backpack of ultimate health potions')
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')
shopModule:addBuyableItem({'berserk'}, 7439, 1000, 1, 'berserk potion')
shopModule:addBuyableItem({'mastermind'}, 7440, 1000, 1, 'mastermind potion')
shopModule:addBuyableItem({'bullseye'}, 7443, 1000, 1, 'bullseye potion')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 1, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 1, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 5000, 1, 'wand of decay')
shopModule:addBuyableItem({'wand of draconia', 'draconia'}, 8921, 7500, 1, 'wand of draconia')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 1, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 1, 'wand of inferno')
shopModule:addBuyableItem({'wand of starstorm', 'starstorm'}, 8920, 18000, 1, 'wand of starstorm')
shopModule:addBuyableItem({'wand of voodoo', 'voodoo'}, 8922, 22000, 1, 'wand of voodoo')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 1, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 1, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 5000, 1, 'necrotic rod')
shopModule:addBuyableItem({'northwind rod', 'northwind'}, 8911, 7500, 1, 'northwind rod')
shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 10000, 1, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 1, 'hailstorm rod')
shopModule:addBuyableItem({'springsprout rod', 'springsprout'}, 8912, 18000, 1, 'springsprout rod')
shopModule:addBuyableItem({'underworld rod', 'underworld'}, 8910, 22000, 1, 'underworld rod')
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
if(isSorcerer(cid) or isDruid(cid)) then
if(getPlayerStorageValue(cid, 30002) == -1) then
selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
talkState[talkUser] = 1
else
selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
end
else
selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
end
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
selfSay('Here you are young adept, take care yourself.', cid)
setPlayerStorageValue(cid, 30002, 1)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
selfSay('Ok then.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Meu npc system:
-- Advanced NPC System (Created by Jiddo),
-- Modified by TheForgottenServer Team.
if(NpcSystem == nil) then
-- Loads the underlying classes of the npcsystem.
dodirectory(getDataDir() .. 'npc/lib/npcsystem')
-- Global npc constants:
-- Keyword nestling behavior. For more information look at the top of keywordhandler.lua
KEYWORD_BEHAVIOR = BEHAVIOR_NORMAL_EXTENDED
-- Greeting and unGreeting keywords. For more information look at the top of modules.lua
FOCUS_GREETWORDS = {'hi', 'hello'}
FOCUS_FAREWELLWORDS = {'bye', 'farewell'}
-- The word for requesting trade window. For more information look at the top of modules.lua
SHOP_TRADEREQUEST = {'offer', 'trade'}
-- The word for accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! For more information look at the top of modules.lua
SHOP_YESWORD = {'yes'}
SHOP_NOWORD = {'no'}
-- Pattern used to get the amount of an item a player wants to buy/sell.
PATTERN_COUNT = '%d+'
-- Talkdelay behavior. For more information, look at the top of npchandler.lua.
NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK
-- Conversation behavior. For more information, look at the top of npchandler.lua.
NPCHANDLER_CONVBEHAVIOR = CONVERSATION_PRIVATE
-- Constant strings defining the keywords to replace in the default messages.
-- For more information, look at the top of npchandler.lua...
TAG_PLAYERNAME = '|PLAYERNAME|'
TAG_ITEMCOUNT = '|ITEMCOUNT|'
TAG_TOTALCOST = '|TOTALCOST|'
TAG_ITEMNAME = '|ITEMNAME|'
TAG_QUEUESIZE = '|QUEUESIZE|'
NpcSystem = {}
-- Gets an npcparameter with the specified key. Returns nil if no such parameter is found.
function NpcSystem.getParameter(key)
local ret = getNpcParameter(tostring(key))
if((type(ret) == 'number' and ret == 0) or ret == nil) then
return nil
else
return ret
end
end
-- Parses all known parameters for the npc. Also parses parseable modules.
function NpcSystem.parseParameters(npcHandler)
local ret = NpcSystem.getParameter('idletime')
if(ret ~= nil) then
npcHandler.idleTime = tonumber(ret)
end
local ret = NpcSystem.getParameter('talkradius')
if(ret ~= nil) then
npcHandler.talkRadius = tonumber(ret)
end
local ret = NpcSystem.getParameter('message_greet')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_GREET, ret)
end
local ret = NpcSystem.getParameter('message_farewell')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_FAREWELL, ret)
end
local ret = NpcSystem.getParameter('message_decline')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_DECLINE, ret)
end
local ret = NpcSystem.getParameter('message_needmorespace')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDMORESPACE, ret)
end
local ret = NpcSystem.getParameter('message_needspace')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDSPACE, ret)
end
local ret = NpcSystem.getParameter('message_sendtrade')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_SENDTRADE, ret)
end
local ret = NpcSystem.getParameter('message_noshop')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NOSHOP, ret)
end
local ret = NpcSystem.getParameter('message_oncloseshop')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ONCLOSESHOP, ret)
end
local ret = NpcSystem.getParameter('message_onbuy')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ONBUY, ret)
end
local ret = NpcSystem.getParameter('message_onsell')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ONSELL, ret)
end
local ret = NpcSystem.getParameter('message_missingmoney')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_MISSINGMONEY, ret)
end
local ret = NpcSystem.getParameter('message_needmoney')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDMONEY, ret)
end
local ret = NpcSystem.getParameter('message_missingitem')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_MISSINGITEM, ret)
end
local ret = NpcSystem.getParameter('message_needitem')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDITEM, ret)
end
local ret = NpcSystem.getParameter('message_idletimeout')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_IDLETIMEOUT, ret)
end
local ret = NpcSystem.getParameter('message_walkaway')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_WALKAWAY, ret)
end
local ret = NpcSystem.getParameter('message_alreadyfocused')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ALREADYFOCUSED, ret)
end
local ret = NpcSystem.getParameter('message_placedinqueue')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, ret)
end
local ret = NpcSystem.getParameter('message_buy')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_BUY, ret)
end
local ret = NpcSystem.getParameter('message_sell')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_SELL, ret)
end
local ret = NpcSystem.getParameter('message_bought')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_BOUGHT, ret)
end
local ret = NpcSystem.getParameter('message_sold')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_SOLD, ret)
end
-- Parse modules.
for parameter, module in pairs(Modules.parseableModules) do
local ret = NpcSystem.getParameter(parameter)
if(ret ~= nil) then
local number = tonumber(ret)
if(number ~= nil and number ~= 0) then
npcHandler:addModule(module:new())
end
end
end
end
end
Se puderem ajuda agredeço desde ja
e darei REP+