• 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 Ultimate Food Shopkeeper

Ziggy

Member
Joined
Aug 11, 2007
Messages
49
Reaction score
6
Here is the npc

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eldard" script="default.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="143" head="90" body="4" legs="10" feet="68" addons="2"/>
	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="shop_sellable" value="
		meat,2666,2;
		salmon,2668,2;
		ham,2671,4;
		blueberry,2677,1;
		cherry,2678,1;
		carrot,2684,1;
		cookie,2687,1;
		bread,2689,2;
		egg,2695,1;
		cheese,2696,2
		"/>
		<parameter key="shop_buyable" value="
		meat,2666,3;
		fish,2667,3;
		salmon,2668,4;
		ham,2671,5;
		dragon ham,2672,25;
		pear,2673,4;
		red apple,2674,3;
		orange,2675,5;
		banana,2676,2;
		blueberry,2677,1;
		cherry,2678,1;
		strawberry,2680,1;
		grapes,2681,3;
		melon,2682,8;
		pumpkin,2683,10;
		carrot,2684,2;
		tomato,2685,3;
		corncob,2686,3;
		cookie,2687,2;
		bread,2689,2;
		roll,2690,2;
		brown bread,2691,3;
		egg,2695,2;
		cheese,2696,4;
		white mushroom,2787,6;
		red mushroom,2788,12;
		brown mushroom,2789,10;
		mango,5097,8;
		cake,6278,50;
		party cake,6280,50;
		valentine's cake,6393,30;
		potato,8838,4;
		plum,8839,3;
		raspberry,8840,1;
		lemon,8841,3;
		cucumber,8842,3;
		onion,8843,2;
		jalapeno pepper,8844,2;
		beetroot,8845,2
		"/>
	</parameters>
</npc>
he buys and sells everything from all of the real tibia foodshopkeepers combined, at the lowest price to sell to the player, highest price to buy from the player

