Ir para conteúdo

[Npc] Comprador (Pokemons)


cayodiebe

Posts Recomendados

Estava, a muito tempo Procurando o Script do [NPC] Comprador Completo,

 

ATENÇÃO xTIBIANOS, não fui ue qm fiz o script MAIS EU QUE O EDITEI, o que eu peguei estava INCOMPLETO!

 

O Script foi feito em 2 Etapas

"Comprador de Pokemon" e "Compradora de Pokemon" .

 

Vamos começar com o COMPRADOR DE POKEMON

Vá em DATA/NPC Copie e cole qualquer arquivo de lá, e renomeie com o nome de Comprador de Pokemon coloque isso :

 

<?xml version="1.0"?> 
<npc name="Comprador de Pokemon" script="data/npc/scripts/buy.pokemons.lua" walkinterval="5000" floorchange="0"> 
<health now="100" max="100"/> 
<look type="143" head="78" body="88" legs="0" feet="88" addons="3"/> 
<parameters> 
<parameter key="message_greet" value="Ola |PLAYERNAME|. quer me vender {pokemon}? " /> 
</parameters> 
</npc> 

 

Depois vá na pasta Scripts e crie 1 arquivo chamado buy.pokemons.lua

 

-- COMPRADOR SYSTEM BY : Cayodiebe - xTibia
--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  

function creatureSayCallback(cid, type, msg)  
if(not npcHandler:isFocused(cid)) then  
return false  
end  

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid  

   function pairsByKeys (t, f) -- function for alphabetical order in list 
     local a = {} 
     for n in pairs(t) do table.insert(a, n) end 
     table.sort(a, f) 
     local i = 0 
     local iter = function () 
       i = i + 1 
       if a[i] == nil then return nil 
       else return a[i], t[a[i]] 
       end 
     end 
     return iter 
   end 


local Pokemons = { 

["mew"] = {price = 500000}, 
["mewtwo"] = {price = 500000}, 
["lugia"] = {price = 700000}, 
["celebi"] = {price = 500000}, 
["moltres"] = {price = 400000}, 
["zapdos"] = {price = 400000}, 
["articuno"] = {price = 400000}, 
["bayleef"] = {price = 400000}, 
["chikorital"] = {price = 200000}, 
["meganium"] = {price = 600000},
["cyndaquil"] = {price = 200000},
["quilava"] = {price = 400000},
["typhlosion"] = {price = 600000},
["teddiursa"] = {price = 200000},
["ursaring"] = {price = 500000},
["wobbuffet"] = {price = 300000},
["stantler"] = {price = 320000},
["noctowl"] = {price = 350000},
["houndour"] = {price = 100000},
["houndoom"] = {price = 300000},
["gligar"] = {price = 350000},
["hoothoot"] = {price = 150000},
["scizor"] = {price = 800000},
["steelix"] = {price = 800000},
["hitmontopl"] = {price = 800000},
["pichu"] = {price = 500000},
["tyrogue"] = {price = 500000},
["swablu"] = {price = 500000},
["suicune"] = {price = 900000},
["entei"] = {price = 900000},
["raikou"] = {price = 900000},
["skarmory"] = {price = 900000},
["electabuzz"] = {price = 50000},
["seel"] = {price = 10000},
["dewgong"] = {price = 25000},
["arcanine"] = {price = 30000},
["muk"] = {price = 20000},
["shellder"] = {price = 5000},
["cloyster"] = {price = 30000},
["onix"] = {price = 35000},
["drowzee"] = {price = 10000},
["hypno"] = {price = 25000},
["kingler"] = {price = 15000},
["corphish"] = {price = 10000},
["crawdaunt"] = {price = 20000},
["exeggutor"] = {price = 20000},
["marowak"] = {price = 25000},
["hitmonlee"] = {price = 50000},
["hitmonchan"] = {price = 50000},
["lickitung"] = {price = 40000},
["weezing"] = {price = 25000},
["rhyhorn"] = {price = 10000},
["rhydon"] = {price = 25000},
["tangela"] = {price = 20000},
["kangaskhan"] = {price = 40000},
["kingdra"] = {price = 50000},
["togepi"] = {price = 10000},
["togetic"] = {price = 20000},
["shuppet"] = {price = 10000},
["banette"] = {price = 20000},
["duskull"] = {price = 20000},
["dusclops"] = {price = 30000},
["seaking"] = {price = 15000},
["buizel"] = {price = 10000},
["starmie"] = {price = 20000},
["mime jr"] = {price = 10000},
["mr.mime"] = {price = 35000},
["scyther"] = {price = 50000},
["smoochum"] = {price = 10000},
["jynx"] = {price = 35000},
["magmar"] = {price = 50000},
["politoed"] = {price = 40000},
["poliwrath"] = {price = 30000},
["gyarados"] = {price = 30000},
["lapras"] = {price = 50000},
["eevee"] = {price = 10000},
["porygon"] = {price = 70000},
["omanyte"] = {price = 15000},
["omastar"] = {price = 50000},
["kabuto"] = {price = 15000},
["kabutops"] = {price = 50000},
["aerodactyl"] = {price = 100000},
["snorlax"] = {price = 60000},
["dratini"] = {price = 15000},
["dragonair"] = {price = 30000},
["dragonite"] = {price = 50000},
["ivysaur"] = {price = 20000},
["venusaur"] = {price = 30000},
["charmander"] = {price = 5000},
["charmeleon"] = {price = 15000},
["charizard"] = {price = 30000},
["squirtle"] = {price = 5000},
["wartortle"] = {price = 15000},
["blastoise"] = {price = 30000},
["fearow"] = {price = 20000},
["lucario"] = {price = 35000},
["arbok"] = {price = 20000},
["pikachu"] = {price = 15000},
["sandslash"] = {price = 30000},
["nidorina"] = {price = 10000},
["nidoqueen"] = {price = 25000},
["nidorino"] = {price = 10000},
["nidoking"] = {price = 25000},
["clefairy"] = {price = 15000},
["clefable"] = {price = 25000}
}


