Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-28-2002, 11:54 AM
Malevolent
Hill Giant
 
Join Date: Mar 2002
Posts: 171
Default A forage skill snippet

client_process.cpp
Code:
					case OP_Forage:
					{
						
						
						
						/******************************************************
						An interesting problem is determining in advance what the qualifications
						are for a given piece of food for even if you were to 
						select from the database items table for edible food (if there is a flag)
						you would need to still sort the item by skill and the like. Thus, 
						I would argue a food table is necessary. Until one is constructed
						or a better method built, this will work.
						
						  --MV

						*******************************************************/
						
#define MAX_POSSIBLE_FOOD_IDS 5
						uint32 possible_food_ids[MAX_POSSIBLE_FOOD_IDS];

						possible_food_ids[0] = 13977; /* Carrot */
						possible_food_ids[1] = 14912; /* Mill Carrot */
						possible_food_ids[2] = 14920; /* Wild Raddish */
						possible_food_ids[3] = 12845; /* Creeper Cabbage */
						possible_food_ids[4] = 14913; /* Wild Cabbage */
						possible_food_ids[5] = 1429;  /* Snow Griffin Egg */

						/******************************************************
						My rational: The higher your skill in forage, the more 
						likely you are to forage something. With a slight chance that 
						even at 255 you will fail
						/*****************************************************/
						if (rand()%265<GetSkill(FORAGE)){						
							uint32 food_id=possible_food_ids[rand()%MAX_POSSIBLE_FOOD_IDS];
							Item_Struct* food_item = database.GetItem(food_id);
							if (food_item->name!=0) {
								this->Message(MT_Emote, "You forage a %s",food_item->name);												
								this->PutItemInInventory(0,food_item);
							}
						} else {
							if (rand()%4==1){
								this->Message(MT_Emote, "You failed to find anything worthwhile.");
							} else {
								this->Message(MT_Emote, "You fail to find anything to forage.");
							}
						}
						
						break;
					}
"Better than nothing" (TM)


--MV
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:20 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3