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 onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, "premium") or msgcontains(msg, "price")) then
selfSay("O premium esta no valor de 300K por 5 days.", cid)
elseif(msgcontains(msg, "premium") or msgcontains(msg, "Premium")) then
selfSay("Você gostaria de comprar 5 dias de premium?", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 2160, 30) == true) then
selfSay("Muito bem! Aproveite!", cid)
doPlayerAddPremiumDays(cid, 5)
talkState[talkUser] = 0
elseif(doPlayerRemoveItem(cid, 2152, 200) == true) then
selfSay("Muito bem! Aproveite!", cid)
doPlayerAddPremiumDays(cid, 5)
talkState[talkUser] = 0
elseif(doPlayerRemoveItem(cid, 2148, 20000) == true) then
selfSay("Muito bem! Aproveite!", cid)
doPlayerAddPremiumDays(cid, 5)
talkState[talkUser] = 0
else
selfSay("Desculpe, você não tem o {valor} necessário parar comprar uma premium.", cid)
talkState[talkUser] = 0
end
end
return TRUE
end
local node1 = keywordHandler:addKeyword({"first bless"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy the first blessing for 2000 (plus level depending amount) gold?"})
node1:addChildKeyword({"yes"}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 60, endLevel = 200})
node1:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "Too expensive, eh?"})
local node2 = keywordHandler:addKeyword({"second bless"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy the second blessing for 2000 (plus level depending amount) gold?"})
node2:addChildKeyword({"yes"}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 60, endLevel = 200})
node2:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "Too expensive, eh?"})
local node3 = keywordHandler:addKeyword({"third bless"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy the third blessing for 2000 (plus level depending amount) gold?"})
node3:addChildKeyword({"yes"}, StdModule.bless, {npcHandler = npcHandler, number = 3, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 60, endLevel = 200})
node3:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "Too expensive, eh?"})
local node4 = keywordHandler:addKeyword({"fourth bless"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy the fourth blessing for 2000 (plus level depending amount) gold?"})
node4:addChildKeyword({"yes"}, StdModule.bless, {npcHandler = npcHandler, number = 4, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 60, endLevel = 200})
node4:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "Too expensive, eh?"})
local node5 = keywordHandler:addKeyword({"fifth bless"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy the fifth blessing for 2000 (plus level depending amount) gold?"})
node5:addChildKeyword({"yes"}, StdModule.bless, {npcHandler = npcHandler, number = 5, premium = true, baseCost = 200000, levelCost = 666, startLevel = 60, endLevel = 200})
node5:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "Too expensive, eh?"})
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())