local idballs = { 
[2532] = {2531}, 
[2653] = {2557},
[2654] = {2525}, 
[2652] = {2524}, 
[2195] = {2523}, 
[2531] = {2532}, 
[2557] = {2653}, 
[2525] = {2654}, 
[2524] = {2652}, 
[2523] = {2195},
} 
local balls = idballs[getPlayerSlotItem(cid,8).itemid] 



if(msgcontains(msg, "pokemon") or msgcontains(msg, "pokemon")) then 
selfSay("Qual o pokemon que você quer me vender? quer olhar a {list} ?", cid)  
talkState[talkUser] = 1 
elseif (msgcontains(msg, "list") or msgcontains(msg, "LIST")) and talkState[talkUser] == 1 then 
local str = "" 
str = str .. "Pokemon Prices :\n\n" 
for name, pos in pairsByKeys(Pokemons) do 
str = str..name.." = "..pos.price.."\n" 
end 
str = str .. ""  
doShowTextDialog(cid, 6579, str)  
elseif Pokemons[msg]  and talkState[talkUser] == 1 then 
if getPlayerStorageValue(cid, 25000) == 5 then        
return selfSay('Você está montando.',cid) 
elseif getPlayerStorageValue(cid, 23000) == 5 then 
return selfSay('Você está voando.',cid) 
elseif #getCreatureSummons(cid) >= 1 then 
return selfSay('Voce precisa botar seus pokemons dentro da pokebola.',cid) 
elseif balls == nil then 
return selfSay('Coloque seu pokemon slot da Pokeball para que eu possar examinar!!',cid) 
end 
local a = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name") 
if string.find(tostring(a),msg) then 
doRemoveItem(getPlayerSlotItem(cid,8).uid, 1) 
doPlayerAddMoney(cid, Pokemons[msg].price)  
selfSay('Obrigado por vender o pokemon '..msg..' por '..Pokemons[msg].price..' meu amigo!', cid) 
else 
selfSay('vc n tem o pokemon '..msg..' para vender!', cid) 
end 
elseif msg == "no" and talkState[talkUser] >= 1 then  
selfSay("Then not", cid)  
talkState[talkUser] = 0  
npcHandler:releaseFocus(cid)  
end  
return TRUE  
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

 

 

Etapa 2:

 

"COMPRADORA DE POKEMONS"

 

Refaça, o mesmo processo, DATA/NPC copie e cole qualuqer aquivo , e o renomeie de COMPRADORA DE POKEMONe cole isso :

 

