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.

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 04-28-2002, 07:33 PM
devn00b's Avatar
devn00b
Demi-God
 
Join Date: Jan 2002
Posts: 15,658
Default

Plugged it in and worked perfect! thanks much!
__________________
(Former)Senior EQEMu Developer
GuildWars Co-Founder / World Builder.
World Builder and Co-Founder Zek [PVP/Guild Wars/City Takeovers]
Member of the "I hate devn00b" Club
Most Senior EQEMu Member.

Current Work: EverQuest 2 Emulator. Zeklabs Server
Reply With Quote
  #3  
Old 04-30-2002, 05:34 AM
Drawde
Dragon
 
Join Date: Jan 2002
Posts: 521
Default

I was just about to make a post asking if anyone had done any work on incorporating foraging (someone posted some code for it a month or so ago). But it looks like you've already done it - wish I had your programming skills!
There's a complete list of what can be foraged (and fished) in each zone at eqtraders.com.
Reply With Quote
  #4  
Old 04-30-2002, 12:36 PM
Malevolent
Hill Giant
 
Join Date: Mar 2002
Posts: 171
Default

Add this to have the skill go up.

Code:
						//See if the player increases their skill
						float wisebonus =  (pp.WIS > 200) ? 20 + ((pp.WIS - 200) * 0.05) : pp.WIS * 0.1;
						if ((55-(GetSkill(FORAGE)*0.236))+wisebonus > (float)rand()/RAND_MAX*100)
								this->SetSkill(FORAGE,++pp.skills[FORAGE]);
Reply With Quote
Reply


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 12:34 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