Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 itemWindow = {
- {id=2208, subType=0, sell=50, name="axe ring"},
- {id=2191, subType=0, sell=100, name="wand of dragonbreath"},
- {id=2197, subType=0, sell=250, name="stone skin amulet"},
- {id=2172, subType=0, sell=25, name="bronze amulet"},
- {id=2209, subType=0, sell=50, name="club ring"},
- {id=2198, subType=0, sell=50, name="elven amulet"},
- {id=2199, subType=0, sell=25, name="garlic necklace"},
- {id=2177, subType=0, sell=25, name="life crystal"},
- {id=2162, subType=0, sell=20, name="magic lightwand"},
- {id=2178, subType=0, sell=50, name="mindstone"},
- {id=2176, subType=0, sell=375, name="orb"},
- {id=2166, subType=0, sell=25, name="power ring"},
- {id=2165, subType=0, sell=100, name="stealth ring"},
- {id=2207, subType=0, sell=50, name="sword ring"},
- {id=2189, subType=0, sell=1000, name="wand of cosmic energy"},
- {id=2188, subType=0, sell=500, name="wand of decay"},
- {id=8921, subType=0, sell=750, name="wand of draconia"},
- {id=2187, subType=0, sell=1500, name="wand of inferno"},
- {id=2190, subType=0, sell=50, name="wand of vortex"},
- {id=2532, subType=0, sell=450, name="ancient shield"},
- {id=2529, subType=0, sell=800, name="black shield"},
- {id=7428, subType=0, sell=5000, name="bonebreaker"},
- {id=2489, subType=0, sell=200, name="dark armor"},
- {id=2490, subType=0, sell=125, name="dark helmet"},
- {id=2434, subType=0, sell=1000, name="dragon hammer"},
- {id=7419, subType=0, sell=7500, name="dreaded cleaver"},
- {id=2393, subType=0, sell=8500, name="giant sword"},
- {id=7407, subType=0, sell=4000, name="haunted blade"},
- {id=2476, subType=0, sell=2500, name="knight armor"},
- {id=2430, subType=0, sell=1000, name="knight axe"},
- {id=2477, subType=0, sell=2500, name="knight legs"},
- {id=2663, subType=0, sell=75, name="mystic turban"},
- {id=7421, subType=0, sell=11000, name="onyx flail"},
- {id=7411, subType=0, sell=10000, name="ornamented axe"},
- {id=2411, subType=0, sell=25, name="poison dagger"},
- {id=2419, subType=0, sell=75, name="scimitar"},
- {id=2409, subType=0, sell=450, name="serpent sword"},
- {id=2436, subType=0, sell=3000, name="skull staff"},
- {id=2479, subType=0, sell=250, name="strange helmet"},
- {id=7413, subType=0, sell=2000, name="titan axe"},
- {id=2528, subType=0, sell=4000, name="tower shield"},
- {id=2534, subType=0, sell=7500, name="vampire shield"},
- {id=2475, subType=0, sell=2500, name="warrior helmet"},
- {id=7436, subType=0, sell=2500, name="angelic axe"},
- {id=2656, subType=0, sell=5000, name="blue robe"},
- {id=2518, subType=0, sell=600, name="beholder shield"},
- {id=2195, subType=0, sell=15000, name="boots of haste"},
- {id=2413, subType=0, sell=250, name="broadsword"},
- {id=7412, subType=0, sell=9000, name="butchers axe"},
- {id=2487, subType=0, sell=6000, name="crown armor"},
- {id=2491, subType=0, sell=1250, name="crown helmet"},
- {id=2488, subType=0, sell=6000, name="crown legs"},
- {id=2519, subType=0, sell=4000, name="crown shield"},
- {id=2497, subType=0, sell=3000, name="crusader helmet"},
- {id=2414, subType=0, sell=4500, name="dragon lance"},
- {id=2516, subType=0, sell=2000, name="dragon shield"},
- {id=2432, subType=0, sell=4000, name="fire axe"},
- {id=2392, subType=0, sell=2000, name="fire sword"},
- {id=7454, subType=0, sell=1500, name="glorious axe"},
- {id=2515, subType=0, sell=1000, name="guardian shield"},
- {id=2396, subType=0, sell=500, name="ice rapier"},
- {id=2486, subType=0, sell=450, name="noble armor"},
- {id=2425, subType=0, sell=250, name="obsidian lance"},
- {id=2539, subType=0, sell=8000, name="phoenix shield"},
- {id=7410, subType=0, sell=5000, name="queen sceptre"},
- {id=2498, subType=0, sell=15000, name="royal helmet"},
- {id=7451, subType=0, sell=5000, name="shadow sceptre"},
- {id=2383, subType=0, sell=500, name="spike sword"},
- {id=7391, subType=0, sell=8000, name="thaian sword"},
- {id=2391, subType=0, sell=600, name="war hammer"},
- {id=2193, subType=0, sell=50, name="ankh"},
- {id=2201, subType=0, sell=50, name="dragon necklace"},
- {id=2213, subType=0, sell=50, name="dwarven ring"},
- {id=2167, subType=0, sell=50, name="energy ring"},
- {id=2183, subType=0, sell=1500, name="hailstorm rod"},
- {id=2168, subType=0, sell=25, name="life ring"},
- {id=2164, subType=0, sell=125, name="might ring"},
- {id=2186, subType=0, sell=100, name="moonlight rod"},
- {id=2194, subType=0, sell=25, name="mysterious fetish"},
- {id=2185, subType=0, sell=500, name="necrotic rod"},
- {id=8911, subType=0, sell=750, name="northwind rod"},
- {id=2200, subType=0, sell=50, name="protection amulet"},
- {id=2214, subType=0, sell=50, name="ring of healing"},
- {id=2185, subType=0, sell=15, name="strange talisman"},
- {id=2170, subType=0, sell=25, name="silver amulet"},
- {id=2182, subType=0, sell=50, name="snakebite rod"},
- {id=2181, subType=0, sell=1000, name="terra rod"},
- {id=2169, subType=0, sell=50, name="time ring"}
- -- ID = ID DO ITEM
- -- SBUTYPE = SÓ DEUS SABE
- -- SELL = VALOR PARA O PLAYER VENDER
- -- NAME = NOME QUE APARECE NA JANELA DE COMPRA/VENDA
- }
- local itemWindowPremium = {
- {id=2208, subType=0, sell=100, name="axe ring"},
- {id=2191, subType=0, sell=200, name="wand of dragonbreath"},
- {id=2197, subType=0, sell=500, name="stone skin amulet"},
- {id=2172, subType=0, sell=50, name="bronze amulet"},
- {id=2209, subType=0, sell=100, name="club ring"},
- {id=2198, subType=0, sell=100, name="elven amulet"},
- {id=2199, subType=0, sell=50, name="garlic necklace"},
- {id=2177, subType=0, sell=50, name="life crystal"},
- {id=2162, subType=0, sell=40, name="magic lightwand"},
- {id=2178, subType=0, sell=100, name="mindstone"},
- {id=2176, subType=0, sell=750, name="orb"},
- {id=2166, subType=0, sell=50, name="power ring"},
- {id=2165, subType=0, sell=200, name="stealth ring"},
- {id=2207, subType=0, sell=100, name="sword ring"},
- {id=2189, subType=0, sell=2000, name="wand of cosmic energy"},
- {id=2188, subType=0, sell=1000, name="wand of decay"},
- {id=8921, subType=0, sell=1500, name="wand of draconia"},
- {id=2187, subType=0, sell=3000, name="wand of inferno"},
- {id=2190, subType=0, sell=100, name="wand of vortex"},
- {id=2532, subType=0, sell=900, name="ancient shield"},
- {id=2529, subType=0, sell=1600, name="black shield"},
- {id=7428, subType=0, sell=10000, name="bonebreaker"},
- {id=2489, subType=0, sell=400, name="dark armor"},
- {id=2490, subType=0, sell=250, name="dark helmet"},
- {id=2434, subType=0, sell=2000, name="dragon hammer"},
- {id=7419, subType=0, sell=15000, name="dreaded cleaver"},
- {id=2393, subType=0, sell=17000, name="giant sword"},
- {id=7407, subType=0, sell=8000, name="haunted blade"},
- {id=2476, subType=0, sell=5000, name="knight armor"},
- {id=2430, subType=0, sell=2000, name="knight axe"},
- {id=2477, subType=0, sell=5000, name="knight legs"},
- {id=2663, subType=0, sell=150, name="mystic turban"},
- {id=7421, subType=0, sell=22000, name="onyx flail"},
- {id=7411, subType=0, sell=20000, name="ornamented axe"},
- {id=2411, subType=0, sell=50, name="poison dagger"},
- {id=2419, subType=0, sell=150, name="scimitar"},
- {id=2409, subType=0, sell=900, name="serpent sword"},
- {id=2436, subType=0, sell=6000, name="skull staff"},
- {id=2479, subType=0, sell=500, name="strange helmet"},
- {id=7413, subType=0, sell=4000, name="titan axe"},
- {id=2528, subType=0, sell=8000, name="tower shield"},
- {id=2534, subType=0, sell=15000, name="vampire shield"},
- {id=2475, subType=0, sell=5000, name="warrior helmet"},
- {id=7436, subType=0, sell=5000, name="angelic axe"},
- {id=2656, subType=0, sell=10000, name="blue robe"},
- {id=2518, subType=0, sell=1200, name="beholder shield"},
- {id=2195, subType=0, sell=30000, name="boots of haste"},
- {id=2413, subType=0, sell=500, name="broadsword"},
- {id=7412, subType=0, sell=18000, name="butchers axe"},
- {id=2487, subType=0, sell=12000, name="crown armor"},
- {id=2491, subType=0, sell=2500, name="crown helmet"},
- {id=2488, subType=0, sell=12000, name="crown legs"},
- {id=2519, subType=0, sell=8000, name="crown shield"},
- {id=2497, subType=0, sell=6000, name="crusader helmet"},
- {id=2414, subType=0, sell=9000, name="dragon lance"},
- {id=2516, subType=0, sell=4000, name="dragon shield"},
- {id=2432, subType=0, sell=8000, name="fire axe"},
- {id=2392, subType=0, sell=4000, name="fire sword"},
- {id=7454, subType=0, sell=3000, name="glorious axe"},
- {id=2515, subType=0, sell=2000, name="guardian shield"},
- {id=2396, subType=0, sell=1000, name="ice rapier"},
- {id=2486, subType=0, sell=900, name="noble armor"},
- {id=2425, subType=0, sell=500, name="obsidian lance"},
- {id=2539, subType=0, sell=16000, name="phoenix shield"},
- {id=7410, subType=0, sell=10000, name="queen sceptre"},
- {id=2498, subType=0, sell=30000, name="royal helmet"},
- {id=7451, subType=0, sell=10000, name="shadow sceptre"},
- {id=2383, subType=0, sell=1000, name="spike sword"},
- {id=7391, subType=0, sell=16000, name="thaian sword"},
- {id=2391, subType=0, sell=1200, name="war hammer"},
- {id=2193, subType=0, sell=100, name="ankh"},
- {id=2201, subType=0, sell=100, name="dragon necklace"},
- {id=2213, subType=0, sell=100, name="dwarven ring"},
- {id=2167, subType=0, sell=100, name="energy ring"},
- {id=2183, subType=0, sell=3000, name="hailstorm rod"},
- {id=2168, subType=0, sell=50, name="life ring"},
- {id=2164, subType=0, sell=250, name="might ring"},
- {id=2186, subType=0, sell=200, name="moonlight rod"},
- {id=2194, subType=0, sell=50, name="mysterious fetish"},
- {id=2185, subType=0, sell=1000, name="necrotic rod"},
- {id=8911, subType=0, sell=1500, name="northwind rod"},
- {id=2200, subType=0, sell=100, name="protection amulet"},
- {id=2214, subType=0, sell=100, name="ring of healing"},
- {id=2185, subType=0, sell=30, name="strange talisman"},
- {id=2170, subType=0, sell=50, name="silver amulet"},
- {id=2182, subType=0, sell=100, name="snakebite rod"},
- {id=2181, subType=0, sell=2000, name="terra rod"},
- {id=2169, subType=0, sell=100, name="time ring"}
- -- ID = ID DO ITEM
- -- SBUTYPE = SÓ DEUS SABE
- -- SELL = VALOR PARA O PLAYER VENDER
- -- NAME = NOME QUE APARECE NA JANELA DE COMPRA/VENDA
- }
- local items = {}
- if(isPremium == true) then
- for _, item in ipairs(itemWindowPremium) do
- items[item.id] = {buyPrice = item.buy, sellPrice = item.sell, subType = item.subType, realName = item.name}
- end
- else
- for _, item in ipairs(itemWindow) do
- items[item.id] = {buyPrice = item.buy, sellPrice = item.sell, subType = item.subType, realName = item.name}
- end
- end
- local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
- if(items[item] == nil) then
- selfSay("Ehm.. sorry... this shouldn't be there, I'm not buying it.", cid)
- end
- if(subType < 1) then
- subType = -1
- end
- if(isPremium(cid) == true) then
- if(doPlayerRemoveItem(cid, item, amount, subType)) then
- doPlayerAddMoney(cid, items[item].sellPrice * 2 * amount)
- selfSay("Uhh... It's always good to make a profit.", cid)
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sold ".. amount .."x ".. items[item].realName .." for ".. items[item].sellPrice * 2 * amount .." gold.")
- else
- selfSay("No item, no deal.", cid)
- end
- else
- if(doPlayerRemoveItem(cid, item, amount, subType)) then
- doPlayerAddMoney(cid, items[item].sellPrice * amount)
- selfSay("Uhh... It's always good to make a profit.", cid)
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sold ".. amount .."x ".. items[item].realName .." for ".. items[item].sellPrice * amount .." gold.")
- else
- selfSay("No item, no deal.", cid)
- end
- end
- end
- function creatureSayCallback(cid, type, msg)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- if(msgcontains(msg, "trade")) then
- if(isPremium(cid) == true) then
- selfSay("Hmm, it's great to have someone to trade.", cid)
- openShopWindow(cid, itemWindowPremium, onBuy, onSell)
- else
- selfSay("Hmm, it's great to have someone to trade.", cid)
- openShopWindow(cid, itemWindow, onBuy, onSell)
- end
- end
- end
- local interval = 2 -- EM SEGUNDOS
- function onThink()
- local npc = getNpcCid()
- addEvent(function()
- if(isCreature(npc)) then
- doCreatureChangeOutfit(npc, {lookType = (getCreatureOutfit(npc).lookType == 80 and 51 or 80)})
- end
- end, interval*1000)
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement