Ir para conteúdo

Posts Recomendados

Ai vai um npc que vende itens ta tudo certo so mudar os preços......

 

 

 

AKi o script

 

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 ' .. creatureGetName(cid) .. '! I Sell your Helmets, Armors, Legs, Shields, Boots, Amulets and Rings, Swords, Axes and Clubs.')

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, 'demon helmet') then

buy(cid,2493,getCount(msg),160000)

elseif msgcontains(msg, 'royal helmet') or msgcontains(msg, 'rh') then

buy(cid,2498,getCount(msg),80000)

elseif msgcontains(msg, 'warrior helmet') then

buy(cid,2475,getCount(msg),12000)

elseif msgcontains(msg, 'horned helmet') then

buy(cid,2496,getCount(msg),200000)

elseif msgcontains(msg, 'amazon helmet') then

buy(cid,2500,getCount(msg),80000)

elseif msgcontains(msg, 'magma monocle') then

buy(cid,7900,getCount(msg),40000)

elseif msgcontains(msg, 'lightning headband') then

buy(cid,7901,getCount(msg),40000)

elseif msgcontains(msg, 'glacier mask') then

buy(cid,7902,getCount(msg),40000)

elseif msgcontains(msg, 'crusader helmet') then

buy(cid,2497,getCount(msg),18000)

elseif msgcontains(msg, 'terra hood') then

buy(cid,7903,getCount(msg),40000)

elseif msgcontains(msg, 'crown helmet') then

buy(cid,2491,getCount(msg),6000)

elseif msgcontains(msg, 'golden helmet') then

buy(cid,2471,getCount(msg),2000000)

elseif msgcontains(msg, 'winged helmet') then

buy(cid,2474,getCount(msg),2000000)

elseif msgcontains(msg, 'dwarven helmet') then

buy(cid,2502,getCount(msg),60000)

elseif msgcontains(msg, 'devil helmet') then

buy(cid,2462,getCount(msg),84000)

elseif msgcontains(msg, 'dragon scale helmet') then

buy(cid,2506,getCount(msg),400000)

elseif msgcontains(msg, 'skull helmet') then

buy(cid,5741,getCount(msg),120000)

elseif msgcontains(msg, 'beholder helmet') then

buy(cid,3972,getCount(msg),60000)

elseif msgcontains(msg, 'helmets') then

selfSay('I Sell Demon Helmet (16k), RH (80k), Warrior Helmet (12k), Horned Helmet (200k), Amazon Helmet (80k), Magma Monocle (40k), Lightning Headband (40k), Glacier Mask (40k), Terra Hood (40k), Crusader Helmet (10k), Crown Helmet (6k), Winged Helmet (2kk), Dwarven Helmet (60k), Devil Helmet (8k), Dragon Scale Helmet (400k), Skull Helmet (120k), Beholder Helmet (60k) and Golden Helmet (2kk).')

 

elseif msgcontains(msg, 'steel boots') and focus == cid then

buy(cid,2645,getCount(msg),60000)

elseif msgcontains(msg, 'boh') or msgcontains(msg, 'boots of haste') and focus == cid then

buy(cid,2195,getCount(msg),60000)

elseif msgcontains(msg, 'golden boots') and focus == cid then

buy(cid,2646,getCount(msg),200000)

elseif msgcontains(msg, 'magma boots') and focus == cid then

buy(cid,7891,getCount(msg),40000)

elseif msgcontains(msg, 'glacier shoes') and focus == cid then

buy(cid,7892,getCount(msg),40000)

elseif msgcontains(msg, 'lightning boots') and focus == cid then

buy(cid,7893,getCount(msg),40000)

elseif msgcontains(msg, 'terra boots') and focus == cid then

buy(cid,7886,getCount(msg),40000)

elseif msgcontains(msg, 'boots') then

selfSay('I sell BOH (60k), Steel Boots (60k), Golden Boots (200k), Magma Boots (40k), Glacier Shoes (40k), Lightning Boots (40k) and Terra Boots (40k).')

 

elseif msgcontains(msg, 'magic plate armor') or msgcontains(msg, 'mpa') then

buy(cid,2472,getCount(msg),600000)

elseif msgcontains(msg, 'dragon scale mail') or msgcontains(msg, 'dsm') then

buy(cid,2492,getCount(msg),120000)

elseif msgcontains(msg, 'demon armor') then

buy(cid,2494,getCount(msg),1800000)

elseif msgcontains(msg, 'magma coat') then

buy(cid,7899,getCount(msg),60000)

elseif msgcontains(msg, 'terra mantle') then

buy(cid,7884,getCount(msg),60000)

elseif msgcontains(msg, 'lightning robe') then

buy(cid,7898,getCount(msg),60000)

elseif msgcontains(msg, 'glacier robe') then

buy(cid,7897,getCount(msg),60000)

elseif msgcontains(msg, 'golden armor') then

buy(cid,2466,getCount(msg),60000)

elseif msgcontains(msg, 'dwarven armor') then

buy(cid,2503,getCount(msg),100000)

elseif msgcontains(msg, 'crown armor') then

buy(cid,2487,getCount(msg),40000)

elseif msgcontains(msg, 'knight armor') then

buy(cid,2476,getCount(msg),10000)

elseif msgcontains(msg, 'blue robe') then

buy(cid,2656,getCount(msg),25000)

elseif msgcontains(msg, 'amazon armor') then

buy(cid,2500,getCount(msg),100000)

elseif msgcontains(msg, 'plate armor') then

buy(cid,2463,getCount(msg),1000)

elseif msgcontains(msg, 'armors') then

selfSay('I buy MPA (600k), DSM (120k), Demon Armor (1.8kkk), Golden Armor (60k), Dwarven Armor (100k), Crown Armor (40k), Knight Armor (10k), Blue Robe (25k), Amazon Armor (100k), Plate Armor (1k), Magma Coat (60k), Glacier Robe (60k), Lightning Ribe (60k) and Terra Mantle (60k).')

 

elseif msgcontains(msg, 'golden legs') then

buy(cid,2470,getCount(msg),220000)

elseif msgcontains(msg, 'crown legs') then

buy(cid,2488,getCount(msg),25000)

elseif msgcontains(msg, 'knight legs') then

buy(cid,2477,getCount(msg),12000)

elseif msgcontains(msg, 'demon legs') then

buy(cid,2495,getCount(msg),1000000)

elseif msgcontains(msg, 'dwarven legs') then

buy(cid,2504,getCount(msg),100000)

elseif msgcontains(msg, 'glacier kilt') then

buy(cid,7896,getCount(msg),40000)

elseif msgcontains(msg, 'lightning legs') then

buy(cid,7895,getCount(msg),40000)

elseif msgcontains(msg, 'blue legs') then

buy(cid,7730,getCount(msg),25000)

elseif msgcontains(msg, 'terra legs') then

buy(cid,7885,getCount(msg),40000)

elseif msgcontains(msg, 'magma legs') then

buy(cid,7894,getCount(msg),40000)

elseif msgcontains(msg, 'plate legs') then

buyl(cid,2647,getCount(msg),1000)

elseif msgcontains(msg, 'dragon scale legs') then

buy(cid,2469,getCount(msg),2000000)

elseif msgcontains(msg, 'legs') then

selfSay('I buy Golden Legs (220k), Crown Legs (25k), Knight Legs (12k), Demon Legs (1kk), Dwarven Legs (100k), Glacier Kilt (40k), Magma Legs (40k), Lightning Legs (40k), Terra Legs (40k), Blue Legs (25k), Dragon Scale Legs (2kk) and Plate Legs (1k).')

 

elseif msgcontains(msg, 'shield of the mastermind') or msgcontains(msg, 'mms') then

buy(cid,2514,getCount(msg),160000)

elseif msgcontains(msg, 'demon shield') then

buy(cid,2520,getCount(msg),80000)

elseif msgcontains(msg, 'blessed shield') then

buy(cid,2523,getCount(msg),1800000)

elseif msgcontains(msg, 'great shield') then

buy(cid,2522,getCount(msg),300000)

elseif msgcontains(msg, 'vampire shield') then

buy(cid,2534,getCount(msg),35000)

elseif msgcontains(msg, 'tempest shield') then

buy(cid,2542,getCount(msg),200000)

elseif msgcontains(msg, 'castle shield') then

buy(cid,2535,getCount(msg),60000)

elseif msgcontains(msg, 'eagle shield') then

buy(cid,2538,getCount(msg),140000)

elseif msgcontains(msg, 'phoenix shield') then

buy(cid,2539,getCount(msg),400000)

elseif msgcontains(msg, 'medusa shield') then

buy(cid,2536,getCount(msg),16000)

elseif msgcontains(msg, 'amazon shield') then

buy(cid,2537,getCount(msg),8000)

elseif msgcontains(msg, 'crown shield') then

sell(cid,2519,getCount(msg),10000)

elseif msgcontains(msg, 'tower shield') then

buy(cid,2528,getCount(msg),14000)

elseif msgcontains(msg, 'dragon shield') then

