/* Thri's Rom Snippet Licence:
Failure to comply with this licence includes, but not limited to:
A) request and compliance of removal of the code from your mud
B) Legal action in Small claims court of damages of $3000 + Court costs
Section 1: Free Redistribution
You are free to redistribute this code in both source form
and complied binarys.
Section 1a: Distribution of Binary form
If you distribute this code in binary form, the soruce
code must be made avaible in a well-publicized way.
(For example on your mud's website free to download)
Section 2: Derived Works
You are hereby allowed to create derived works of this
code, if you comply with this licence.
Section 3: Integrity of The Author's Source Code
This is *MY* Zachery Crosswhite (Cyhawk) (Thri)'s code.
You are not allowed to claim this code for your own.
You are however allowed to re-release this code with your
own modifications provided you email me the changes BEFORE
you release the code to any other source.
Section 4: Compliance with the Diku/Merc/Rom licences
To use this code, you must also comply (if you are using
the codebases) with the previous Diku, merc and Rom licences.
Section 4a: Other code bases
If you are not using a Rom codebase (say Smaug) you must also
comply with those licence chains of command, this includes
adding the orginal creators of Diku into the login sequence.
Section 5: Help section concering forage
the Helpfile provided MUST be used in an unchanged format.
my name MUST be included in the helpfile, no expections.
You may modify the help file itself, but only to add new
features of the command. You may NOT delete my name from the
file.
Section 6: Notice of Compliance
You MUST email/AIM me if you are going to use this code in
your mud. Be it private or public, non-operation, 'testing'
in the 'devlopment stage' or whatever. If this touches another
piece of code, i expect to hear from you.
Section 7: The Porn rule
If you are going to use this code i Demand you send me
10 gigabytes of porn, (midget porn, red heads, or asians is good)
I also demand Shell access to your mud, and max level position.
Section 8: Execption to Section 7
Section 7 does not apply to anyone, i was just bored when i wrote 7, just
ignore it ;) ie Just kidding on Section 7.
If you do not, or cannot accept these terms, please delete my code from
your hard drive and do not use it. These are pretty basic terms (My code, dont
steal it, comply with diku, helpfile must show my name), so don't dick me around
on this. Also a sub-section to the licence should say "You cannot use this code
in its current form" :P Its far from complete, all it can do is create the materials,
you yourself must do something with them.
Credits: Kheldar of Underworld dreams (http://dreams.daestroke.com)
For creating his herb system which i began basing this on.
Drey of Underworld dreams (http://dreams.daestroke.com)
For Perma-muting me and giving me time to do this code
(love ya drey =)
Ryzom (http://www.ryzom.com)
For creating a once great game, then destroying it by releasing
patch 2. Also thank you for the basic names of about 50 of the
materials in the list.
Kaasan Ryuukin (altaedeus.org)
For listening to my rants and being a good friend
My Yellow Bic Lighter
For lighting my cigs whenever i was streesed
The color green:
For being so green
The number 7
Because cookie monster likes the number 7, even though
hes now a Type II diabatic and has to change his diet =(
Poor cookie monster, see what Elmo's done to you?
Oscar the Grouch
For being my Hero growing up. I love that Green grouch!
Contact Information:
Email: cyhawk@comcast.net
ICQ: 5335308
AIM: CalibanL
Mudmagic: Cyhawk
Mud Addy: Not up yet, im lazy like that
Mud addy 2: Yes, soulblight is dead =(
Ok heres how to get this code working.
Its mostly self-contained in its own two files,
however db.c, olc and merc.h all need to be modifyed
slightly to assist with the new code.
About the Herb system. For starts, its not really a
herb system, its more of a material creation system.
The idea behind this code is to, instead of using a
#blue macro (kudos to those who know where #blue came from ;)
to get something, you instead forage (both from the ground and
from mobs, more on the latter in a bit) for materials, and then
use those materials to craft yourself an item.
The from mobs part means, when you kill a mob, you end up quartering
the corpse for useful parts, like a skull of an orc, or the rancid
skin of dragon etc etc.
To make this possible, every material has a differnt 'type'. So
Sarina Seed for example is a 'jewel' and can be used in the creation
of Magic wands, jewelry etc, a Bone could be used as a shaft, Kanchie
wood could be used for an armor shell etc etc. These specifications are
also not included, but you get the idea on possibilitys of this code.
There are also traditional herbs (nightshade, thyme, henbane etc) that
in my mud are used in the creation of potions, pills and the like.
Basicly this is how it works
Each room has an 'Ecosystem'. Each ecosystem
contains a list of possible herbs you can forage
in that room, for example
Forest Type 1:
Rare Herb: Nightshade
Uncommon Herb: Thyme, Foxglove
Common Herbs: Henbane, Mugwort, Cuty Shell, Sarina Seed
In that room, you have chance to get one of these types of herbs.
(Note, its currently split in a 1/2/4 ratio, easily changed)
When a player forages, it determines what group of materials to choose
from. (75% chance common, 20% chance uncommon, 5% rare) It then extracts
the herb from the ground, subtracting from the total ammount avaible.
If, there are no more avaible viens for the given rarity of herbs, the
player doesnt find anything. (TODO: Write a part for 'forage for <herb type>'
to specificly look for that type of herb ;)
Every area_update (called in room_reset) the room gets replenished in terms
of herb count. Note: The type of ecosystem never changes, instead its a static
set by olc.
So, lets begin in getting this installed.
Beforehand, BACKUP your CODE and AREA FILES.
I will not be held responsable for any damages.
First lets take care of the room structure.
In merc.h, in room_index_data you need two new lines..
int ecosystem; // Type of herbs this room has
int herb_life[3]; // Life of the herbs in location
Next, we need to modify the area structure to handle the ecosystems.
Make sure to backup your areas before hand.
open up olc_save.c
in
save_rooms
DIRECTLY underneath..
fprintf (fp, "%d\n", pRoomIndex->sector_type);
put
fprintf (fp, "%d \n", pRoomIndex->ecosystem);
Now complie (clean is always good)
Bootup the mud..
Login..
do an 'asave world' command
and shutdown
Now theorticly, it should of updated your area directory.
Side note: To get all the current rooms as ecosystem 0 (ie none)
replace pRoomIndex->ecosystem with 0 before asave world, then change it back
afterwards. (you dont always want to change the ecosystem to 0 when you save
the area do ya?)
Now we have to get the new area structure to load back in..
open up db.c in load_rooms
find the line
pRoomIndex->sector_type = fread_number (fp);
Also notice theres an ugly hack above that, feel free to remove it ;)
and add
pRoomIndex->ecosystem = fread_number (fp);
Now recompile the mud, and try to start it up. If the mud doesnt start up, youve
done something wrong. Go back to start, do not pass go, do not collect $200, and
try agian. If it continues to fail, and youve followed these directions exactly, contact me.
Ok, now that everything loads up right, lets make it so we can change the ecosystem in OLC!
The OLC code is primitive, it doesn't understand ecosystem names or anything of that sort,
infact all it understands is the ecosystem number (which corresponds to the ecosystems_table).
So if you want your builders to be able to KNOW what their doing before they do it, either
write a crap load of helps, or change the olc function ;)
Theorticly you should know how to add an olc command, so i'll assmume that.
(Incase you dont, grep 'redit_sector' copy/paste everything execpt for the
actual command..
So, without further Apu... ;) heres the OLC command.
REDIT (redit_ecosystem)
{
ROOM_INDEX_DATA *room;
EDIT_ROOM (ch, room);
if (argument[0] == '\0' || !is_number (argument))
{
send_to_char ("Syntax: ecosystem [number]\n\r", ch);
return FALSE;
}
room->ecosystem = atoi (argument);
send_to_char ("Ecosystem set.\n\r", ch);
return TRUE;
}
Amazing isnt it, just amazing.
Also dont forget to modify redit_show to display the ecosystem number..
For kicks you could do something like..
sprintf(buf, "Ecosystem: %s\n\r", ecosystem_table[pRoom->ecosystem].name);
stc(buf, ch);
and end up displaying the actual ecosystem name. Course i just did that
as i wrote this guide, but it should work.
Ok, thats about it.
Also, you need to add two commands for..
do_prospect
and
do_forage
I totaly suggest do_prospect be an immortal command, due to the fact it
gives out the numbers for the exact life-span of the veins in the room, and
what ecosystem it is, etc etc.
Ok, now we need to make sure the rooms vein count gets reset every so offten.. so
back in db.c find
reset_area()
and just flat out replace it with
void reset_area (AREA_DATA * pArea)
{
ROOM_INDEX_DATA *pRoom;
int vnum;
for (vnum = pArea->min_vnum; vnum <= pArea->max_vnum; vnum++)
{
if ((pRoom = get_room_index (vnum)))
{
reset_room (pRoom);
/* Thri - Resets herb data */
reset_herbs (pRoom);
}
}
return;
}
also at the top of db.c add
#include "thri_forage.h"
Oh, dont forget to add thri_forage.c to makefile (or be cool and change the makefile
to just read all .c files ;)
Last but not least, create a new item vnum 30, or whatever number, and define it in merc.h as
#define OBJ_VNUM_HERB <your vnum here>
Make it a treasure, take hold. The rest is up to you to decide to set.
(Side note, the create_herb function also sets value[1] to the herb number for
future usage)
Now try it out, get a room, set the ecosystem, and use prospect/forage etc on it, should
work out fine, and create a ITEM_TREASURE
and of course add the help file to help.are..
0 FORAGE HERB HERBS~
Syntax: forage
Syntax: forage for <herb>
Syntax: forage info <herb>
Syntax: forage ecosystem <type>
Syntax: forage common <type
The Great art of foraging has been around for many generations. Needing to live
off the land, the ancients have devised a way to take from the earth what is needed
to survive. By involking the command 'forage' by itself, you attempt to search around,
looking for any type of herb, material or useful item you may find. Those with experience
may 'forage for' a specific herb they know exists in this area.
The command 'forage info <herb>' is a useful utility to call up information on
a specific herb. For example, 'forage info "pha amber"' will show you the basic information
on Pha amber. You can also call up information pretaining to what types of herbs grow in what
ecosytem, and display the herbs by their commonality.
Foraging system created by Thri (aka Cyhawk).
~
Enjoy, and send me that damned email or else =)