• 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!

Trade item with storage X

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
Yeah I know this is older than walking forward

But, I've seen this function on modules.lua, and I was wondering if we could make something on this:

LUA:
	-- Callback for requesting a trade window with the NPC.
	function ShopModule.requestTrade(cid, message, keywords, parameters, node)
		local module = parameters.module
		if(not module.npcHandler:isFocused(cid)) then
			return false
		end

		if(table.maxn(module.npcHandler.shopItems) == 0) then
			local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid) }
			local msg = module.npcHandler:parseMessage(module.npcHandler:getMessage(MESSAGE_NOSHOP), parseInfo)

			module.npcHandler:say(msg, cid)
			return true
		end

		local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid) }
		local msg = module.npcHandler:parseMessage(module.npcHandler:getMessage(MESSAGE_SENDTRADE), parseInfo)
		openShopWindow(cid, module.npcHandler.shopItems,
			function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
				module.npcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
			end,
			function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
				module.npcHandler:onSell(cid, itemid, subType, amount, ignoreCap, inBackpacks)
			end
		)

		module.npcHandler:say(msg, cid)
		return true
	end

The idea:

if getplayerstoragevalue X > 1 then

Instead of opening trade from shop_buyable
It opens from shop_buyable_storage

You know?

So it would be like this:

LUA:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Cael" script="data/npc/scripts/Cael.lua" walkinterval="2000" floorchange="0">
	<health now="185" max="185"/>
    <look type="66" head="0" body="0" legs="0" feet="0" addons="0"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="shop_buyable" value="blessed wooden stake,3953,1000;obsidian knife,3952,5000;" />
                <parameter key="shop_buyable_storage" value="blessed wooden stake,3953,1000;obsidian knife,3952,5000;didgeridoo,3952,5000;war drum,3953,1000;" />
		<parameter key="storage" value="2550" />
		<parameter key="storage_value" value="1" />
	</parameters>
</npc>
 
Back
Top