• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Addon Item Seller

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
I don't know if someone released a Addon Item Seller before.

I made a simple NPC for that. If you like it, feel free to rep+ me.


Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Addon Item Seller" script="default.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150"/>
	<look type="128" head="25" body="95" legs="50" feet="99" addons="3" corpse="2212"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I can sell addon items to you. Just {trade} with me. "/>
		<parameter key="module_shop" value="1"/>
		<parameter key="shop_buyable" value="mermaid comb,5945,300000;fighting spirit,5884,150000;banana staff,3966,1500;tribal mask,3967,1500;simon the beggar's favorite staff,6107,1500;damaged steel helmet,5924,1000;piece of royal steel,5887,1000;piece of hell steel,5888,1000;enchanted chicken wing,5891,1000;piece of draconian steel,5889,1000;botanist container,5937,100000;magic sulphur,5904,100000;waterhose,5938,100000;chunk of crude iron,5892,100000;iron ore,5880,1000;ankh,2193,1000;red poc,5911,1000;yellow poc,5914,1000;green poc,5910,1000;demon dust,5906,5000;blue poc,5912,1000;white poc,5909,1000;warriors sweat,5885,100000; beholder eye,5898, 1000; demonic essence,6500,600; minotaur leather,5878,1000; lizard scale,5881,1000; behemoth claw,5930,1000; vampire dusts,5905,1000; turtle shells,5899,1000; spider silk,5879,1000; shard,7290,30000; honeycomb,5902,1000; hardened bone,5925,1000; fish fin,5895,1000; demon horn,5954,1000; bear paw,5896,1000; bat wing,5894,1000; green dragon scale,5920,1000; red dragon scale,5882,1000; green lizard leather,5876,1000; green dragon leather,5877,1000; lottery ticket,5958,100000"/>
	</parameters>
</npc>
 
for canary please!
FOR CANARY PLEASEEEEEE!

Code:
local internalNpcName = "Addon Item Seller"
local npcType = Game.createNpcType(internalNpcName)
local npcConfig = {}

npcConfig.name = internalNpcName
npcConfig.description = internalNpcName

npcConfig.health = 100
npcConfig.maxHealth = npcConfig.health
npcConfig.walkInterval = 2000
npcConfig.walkRadius = 2

npcConfig.outfit = {
    lookType = 128,
    lookHead = 25,
    lookBody = 95,
    lookLegs = 50,
    lookFeet = 99,
    lookAddons = 3,
}

npcConfig.flags = {
    floorchange = false,
}

npcConfig.shop = { -- Sellable items
    { itemName = "mermaid comb", clientId = 5945, buy = 300000 },
    { itemName = "fighting spirit", clientId = 5884, buy = 150000 },
    { itemName = "banana staff", clientId = 3348, buy = 1500 },
    { itemName = "tribal mask", clientId = 3403, buy = 1500 },
    { itemName = "simon the beggar's favorite staff", clientId = 6107, buy = 1500 },
    { itemName = "damaged steel helmet", clientId = 5924, buy = 1000 },
    { itemName = "piece of royal steel", clientId = 5887, buy = 1000 },
    { itemName = "piece of hell steel", clientId = 5888, buy = 1000 },
    { itemName = "enchanted chicken wing", clientId = 5891, buy = 1000 },
    { itemName = "piece of draconian steel", clientId = 5889, buy = 1000 },
    { itemName = "botanist container", clientId = 5937, buy = 100000 },
    { itemName = "magic sulphur", clientId = 5904, buy = 100000 },
    { itemName = "waterhose", clientId = 5938, buy = 100000 },
    { itemName = "chunk of crude iron", clientId = 5892, buy = 100000 },
    { itemName = "iron ore", clientId = 5880, buy = 1000 },
    { itemName = "ankh", clientId = 2193, buy = 1000 },
    { itemName = "red poc", clientId = 5911, buy = 1000 },
    { itemName = "yellow poc", clientId = 5914, buy = 1000 },
    { itemName = "green poc", clientId = 5910, buy = 1000 },
    { itemName = "demon dust", clientId = 5906, buy = 5000 },
    { itemName = "blue poc", clientId = 5912, buy = 1000 },
    { itemName = "white poc", clientId = 5909, buy = 1000 },
    { itemName = "warriors sweat", clientId = 5885, buy = 100000 },
    { itemName = "beholder eye", clientId = 5898, buy = 1000 },
    { itemName = "demonic essence", clientId = 6500, buy = 600 },
    { itemName = "minotaur leather", clientId = 5878, buy = 1000 },
    { itemName = "lizard scale", clientId = 5881, buy = 1000 },
    { itemName = "behemoth claw", clientId = 5930, buy = 1000 },
    { itemName = "vampire dusts", clientId = 5905, buy = 1000 },
    { itemName = "turtle shells", clientId = 5899, buy = 1000 },
    { itemName = "spider silk", clientId = 5879, buy = 1000 },
    { itemName = "shard", clientId = 7290, buy = 30000 },
    { itemName = "honeycomb", clientId = 5902, buy = 1000 },
    { itemName = "hardened bone", clientId = 5925, buy = 1000 },
    { itemName = "fish fin", clientId = 5895, buy = 1000 },
    { itemName = "demon horn", clientId = 5954, buy = 1000 },
    { itemName = "bear paw", clientId = 5896, buy = 1000 },
    { itemName = "bat wing", clientId = 5894, buy = 1000 },
    { itemName = "green dragon scale", clientId = 5920, buy = 1000 },
    { itemName = "red dragon scale", clientId = 5882, buy = 1000 },
    { itemName = "green lizard leather", clientId = 5876, buy = 1000 },
    { itemName = "green dragon leather", clientId = 5877, buy = 1000 },
    { itemName = "lottery ticket", clientId = 5957, buy = 100000 },
}

-- On buy npc shop message
npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost)
    npc:sellItem(player, itemId, amount, subType, 0, ignore, inBackpacks)
end
-- On sell npc shop message
npcType.onSellItem = function(npc, player, itemId, subtype, amount, ignore, name, totalCost)
    player:sendTextMessage(MESSAGE_TRADE, string.format("Sold %ix %s for %i gold.", amount, name, totalCost))
end
-- On check npc shop message (look item)
npcType.onCheckItem = function(npc, player, clientId, subType) end

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
    npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
    npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
    npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
    npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
    npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
    npcHandler:onCloseChannel(npc, creature)
end

npcHandler:setMessage(MESSAGE_GREET, "Hello "..player:getName()..". I can sell addon items to you. Just {trade} with me.")

npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
 
Back
Top