<?xml version="1.0"?> 
<npc name="Compradora de Pokemon" script="data/npc/scripts/buy_pokemons.lua" walkinterval="5000" floorchange="0"> 
<health now="100" max="100"/> 
<look type="144" head="78" body="88" legs="0" feet="88" addons="3"/> 
<parameters> 
<parameter key="message_greet" value="Ola |PLAYERNAME|. quer me vender {pokemon}? " /> 
</parameters> 
</npc> 

 

Agora vá na pasta SCRIPTS e crie 1 arquivo chamado buy_pokemons.lua

 

e cole isso

 

-- COMPRADOR SYSTEM BY : Cayodiebe - xTibia
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  

function creatureSayCallback(cid, type, msg)  
if(not npcHandler:isFocused(cid)) then  
return false  
end  

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid  

   function pairsByKeys (t, f) -- function for alphabetical order in list 
     local a = {} 
     for n in pairs(t) do table.insert(a, n) end 
     table.sort(a, f) 
     local i = 0 
     local iter = function () 
       i = i + 1 
       if a[i] == nil then return nil 
       else return a[i], t[a[i]] 
       end 
     end 
     return iter 
   end 


local Pokemons = { 

["pidgeot"] = {price = 25000}, 
["pidgeotto"] = {price = 12000}, 
["magneton"] = {price = 25000}, 
["seadra"] = {price = 25000}, 
["dodrio"] = {price = 20000}, 
["golbat"] = {price = 15000}, 
["graveler"] = {price = 20000}, 
["electrode"] = {price = 20000}, 
["victreebel"] = {price = 25000}, 
["poliwhirl"] = {price = 15000},
["bulbasaur"] = {price = 3000},
["electabuzz"] = {price = 50000},
["abra"] = {price = 10000},
["kadabra"] = {price = 20000},
["alakazam"] = {price = 35000},
["gastly"] = {price = 10000},
["haunter"] = {price = 20000},
["gengar"] = {price = 35000},
["aipom"] = {price = 10000},
["ambipom"] = {price = 20000},
["machop"] = {price = 5000},
["machoke"] = {price = 15000},
["machamp"] = {price = 30000},
["weepinbell"] = {price = 15000},
["tentacruel"] = {price = 30000},
["geodude"] = {price = 5000},
["golem"] = {price = 35000},
["ponyta"] = {price = 10000},
["rapidash"] = {price = 25000},
["slowpoke"] = {price = 5000},
["slowbro"] = {price = 20000},
["magnezone"] = {price = 50000},
["farfetchd"] = {price = 200000},
["seel"] = {price = 10000},
["dewgong"] = {price = 25000},
["arcanine"] = {price = 30000},
["muk"] = {price = 20000},
["shellder"] = {price = 5000},
["cloyster"] = {price = 30000},
["onix"] = {price = 35000},
["drowzee"] = {price = 10000},
["hypno"] = {price = 25000},
["kingler"] = {price = 15000},
["corphish"] = {price = 10000},
["crawdaunt"] = {price = 20000},
["exeggutor"] = {price = 20000},
["marowak"] = {price = 25000},
["hitmonlee"] = {price = 50000},
["hitmonchan"] = {price = 50000},
["lickitung"] = {price = 40000},
["weezing"] = {price = 25000},
["rhyhorn"] = {price = 10000},
["rhydon"] = {price = 25000},
["tangela"] = {price = 20000},
["kangaskhan"] = {price = 40000},
["kingdra"] = {price = 50000},
["togepi"] = {price = 10000},
["togetic"] = {price = 20000},
["shuppet"] = {price = 10000},
["banette"] = {price = 20000},
["duskull"] = {price = 20000},
["dusclops"] = {price = 30000},
["seaking"] = {price = 15000},
["buizel"] = {price = 10000},
["starmie"] = {price = 20000},
["mime jr"] = {price = 10000},
["mr.mime"] = {price = 35000},
["scyther"] = {price = 50000},
["smoochum"] = {price = 1000},
["jynx"] = {price = 35000},
["magmar"] = {price = 50000},
["politoed"] = {price = 40000},
["poliwrath"] = {price = 30000},
["gyarados"] = {price = 30000},
["lapras"] = {price = 50000},
["eevee"] = {price = 10000},
["porygon"] = {price = 70000},
["omanyte"] = {price = 15000},
["omastar"] = {price = 50000},
["kabuto"] = {price = 15000},
["kabutops"] = {price = 50000},
["aerodactyl"] = {price = 100000},
["snorlax"] = {price = 60000},
["zapdos"] = {price = 500000},
["moltres"] = {price = 500000},
["articuno"] = {price = 500000},
["dratini"] = {price = 15000},
["dragonair"] = {price = 30000},
["dragonite"] = {price = 50000},
["ivysaur"] = {price = 20000},
["venusaur"] = {price = 30000},
["charmander"] = {price = 5000},
["charmeleon"] = {price = 15000},
["charizard"] = {price = 30000},
["squirtle"] = {price = 5000},
["wartortle"] = {price = 15000},
["blastoise"] = {price = 30000},
["fearow"] = {price = 20000},
["lucario"] = {price = 35000},
["arbok"] = {price = 20000},
["pikachu"] = {price = 15000},
["sandslash"] = {price = 30000},
["nidorina"] = {price = 10000},
["nidoqueen"] = {price = 25000},
["nidorino"] = {price = 10000},
["nidoking"] = {price = 25000},
["clefairy"] = {price = 15000},
["clefable"] = {price = 25000}
}


