I made this for a friend. If you like it, just tell me. If not... well, go away.
firebootmaker.lua
Pyralis.xml
firebootmaker.lua
Code:
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, 'firewalker') or msgcontains(msg, 'boots') or msgcontains(msg, 'repair')) then
selfSay('So do you want to repair your worn firewalker boots for 50000 gold coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 10022) >= 1) then
if(doPlayerRemoveMoney(cid, 50000)) then
local item = getPlayerItemById(cid, true, 10022)
doTransformItem(item.uid, 9933)
selfSay('Have fun with your boots.', cid)
else
selfSay('Sorry dude, you don\'t have enough gold.', cid)
end
elseif(getPlayerItemCount(cid, 10022) >= 1) then
if(doPlayerRemoveMoney(cid, 50000)) then
local item = getPlayerItemById(cid, true, 10022)
doTransformItem(item.uid, 9933)
selfSay('Have fun with your boots.', cid)
else
selfSay('Sorry dude, you don\'t have enough gold.', cid)
end
else
selfSay('Dude, you need worn firewalker boots for me to repair them.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Seriously dude? Stop wasting my time and go away.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Pyralis.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Pyralis" script="firebootmaker.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="94" body="132" legs="114" feet="94" addons="2"/>
<parameters>
<parameter key="message_greet" value="What's up, |PLAYERNAME|? Got any boots I can repair?"/>
</parameters>
</npc>