Ir para conteúdo
  • 0
JohnMatos

Scripting Criar NPC

Pergunta

JohnMatos    0
JohnMatos

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Obs: não delete esse formulário pré-definido, preencha-o corretamente para postar o seu tópico!

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

Base:

otservbr-global

Qual é a sua pergunta?

Estou tentando criar um NPC que compra todos os loots, porém devido a quantidade de itens quando fala "trade" ao npc o cliente crasha.
Não cai o servidor, mais o cliente crasha.
Para tentar resolver tentei fazer um script para que ao dizer "trade" quando for abrir a janela, apareça somente os itens que o player possui no inventário para vender, assim evitando o crash do cliente, porém sem sucesso.
Alguém consegue me ajudar?

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

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

local function getTable(player)
    local itemsList = {        
        {name="abyss hammer", id=7414, sell=20000},        
        {name="albino plate", id=21692, sell=1500},
        {name="alptramun's toothbrush", id=34581, sell=270000},
        {name="amber staff", id=7426, sell=8000},
        {name="ancient amulet", id=2142, sell=200},
        {name="ancient belt buckle", id=27052, sell=260},
        {name="ancient coin", id=27058, sell=350},
        {name="ancient liche bone", id=36423, sell=28000},
        {name="ancient stone", id=10549, sell=200},
        {name="angelic axe", id=7436, sell=5000},
        {name="ankh", id=2327, sell=100},
        {name="antlers", id=11214, sell=50},
        {name="ape fur", id=5883, sell=120},
        {name="apron", id=38768, sell=1300},
        {name="assassin dagger", id=7404, sell=20000},
        {name="axe ring", id=2208, sell=100},
        {name="banana sash", id=12467, sell=55},
        {name="bandana", id=5917, sell=150},
        {name="bar of gold", id=15515, sell=10000},
        {name="basalt fetish", id=20136, sell=210},
        {name="basalt figurine", id=20137, sell=160},
        {name="bat decoration", id=6492, sell=2000},
        {name="bat wing", id=5894, sell=50},
        {name="Battle Axe", id=2378, sell=80},
        {name="Battle Hammer", id=2417, sell=120},
        {name="Battle Shield", id=2513, sell=95},
        {name="battle stone", id=12403, sell=290},
        {name="bear paw", id=5896, sell=100},
        {name="beast's nightmare-cushion", id=34584, sell=630000},
        {name="beastslayer axe", id=3962, sell=1500},
        {name="bed of nails", id=29039, sell=500},
        {name="beetle carapace", id=27049, sell=200},
        {name="beetle necklace", id=11374, sell=1500},
        {name="behemoth claw", id=5930, sell=2000},
        {name="berserker", id=7403, sell=40000},
        {name="black hood", id=10562, sell=190},
        {name="black pearl", id=2144, sell=280},
        {name="black wool", id=12404, sell=300},
        {name="blacksteel sword", id=7406, sell=6000},
        {name="blazing bone", id=18425, sell=610},
        {name="blessed sceptre", id=7429, sell=40000},
        {name="blood preservation", id=12405, sell=320},
        {name="blood tincture in a vial", id=21245, sell=360},
        {name="bloody dwarven beard", id=20107, sell=110},
        {name="bloody pincers", id=10550, sell=100},
        {name="blue crystal shard", id=18413, sell=1500},
        {name="blue crystal splinter", id=18418, sell=400},
        {name="blue gem", id=2158, sell=5000},
        {name="blue glass plate", id=33983, sell=60},
        {name="blue goanna scale", id=36394, sell=230},
        {name="blue piece of cloth", id=5912, sell=200},
        {name="blue robe", id=2656, sell=10000},
        {name="blue rose", id=2745, sell=200},
        {name="boggy dreads", id=10584, sell=200},
        {name="bone fetish", id=20111, sell=150},
        {name="bone shield", id=2541, sell=80},
        {name="bone shoulderplate", id=11321, sell=150},
        {name="bone toothpick", id=27048, sell=150},
        {name="bonecarving knife", id=20110, sell=190},
        {name="bonelord eye", id=5898, sell=80},
        {name="bonelord helmet", id=3972, sell=7500},
        {name="bonelord shield", id=2518, sell=1200},
        {name="bones of zorvorax", id=27610, sell=10000},
        {name="bony tail", id=11194, sell=210},
        {name="book of necromantic rituals", id=11237, sell=180},
        {name="book of prayers", id=10563, sell=120},
        {name="book page", id=33316, sell=640},
        {name="boots of haste", id=2195, sell=30000},
        {name="Bow", id=2456, sell=100},
        {name="bowl of terror sweat", id=22538, sell=500},
        {name="Brass Armor", id=2465, sell=150},
        {name="bright bell", id=35151, sell=220},
        {name="brimstone fangs", id=12658, sell=380},
        {name="brimstone shell", id=12659, sell=210},
        {name="broadsword", id=2413, sell=500},
        {name="broken bell", id=35044, sell=150},
        {name="broken draken mail", id=12616, sell=340},
        {name="broken gladiator shield", id=10573, sell=190},
        {name="broken halberd", id=11335, sell=100},
        {name="broken key ring", id=12608, sell=8000},
        {name="broken longbow", id=38996, sell=120},
        {name="broken ring of ending", id=13877, sell=4000},
        {name="broken slicer", id=12617, sell=120},
        {name="broken throwing axe", id=20131, sell=230},
        {name="broken visor", id=22518, sell=1900},
        {name="bronze amulet", id=2172, sell=50},
        {name="brooch of embracement", id=38858, sell=14000},
        {name="brown crystal splinter", id=18417, sell=400},
        {name="brown giant shimmering pearl", id=7633, sell=3000},
        {name="brown piece of cloth", id=5913, sell=100},
        {name="brutetamer's staff", id=7379, sell=1500},
        {name="buckle", id=20109, sell=7000},
        {name="bundle of cursed straw", id=10605, sell=800},
        {name="butcher's axe", id=7412, sell=18000},
        {name="butterfly ring", id=29003, sell=2000},
        {name="calopteryx cape", id=15489, sell=15000},
        {name="capricious heart", id=38973, sell=2100},
        {name="capricious robe", id=38980, sell=1200},
        {name="carapace shield", id=15491, sell=32000},
        {name="Carlin Sword", id=2395, sell=118},
        {name="carniphila seeds", id=11217, sell=50},
        {name="castle shield", id=2535, sell=5000},
        {name="cat's paw", id=5480, sell=2000},
        {name="cave devourer eyes", id=30834, sell=550},
        {name="cave devourer legs", id=30836, sell=350},
        {name="cave devourer maw", id=30835, sell=600},
        {name="Chain Armor", id=2464, sell=70},
        {name="chain bolter", id=8850, sell=40000},
        {name="chaos mace", id=7427, sell=9000},
        {name="chasm spawn abdomen", id=30838, sell=240},
        {name="chasm spawn head", id=30837, sell=850},
        {name="chasm spawn tail", id=30839, sell=120},
        {name="cheese cutter", id=20097, sell=50},
        {name="cheesy figurine", id=20098, sell=150},
        {name="cheesy membership card", id=40449, sell=120000},
        {name="chitinous mouth", id=30857, sell=10000},
        {name="chitinous mouth", id=30861, sell=10000},
        {name="cliff strider claw", id=18428, sell=800},
        {name="closed trap", id=2578, sell=75},
        {name="club ring", id=2209, sell=100},
        {name="cobra crest", id=36513, sell=650},
        {name="cobra crown", id=12630, sell=50000},
        {name="coconut shoes", id=9931, sell=500},
        {name="colourful feather", id=12470, sell=110},
        {name="colourful feathers", id=27757, sell=400},
        {name="colourful snail shell", id=29001, sell=250},
        {name="composite hornbow", id=8855, sell=25000},
        {name="compound eye", id=15486, sell=150},
        {name="condensed energy", id=26157, sell=260},
        {name="Copper Shield", id=2530, sell=50},
        {name="coral brooch", id=27059, sell=750},
        {name="corrupted flag", id=11326, sell=700},
        {name="countess sorrow's frozen tear", id=6536, sell=50000},
        {name="cracked alabaster vase", id=27053, sell=180},
        {name="cranial basher", id=7415, sell=30000},
        {name="crawler head plating", id=15482, sell=210},
        {name="crawler's essence", id=38817, sell=3700},
        {name="crocodile boots", id=3982, sell=1000},
        {name="Crossbow", id=2455, sell=120},
        {name="crowbar", id=2416, sell=50},
        {name="crown", id=38770, sell=2700},
        {name="crown armor", id=2487, sell=12000},
        {name="crown helmet", id=2491, sell=2500},
        {name="crown legs", id=2488, sell=12000},
        {name="crown shield", id=2519, sell=8000},
        {name="cruelty's chest", id=38758, sell=720000},
        {name="cruelty's claw", id=38757, sell=640000},
        {name="crunor idol", id=34693, sell=30000},
        {name="crusader helmet", id=2497, sell=6000},
        {name="crystal ball", id=2192, sell=190},
        {name="crystal bone", id=26177, sell=250},
        {name="crystal crossbow", id=18453, sell=35000},
        {name="crystal mace", id=2445, sell=12000},
        {name="crystal necklace", id=2125, sell=400},
        {name="crystal of balance", id=9942, sell=1000},
        {name="crystal of focus", id=9941, sell=2000},
        {name="crystal of power", id=9980, sell=3000},
        {name="crystal ring", id=6093, sell=250},
        {name="crystal sword", id=7449, sell=600},
        {name="crystalline armor", id=8878, sell=16000},
        {name="crystalline spikes", id=18432, sell=440},
        {name="crystallized anger", id=26163, sell=400},
        {name="cultish mask", id=10555, sell=280},
        {name="cultish robe", id=10556, sell=150},
        {name="cultish symbol", id=12411, sell=500},
        {name="curious matter", id=26167, sell=430},
        {name="cursed bone", id=37609, sell=6000},
        {name="cursed shoulder spikes", id=11327, sell=320},
        {name="cyan crystal fragment", id=18419, sell=800},
        {name="cyclops toe", id=10574, sell=55},
        {name="damaged armor plates", id=32519, sell=280},
        {name="damaged worm head", id=30855, sell=8000},
        {name="dandelion seeds", id=29000, sell=200},
        {name="dangerous proto matter", id=26171, sell=300},
        {name="daramian mace", id=2439, sell=110},
        {name="daramian waraxe", id=2440, sell=1000},
        {name="dark bell", id=35152, sell=250},
        {name="dark shield", id=2521, sell=400},
        {name="dead weight", id=22536, sell=450},
        {name="death ring", id=6300, sell=1000},
        {name="Deepling Axe", id=15404, sell=40000},
        {name="deepling breaktime snack", id=15424, sell=90},
        {name="deepling claw", id=15455, sell=430},
        {name="deepling guard belt buckle", id=15423, sell=230},
        {name="deepling ridge", id=15452, sell=360},
        {name="deepling scales", id=15430, sell=80},
        {name="Deepling Squelcher", id=15647, sell=7000},
        {name="Deepling Staff", id=15400, sell=4000},
        {name="deepling warts", id=15425, sell=180},
        {name="deeptags", id=15426, sell=290},
        {name="deepworm jaws", id=30829, sell=500},
        {name="deepworm spike roots", id=30828, sell=650},
        {name="deepworm spikes", id=30827, sell=800},
        {name="demon dust", id=5527, sell=300},
        {name="demon horn", id=5954, sell=1000},
        {name="demon shield", id=2520, sell=30000},
        {name="demonbone amulet", id=2136, sell=32000},
        {name="demonic finger", id=13530, sell=1000},
        {name="demonic skeletal hand", id=10564, sell=80},
        {name="demonrage sword", id=7382, sell=36000},
        {name="Depth Calcei", id=15410, sell=25000},
        {name="Depth Galea", id=15408, sell=35000},
        {name="Depth Lorica", id=15407, sell=30000},
        {name="Depth Ocrea", id=15409, sell=16000},
        {name="Depth Scutum", id=15411, sell=36000},
        {name="devil helmet", id=2462, sell=1000},
        {name="diabolic skull", id=38860, sell=19000},
        {name="diamond", id=37605, sell=15000},
        {name="diamond sceptre", id=7387, sell=3000},
        {name="diremaw brainpan", id=30832, sell=350},
        {name="diremaw legs", id=30833, sell=270},
        {name="dirty turban", id=12412, sell=120},
        {name="distorted heart", id=38977, sell=2100},
        {name="distorted robe", id=38984, sell=1200},
        {name="divine plate", id=8885, sell=55000},
        {name="djinn blade", id=2451, sell=15000},
        {name="doll", id=2110, sell=200},
        {name="Double Axe", id=2387, sell=260},
        {name="drachaku", id=11308, sell=10000},
        {name="dracola's eye", id=6546, sell=50000},
        {name="dracoyle statue", id=9948, sell=5000},
        {name="dragon blood", id=27605, sell=700},
        {name="dragon claw", id=5919, sell=8000},
        {name="dragon figurine", id=34691, sell=45000},
        {name="dragon lance", id=2414, sell=9000},
        {name="dragon necklace", id=2201, sell=100},
        {name="dragon priest's wandtip", id=11361, sell=175},
        {name="dragon scale mail", id=2492, sell=40000},
        {name="dragon shield", id=2516, sell=4000},
        {name="dragon slayer", id=7402, sell=15000},
        {name="dragon tongue", id=27606, sell=550},
        {name="dragonbone staff", id=7430, sell=3000},
        {name="dragon's tail", id=12413, sell=100},
        {name="draken boots", id=12646, sell=40000},
        {name="draken sulphur", id=12614, sell=550},
        {name="draken wristbands", id=12615, sell=430},
        {name="drakinata", id=11305, sell=10000},
        {name="dreaded cleaver", id=7419, sell=10000},
        {name="dream blossom staff", id=29005, sell=5000},
        {name="dream essence egg", id=34643, sell=205},
        {name="dung ball", id=15622, sell=130},
        {name="dwarven armor", id=2503, sell=30000},
        {name="dwarven ring", id=2213, sell=100},
        {name="Dwarven Shield", id=2525, sell=100},
        {name="earth blacksteel sword", id=7857, sell=6000},
        {name="earth cranial basher", id=7866, sell=30000},
        {name="earth crystal mace", id=7865, sell=12000},
        {name="earth dragon slayer", id=7858, sell=15000},
        {name="earth headchopper", id=7862, sell=6000},
        {name="earth heroic axe", id=7861, sell=30000},
        {name="earth mystic blade", id=7856, sell=30000},
        {name="earth orcish maul", id=7867, sell=6000},
        {name="earth relic sword", id=7855, sell=25000},
        {name="earth spike sword", id=7854, sell=1000},
        {name="earth war axe", id=7863, sell=12000},
        {name="earth war hammer", id=7868, sell=1200},
        {name="elder bonelord tentacle", id=11193, sell=150},
        {name="Elite Draken Mail", id=12607, sell=50000},
        {name="elven amulet", id=2198, sell=100},
        {name="elven astral observer", id=12421, sell=90},
        {name="elven hoof", id=21311, sell=115},
        {name="elven scouting glass", id=12420, sell=50},
        {name="elvish bow", id=7438, sell=2000},
        {name="emerald bangle", id=2127, sell=800},
        {name="empty honey glass", id=36166, sell=270},
        {name="enchanted chicken wing", id=5891, sell=20000},
        {name="energy ball", id=26179, sell=300},
        {name="energy blacksteel sword", id=7872, sell=6000},
        {name="energy cranial basher", id=7881, sell=30000},
        {name="energy crystal mace", id=7880, sell=12000},
        {name="energy dragon slayer", id=7873, sell=15000},
        {name="energy headchopper", id=7877, sell=6000},
        {name="energy heroic axe", id=7876, sell=30000},
        {name="energy mystic blade", id=7871, sell=30000},
        {name="energy orcish maul", id=7882, sell=6000},
        {name="energy relic sword", id=7870, sell=25000},
        {name="energy ring", id=2167, sell=100},
        {name="energy spike sword", id=7869, sell=1000},
        {name="energy vein", id=26164, sell=270},
        {name="energy war axe", id=7878, sell=12000},
        {name="energy war hammer", id=7883, sell=1200},
        {name="epee", id=2438, sell=8000},
        {name="essence of a bad dream", id=11223, sell=360},
        {name="eye of a deepling", id=13870, sell=150},
        {name="eye of a weeper", id=18426, sell=650},
        {name="eye of corruption", id=12627, sell=390},
        {name="fafnar symbol", id=36278, sell=950},
        {name="fairy wings", id=28999, sell=200},
        {name="falcon crest", id=32520, sell=650},
        {name="fiery blacksteel sword", id=7747, sell=6000},
        {name="fiery cranial basher", id=7756, sell=30000},
        {name="fiery crystal mace", id=7755, sell=12000},
        {name="fiery dragon slayer", id=7748, sell=15000},
        {name="fiery headchopper", id=7752, sell=6000},
        {name="fiery heart", id=10553, sell=375},
        {name="fiery heroic axe", id=7751, sell=30000},
        {name="fiery mystic blade", id=7746, sell=30000},
        {name="fiery orcish maul", id=7757, sell=6000},
        {name="fiery relic sword", id=7745, sell=25000},
        {name="fiery spike sword", id=7744, sell=1000},
        {name="fiery war axe", id=7753, sell=12000},
        {name="fiery war hammer", id=7758, sell=1200},
        {name="fig leaf", id=29043, sell=200},
        {name="figurine of cruelty", id=38854, sell=3100000},
        {name="figurine of greed", id=38856, sell=2900000},
        {name="figurine of hatred", id=38855, sell=2700000},
        {name="figurine of malice", id=38853, sell=2800000},
        {name="figurine of megalomania", id=38788, sell=5000000},
        {name="figurine of spite", id=38787, sell=3000000},
        {name="fire axe", id=2432, sell=8000},
        {name="Fire Sword", id=2392, sell=1000},
        {name="fire sword", id=2392, sell=4000},
        {name="fish fin", id=5895, sell=150},
        {name="flask of warrior's sweat", id=5885, sell=10000},
        {name="flintstone", id=13943, sell=800},
        {name="flower dress", id=9929, sell=1000},
        {name="flower wreath", id=9927, sell=500},
        {name="fox paw", id=30697, sell=100},
        {name="frazzle skin", id=22533, sell=400},
        {name="frazzle tongue", id=22532, sell=700},
        {name="frost giant pelt", id=10575, sell=160},
        {name="frosty heart", id=10578, sell=280},
        {name="frozen lightning", id=26175, sell=270},
        {name="fur boots", id=7457, sell=2000},
        {name="fur shred", id=38999, sell=200},
        {name="furry club", id=7432, sell=1000},
        {name="garlic necklace", id=2199, sell=50},
        {name="gauze bandage", id=10566, sell=90},
        {name="gear crystal", id=10572, sell=200},
        {name="gear wheel", id=9690, sell=500},
        {name="gemmed figurine", id=27060, sell=3500},
        {name="geomancer's robe", id=12414, sell=80},
        {name="geomancer's staff", id=12419, sell=120},
        {name="ghastly dragon head", id=11366, sell=700},
        {name="ghostly tissue", id=10607, sell=90},
        {name="ghoul snack", id=12423, sell=60},
        {name="giant emerald", id=34698, sell=90000},
        {name="giant eye", id=11197, sell=380},
        {name="giant pacifier", id=23570, sell=170},
        {name="giant ruby", id=34697, sell=70000},
        {name="giant sapphire", id=34699, sell=50000},
        {name="giant tentacle", id=30854, sell=10000},
        {name="glacial rod", id=18412, sell=6500},
        {name="glacier amulet", id=7888, sell=1500},
        {name="glacier kilt", id=7896, sell=11000},
        {name="glacier mask", id=7902, sell=2500},
        {name="glacier robe", id=7897, sell=11000},
        {name="glacier shoes", id=7892, sell=2500},
        {name="gland", id=8971, sell=500},
        {name="glistening bone", id=26178, sell=250},
        {name="gloom wolf fur", id=24663, sell=70},
        {name="glorious axe", id=7454, sell=3000},
        {name="glowing rune", id=33317, sell=350},
        {name="goanna claw", id=36396, sell=260},
        {name="goanna meat", id=36395, sell=190},
        {name="goblet of gloom", id=38857, sell=12000},
        {name="gold ingot", id=9971, sell=5000},
        {name="gold nugget", id=2157, sell=850},
        {name="gold ring", id=2179, sell=8000},
        {name="golden armor", id=2466, sell=20000},
        {name="golden brush", id=28995, sell=250},
        {name="golden cheese wedge", id=40416, sell=6000},
        {name="golden dustbin", id=40414, sell=7000},
        {name="golden figurine", id=5799, sell=3000},
        {name="golden hyena pendant", id=13532, sell=10000},
        {name="golden legs", id=2470, sell=30000},
        {name="golden lotus brooch", id=24630, sell=270},
        {name="golden mask", id=36159, sell=38000},
        {name="golden mug", id=2033, sell=250},
        {name="golden skull", id=40415, sell=9000},
        {name="goo shell", id=21706, sell=4000},
        {name="goosebump leather", id=22539, sell=650},
        {name="grant of arms", id=32521, sell=950},
        {name="grappling hook", id=40423, sell=150},
        {name="Grasshopper Legs", id=15490, sell=15000},
        {name="greed's arm", id=38759, sell=950000},
        {name="green bandage", id=29002, sell=180},
        {name="green crystal fragment", id=18421, sell=800},
        {name="green crystal shard", id=18415, sell=1500},
        {name="green crystal splinter", id=18416, sell=400},
        {name="green dragon leather", id=5877, sell=100},
        {name="green dragon scale", id=5920, sell=100},
        {name="green gem", id=2155, sell=5000},
        {name="green giant shimmering pearl", id=7632, sell=3000},
        {name="green glass plate", id=33984, sell=180},
        {name="green piece of cloth", id=5910, sell=200},
        {name="griffin shield", id=2533, sell=3000},
        {name="gruesome fan", id=38859, sell=15000},
        {name="Guardian Axe", id=15454, sell=9000},
        {name="guardian boots", id=11240, sell=35000},
        {name="guardian halberd", id=2427, sell=11000},
        {name="guardian shield", id=2515, sell=2000},
        {name="guidebook", id=29046, sell=200},
        {name="hailstorm rod", id=2183, sell=3000},
        {name="hair of a banshee", id=12402, sell=350},
        {name="Halberd", id=2381, sell=400},
        {name="half-digested piece of meat", id=11200, sell=55},
        {name="half-eaten brain", id=10576, sell=85},
        {name="hammer of wrath", id=2444, sell=30000},
        {name="hand", id=38771, sell=1450},
        {name="hardened bone", id=5925, sell=70},
        {name="harpoon of a giant snail", id=30860, sell=15000},
        {name="haunted piece of wood", id=10600, sell=115},
        {name="headchopper", id=7380, sell=6000},
        {name="heavy mace", id=2452, sell=50000},
        {name="heavy machete", id=2442, sell=90},
        {name="heavy trident", id=13838, sell=2000},
        {name="helmet of the lost", id=20132, sell=2000},
        {name="heroic axe", id=7389, sell=30000},
        {name="hexagonal ruby", id=34818, sell=30000},
        {name="hibiscus dress", id=8873, sell=3000},
        {name="hieroglyph banner", id=13739, sell=500},
        {name="high guard's shoulderplates", id=11333, sell=130},
        {name="Hive Bow", id=15643, sell=28000},
        {name="Hive Scythe", id=15492, sell=17000},
        {name="horn (ring)", id=21693, sell=300},
        {name="huge chunk of crude iron", id=5892, sell=15000},
        {name="ice rapier", id=2396, sell=1000},
        {name="icy blacksteel sword", id=7766, sell=6000},
        {name="icy cranial basher", id=7775, sell=30000},
        {name="icy crystal mace", id=7774, sell=12000},
        {name="icy dragon slayer", id=7767, sell=15000},
        {name="icy headchopper", id=7771, sell=6000},
        {name="icy heroic axe", id=7770, sell=30000},
        {name="icy mystic blade", id=7765, sell=30000},
        {name="icy orcish maul", id=7776, sell=6000},
        {name="icy relic sword", id=7764, sell=25000},
        {name="icy spike sword", id=7763, sell=1000},
        {name="icy war axe", id=7772, sell=12000},
        {name="icy war hammer", id=7777, sell=1200},
        {name="Iron Helmet", id=2459, sell=150},
        {name="ivory comb", id=37608, sell=8000},
        {name="jade hammer", id=7422, sell=25000},
        {name="Key to the Drowned Library", id=15422, sell=330},
        {name="Kollos Shell", id=15480, sell=420},
        {name="krimhorn helmet", id=7461, sell=200},
        {name="lavos armor", id=8877, sell=16000},
        {name="leaf legs", id=9928, sell=500},
        {name="leaf star", id=29036, sell=50},
        {name="leopard armor", id=3968, sell=1000},
        {name="leviathan's amulet", id=10220, sell=3000},
        {name="life crystal", id=4851, sell=50},
        {name="life crystal", id=2177, sell=85},
        {name="life ring", id=2168, sell=50},
        {name="light shovel", id=5710, sell=300},
        {name="lightning boots", id=7893, sell=2500},
        {name="lightning headband", id=7901, sell=2500},
        {name="lightning legs", id=7895, sell=11000},
        {name="lightning pendant", id=7889, sell=1500},
        {name="lightning robe", id=7898, sell=11000},
        {name="lion figurine", id=38616, sell=10000},
        {name="locket", id=34694, sell=18000},
        {name="Longsword", id=2397, sell=51},
        {name="lunar staff", id=7424, sell=5000},
        {name="magic plate armor", id=2472, sell=90000},
        {name="magma amulet", id=7890, sell=1500},
        {name="magma boots", id=7891, sell=2500},
        {name="magma clump", id=18424, sell=570},
        {name="magma coat", id=7899, sell=11000},
        {name="magma legs", id=7894, sell=11000},
        {name="magma monocle", id=7900, sell=2500},
        {name="mammoth fur cape", id=7463, sell=6000},
        {name="mammoth fur shorts", id=7464, sell=850},
        {name="mammoth whopper", id=7381, sell=300},
        {name="mandrake", id=5015, sell=5000},
        {name="mastermind shield", id=2514, sell=50000},
        {name="medusa shield", id=2536, sell=9000},
        {name="mercenary sword", id=7386, sell=12000},
        {name="metal spike", id=11215, sell=320},
        {name="might ring", id=2164, sell=250},
        {name="mind stone", id=2178, sell=100},
        {name="mind stone", id=2178, sell=170},
        {name="model ship", id=2113, sell=1000},
        {name="moonlight rod", id=2186, sell=200},
        {name="moonstone", id=37606, sell=13000},
        {name="Morning Star", id=2394, sell=100},
        {name="muck rod", id=18411, sell=6000},
        {name="mycological bow", id=18454, sell=35000},
        {name="mysterious fetish", id=2194, sell=50},
        {name="mystic blade", id=7384, sell=30000},
        {name="naginata", id=2426, sell=2000},
        {name="Necklace of the Deep", id=15403, sell=3000},
        {name="necrotic rod", id=2185, sell=1000},
        {name="nightmare blade", id=7418, sell=35000},
        {name="noble armor", id=2486, sell=900},
        {name="noble axe", id=7456, sell=10000},
        {name="norse shield", id=7460, sell=1500},
        {name="northwind rod", id=8911, sell=1500},
        {name="obsidian lance", id=2425, sell=500},
        {name="onyx chip", id=24849, sell=500},
        {name="onyx pendant", id=24851, sell=3500},
        {name="opal", id=24850, sell=500},
        {name="orb", id=2176, sell=750},
        {name="Orcish Axe", id=2428, sell=350},
        {name="orcish maul", id=7392, sell=6000},
        {name="oriental shoes", id=24637, sell=15000},
        {name="Ornate Chestplate", id=15406, sell=60000},
        {name="Ornate Crossbow", id=15644, sell=12000},
        {name="Ornate Legs", id=15412, sell=40000},
        {name="ornate lion figurine", id=38616, sell=10000},
        {name="ornate locket", id=34694, sell=18000},
        {name="Ornate Mace", id=15414, sell=42000},
        {name="Ornate Shield", id=15413, sell=42000},
        {name="pair of iron fists", id=20108, sell=4000},
        {name="paladin armor", id=8891, sell=15000},
        {name="panpipes", id=2074, sell=150},
        {name="patched boots", id=2641, sell=2000},
        {name="pharaoh banner", id=13472, sell=1000},
        {name="pharaoh sword", id=2446, sell=23000},
        {name="phoenix shield", id=2539, sell=16000},
        {name="piece of draconian steel", id=5889, sell=3000},
        {name="piece of hell steel", id=5888, sell=500},
        {name="piece of hellfire armor", id=10581, sell=550},
        {name="piece of royal steel", id=5887, sell=10000},
        {name="pirate boots", id=5462, sell=3000},
        {name="pirate coin", id=40407, sell=110},
        {name="pirate hat", id=6096, sell=1000},
        {name="pirate knee breeches", id=5918, sell=200},
        {name="pirate shirt", id=6095, sell=500},
        {name="pirate voodoo doll", id=5810, sell=500},
        {name="plagueroot offshoot", id=34725, sell=280000},
        {name="plasma pearls", id=26162, sell=250},
        {name="plasmatic lightning", id=26176, sell=270},
        {name="Plate Armor", id=2463, sell=400},
        {name="Plate Legs", id=2647, sell=115},
        {name="platinum amulet", id=2171, sell=2500},
        {name="poisonous slime", id=10557, sell=50},
        {name="pool of chitinous glue", id=22541, sell=480},
        {name="porcelain mask", id=27756, sell=2000},
        {name="power ring", id=2166, sell=50},
        {name="prismatic quartz", id=27630, sell=450},
        {name="pristine worm head", id=30853, sell=15000},
        {name="protection amulet", id=2200, sell=100},
        {name="protective charm", id=12400, sell=60},
        {name="pulverized ore", id=18427, sell=400},
        {name="purple robe", id=12429, sell=110},
        {name="quara bone", id=12447, sell=500},
        {name="quara eye", id=12444, sell=350},
        {name="quara pincers", id=12446, sell=410},
        {name="quara tentacle", id=12443, sell=140},
        {name="queen's sceptre", id=7410, sell=20000},
        {name="quill", id=33314, sell=1100},
        {name="ragnir helmet", id=7462, sell=400},
        {name="rainbow quartz", id=29038, sell=500},
        {name="rare earth", id=30536, sell=80},
        {name="ratmiral's hat", id=40448, sell=150000},
        {name="red crystal fragment", id=18420, sell=800},
        {name="red dragon leather", id=5948, sell=200},
        {name="red dragon scale", id=5882, sell=200},
        {name="red gem", id=2156, sell=1000},
        {name="red goanna scale", id=36393, sell=190},
        {name="red piece of cloth", id=5911, sell=300},
        {name="relic sword", id=7383, sell=25000},
        {name="rhino hide", id=27056, sell=175},
        {name="rhino horn", id=27057, sell=265},
        {name="rhino horn carving", id=27054, sell=300},
        {name="rift bow", id=25522, sell=45000},
        {name="rift crossbow", id=25523, sell=45000},
        {name="rift lance", id=25383, sell=30000},
        {name="rift shield", id=25382, sell=50000},
        {name="ring of healing", id=2216, sell=100},
        {name="ring of the sky", id=2123, sell=30000},
        {name="rod", id=38764, sell=2200},
        {name="roots", id=38773, sell=1200},
        {name="rope belt", id=12448, sell=66},
        {name="rorc egg", id=21313, sell=120},
        {name="rorc feather", id=21310, sell=70},
        {name="rotten heart", id=36424, sell=74000},
        {name="royal axe", id=7434, sell=40000},
        {name="royal helmet", id=2498, sell=30000},
        {name="ruby necklace", id=2133, sell=2000},
        {name="ruthless axe", id=6553, sell=45000},
        {name="sabretooth", id=11228, sell=400},
        {name="sacred tree amulet", id=10219, sell=3000},
        {name="safety pin", id=12449, sell=120},
        {name="sais", id=11306, sell=16500},
        {name="sample of monster blood", id=32648, sell=250},
        {name="sapphire hammer", id=7437, sell=7000},
        {name="Scale Armor", id=2483, sell=75},
        {name="scale of corruption", id=12629, sell=680},
        {name="scale of gelidrazah", id=27607, sell=10000},
        {name="scarab amulet", id=2135, sell=200},
        {name="scarab pincers", id=10548, sell=280},
        {name="scarab shield", id=2540, sell=2000},
        {name="scroll of heroic deeds", id=12466, sell=230},
        {name="scythe leg", id=11229, sell=450},
        {name="sea horse figurine", id=36158, sell=42000},
        {name="sea serpent scale", id=10583, sell=520},
        {name="seeds", id=7732, sell=150},
        {name="shadow sceptre", id=7451, sell=10000},
        {name="shamanic talisman", id=24840, sell=200},
        {name="shark fins", id=40409, sell=250},
        {name="shimmering beatles", id=28998, sell=150},
        {name="shimmering beetles", id=28993, sell=150},
        {name="shiny stone", id=11227, sell=500},
        {name="shockwave amulet", id=10221, sell=3000},
        {name="sight of surrender's eye", id=22517, sell=3000},
        {name="signet ring", id=36427, sell=480000},
        {name="silencer claws", id=22534, sell=390},
        {name="silencer resonating chamber", id=22535, sell=600},
        {name="silken bookmark", id=33313, sell=550},
        {name="silver amulet", id=2170, sell=50},
        {name="silver brooch", id=2134, sell=150},
        {name="silver dagger", id=2402, sell=500},
        {name="silver hand mirror", id=37607, sell=10000},
        {name="single human eye", id=29001, sell=1000},
        {name="skeleton decoration", id=6526, sell=3000},
        {name="skull belt", id=12436, sell=80},
        {name="skull coin", id=37418, sell=12000},
        {name="skull fetish", id=24847, sell=250},
        {name="skull helmet", id=5741, sell=40000},
        {name="skull shatterer", id=20129, sell=170},
        {name="skullcracker armor", id=8889, sell=18000},
        {name="skunk tail", id=11191, sell=50},
        {name="slimy leg", id=30858, sell=4500},
        {name="small amethyst", id=2150, sell=200},
        {name="small diamond", id=2145, sell=300},
        {name="small emerald", id=2149, sell=250},
        {name="small enchanted amethyst", id=7762, sell=200},
        {name="small enchanted emerald", id=7761, sell=250},
        {name="small enchanted ruby", id=7760, sell=250},
        {name="small enchanted sapphire", id=7759, sell=250},
        {name="small energy ball", id=26180, sell=250},
        {name="small flask of eyedrops", id=12468, sell=95},
        {name="small notebook", id=12406, sell=480},
        {name="small oil lamp", id=2063, sell=150},
        {name="small pitchfork", id=12469, sell=70},
        {name="small ruby", id=2147, sell=250},
        {name="small sapphire", id=2146, sell=250},
        {name="small topaz", id=9970, sell=200},
        {name="small treasure chest", id=40406, sell=500},
        {name="snake skin", id=10611, sell=400},
        {name="snakebite rod", id=2182, sell=100},
        {name="sniper gloves", id=5875, sell=2000},
        {name="solid rage", id=26173, sell=310},
        {name="some grimeleech wings", id=25386, sell=1200},
        {name="soul stone", id=5809, sell=6000},
        {name="spark sphere", id=26174, sell=350},
        {name="sparkion claw", id=26158, sell=290},
        {name="sparkion legs", id=26160, sell=310},
        {name="sparkion stings", id=26161, sell=280},
        {name="sparkion tail", id=26159, sell=300},
        {name="spellbook of enlightenment", id=8900, sell=4000},
        {name="spellbook of lost souls", id=8903, sell=19000},
        {name="spellbook of mind control", id=8902, sell=13000},
        {name="spellbook of warding", id=8901, sell=8000},
        {name="Spellsinger's Seal", id=15421, sell=280},
        {name="spellwand", id=7735, sell=299},
        {name="sphinx feather", id=36272, sell=470},
        {name="sphinx tiara", id=36273, sell=360},
        {name="spider silk", id=5879, sell=100},
        {name="Spidris Mandible", id=15485, sell=450},
        {name="Spike Sword", id=2383, sell=240},
        {name="spike sword", id=2383, sell=1000},
        {name="spiked iron ball", id=11325, sell=100},
        {name="spiked squelcher", id=7452, sell=5000},
        {name="spirit container", id=5884, sell=40000},
        {name="spite's spirit", id=38761, sell=840000},
        {name="Spitter Nose", id=15481, sell=340},
        {name="spooky blue eye", id=10559, sell=95},
        {name="springsprout rod", id=8912, sell=3600},
        {name="srezz' eye", id=38938, sell=300},
        {name="stealth ring", id=2165, sell=200},
        {name="steel boots", id=2645, sell=30000},
        {name="Steel Helmet", id=2457, sell=293},
        {name="Steel Shield", id=2509, sell=80},
        {name="stone nose", id=18431, sell=590},
        {name="stone skin amulet", id=2197, sell=500},
        {name="stone wing", id=11195, sell=120},
        {name="stonerefiner's skull", id=30841, sell=100},
        {name="strand of medusa hair", id=11226, sell=600},
        {name="strange proto matter", id=26169, sell=300},
        {name="strange symbol", id=2174, sell=200},
        {name="striped fur", id=11210, sell=50},
        {name="sulphurous stone", id=11232, sell=100},
        {name="summer dress", id=8874, sell=1500},
        {name="swamplair armor", id=8880, sell=16000},
        {name="Swarmer Antenna", id=15479, sell=130},
        {name="sword ring", id=2207, sell=100},
        {name="tail of corruption", id=12628, sell=240},
        {name="tarantula egg", id=11198, sell=80},
        {name="tarnished rhino figurine", id=27055, sell=320},
        {name="tattered piece of robe", id=10601, sell=120},
        {name="taurus mace", id=7425, sell=500},
        {name="telescope eye", id=38769, sell=1600},
        {name="tempest shield", id=2542, sell=35000},
        {name="tentacle of tentugly", id=40446, sell=27000},
        {name="tentacle piece", id=12622, sell=5000},
        {name="tentugly's eye", id=40445, sell=52000},
        {name="tentugly's jaws", id=40447, sell=80000},
        {name="terra amulet", id=7887, sell=1500},
        {name="terra boots", id=7886, sell=2500},
        {name="terra hood", id=7903, sell=2500},
        {name="terra legs", id=7885, sell=11000},
        {name="terra mantle", id=7884, sell=11000},
        {name="terra rod", id=2181, sell=2000},
        {name="terramite eggs", id=11370, sell=50},
        {name="terramite legs", id=11371, sell=60},
        {name="terramite shell", id=11369, sell=170},
        {name="terrorbird beak", id=11190, sell=95},
        {name="thaian sword", id=7391, sell=16000},
        {name="the handmaiden's protector", id=6539, sell=50000},
        {name="the imperor's trident", id=6534, sell=50000},
        {name="the justice seeker", id=7390, sell=40000},
        {name="the plasmother's remains", id=6535, sell=50000},
        {name="thick fur", id=11224, sell=150},
        {name="thorn", id=10560, sell=100},
        {name="tiara", id=40413, sell=11000},
        {name="tiger eye", id=27629, sell=350},
        {name="time ring", id=2169, sell=100},
        {name="token of love", id=36429, sell=440000},
        {name="tooth file", id=21241, sell=60},
        {name="tooth of tazhadur", id=27608, sell=10000},
        {name="torn shirt", id=29040, sell=250},
        {name="tortoise shield", id=6131, sell=150},
        {name="trapped bad dream monster", id=22537, sell=900},
        {name="trollroot", id=12471, sell=50},
        {name="tunnel tyrant head", id=30830, sell=500},
        {name="tunnel tyrant shell", id=30831, sell=700},
        {name="turtle shell", id=5899, sell=90},
        {name="tusk", id=3956, sell=100},
        {name="twiceslicer", id=12613, sell=28000},
        {name="Two Handed Sword", id=2377, sell=450},
        {name="undead heart", id=11367, sell=200},
        {name="underworld rod", id=8910, sell=4400},
        {name="unholy bone", id=11233, sell=480},
        {name="unicorn figurine", id=34692, sell=50000},
        {name="urmahlullus mane", id=36458, sell=490000},
        {name="urmahlullus paws", id=36459, sell=245000},
        {name="urmahlullus tail", id=36457, sell=210000},
        {name="vampire dust", id=5905, sell=100},
        {name="vampire teeth", id=10602, sell=275},
        {name="vampire's cape chain", id=21244, sell=150},
        {name="vein of ore", id=18429, sell=330},
        {name="venison", id=21312, sell=55},
        {name="vexclaw talon", id=25384, sell=1100},
        {name="Viking Helmet", id=2473, sell=66},
        {name="Viking Shield", id=2531, sell=85},
        {name="vile axe", id=7388, sell=30000},
        {name="violet crystal shard", id=18414, sell=1500},
        {name="violet gem", id=2153, sell=10000},
        {name="violet glass plate", id=33985, sell=2150},
        {name="volatile proto matter", id=26170, sell=300},
        {name="voodoo doll", id=3955, sell=400},
        {name="wailing widow's necklace", id=11329, sell=3000},
        {name="wand of cosmic energy", id=2189, sell=2000},
        {name="wand of decay", id=2188, sell=1000},
        {name="wand of defiance", id=18390, sell=6500},
        {name="wand of draconia", id=8921, sell=1500},
        {name="wand of dragonbreath", id=2191, sell=200},
        {name="wand of everblazing", id=18409, sell=6000},
        {name="wand of inferno", id=2187, sell=3000},
        {name="wand of starstorm", id=8920, sell=3600},
        {name="wand of voodoo", id=8922, sell=4400},
        {name="wand of vortex", id=2190, sell=100},
        {name="war axe", id=2454, sell=12000},
        {name="war crystal", id=10571, sell=460},
        {name="War Hammer", id=2391, sell=470},
        {name="war hammer", id=2391, sell=1200},
        {name="war horn", id=2079, sell=8000},
        {name="warmaster's wristguards", id=11322, sell=200},
        {name="Warrior's Axe", id=15451, sell=11000},
        {name="Warrior's Shield", id=15453, sell=9000},
        {name="Waspoid Claw", id=15483, sell=320},
        {name="Waspoid Wing", id=15484, sell=190},
        {name="watermelon tourmaline", id=38614, sell=30000},
        {name="watermelon tourmaline", id=38615, sell=230000},
        {name="weaver's wandtip", id=11314, sell=250},
        {name="wedding ring", id=2121, sell=100},
        {name="werewolf fur", id=11234, sell=380},
        {name="white gem", id=37604, sell=12000},
        {name="white pearl", id=2143, sell=160},
        {name="white piece of cloth", id=5909, sell=100},
        {name="white silk flower", id=38843, sell=9000},
        {name="widow's mandibles", id=11328, sell=110},
        {name="wild flowers", id=28991, sell=120},
        {name="wild flowers", id=28996, sell=120},
        {name="wimp tooth chain", id=20127, sell=120},
        {name="winged tail", id=11230, sell=800},
        {name="witch broom", id=10569, sell=60},
        {name="witch hat", id=10570, sell=5000},
        {name="withered pauldrons", id=30842, sell=850},
        {name="withered scalp", id=30843, sell=900},
        {name="wolf paw", id=5897, sell=70},
        {name="wood cape", id=2664, sell=5000},
        {name="wooden spellbook", id=29004, sell=12000},
        {name="wyrm scale", id=10582, sell=400},
        {name="wyvern fang", id=7408, sell=1500},
        {name="wyvern talisman", id=10561, sell=265},
        {name="yellow gem", id=2154, sell=1000},
        {name="yellow piece of cloth", id=5914, sell=150},
        {name="yielowax", id=13881, sell=600},
        {name="young lich worm", id=36425, sell=25000},
        {name="zaoan armor", id=11301, sell=14000},
        {name="zaoan helmet", id=11302, sell=45000},
        {name="zaoan legs", id=11304, sell=14000},
        {name="zaoan shoes", id=11303, sell=5000},
        {name="zaoan sword", id=11307, sell=30000},
        {name="zaogun flag", id=11330, sell=600},
        {name="zaogun shoulderplates", id=11331, sell=150}
}    
    return itemsList
