Tó:
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 time = 5
---------------------------------
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|, I can {create} wings or {information} about wings.") -- muda a frase só yes q não muda
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
---------------------------------
local function Sucesso(cid,id)
if isPlayer(cid) then
doPlayerAddItem(cid,id,1)
doPlayerSendTextMessage(cid, 27, "Success -> You created an ".. getItemNameById(id).."")
end
end
---------------------------------
local function Falha(cid, id)
if isPlayer(cid) then
doPlayerSendTextMessage(cid, 27, "Failed -> Trying to create your ".. getItemNameById(id).." failed.")
end
end
---------------------------------
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
---------------------------------
if(msgcontains(msg, 'create')) then
selfSay("Well .. I can only create three types of wings. {angelic wings}, {dragon wings} and {fairy wings}.", cid)
talkState[talkUser] = 1
return true
elseif msgcontains(msg, 'information') then
selfSay("Well .. I can show you informations about three wings, these wings are {angelic wings}, {dragon wings} and {fairy wings}.", cid)
talkState[talkUser] = 2
return true
elseif msgcontains(msg, 'angelic wings') and talkState[talkUser] == 2 then
doShowTextDialog(cid,2407,"####--> Informations <--####\n\nName: Angelic Wigns\nVocation: Mage\nLevel: 40\nPrice NPC: $40.000,00\nWeighs: 40.00 oz\n ")
return true
elseif msgcontains(msg, 'dragon wings') and talkState[talkUser] == 2 then
doShowTextDialog(cid,2417,"####--> Informations <--####\n\nName: Dragon Wings\nVocation: Warrior\nLevel: 40\nPrice NPC: $40.000,00\nWeighs: 40.00 oz\n ")
return true
elseif msgcontains(msg, 'fairy wings') and talkState[talkUser] == 2 then
doShowTextDialog(cid,2412,"####--> Informations <--####\n\nName: Fairy Wings\nVocation: Elf\nLevel: 40\nPrice NPC: $40.000,00\nWeighs: 40.00 oz\n ")
return true
elseif msgcontains(msg, 'angelical wings') and talkState[talkUser] == 1 then
selfSay("Ok .. You to create an angelic wing, 1kk you need, and you will have 35% chance of success, yet you want to create your wing?", cid)
talkState[TalkUser] = 3
return true
elseif msgcontains(msg, 'dragon wings') and talkState[talkUser] == 1 then
selfSay("Ok .. You to create an dragon wings, 1kk you need, and you will have 35% chance of success, yet you want to create your wing?", cid)
talkState[TalkUser] = 4
return true
elseif msgcontains(msg, 'fairy wings') and talkState[talkUser] == 1 then
selfSay("Ok .. You to create an fairy wings, 1kk you need, and you will have 35% chance of success, yet you want to create your wing?", cid)
talkState[TalkUser] = 5
return true
------------------------------------------------------------
elseif(msgcontains(msg, 'yes')) and talkState[talkUser] == 3 then
if math.random(1,100) <= 35 and getPlayerItemCount(cid,2160) >= 100 then
doPlayerRemoveItem(cid,2160,100)
addEvent(Sucesso, time*1000, cid, 2407)
talkState[talkUser] = 0
return true
elseif math.random(1,100) > 35 and getPlayerItemCount(cid,2160) >= 100 then
doPlayerRemoveItem(cid,2160,100)
addEvent(Falha, time*1000, cid, 2407)
talkState[talkUser] = 0
return true
elseif getPlayerItemCount(cid,2160) < 100 then
selfSay("Você não tem dinheiro suficiente!", cid)
return true
-------------------------------------------------------------
elseif(msgcontains(msg, 'yes')) and talkState[talkUser] == 4 then
if math.random(1,100) <= 35 and getPlayerItemCount(cid,2160) >= 100 then
doPlayerRemoveItem(cid,2160,100)
addEvent(Sucesso, time*1000, cid, 2417)
talkState[talkUser] = 0
return true
elseif math.random(1,100) > 35 and getPlayerItemCount(cid,2160) >= 100 then
doPlayerRemoveItem(cid,2160,100)
addEvent(Falha, time*1000, cid, 2417)
talkState[talkUser] = 0
return true
elseif getPlayerItemCount(cid,2160) < 100 then
selfSay("Você não tem dinheiro suficiente!", cid)
return true
-------------------------------------------------------------
elseif(msgcontains(msg, 'yes')) and talkState[talkUser] == 5 then
if math.random(1,100) <= 35 and getPlayerItemCount(cid,2160) >= 100 then
doPlayerRemoveItem(cid,2160,100)
addEvent(Sucesso, time*1000, cid, 2412)
talkState[talkUser] = 0
return true
elseif math.random(1,100) > 35 and getPlayerItemCount(cid,2160) >= 100 then
doPlayerRemoveItem(cid,2160,100)
addEvent(Falha, time*1000, cid, 2412)
talkState[talkUser] = 0
return true
elseif getPlayerItemCount(cid,2160) < 100 then
selfSay("Você não tem dinheiro suficiente!", cid)
return true
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())







info
Grupo: Visconde
Registrado: 21/09/10
Posts: 319
Reputação: +27
Char no Tibia: lest sarif
Duvida Sanada.
Editado Outubro 14 por tonynamoral