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 = {}
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- 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 greetCallback(cid)
- talkState[talkUser] = 0
- return true
- end
- function creatureSayCallback(cid, type, msg)
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local trade = {
- {id=1691, storage=230, name="Red"},
- {id=1688, storage=160, name="Green"},
- {id=1690, storage=160, name="Blue"},
- {id=1689, storage=160, name="Yellow"},
- {id=1692, storage=160, name="Violet"},
- }
- local items = {}
- for _, item in ipairs(trade) do
- items[item.id] = {item_id = item.id, realName = item.name}
- end
- local onBuy = function(cid, item, amount, ignoreCap, inBackpacks)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE , "Kupiles "..items[item].realName.." Aura.")
- setPlayerStorageValue(cid,trade.storage,1)
- end
- if msgcontains(msg, 'Aura') or msgcontains(msg, 'Effects') then
- openShopWindow(cid, trade, onBuy, onSell)
- selfSay("Co dzis zaczarujesz?", cid)
- end
- return true
- end
- npcHandler:setMessage(MESSAGE_WALKAWAY, "Do zobaczenia!")
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement