local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Dowidzenia.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Witaj ' .. creatureGetName(cid) .. '! Sprzedaje plecaki run (bp runes).')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! czekaj chwile!.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'bp runes') then
selfSay('Sprzedaje bp hmm (2cc), bp uh (2cc), bp gfb (2cc), bp explosion (3cc), bp sd (8cc), bp mwall (4cc), bp manarune (10cc), bp paralize (5cc)')
elseif msgcontains(msg, 'bp sd') then
buyContainer(cid,2003,2268,100,80000)
elseif msgcontains(msg, 'bp hmm') then
buyContainer(cid,1998,2311,100,20000)
elseif msgcontains(msg, 'bp paralize') then
buyContainer(cid,2000,2278,50,50000)
elseif msgcontains(msg, 'bp uh') then
buyContainer(cid,2002,2273,100,20000)
elseif msgcontains(msg, 'bp gfb') then
buyContainer(cid,2000,2304,100,20000)
elseif msgcontains(msg, 'bp explosion') or msgcontains(msg, 'bp explo') then
buyContainer(cid,2001,2313,100,30000)
elseif msgcontains(msg, 'bp mwall') then
buyContainer(cid,1999,2293,100,40000)
elseif msgcontains(msg, 'bp manarune') then
buyContainer(cid,2000,2270,100,100000)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Dowidzenia, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepny prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dowidzenia!')
focus = 0
end
end
end