• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[AVESTA SQL 7.6] 100x Runes!

Anyjia

KillaBeez
Joined
Jun 10, 2007
Messages
220
Reaction score
37
Location
Sweden
Hello!

This script is giving me ability to buy 100x runes. or 58x. Or whatever I like.
Problem: People can buy 500x runes. Why?
Edit: To be clear; I want the maximum rune charge to be 100x!
Thanks in advance.

Code:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'light wand', 'lightwand'}, 		2163, 120, 		'magic light wand')
shopModule:addBuyableItem({'spell book', 'spellbook'}, 		2175, 150, 		'spellbook')
shopModule:addBuyableItem({'mana fluid', 'manafluid'}, 		2006, 55, 	7, 	'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'}, 		2006, 50, 	10,	'life fluid')
shopModule:addBuyableItem({'blank'}, 				2260, 10, 		'blank rune')

shopModule:addBuyableItem({'life ring'}, 	2168, 900, 	1,	'life ring')

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 				2187, 15000, 	'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 				2188, 5000, 	'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 			2189, 10000,	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 				2190, 500, 	'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 			2191, 1000, 	'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 				2181, 10000, 	'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 				2182, 500, 	'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'}, 					2183, 15000, 	'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 				2185, 5000, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 				2186, 1000,   	'moonlight rod')

