esse é um npc q da a addon em troca dos itens é so vc editar (ce n souber da um toke)
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
npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|. Will you help me? If you do, I'll sell assassin first addons! Just say {addon} or {help} if you don't know what to do.")
function playerBuyAddonNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.confirm ~= true) and (parameters.decline ~= true) then
if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
npcHandler:say('Sorry, but this addon is only for premium players!', cid)
npcHandler:resetNpc()
return true
end
if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
npcHandler:say('You already have this addon!', cid)
npcHandler:resetNpc()
return true
end
local itemsTable = parameters.items
local items_list = ''
if table.maxn(itemsTable) > 0 then
for i = 1, table.maxn(itemsTable) do
local item = itemsTable
items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1])
if i ~= table.maxn(itemsTable) then
items_list = items_list .. ', '
end
end
end
local text = ''
if (parameters.cost > 0) and table.maxn(parameters.items) then
text = items_list .. ' and ' .. parameters.cost .. ' gp'
elseif (parameters.cost > 0) then
text = parameters.cost .. ' gp'
elseif table.maxn(parameters.items) then
text = items_list
end
npcHandler:say('Did you bring me ' .. text .. ' for ' .. keywords[1] .. '?', cid)
return true
elseif (parameters.confirm == true) then
local addonNode = node:getParent()
local addoninfo = addonNode:getParameters()
local items_number = 0
if table.maxn(addoninfo.items) > 0 then
for i = 1, table.maxn(addoninfo.items) do
local item = addoninfo.items
if (getPlayerItemCount(cid,item[1]) >= item[2]) then
items_number = items_number + 1
end
end
end
if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then
doPlayerRemoveMoney(cid, addoninfo.cost)
if table.maxn(addoninfo.items) > 0 then
for i = 1, table.maxn(addoninfo.items) do
local item = addoninfo.items
doPlayerRemoveItem(cid,item[1],item[2])
end
end
doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
setPlayerStorageValue(cid,addoninfo.storageID,1)
npcHandler:say('Here you are.', cid)
else
npcHandler:say('You do not have needed items or cash!', cid)
end
npcHandler:resetNpc()
return true
elseif (parameters.decline == true) then
npcHandler:say('Not interested? Maybe other addon?', cid)
npcHandler:resetNpc()
return true
end
return false
end
local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true})
-- assassin by delton (done)
local outfit_node = keywordHandler:addKeyword({'assassin mission'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5930,10}, {5879,100}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10024})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you , assassin addon.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To buy the first addon say \'assassin mission\', i need 10 behemoth claws and 100 giant spider silk.'})
npcHandler:addModule(FocusModule:new())
Tenho um npc que vende itens pra addon so n sei ce tem todos qualquer coisa é so vc adiciona
crie um arquivo.xml e koloke isso dentro.
<?xml version="1.0" encoding="UTF-8"?><npc name="Strair" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="139" head="113" body="57" legs="95" feet="113" addons="3"/>
<parameters>
<parameter key="module_shop" value="1"/>
<parameter key="message_greet" value="Hello |PLAYERNAME|, i can sell any addon type. Say {trade} for see me offers."/>
<parameter key="shop_buyable" value="white piece of cloth,5909,1000;green piece of cloth,5910,1000;red piece of cloth,5911,1000;blue piece of cloth,5912,1000;brown piece of cloth,5913,1000;yellow piece of cloth,5914,1000;lizard leather,5876,1000;green dragon leather,5877,1000;minotaur leather,5878,1000;giant spider silk,5879,1000;iron ore,5880,1000;lizard scale,5881,1000;red dragon scale,5882,1000;ape fur,5883,1000;chicken feather,5890,1000;perfect behemoth fang,5893,1000;bat wing,5894,1000;fish fin,5895,1000;bear paw,5896,1000;wolf paw,5897,1000;beholder eye,5898,1000;turtle shell,5899,1000;dwarven beard,5900,1000;honeycomb,5902,1000;vampire dust,5905,1000;demon dust,5906,50000;heaven blosson,5921,1000;holy orchid,5922,1000;behemoth claw,5930,1000;demonic essence,6500,1000;shard,7290,1000;hardened bone,5925,1000;enchanted chicken wing,5891,15000;piece of royal stell,5887,55000;piece of draconian stell,5889,55000;piece of hell stell,5888,55000;ankh,2193,5000;huge chunk of crude iron,5892,130000;vampiric crest,9955,100000;dragon claw,5919,400000"/>
</parameters>
</npc>
AJUDEI? REP+










info
Grupo: Campones
Registrado: 09/01/11
Posts: 5
Reputação: 0
Char no Tibia: Realister
Eai Galera , blz??
teria como voces me ajudarem ?
assim,estou presizando de dois npc's :
um que venda addon's por item e outro npc que venda os itens dos addons , todos os itens...
teriam como vcs me ajudarem ??
vlws galera
abraços !