Oldschool'er
Tibia since 1998'
Hello im looking for a NPC so when you give a "Vampire Lord Token" you get 2 premium days also if possible to get 1 token every certain amount of levels. Levels 100, 200, 300, and 350 if possible
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Token Trader" script="tokentrader.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="130" head="0" body="113" legs="114" feet="114" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|, I trade vampire lord {tokens} for premium days."/>
</parameters>
</npc>
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
if(msgcontains(msg, 'token')) then
selfSay('Do you want to trade a vampire lord token for 2 premium days?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 9020, 1)) then
doPlayerAddPremiumDays(cid, 2)
selfSay('Here you are, 2 extra premium days!', cid)
else
selfSay('You don\'t have vampire lord tokens.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
selfSay('Ah, well then keep them!', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())