function creatureSayCallback(cid, type, msg)
	if(npcHandler.focus ~= cid) then
		return FALSE
	end
	if msgcontains(msg, 'runes') then
		selfSay("I sell all kind of runes. For example, say 100 SUDDEN DEATH RUNE or 1 SD.")
		talk_state = 0
	elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'hmm') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 12*charges
		selfSay('Do you want a heavy magic missile rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2311
	elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 90*charges
		selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2304
	elseif msgcontains(msg, 'explosion') or msgcontains(msg, 'explo') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 60*charges
		selfSay('Do you want an explosion rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2313
	elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'uh') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 175*charges
		selfSay('Do you want an ultimate healing rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2274
	elseif msgcontains(msg, 'sudden death') or msgcontains(msg, 'sd') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 325*charges
		selfSay('Do you want a sudden death rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2263
        elseif msgcontains(msg, 'light magic missile') or msgcontains(msg, 'lmm') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 4*charges
		selfSay('Do you want a light magic missile rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2287
        elseif msgcontains(msg, 'poison field') or msgcontains(msg, 'pf') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 20*charges
		selfSay('Do you want a poison field rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2285
        elseif msgcontains(msg, 'poison wall') or msgcontains(msg, 'pw') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 50*charges
		selfSay('Do you want a poison wall rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2289
        elseif msgcontains(msg, 'intense healing') or msgcontains(msg, 'ih') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 40*charges
		selfSay('Do you want a intense healing rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2265
        elseif msgcontains(msg, 'fire wall') or msgcontains(msg, 'fw') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 60*charges
		selfSay('Do you want a fire wall rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2303
        elseif msgcontains(msg, 'fire field') or msgcontains(msg, 'ff') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 25*charges
		selfSay('Do you want a fire field rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2301
        elseif msgcontains(msg, 'fire bomb') or msgcontains(msg, 'fb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 115*charges
		selfSay('Do you want a fire bomb rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2305
        elseif msgcontains(msg, 'energy wall') or msgcontains(msg, 'ew') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 85*charges
		selfSay('Do you want an energy wall rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2279
        elseif msgcontains(msg, 'energy field') or msgcontains(msg, 'ef') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 35*charges
		selfSay('Do you want an energy field rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2277
        elseif msgcontains(msg, 'destroy field') or msgcontains(msg, 'df') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 15*charges
		selfSay('Do you want a destroy field rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2261
        elseif msgcontains(msg, 'convince creature') or msgcontains(msg, 'cc') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 80*charges
		selfSay('Do you want a convince creature rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2290
        elseif msgcontains(msg, 'chameleon') or msgcontains(msg, 'c') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 210*charges
		selfSay('Do you want a chameleon rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2291
        elseif msgcontains(msg, 'antidote') or msgcontains(msg, 'a') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 65*charges
		selfSay('Do you want an antidote rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2266
        elseif msgcontains(msg, 'magic wall') or msgcontains(msg, 'mw') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 80*charges
		selfSay('Do you want a magic wall rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2293
        elseif msgcontains(msg, 'paralyze') or msgcontains(msg, 'para') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 700*charges
		selfSay('Do you want a paralyze rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2278
        elseif msgcontains(msg, 'fireball') or msgcontains(msg, 'fire ball') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 50*charges
		selfSay('Do you want a fireball rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2302
        elseif msgcontains(msg, 'soulfire') or msgcontains(msg, 'soul fire') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 70*charges
		selfSay('Do you want a soulfire rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2308
        elseif msgcontains(msg, 'animate dead') or msgcontains(msg, 'ad') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 375*charges
		selfSay('Do you want an animated dead rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2316
        elseif msgcontains(msg, 'poison bomb') or msgcontains(msg, 'pb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 85*charges
		selfSay('Do you want a poison bomb rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2286
        elseif msgcontains(msg, 'energy bomb') or msgcontains(msg, 'eb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 80*charges
		selfSay('Do you want an energy bomb rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2262
        elseif msgcontains(msg, 'desintegrate') or msgcontains(msg, 'dg') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 60*charges
		selfSay('Do you want a desintegrate rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2310
	elseif msgcontains(msg, 'yes') and talk_state == 1 then
		if doPlayerRemoveMoney(cid, price) == TRUE then
			doPlayerGiveItem(cid, itemid, 1, charges)
			selfSay("You have bought this rune.")
			talk_state = 0
		else
			selfSay("You don't have enough money.")
			talk_state = 0
		end
	elseif msgcontains(msg, 'no') and talk_state == 1 then
		selfSay("Then not.")
		talk_state = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
The reason half the questions on here dont get answered is people see them and think? "can you really be this stupid?"
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
 
function returnVials(cid, message, keywords, parameters, node)
    if(npcHandler.focus ~= cid) then
        return false
    end
 
    local amount = removePlayerItemsWithCharges(cid, parameters.itemid, parameters.charges)
    if(amount <= 0) then
        npcHandler:say('You do not have any.')
    else
        local price = amount*parameters.cost
        if(doPlayerAddMoney(cid, price) == LUA_NO_ERROR) then
            npcHandler:say('Here are your reward of ' .. price .. ' gold coins. It was a pleasure doing business with you.')
        else
            error('[Error] returnVials:', 'Could not give ' .. price .. ' gold coins to player ' .. getPlayerName(cid))
        end
    end
    npcHandler:resetNpc()
    return true
end
 
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)



keywordHandler:addKeyword({'missile'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell light magic missile(40gp), heavy magic missile(125gp) and sudden death(325gp) runes.'})
keywordHandler:addKeyword({'explosive runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell fireball(95gp), great fireball(180gp) and explosion(250gp) runes.'})
keywordHandler:addKeyword({'field runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell fire field(85gp), energy field(115gp), poison field(65gp) and destroy field(45gp) runes.'})
keywordHandler:addKeyword({'wall runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell fire wall(245gp), energy wall(340gp) and poison wall(210gp) runes. I also sell magic wall runes for 350gp.'})
keywordHandler:addKeyword({'bomb runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell fire bomb(210gp), poison bomb(170gp) and energy bomb(325gp) runes.'})
keywordHandler:addKeyword({'healing runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell antidote(65gp), intense healing(95gp) and ultimate healing(175gp) runes.'})
keywordHandler:addKeyword({'other spell runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell convince creature(80gp) and chameleon(210gp) runes, but also envenom(130gp), desintegrate(80gp), soulfire(210gp) and paralyze(700gp) runes.'})
keywordHandler:addKeyword({'wands'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell wand of vortex(free), magic lightwand(500gp), dragonbreath(1k), plague(5k), cosmic energy(10k) and inferno(15k).'})
keywordHandler:addKeyword({'rods'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell snakebite(free), moonlight(1k), volcanic(5k), quarmire(10k) and tempest rods(15k).'})
keywordHandler:addKeyword({'fluids'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell mana fluids(30gp) and life fluids(60gp). I also sell strong mana potions(100gp).'})

shopModule:addBuyableItem({'mana fluid', 'manafluid', 'mf'}, 	2006, 55, 	7, 	'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid', 'lf'}, 	2006, 60, 	10,	'life fluid')

shopModule:addBuyableItem({'blank rune'}, 		2260, 10, 		'blank rune')

shopModule:addBuyableItem({'light magic missile', 'lmm'}, 	2287, 40, 10,		'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 	2311, 125, 10,		'heavy magic missile rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 		2263, 325, 2, 		'sudden death rune')
shopModule:addBuyableItem({'great fireball rune', 'gfb'}, 		2304, 180, 4, 		'great fireball rune')
shopModule:addBuyableItem({'great energyball rune', 'geb'}, 		2280, 220, 4, 		'great energyball rune')
shopModule:addBuyableItem({'fireball'}, 			2302, 95,  5,		'fire ball')
shopModule:addBuyableItem({'explosion', 'explo'}, 		2314, 250, 6, 		'explosion rune')

shopModule:addBuyableItem({'fire field', 'ff'}, 		2301, 85,  3,		'fire field rune')
shopModule:addBuyableItem({'energy field', 'ef'}, 		2277, 115, 3, 		'energy field')
shopModule:addBuyableItem({'poison field', 'pf'}, 		2285, 65,  3,		'poison field')
shopModule:addBuyableItem({'destroy field', 'df'}, 		2261, 45,  3, 		'destroy field')

shopModule:addBuyableItem({'fire wall', 'fw'}, 			2303, 245, 4,		'fire wall rune')
shopModule:addBuyableItem({'energy wall', 'ew'}, 		2279, 340, 4,		'energy wall rune')
shopModule:addBuyableItem({'poison wall', 'pw'}, 		2289, 210, 4,		'poison wall rune')
shopModule:addBuyableItem({'magic wall', 'mw'}, 		2293, 350, 3,		'magic wall rune')

shopModule:addBuyableItem({'fire bomb'}, 			2305, 235, 2,		'fire bomb rune')
shopModule:addBuyableItem({'poison bomb'}, 			2286, 170, 2,		'poison bomb rune')
shopModule:addBuyableItem({'energy bomb'}, 			2262, 325, 2,		'energy bomb rune')

shopModule:addBuyableItem({'antidote'}, 			2266, 65, 1, 		'antidote rune')
shopModule:addBuyableItem({'intense healing', 'ih'}, 		2265, 95, 1,		'intense healing rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 		2274, 175, 2, 		'ultimate healing rune')

shopModule:addBuyableItem({'convince creature'}, 		2290, 80, 1,		'convince creature rune')	
shopModule:addBuyableItem({'soulfire rune'}, 			2308, 210, 3, 		'soulfire rune')
shopModule:addBuyableItem({'envenom'}, 				2292, 130, 1, 		'envenom rune')


shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 			2187, 15000, 	'wand of inferno')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 		2189, 10000,  	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 			2188, 5000, 	'wand of plague')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 		2191, 1000, 	'wand of dragonbreath')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 			2190, 500, 	'wand of vortex')
shopModule:addBuyableItem({'magic light wand', 'magic lightwand'}, 		2163, 500, 	'magic light wand')

shopModule:addBuyableItem({'tempest rod', 'tempest'}, 				2183, 15000, 	'tempest rod')
shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 			2181, 10000,  	'quagmire rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 			2185, 5000, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 			2186, 1000, 	'moonlight rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 			2182, 500, 	'snakebite rod')

local node = keywordHandler:addKeyword({'flask'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to return all your empty vials for 5 gold coins each?'})
	node:addChildKeyword({'yes'}, returnVials, {itemid = 2006, charges = 0, cost = 5})
	node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Allright then.'})

npcHandler:addModule(FocusModule:new())

local node = keywordHandler:addKeyword({'vial'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to return all your empty vials for 5 gold coins each?'})
	node:addChildKeyword({'yes'}, returnVials, {itemid = 2006, charges = 0, cost = 5})
	node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Allright then.'})

npcHandler:addModule(FocusModule:new())
Just change all the charges to 100. Not very hard.
Edit: AH. i see you want multiple charges.. best thing to do would be to make only like 10x, 50x, 75x, or 100x buyable ya dig?
 
Last edited by a moderator:
you noob? i want massg you in yahoo bec i can't help you here
i want masssg you in yahoo petter! right?
 
Back
Top