here is an updated food.lua with 1200 seconds for being full like real tibia (default was 400), annotated, and fixed regeneration rates (they are in percents so a blueberry is 1 (12 seconds) while dragon ham is 60 (720 seconds)) (some were wrong)
Code:
local FOODS =
{
		[2666] = {15, "Munch."}, --meat
		[2667] = {12, "Munch."}, --fish
		[2668] = {10, "Mmmm."}, --salmon
		[2669] = {17, "Munch."}, --northern pike
		[2670] = {4, "Gulp."}, --shrimp
		[2671] = {30, "Chomp."}, --ham
		[2672] = {60, "Chomp."}, --dragon ham
		[2673] = {5, "Yum."}, --pear
		[2674] = {6, "Yum."}, --red apple
		[2675] = {13, "Yum."}, --orange
		[2676] = {8, "Yum."}, --banana
		[2677] = {1, "Yum."}, --blueberry
		[2678] = {18, "Slurp."}, --coconut
		[2679] = {1, "Yum."}, --cherry
		[2680] = {2, "Yum."}, --strawberry
		[2681] = {9, "Yum."}, --grapes
		[2682] = {20, "Yum."}, --melon
		[2683] = {17, "Munch."}, --pumpkin
		[2684] = {5, "Crunch."}, --carrot
		[2685] = {6, "Munch."}, --tomato
		[2686] = {9, "Crunch."}, --corncob
		[2687] = {2, "Crunch."}, --cookie
		[2688] = {2, "Mmmm."}, --candy cane
		[2689] = {10, "Crunch."}, --bread
		[2690] = {3, "Crunch."}, --roll
		[2691] = {8, "Crunch."}, --brown bread
		[2792] = {6, "Munch."}, --dark mushroom
		[2793] = {12, "Munch."}, --some mushrooms (brown)
		[2794] = {3, "Munch."}, --some mushrooms	
		[2695] = {6, "Gulp."}, --egg
		[2696] = {9, "Smack."}, --cheese
		[2787] = {9, "Munch."}, --white mushroom
		[2788] = {4, "Munch."}, --red mushroom
		[2789] = {22, "Munch."}, --brown mushroom
		[2790] = {30, "Munch."}, --orange mushroom
		[2791] = {9, "Munch."}, --wood mushroom
		[2792] = {6, "Munch."}, --dark mushroom
		[2795] = {36, "Munch."}, --fire mushroom
		[2796] = {5, "Munch."}, --green mushroom
		[5097] = {4, "Yum."}, --mango
		[6278] = {10, "Mmmm."}, --cake
		[6279] = {15, "Mmmm."}, --decorated cake
		[6393] = {12, "Mmmm."}, --valentines cake
		[6394] = {15, "Mmmm."}, --cream cake
		[6501] = {20, "Mmmm."}, --gingerbreadman
		[6569] = {1, "Mmmm."}, --candy
		[6574] = {5, "Mmmm."}, --bar of chocolate
		[7158] = {25, "Munch."}, --rainbow trout
		[7159] = {15, "Munch."}, --green perch
		[7372] = {2, "Yum."}, --ice cream cone (Crispy Chocolate Chips)
		[7373] = {2, "Yum."}, --ice cream cone yellow
		[7374] = {2, "Yum."}, --ice cream cone red
		[7375] = {2, "Yum."}, --ice cream cone (Chilly Cherry)
		[7376] = {2, "Yum."}, --ice cream cone (Mellow Melon)
		[7377] = {2, "Yum."}, --ice cream cone (Blue-Barian)
		[7909] = {4, "Crunch."}, --walnut
		[8838] = {10, "Gulp."}, --potato
		[8839] = {5, "Yum."}, --plum
		[8840] = {1, "Yum."}, --raspberry
		[8841] = {1, "Urgh."}, --lemon
		[8842] = {7, "Munch."}, --cucumber
		[8843] = {5, "Crunch."}, --onion
		[8844] = {1, "Gulp."}, --jalapeno pepper
		[8845] = {5, "Munch."}, --beetroot
		[8847] = {11, "Yum."} --chocolate cake
	
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local food = FOODS[item.itemid]
	if(not food) then
		return false
	end

	if((getPlayerFood(cid) + food[1]) >= 1200) then
		doPlayerSendCancel(cid, "You are full.")
		return true
	end

	doPlayerFeed(cid, food[1] * 4)
	doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
	return true
end

All of this was tested on TFS 0.3.6, so if you are using 0.2 some may or may not work
 
The npc is nice just for an npc that sells all food types, but thank you for releasing your updated version of food.lua, i'm gonna test it out.
 
Nice work dude, must have taken you some time to finish this.
 
working in 8.7 tfs:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Elyn" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="140" head="79" body="0" legs="0" feet="95" addons="3"/>
	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="shop_sellable" value="meat,2666,2;salmon,2668,2;ham,2671,4;blueberry,2677,1;cherry,2678,1;carrot,2684,1;cookie,2687,1;bread,2689,2;egg,2695,1;cheese,2696,2"/>
		<parameter key="shop_buyable" value="meat,2666,3;fish,2667,3;salmon,2668,4;ham,2671,5;dragon ham,2672,25;pear,2673,4;red apple,2674,3;orange,2675,5;banana,2676,2;blueberry,2677,1;cherry,2678,1;strawberry,2680,1;grapes,2681,3;melon,2682,8;pumpkin,2683,10;carrot,2684,2;tomato,2685,3;corncob,2686,3;cookie,2687,2;bread,2689,2;roll,2690,2;brown bread,2691,3;egg,2695,2;cheese,2696,4;white mushroom,2787,6;red mushroom,2788,12;brown mushroom,2789,10;mango,5097,8;cake,6278,50;party cake,6280,50;valentine's cake,6393,30;potato,8838,4;plum,8839,3;raspberry,8840,1;lemon,8841,3;cucumber,8842,3;onion,8843,2;jalapeno pepper,8844,2;beetroot,8845,2"/>
	</parameters>
</npc>
 
Back
Top