buy(cid,2516,getCount(msg),6000)

elseif msgcontains(msg, 'guardian shield') then

buy(cid,2515,getCount(msg),4000)

elseif msgcontains(msg, 'necromancer shield') then

buy(cid,6433,getCount(msg),2000000)

elseif msgcontains(msg, 'nightmare shield') then

buy(cid,6391,getCount(msg),2000000)

elseif msgcontains(msg, 'shields') then

selfSay('I buy MMS (160k), Demon Shield (80k), Blessed Shield (1.8kk), Great Shield (400k), Vampire Shield (45k), Tempest Shield (200k), Castle Shield (60k), Eagle Shield (140k), Phoenix Shield (400k), Medusa Shield (16k), Amazon Shield (8k), Crown Shield (10k), Tower Shield (14k), Dragon Shield (6k), Guardian Shield (4k), Necromancer Shield (2kk) and Nightmare Shield (2kk).')

 

elseif msgcontains(msg, 'magic longsword') then

buy(cid,2390,getCount(msg),600000)

elseif msgcontains(msg, 'warlord sword') then

buy(cid,2408,getCount(msg),2000000)

elseif msgcontains(msg, 'magic sword') then

buy(cid,2400,getCount(msg),1600000)

elseif msgcontains(msg, 'mystic blade') then

buy(cid,7384,getCount(msg),60000)

elseif msgcontains(msg, 'avenger') then

buy(cid,6528,getCount(msg),220000)

elseif msgcontains(msg, 'justice seeker') then

buy(cid,7390,getCount(msg),200000)

elseif msgcontains(msg, 'mercenary sword') then

buy(cid,7386,getCount(msg),27000)

elseif msgcontains(msg, 'crimson sword') then

buy(cid,7385,getCount(msg),6000)

elseif msgcontains(msg, 'djinn blade') then

sell(cid,2451,getCount(msg),160000)

elseif msgcontains(msg, 'demonrage sword') then

buy(cid,7382,getCount(msg),40000)

elseif msgcontains(msg, 'relic sword') then

buy(cid,7383,getCount(msg),100000)

elseif msgcontains(msg, 'giant sword') then

buy(cid,2393,getCount(msg),20000)

elseif msgcontains(msg, 'pharaoh sword') then

buy(cid,2446,getCount(msg),80000)

elseif msgcontains(msg, 'dragon slayer') then

buy(cid,7402,getCount(msg),22000)

elseif msgcontains(msg, 'shenlong sword') then

buy(cid,7405,getCount(msg),400000)

elseif msgcontains(msg, 'bloody edge') then

buy(cid,7416,getCount(msg),160000)

elseif msgcontains(msg, 'dreaded cleaver') then

buy(cid,7419,getCount(msg),80000)

elseif msgcontains(msg, 'crystal sword') then

buy(cid,7449,getCount(msg),4000)

elseif msgcontains(msg, 'haunted blade') then

buy(cid,7407,getCount(msg),24000)

elseif msgcontains(msg, 'wyvern fang') then

buy(cid,7408,getCount(msg),6000)

elseif msgcontains(msg, 'bright sword') then

buy(cid,2407,getCount(msg),12000)

elseif msgcontains(msg, 'ice rapier') then

buy(cid,2396,getCount(msg),8000)

elseif msgcontains(msg, 'fire sword') then

buy(cid,2392,getCount(msg),6000)

elseif msgcontains(msg, 'assassin dagger') then

buy(cid,7404,getCount(msg),100000)

elseif msgcontains(msg, 'blacksteel sword') then

buy(cid,7406,getCount(msg),10000)

elseif msgcontains(msg, 'swords') then

selfSay('I buy Magic Longsword (600k), Warlord Sword (2kk), Magic Sword (1.6kk), Mystic Blade (60k), Avenger (220k), Justice Seeker (200k), Mercenary Sword (27k), Crimson Sword (6k), Djinn Blade (160k), Demonrage Sword (40k), Relic Sword (100k), Giant Sword (20k), Pharaoh Sword (80k), Dragon Slayer (22k), Shenlong Sword (400k), Bloody Edge (160k), Dreaded Cleaver (80k), Crystal Sword (4k), Haunted Blade (24k), Wyvern Fang (6k), Bright Sword (12k), Ice Rapier (8k), Fire Sword (6k) and Blacksteel Sword (10k).')

 

elseif msgcontains(msg, 'dragon lance') then

buy(cid,2414,getCount(msg),20000)

elseif msgcontains(msg, 'stonecutters axe') then

buy(cid,2431,getCount(msg),1600000)