local idballs = { 
[2532] = {2531}, 
[2653] = {2557},
[2654] = {2525}, 
[2652] = {2524}, 
[2195] = {2523}, 
[2531] = {2532}, 
[2557] = {2653}, 
[2525] = {2654}, 
[2524] = {2652}, 
[2523] = {2195},
} 
local balls = idballs[getPlayerSlotItem(cid,8).itemid] 



if(msgcontains(msg, "pokemon") or msgcontains(msg, "pokemon")) then 
selfSay("Qual o pokemon que você quer me vender? quer olhar a {list} ?", cid)  
talkState[talkUser] = 1 
elseif (msgcontains(msg, "list") or msgcontains(msg, "LIST")) and talkState[talkUser] == 1 then 
local str = "" 
str = str .. "Pokemon Prices :\n\n" 
for name, pos in pairsByKeys(Pokemons) do 
str = str..name.." = "..pos.price.."\n" 
end 
str = str .. ""  
doShowTextDialog(cid, 6579, str)  
elseif Pokemons[msg]  and talkState[talkUser] == 1 then 
if getPlayerStorageValue(cid, 25000) == 5 then        
return selfSay('Você está montando.',cid) 
elseif getPlayerStorageValue(cid, 23000) == 5 then 
return selfSay('Você está voando.',cid) 
elseif #getCreatureSummons(cid) >= 1 then 
return selfSay('Voce precisa botar seus pokemons dentro da pokebola.',cid) 
elseif balls == nil then 
return selfSay('Coloque seu pokemon slot da Pokeball para que eu possar examinar!!',cid) 
end 
local a = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name") 
if string.find(tostring(a),msg) then 
doRemoveItem(getPlayerSlotItem(cid,8).uid, 1) 
doPlayerAddMoney(cid, Pokemons[msg].price)  
selfSay('Obrigado por vender o pokemon '..msg..' por '..Pokemons[msg].price..' meu amigo!', cid) 
else 
selfSay('vc n tem o pokemon '..msg..' para vender!', cid) 
end 
elseif msg == "no" and talkState[talkUser] >= 1 then  
selfSay("Then not", cid)  
talkState[talkUser] = 0  
npcHandler:releaseFocus(cid)  
end  
return TRUE  
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

Créditos : cayodiebe 90%

 

Vodkart 10%

Editado por cayodiebe
Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...

Valeeu, era oque eu queria! Repiado + :smile_positivo: :button_cancel:

 

Edited : Opa.... nao funciono. na hora de eu colocar ele fala Sorry,Not Possible... Pq? :sad:

 

(se eu postei sem querer duas vezes me desculpe, meu computador pifou na hora que eu fui postar)

Editado por Poketch
Link para o comentário
Compartilhar em outros sites

  • 1 month later...
  • 5 weeks later...
  • 2 weeks later...
  • 3 months later...
  • 1 month later...
×
×
  • Criar Novo...