I currently had a problem with my server, caused by npcsystem / lib that did not buy bundled items, so I upgraded to be able to buy, but now I had to pass all npcs moduleshop xml. For the .lua what happens is, my djin npcs are made from quest, and now they are selling and buying items freely, could someone help me lock, for just who owns the quest?
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local storage = 100057
local storage2 = 100032
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 greetCallback(cid)
Topic[cid] = 0
return true
end
function creatureSayCallback(cid, type, msg)
local p = getCreatureName(cid)
local v = getPlayerStorageValue(cid, storage)
if npcHandler:isFocused(cid) then
if msgcontains(msg, 'no') and Topic[cid] == 2 then
npcHandler:say("Dont disturb me then.",cid)
Topic[cid] = 1
elseif msgcontains(msg, 'no') and Topic[cid] >= 4 then
npcHandler:say("Dont disturb me then.",cid)
Topic[cid] = 3
end
end
if (msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) and getPlayerStorageValue(cid, storage) == -1 then
if getPlayerStorageValue(cid, 100054) == 2 and getPlayerStorageValue(cid, 9030) == 1 then
npcHandler:say("What do you want from me, "..p.."?", cid)
npcHandler:addFocus(cid)
Topic[cid] = 1
end
elseif Topic[cid] == 1 then
if msgcontains(msg, 'mission') and getPlayerStorageValue(cid, storage) == -1 then
npcHandler:say("So Baa'leal thinks you are up to do a mission for us? ...",cid)
npcHandler:say("I think he is getting old, entrusting human scum such as you are with an important mission like that. ...",cid, 1000)
npcHandler:say("I don't understand why you haven't been slaughtered right at the gates. ...",cid, 2500)
npcHandler:say("Are you prepared to embark on a dangerous mission for us?",cid, 3500)
Topic[cid] = 2
end
elseif Topic[cid] == 2 then
if msgcontains(msg, 'yes') and getPlayerStorageValue(cid, storage) == -1 then
npcHandler:say("All right then, human. Have you ever heard of the {Tears of Daraman}? ...",cid)
npcHandler:say("They are precious gemstones made of some unknown blue mineral and possess enormous magical power. ...",cid, 1000)
npcHandler:say("If you want to learn more about these gemstones don't forget to visit our library. ...",cid, 2000)
npcHandler:say("Anyway, one of them is enough to create thousands of our mighty djinn blades. ...",cid, 3000)
npcHandler:say("Unfortunately my last gemstone broke and therefore I'm not able to create new blades anymore. ...",cid, 4000)
npcHandler:say("To my knowledge there is only one place where you can find these gemstones - I know for a fact that the Marid have at least one of them. ...",cid, 5000)
npcHandler:say("Well... to cut a long story short, your mission is to sneak into Ashta'daramai and to steal it. ...",cid, 6000)
npcHandler:say("Needless to say, the Marid won't be too eager to part with it. Try not to get killed until you have delivered the stone to me.",cid, 7000)
setPlayerStorageValue(cid, 100062, 6)
setPlayerStorageValue(cid,10160, 1)
end
Topic[cid] = 0
end
if (msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) and getPlayerStorageValue(cid, storage) == 1 then
if getPlayerStorageValue(cid, storage) == 1 and getPlayerStorageValue(cid, 9030) == 1 then
npcHandler:say("What do you want from me, "..p.."?", cid)
npcHandler:addFocus(cid)
Topic[cid] = 3
end
elseif Topic[cid] == 3 then
if msgcontains(msg, 'mission') then
npcHandler:say("Did you find the tear of Daraman?",cid)
Topic[cid] = 4
end
elseif Topic[cid] == 4 then
if msgcontains(msg, 'yes') and doPlayerTakeItem(cid, 2346, 1) then
npcHandler:say("So you have made it? You have really managed to steal a Tear of Daraman? ...",cid)
npcHandler:say("Amazing how you humans are just impossible to get rid of. Incidentally, you have this character trait in common with many insects and with other vermin. ...",cid, 1000)
npcHandler:say("Nevermind. I hate to say it, but it you have done us a favour, human. That gemstone will serve us well. ...",cid, 3000)
npcHandler:say("Baa'leal, wants you to talk to {Malor} concerning some {new mission.} ...",cid, 4500)
npcHandler:say("Looks like you have managed to extended your life expectancy - for just a bit longer.",cid, 5500)
setPlayerStorageValue(cid,storage, 1)
setPlayerStorageValue(cid, 100062, 8)
setPlayerStorageValue(cid,100159, 3)
else
npcHandler:say("You better don't return here until you've got the Tear.", cid)
end
Topic[cid] = 0
end
if msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("Finally.",cid)
npcHandler:releaseFocus(cid)
npcHandler:resetNpc(cid)
Topic[cid] = 0
end
return true
end
local function onTradeRequest(cid)
if getPlayerStorageValue(cid, storage2) == -1 then
npcHandler:say('You did not give you the permission to trade with me.', cid)
return false
end
return true
end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- player vende pro npc
shopModule:addSellableItem({'Tower shield', 'Tower shield'}, 2528, 8000,'Tower shield')
shopModule:addSellableItem({'Vampire shield', 'Vampire shield'}, 2534, 15000,'Vampire shield')
shopModule:addSellableItem({'Ornamented Axe', 'Ornamented Axe'}, 7411, 20000,'Ornamented Axe')
shopModule:addSellableItem({'dreaded clever', 'dreaded clever'}, 7419, 15000,'dreaded clever')
shopModule:addSellableItem({'bonebreaker', 'bonebreaker'}, 7428, 10000,'bonebreaker')
shopModule:addSellableItem({'onyx flail', 'onyx flail'}, 7421, 22000,'onyx flail')
shopModule:addSellableItem({'haunted blade', 'haunted blade'}, 7407, 8000,'haunted blade')
shopModule:addSellableItem({'titan axe', 'titan axe'}, 7413, 4000,'titan axe')
shopModule:addSellableItem({'Dragon hammer', 'Dragon hammer'}, 2434, 2000,'Dragon hammer')
shopModule:addSellableItem({'Giant sword', 'Giant sword'}, 2393, 17000,'Giant sword')
shopModule:addSellableItem({'Knight axe', 'Knight axe'}, 2430, 2000,'Knight axe')
shopModule:addSellableItem({'Poison dagger', 'Poison dagger'}, 2411, 50,'Poison dagger')
shopModule:addSellableItem({'Scimitar', 'Scimitar'}, 2419, 150,'Scimitar')
shopModule:addSellableItem({'Serpent sword', 'Serpent sword'}, 2409, 900,'Serpent sword')
shopModule:addSellableItem({'Skull staff', 'Skull staff'}, 2436, 6000,'Skull staff')
shopModule:addSellableItem({'Dark armor', 'Dark armor'}, 2489, 400,'Dark armor')
shopModule:addSellableItem({'Knight armor', 'Knight armor'}, 2476, 5000,'Knight armor')
shopModule:addSellableItem({'Dark helmet', 'Dark helmet'}, 2490, 250,'Dark helmet')
shopModule:addSellableItem({'Mystic turban', 'Mystic turban'}, 2663, 150,'Mystic turban')
shopModule:addSellableItem({'Strange helmet', 'Strange helmet'}, 2479, 500,'Strange helmet')
shopModule:addSellableItem({'Warrior helmet', 'Warrior helmet'}, 2475, 5000,'Warrior helmet')
shopModule:addSellableItem({'Knight legs', 'Knight legs'}, 2477, 5000,'Knight legs')
shopModule:addSellableItem({'Ancient shield', 'Ancient shield'}, 2532, 900,'Ancient shield')
shopModule:addSellableItem({'Black shield', 'Black shield'}, 2529, 800,'Black shield')
-- player compra aqui
shopModule:addBuyableItem({'Ice rapier', 'Ice rapier'}, 2396, 5000,'Ice rapier')
shopModule:addBuyableItem({'Serpent sword', 'Serpent sword'}, 2409, 6000,'Serpent sword')
shopModule:addBuyableItem({'Dark armor', 'Dark armor'}, 2489, 1500,'Dark armor')
shopModule:addBuyableItem({'Dark helmet', 'Dark helmet'}, 2490, 1000,'Dark helmet')
shopModule:addBuyableItem({'Ancient shield', 'Ancient shield'}, 2532, 5000,'Ancient shield')
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)