end

local function onBuy(cid, item, subType, amount, ignoreCap, inBackpacks)
    local player = Player(cid)
    local items = setNewTradeTable(getTable(player))
    local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)
    if not backpack or backpack:getEmptySlots(true) < 1 then
        player:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
        return false
    end
    if not ignoreCap and player:getFreeCapacity() < ItemType(items[item].itemId):getWeight(amount) then
        return player:sendTextMessage(MESSAGE_INFO_DESCR, 'You don\'t have enough cap.')
    end
    if not player:removeMoneyNpc(items[item].buyPrice * amount) then
        selfSay("You don't have enough money.", cid)
    else
        player:addItem(items[item].itemId, amount, true, subType)
        return player:sendTextMessage(MESSAGE_INFO_DESCR, 'Bought '..amount..'x '..items[item].realName..' for '..items[item].buyPrice * amount..' gold coins.')
    end
    return true
end

local function onSell(cid, item, subType, amount, ignoreCap, inBackpacks)
    local player = Player(cid)    
    if items[item].sellPrice and player:removeItem(items[item].itemId, amount) then
        player:addMoney(items[item].sellPrice * amount)
        return player:sendTextMessage(MESSAGE_INFO_DESCR, 'Sold '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.')
    else
        selfSay("You don't have item to sell.", cid)
    end
    return true
end

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

    if msgcontains(msg, "trade") then
        local player = Player(cid)
        openShopWindow(cid, getTable(player), onBuy, onSell)        
        npcHandler:say("Ok, vejamos o que vc tem para vender.", cid)
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, 'Ola, |PLAYERNAME| bem vindo!')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Bye.')

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

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

 

 

trademaster.lua

Compartilhar este post


Link para o post

0 respostass a esta questão

Recommended Posts

Até agora não há respostas para essa pergunta

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×