elseif msgcontains(msg, 'guardian halberd') then

buy(cid,2427,getCount(msg),16000)

elseif msgcontains(msg, 'fire axe') then

buy(cid,2432,getCount(msg),20000)

elseif msgcontains(msg, 'knight axe') then

buy(cid,2430,getCount(msg),2000)

elseif msgcontains(msg, 'great axe') then

buy(cid,2415,getCount(msg),4000000)

elseif msgcontains(msg, 'ravagers axe') then

buy(cid,2443,getCount(msg),80000)

elseif msgcontains(msg, 'twin axe') then

buy(cid,2447,getCount(msg),140000)

elseif msgcontains(msg, 'headchopper') then

buy(cid,7380,getCount(msg),10000)

elseif msgcontains(msg, 'vile axe') then

buy(cid,7388,getCount(msg),60000)

elseif msgcontains(msg, 'heroic axe') then

buy(cid,7389,getCount(msg),40000)

elseif msgcontains(msg, 'naginata') then

buy(cid,2426,getCount(msg),16000)

elseif msgcontains(msg, 'butchers axe') then

buy(cid,7412,getCount(msg),40000)

elseif msgcontains(msg, 'titan axe') then

buy(cid,7413,getCount(msg),80000)

elseif msgcontains(msg, 'ruthless axe') then

buy(cid,6553,getCount(msg),400000)

elseif msgcontains(msg, 'war axe') then

buy(cid,2454,getCount(msg),20000)

elseif msgcontains(msg, 'royal axe') then

buy(cid,7434,getCount(msg),220000)

elseif msgcontains(msg, 'noble axe') then

buy(cid,7456,getCount(msg),20000)

elseif msgcontains(msg, 'dwarven axe') then

buy(cid,2435,getCount(msg),8000)

elseif msgcontains(msg, 'daramanian waraxe') then

buy(cid,2440,getCount(msg),12000)

elseif msgcontains(msg, 'axes') then

selfSay('I buy Dragon Lance (50k), Stonecutters Axe (1.6kk), Guardian Halberd (16k), Fire Axe (50k), Knight Axe (4k), Ravagers Axe (80k), Twin Axe (140k), Headchopper (10k), Vile Axe (60k), Heroic Axe (40k), Naginata (16k), Butchers Axe (80k), Titan Axe (80k) Ruthless Axe (400k), War Axe (20k), Royal Axe (220k), Noble Axe (20k), Dwarven Axe (8k) and Daramanian Waraxe (12k).')

 

elseif msgcontains(msg, 'war hammer') then

buy(cid,2391,getCount(msg),4000)

elseif msgcontains(msg, 'thunder hammer') then

buy(cid,2421,getCount(msg),600000)

elseif msgcontains(msg, 'skull staff') then

buy(cid,2436,getCount(msg),20000)

elseif msgcontains(msg, 'dragonbone staff') then

buy(cid,7430,getCount(msg),20000)

elseif msgcontains(msg, 'demonbone') then

buy(cid,7431,getCount(msg),1000000)

elseif msgcontains(msg, 'furry club') then

buy(cid,7432,getCount(msg),6000)

elseif msgcontains(msg, 'sapphire hammer') then

buy(cid,7437,getCount(msg),10000)

elseif msgcontains(msg, 'blessed sceptre') then

buy(cid,7429,getCount(msg),180000)

elseif msgcontains(msg, 'spiked squelcher') then

buy(cid,7453,getCount(msg),22000)

elseif msgcontains(msg, 'hammer of wrath') then

buy(cid,2444,getCount(msg),80000)

elseif msgcontains(msg, 'crystal mace') then

buy(cid,2445,getCount(msg),60000)

elseif msgcontains(msg, 'queens sceptre') then

buy(cid,7410,getCount(msg),160000)

elseif msgcontains(msg, 'abyss hammer') then

buy(cid,7414,getCount(msg),60000)

elseif msgcontains(msg, 'cranial basher') then

buy(cid,7415,getCount(msg),60000)

elseif msgcontains(msg, 'lunar staff') then

buy(cid,7424,getCount(msg),18000)

elseif msgcontains(msg, 'shadow sceptre') then

buy(cid,7451,getCount(msg),160000)

elseif msgcontains(msg, 'taurus mace') then

buy(cid,7425,getCount(msg),2000)

elseif msgcontains(msg, 'amber staff') then

buy(cid,7426,getCount(msg),16000)

elseif msgcontains(msg, 'chaos mace') then

buy(cid,7427,getCount(msg),80000)

