PDA

View Full Version : Forage Code v.1


mByte
02-22-2002, 12:55 PM
I saw a TODO on something so here it is. I hope this is in time for the next release.

Its very basic at the moment because Im not 100% sure how things are pulled from the database in this code yet.

client_process.cpp
---------------------------------------------------------------
#include "skills.h" //add this include please

case OP_Forage:
{
//Forage Version 1.0 - mByte
//TODO: 1 set a reuse time.
// 2 Set item_id to be the item name
// 3 Set Skill Check & Skill Set
// 4 Check Aginst Database and Randomly get a Item.

//Bugs: 1 Camp and Come back with full stack.
// 2 Sitting allows you to forage - need to check if sitting.

int skillinuse;
int skill;
int8 chance = rand()/10;
skillinuse = 27;
skill = pp.skills[skillinuse]; //gets current skill
int16 item_id = 13419; // Summon's Veggies
int charges = 1;
if(chance > 200){
SummonItem(item_id, charges);
Message(0, "You foraged up some %d's!", item_id);
}
else{
Message(0, "You did not forage anything.");
}
//Testing Message
//Message(0, "You Foraged up Something *(chance) %d *(skillinuse) %d *(skill) %d", chance, skillinuse, skill);
Save(); // I dont think this works - somebody check that save
break;
}

-----------------------------------------------------------

Database Table Creation

-----------------------------------------------------------

#
# Table structure for table 'forage_items'
#

CREATE TABLE items_forage (
id int(11) NOT NULL auto_increment,
item_id int(11) unsigned default NULL,
zone_id int(11) unsigned default NULL,
skill_req int(11) unsigned default NULL,
chance int(11) unsigned default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;

#
# Dumping data for table 'items_forage'
#
INSERT INTO items_forage VALUES (1,0,0,0,0);

-----------------------------------------------------------

Going to need the creator to make a GUI to this on his program - and make sure I created the table correctly.

Thanks,

Nefarious
02-22-2002, 03:47 PM
Your code looks good, but we already put forage in =(

it should be in next version along with most of the other skills that aren't in yet....

mByte
02-22-2002, 04:11 PM
DoH!

mByte
02-22-2002, 04:12 PM
its ok only took me like 20min to write that :)

DeletedUser
02-23-2002, 05:51 AM
looks good mByte sorry someone beat ya to it...