Lua:
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
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
local items = {[VOCATION_SORCERER] = 2190, [VOCATION_DRUID] = 2182}
local itemId = items[player:getVocation():getBase():getId()]
if msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand') then
if player:isMage() then
if player:getStorageValue(PlayerStorageKeys.firstMageWeapon) == -1 then
npcHandler:say('So you ask me for a {' .. ItemType(itemId):getName() .. '} to begin your adventure?', cid)
npcHandler.topic[cid] = 1
else
npcHandler:say('What? I have already gave you one {' .. ItemType(itemId):getName() .. '}!', cid)
end
else
npcHandler:say('Sorry, you aren\'t a druid either a sorcerer.', cid)
end
elseif msgcontains(msg, 'yes') then
if npcHandler.topic[cid] == 1 then
player:addItem(itemId, 1)
npcHandler:say('Here you are young adept, take care yourself.', cid)
player:setStorageValue(PlayerStorageKeys.firstMageWeapon, 1)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
npcHandler:say('Ok then.', cid)
npcHandler.topic[cid] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
this is my data/lib/core/storages.lua
j5u7r - Ghostbin
paste.bingner.com
Code:
firstMageWeapon = 50079,