Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- domodlib('superUberDuperTaski_conf')
- 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 onThink() npcHandler:onThink() end
- function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
- local talkUser = {}
- local function doAddExp(cid, amount)
- return doSendAnimatedText(getThingPos(cid), amount, COLOR_WHITE) and doPlayerAddExperience(cid, amount)
- end
- local function doTakeReward(cid, table, repeatable, value)
- for i = 1, #table / 3 do
- if table[i * 3 - 2] == REWARD_ITEM then
- doPlayerAddItem(cid, table[i * 3 - 1], table[i * 3], true)
- elseif table[i * 3 - 2] == REWARD_EXP then
- doAddExp(cid, table[i * 3])
- elseif table[i * 3 - 2] == REWARD_STORAGE then
- doCreatureSetStorage(cid, table[i * 3 - 1], table[i * 3])
- elseif table[i * 3 - 2] == REWARD_MONEY then
- doPlayerAddMoney(cid, table[i * 3])
- elseif table[i * 3 - 2] == REWARD_SKILL then
- doPlayerSetSkill(cid, table[i * 3 - 1], getPlayerSkillLevel(cid, table[i * 3 - 1]) + table[i * 3])
- elseif table[i * 3 - 2] == REWARD_ADDON then
- doPlayerAddOutfit(cid, (getPlayerSex(cid) == 0 and table[i * 3 - 1][1] or table[i * 3 - 1][2]), table[i * 3])
- elseif table[i * 3 - 2] == REWARD_LEVEL then
- doPlayerAddLevel(cid, table[i * 3])
- end
- end
- end
- local function getDescription(cid, status, storage, first)
- local count = #status.details / 2
- local detail, complete = getDetails(cid, status, storage)
- talkUser[cid] = 0
- if status.var == TYPE_KILL then
- local message = 'You have already started a mission where you must kill %s. Come back when you done it.'
- if first then
- message = 'You have starting a first mission where you must kill %s. Good luck!'
- end
- return selfSay(message:format(detail), cid)
- elseif status.var == TYPE_ITEMBACK then
- local message = 'You have already started a mission where you must gather %s. Come back when you get it all.'
- if first then
- message = 'You have starting a first mission where you must gather %s. Come back when you get it all. Good luck!'
- end
- return selfSay(message:format(detail), cid)
- else
- return selfSay('You are not started any task. If you want to start {task} just ask me.', cid)
- end
- end
- function creatureSayCallback(cid, type, msg)
- if not npcHandler:isFocused(cid) or not npcHandler:isInRange(cid) then
- return false
- end
- local var = task[getCreatureName(getNpcCid())]
- if not var then
- selfSay('Something wrong. Probably task list are empty or something like that.', cid)
- return true
- end
- local storage = getCreatureStorage(cid, var.storage)
- local status = var[storage]
- if msg:find('task') then
- if storage == -1 then
- selfSay('Hi ' .. getCreatureName(cid) .. '! Do you want to start Naruto Gaiden? If you finish it you would get permamently bonus to drop x 2!', cid)
- talkUser[cid] = 1
- else
- getDescription(cid, status, var.storage + 100)
- end
- elseif msg:find('yes') then
- if talkUser[cid] == 1 then
- doCreatureSetStorage(cid, var.storage, 1)
- getDescription(cid, status, var.storage + 100)
- talkUser[cid] = 0
- end
- end
- end
- npcHandler:setMessage(MESSAGE_GREET, "Hi Hey Hello!")
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment