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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local outs = {
["jamaican"] = {181601},
["rapper"] = {181602},
["oriental"] = {181603},
["adventurer"] = {181605},
["bussines"] = {181606},
["atletic"] = {181607},
["punk"] = {181608},
["mercenary"] = {181610},
["hiker"] = {181611},
["assassin"] = {181654, 1},
["veteran trainer"] = {181653, 1},
["house"] = {181651, 1},
["vingaça"] = {181650, 1},
["playboy"] = {181649, 1},
["slash"] = {181648, 1},
["esquiador"] = {181647, 1},
["mergulhador"] = {181646, 1},
["hunter"] = {181645, 1}
}
msg = string.lower(msg)
local diamond = 12785 --id dos diamonds
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("Eu vendo as seguintes outfits: {Jamaican, Rapper, Oriental, Adventurer, Bussines, Atletic, Punk, Mercenary, Hiker, Assassin, Veteran Trainer, House, Vingaça, Playboy, Slash, Esquiador, Mergulhador e Hunter}, qual delas voce quer??", cid)
talkState[talkUser] = 2
elseif outs[msg] and talkState[talkUser] == 2 then
selfSay("Tem certeza que quer comprar essa outfit?", cid)
outfit = outs[tostring(msg)]
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, outfit[1]) <= 0 then
if getPlayerPremiumDays(cid) > 0 then
if outfit[2] then
if doPlayerRemoveItem(cid, diamond, outfit[2]) then
setPlayerStorageValue(cid, outfit[1], 1)
else
selfSay("Voce precisa de ".. outfit[2] .." diamonds para comprar essa outfit!", cid)
talkState[talkUser] = 0
return false
end
else
if getPlayerMoney(cid) >= 20000 then
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outfit[1], 1)
else
selfSay("Voce precisa de 200dl para comprar essa outfit!", cid)
talkState[talkUser] = 0
return false
end
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Voce ja tem essa outfit, so please, choose another outfit...", cid)
talkState[talkUser] = 0
return false
end
selfSay("So... Here is.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())