elseif msgcontains(msg, 'heavy mace') then

 

 

 

 

 

 

 

 

 

buy(cid,2452,getCount(msg),80000)

elseif msgcontains(msg, 'arcane staff') then

buy(cid,2453,getCount(msg),220000)

elseif msgcontains(msg, 'lich staff') then

buy(cid,3961,getCount(msg),40000)

elseif msgcontains(msg, 'mammoth whopper') then

buy(cid,7381,getCount(msg),10000)

elseif msgcontains(msg, 'diamond sceptre') then

buy(cid,7387,getCount(msg),20000)

elseif msgcontains(msg, 'orcish maul') then

buy(cid,7392,getCount(msg),6000)

elseif msgcontains(msg, 'dragon hammer') then

buy(cid,2434,getCount(msg),4000)

elseif msgcontains(msg, 'clubs') then

selfSay('I buy War Hammer (4k), Thunder Hammer (600k), Skull Staff (20k), Dragonbone Staff (20k), Demonbone (1kk), Furry Club (6k), Sapphire Hammer (10k), Blessed Sceptre (180k), Spiked Squelcher (22k), Hammer of Wrath (80k), Crystal Mace (60k), Abyss Hammer (60k), Cranial Basher (60k), Lunar Staff (18k), Shadow Sceptre (160k), Taurus Mace (2k), Amber Staff (16k), Chaos Mace (80k), Heavy Mace (80k), Arcane Staff (220k), Lich Staff (40k), Mammoth Whopper (10k), Diamond Sceptre (20k) and Dragon Hammer (4k).')

 

elseif msgcontains(msg, 'platinum amulet') then

buy(cid,2171,getCount(msg),10000)

elseif msgcontains(msg, 'ring of the sky') then

buy(cid,2123,getCount(msg),20000)

elseif msgcontains(msg, 'amulets and rings') then

selfSay('I buy Platinum Amulet (10k) and Ring of The Sky (20k).')

 

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. creatureGetName(cid) .. ', come back later!')

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 and come back later!')

focus = 0

end

end

end

 

 

Aki o XML

 

 

 

<?xml version="1.0"?>

 

<npc name="Alemao" script="data/npc/scripts/vende.lua" access="3" lookdir="2">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="143" head="0" body="0" legs="0" feet="0"/>

<parameters>

<parameter key="module_shop" value="1" />

<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell swords, clubs, axes, helmets, boots, legs, shields and armors." />

<parameter key="shop_sellable" value="royal helmet,2498,40000;warrior helmet,2475,6000;crusader helmet,2497,9000;crown helmet,2491,5000;devil helmet,2462,4000;mystic turban,2663,500;chain helmet,2458,35;iron helmet,2459,30;steel boots,2645,400000;boots of haste,2195,40000;golden boots,2646,100000;magic plate armor,2472,100000;dragon scale mail,2492,60000;demon armor,2494,90000;golden armor,2466,30000;crown armor,2487,20000;knight armor,2476,5000;blue robe,2656,15000;lady armor,2500,2500;plate armor,2463,400;brass armor,2465,200;chain armor,2464,100;golden legs,2470,80000;crown legs,2488,15000;knight legs,2477,6000;plate legs,2647,500;brass legs,2487,100;mastermind shield,2514,80000;demon shield,2520,40000;blessed shield,2523,150000;great shield,2522,100000;vampire shield,2534,25000;medusa shield,2536,8000;amazon shield,2537,4000;crown shield,2519,5000;tower shield,2528,4000;guardian shield,2515,200;beholder shield,2518,1500;dwarven shield,2525,100;magic longsword,2390,150000;warlord sword,2408,100000;magic sword,2400,90000;giant sword,2393,10000;bright sword,2407,6000;ice rapier,2396,4000;fire sword,2392,3000;serpent sword,2409,1500;spike sword,2383,800;two handed sword,2377,400;broad sword,2413,70;short sword,2406,30;sword,2376,25;dragon lance,2414,10000;stonecutter axe,2431,90000;guardian halberd,2427,7500;fire axe,2432,10000;knight axe,2430,2000;double axe,2387,200;halberd,2381,200;battle axe,2378,100;hatchet,2388,20;war hammer,2391,6000;thunder hammer,2421,90000;skull staff,2436,1000;dragon hammer,2434,2000;clerical mace,2423,200;battle hammer,2417,60;mace,2398,30;" />

</parameters>

</npc>

 

 

Espero q gostem :winksmiley02:

Link para o comentário
https://xtibia.com/forum/topic/87526-npc-q-vende-itens/
Compartilhar em outros sites

×
×
  • Criar Novo...