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('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell runes, wands and rods.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'runes') then
selfSay('I sell hmms, icicles, stalagmites, fireballs, uhs, gfbs, thunderstorms, avalanches, stone showers, explosions, sds, blank runes and mana runes.')
elseif msgcontains(msg, 'wands') then
selfSay('I sell wand of inferno (15k), plague (5k), cosmic energy (10k), vortex (free) and dragonbreath (1k).')
elseif msgcontains(msg, 'rods') then
selfSay('I sell quagmire (10k), snakebite (free), tempest (15k), volcanic (5k) and moonlight rod (1k).')
-- inicio da venda de wands =)
elseif msgcontains(msg, 'inferno') then
count = getCount(msg)
if count == 0 then
selfSay('0 A wand of inferno')
talk_start = os.clock()
else
buy(cid,2187,count,15000)
end
elseif msgcontains(msg, 'decay') then
count = getCount(msg)
if count == 0 then
selfSay('0 A wand of Decay')
talk_start = os.clock()
else
buy(cid,2188,count,5000)
end
elseif msgcontains(msg, 'cosmic energy') then
count = getCount(msg)
if count == 0 then
selfSay('0 A wand of cosmic energy')
talk_start = os.clock()
else
buy(cid,2189,count,10000)
end
elseif msgcontains(msg, 'vortex') then
count = getCount(msg)
if count == 0 then
selfSay('0 A wand of vortex')
talk_start = os.clock()
else
buy(cid,2190,count,0)
end
elseif msgcontains(msg, 'dragonbreath') then
count = getCount(msg)
if count == 0 then
selfSay('0 A Wand of Dragonbreath')
talk_start = os.clock()
else
buy(cid,2191,count,1000)
end
-- fim da venda de wands =)
-- inicio da venda de rods =)
elseif msgcontains(msg, 'terra') then
count = getCount(msg)
if count == 0 then
selfSay('0 A Terra Rod')
talk_start = os.clock()
else
buy(cid,2181,count,10000)
end
elseif msgcontains(msg, 'snakebite') then
count = getCount(msg)
if count == 0 then
selfSay('0 A Snakebite Rod')
talk_start = os.clock()
else
buy(cid,2182,count,0)
end
elseif msgcontains(msg, 'hailstorm') then
count = getCount(msg)
if count == 0 then
selfSay('0 A Hailstorm Rod')
talk_start = os.clock()
else
buy(cid,2183,count,15000)
end
elseif msgcontains(msg, 'necrotic') then
count = getCount(msg)
if count == 0 then
selfSay('0 A Necrotic Rod')
talk_start = os.clock()
else
buy(cid,2185,count,5000)
end
elseif msgcontains(msg, 'moonlight') then
count = getCount(msg)
if count == 0 then
selfSay('0 A Moonlight Rod')
talk_start = os.clock()
else
buy(cid,2186,count,1000)
end
-- fim da venda de rods =)
-- inicio da venda de runas =)
elseif msgcontains(msg, 'hmm') then
count = getCount(msg)
if count == 0 then
selfSay('0 Hmm? LOL?')
talk_start = os.clock()
else
buy(cid,2311,count,10)
end
elseif msgcontains(msg, 'uh') then
count = getCount(msg)
if count == 0 then
selfSay('0 UH? LOL?')
talk_start = os.clock()
else
buy(cid,2273,count,25)
end
elseif msgcontains(msg, 'gfb') then
count = getCount(msg)
if count == 0 then
selfSay('0 GFB? LOL?')
talk_start = os.clock()
else
buy(cid,2304,count,30)
end
elseif msgcontains(msg, 'explosion') then
count = getCount(msg)
if count == 0 then
selfSay('0 EXPLO? LOL?')
talk_start = os.clock()
else
buy(cid,2313,count,40)
end
elseif msgcontains(msg, 'sd') then
count = getCount(msg)
if count == 0 then
selfSay('0 SD? LOL?')
talk_start = os.clock()
else
buy(cid,2268,count,70)
end
elseif msgcontains(msg, 'icicle') then
count = getCount(msg)
if count == 0 then
selfSay('0 Icicle')
talk_start = os.clock()
else
buy(cid,2271,count,10)
end
elseif msgcontains(msg, 'stalagmite') then
count = getCount(msg)
if count == 0 then
selfSay('0 Stalagmite')
talk_start = os.clock()
else
buy(cid,2292,count,10)
end
elseif msgcontains(msg, 'fireball') then
count = getCount(msg)
if count == 0 then
selfSay('0 Fireball')
talk_start = os.clock()
else
buy(cid,2302,count,10)
end
elseif msgcontains(msg, 'avalanche') then
count = getCount(msg)
if count == 0 then
selfSay('0 Avalanche')
talk_start = os.clock()
else
buy(cid,2274,count,30)
end
elseif msgcontains(msg, 'stone shower') then
count = getCount(msg)
if count == 0 then
selfSay('0 Stone Shower')
talk_start = os.clock()
else
buy(cid,2288,count,30)
end
elseif msgcontains(msg, 'thunderstorm') then
count = getCount(msg)
if count == 0 then
selfSay('0 Thunderstorm')
talk_start = os.clock()
else
buy(cid,2314,count,30)
end
elseif msgcontains(msg, 'blank rune') then
count = getCount(msg)
if count == 0 then
selfSay('0 Blank Rune')
talk_start = os.clock()
else
buy(cid,2260,count,5)
end
elseif msgcontains(msg, 'mana rune') then
count = getCount(msg)
if count == 0 then
selfSay('0 Mana rune')
talk_start = os.clock()
else
buy(cid,2278,count,100)
end
elseif msgcontains(msg, 'bp mana potion') and focus == cid then
buy(cid,1988,1,1000)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
buy(cid,7620,getCount(msg),100,1)
talk_start = os.clock()
elseif msgcontains(msg, 'bp strong mana potion') and focus == cid then
buy(cid,1988,1,2000)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
buy(cid,7589,1,1)
talk_start = os.clock()
elseif msgcontains(msg, 'bp great mana potion') and focus == cid then
buy(cid,1988,1,4000)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
buy(cid,7590,1,1)
talk_start = os.clock()
elseif msgcontains(msg, 'bp health potion') and focus == cid then
buy(cid,1988,1,1000)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
buy(cid,7618,getCount(msg),1,1)
talk_start = os.clock()
elseif msgcontains(msg, 'bp strong health potion') and focus == cid then
buy(cid,1988,1,2000)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
buy(cid,7588,getCount(msg),1,1)
talk_start = os.clock()
elseif msgcontains(msg, 'bp great health potion') and focus == cid then
buy(cid,1988,1,4000)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
buy(cid,7591,getCount(msg),1,1)
talk_start = os.clock()
elseif msgcontains(msg, '10 hmm') and focus == cid then
buy(cid,3136,10,5)
talk_start = os.clock()
elseif msgcontains(msg, '50 hmm') and focus == cid then
buy(cid,3136,50,25)
talk_start = os.clock()
elseif msgcontains(msg, '100 hmm') and focus == cid then
buy(cid,3136,100,50)
talk_start = os.clock()
-- fim da venda de runas =)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end