Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local missionS =
- {
- {
- typ = "item",
- vals =
- {
- {12278, 15},
- {12165, 120},
- },
- reward =
- {
- ["exp"] = 1400,
- {12348, 5},
- {12522, 15},
- },
- dialog =
- {
- hp = "|PN|, eu gostaria de expandir minha plantação, porém não tenho as sementes sufícientes, você tem |ITEMS| para me ajudar?",
- nh = "Você não tem |ITEMS|.",
- hv = "Muito obrigado |PN|, ai está sua recompensa! Ainda preciso de ajuda... Diga {help}"
- },
- storage = 18907
- },
- {
- typ = "item",
- vals =
- {
- {12171, 15},
- {12200, 10},
- {10604, 25},
- },
- reward =
- {
- ["exp"] = 2600,
- {12573, 8},
- {2148, 85},
- },
- dialog =
- {
- hp = "Esses pokémons estão acabando com minha plantação, meu amigo está estudando esses pokémons para me ajudar a conter essa grande reprodução deles, você poderia nós ajudar trazendo |ITEMS|? Se puder me ajudar, saia pela cidade pelo lado debaixo, e atravessando a ponte, que lá você encontrará alguns materiais lá.",
- nh = "Você não tem |ITEMS|.",
- hv = "Obrigado pelos items |PN|, ai está sua recompensa!"
- },
- storage = 10238
- },
- {
- typ = "kill",
- vals =
- {
- ["phanpy"] = 10,
- ["weedle"] = 15,
- ["diglett"] = 10,
- ["pineco"] = 5,
- ["pidgeotto"] = 1,
- },
- reward =
- {
- ["exp"] = 2900,
- {12348, 5}
- },
- dialog =
- {
- hp = "Não entendo como esses pokémons estão se reproduzindo tão rápido, o lucro que eu conseguia com minhas maçãs diminuiu bastante, |PN|, você poderia derrotar |POKS| para tentar conter essa grande reprodução?",
- nh = "Você não derrotou |POKS|, por favor, derrote eles.",
- hv = "Obrigado por me ajudar |PN|, ai está sua recompensa!"
- },
- storage = 10239
- }
- }
- -- 4 - 5x potion - 350 exp
- local focus = 0
- local talk_start = 0
- local talkState = {}
- function onCreatureDisappear(cid, pos)
- if (isPlayer(focus)) then
- selfSay('Bye Bye.')
- focus = 0
- talk_start = 0
- end
- 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
- local function getMission(uid)
- for _, v in ipairs(missionS) do
- if (getPlayerStorageValue(uid, v.storage) < 1) then
- return v
- end
- end
- return false
- end
- function onCreatureSay(cid, typE, msg)
- local msg = string.lower(msg)
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- local mss = getMission(cid)
- if (msgcontains(msg, "bye") and (focus == cid)) then
- selfSay("Tchau ".. getCreatureName(cid) .. "!")
- selfSay("Tchau ".. getCreatureName(cid) .. "!", cid)
- focus = 0
- talkState[talkUser] = 0
- elseif (msgcontains(msg, 'hi') and (focus ~= cid)) and (isCreature(focus)) and getDistanceToCreature(cid) < 4 then
- selfSay(getCreatureName(cid) .. " espere sua vez.", cid)
- elseif (msgcontains(msg, 'hi')) and (not isCreature(focus)) and getDistanceToCreature(cid) < 4 then
- selfSay('Olá {' .. getCreatureName(cid) .. '}! As vezes preciso de uma help...')
- selfSay('Olá {' .. getCreatureName(cid) .. '}! As vezes preciso de uma {help}...', cid)
- focus, talk_start = cid, os.clock()
- elseif (msgcontains(msg, 'help')) and (focus == cid) then
- talk_start = os.clock()
- if (mss) then
- local h1, _ = mss.dialog.hp:gsub("|PN|", getCreatureName(cid))
- if (mss.typ == "item") then
- local items = ""
- for _, v in pairs(mss.vals) do
- items = items ..", " .. v[2] .." {".. getItemNameById(v[1]) .. "}"
- end
- local items = items:sub(3, #items)
- local h1, _ = h1:gsub("|ITEMS|", items)
- selfSay(h1, cid)
- talkState[talkUser] = 1
- elseif (mss.typ == "kill") then
- local pokes = ""
- local h1, _ = mss.dialog.hp:gsub("|PN|", getCreatureName(cid))
- for i, v in pairs(mss.vals) do
- pokes = pokes .. ", ".. v .." {".. string.upper(i:sub(1, 1)) .. i:sub(2, #i) .."}"
- end
- local pokes = pokes:sub(3, #pokes)
- local h1, _ = h1:gsub("|POKS|", pokes)
- selfSay(h1, cid)
- talkState[talkUser] = 1
- end
- else
- selfSay("Obrigado por perguntar, porém não estou precisando de ajuda.", cid)
- end
- elseif (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and (focus == cid) and (talkState[talkUser] == 1) then
- talk_start = os.clock()
- local mss = getMission(cid)
- local nv = true
- if (mss.typ == "item") then
- for i, v in pairs(mss.vals) do
- if (getPlayerItemCount(cid, v[1]) < v[2]) then
- nv = false
- break
- end
- end
- if (nv) then
- for i, v in pairs(mss.vals) do
- doPlayerRemoveItem(cid, v[1], v[2])
- end
- for i, v in pairs(mss.reward) do
- if (i == "exp") then
- doPlayerAddExperience(cid, v)
- doSendAnimatedText(getThingPos(cid), v, 215)
- else
- doPlayerAddItem(cid, v[1], v[2])
- end
- end
- local h1, _ = mss.dialog.hv:gsub("|PN|", getCreatureName(cid))
- selfSay(h1, cid)
- setPlayerStorageValue(cid, mss.storage, 1)
- talkState[talkUser] = 0
- else
- local items = ""
- for _, v in pairs(mss.vals) do
- items = items ..", ".. v[2] .." {".. getItemNameById(v[1]) .. "}"
- end
- local items = items:sub(3, #items)
- local h1, _ = mss.dialog.nh:gsub("|ITEMS|", items)
- selfSay(h1, cid)
- end
- elseif (mss.typ == "kill") then
- for i, v in pairs(mss.vals) do
- if (getPlayerStorageValue(cid, PokE_KillS[i]) < 1) then
- setPlayerStorageValue(cid, PokE_KillS[i], 0)
- end
- if (getPlayerStorageValue(cid, PokE_KillS[i]) < v) then
- nv = false
- break
- end
- end
- if (nv) then
- for i, v in pairs(mss.reward) do
- if (i == "exp") then
- doPlayerAddExperience(cid, v)
- doSendAnimatedText(getThingPos(cid), v, 215)
- else
- doPlayerAddItem(cid, v[1], v[2])
- end
- end
- local h1, _ = mss.dialog.hv:gsub("|PN|", getCreatureName(cid))
- selfSay(h1, cid)
- setPlayerStorageValue(cid, mss.storage, 1)
- talkState[talkUser] = 0
- else
- local pokes = ""
- for i, v in pairs(mss.vals) do
- if (getPlayerStorageValue(cid, PokE_KillS[i]) < 1) then
- setPlayerStorageValue(cid, PokE_KillS[i], 0)
- end
- if (getPlayerStorageValue(cid, PokE_KillS[i]) < v) then
- pokes = pokes .. ", ".. v - getPlayerStorageValue(cid, PokE_KillS[i]) .. "/"..v.." {".. string.upper(i:sub(1, 1)) .. i:sub(2, #i) .."}"
- end
- end
- local pokes = pokes:sub(3, #pokes)
- local h1, _ = mss.dialog.nh:gsub("|POKS|", pokes)
- selfSay(h1, cid)
- end
- end
- end
- return true
- end
- function onThink()
- doNpcSetCreatureFocus(focus)
- if (os.clock() - talk_start) > 60 then
- if isCreature(focus) then
- selfSay('Flw!!...', focus)
- end
- focus = 0
- talk_start = 0
- end
- if (isCreature(focus)) then
- if getDistanceToCreature(focus) > 3 then
- selfSay('Bye', focus)
- focus = 0
- talk_start = 0
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement