View Single Post
  #3  
Old 07-18-2008, 08:34 PM
CodeMephit
Fire Beetle
 
Join Date: Oct 2006
Posts: 18
Default

You make a very good point. I did not know about the hunger rule variable. But if I had, I may never have been motivated to look at C++

Anyhow, I found where food is consumed. True to what you said, it is about 1 item every 10 minutes.

I created a new character on a Live server and deleted all but 10 each of his bread / milk. I then used my logs to determine how long the food lasted and timed the 'you are low on food', 'you are out of food', 'you are hungry' messages.

I found that 1 item is eaten / drank about once per hour, give or take a little. This was on a human by the way. If I recall correctly, small races ate slower and large races ate faster. Also, I remember something about eating more if you had a mount summoned. I will see what I can dig up on that.

For now though, this will bring normal eating / drinking habits more inline with Live.

In \EQEmu-0.7.0-1118\zone\client_packet.cpp (Line 1291)
Change:
Code:
		m_pp.hunger_level += eat_item->CastTime*cons_mod; //roughly 1 item per 10 minutes
		DeleteItemInInventory(pcs->slot, 1, false);
		
		if(pcs->auto_consumed != 0xffffffff) //no message if the client consumed for us
			entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), eat_item->Name);
	}
	else if (pcs->type == 0x02) {
#if EQDEBUG >= 1
		LogFile->write(EQEMuLog::Debug, "Drinking from slot:%i", (int)pcs->slot);
#endif
		// 6000 is the max. value
		//m_pp.thirst_level += 1000;
		m_pp.thirst_level += eat_item->CastTime*cons_mod; //roughly 1 item per 10 minutes
		DeleteItemInInventory(pcs->slot, 1, false);
To:
Code:
	// Codemephit [2008.07.18] - Added a multiplier of  '6'.  This makes food last about as long as on Live.
		m_pp.hunger_level += eat_item->CastTime*cons_mod*6; //roughly 1 item per 60 minutes
		DeleteItemInInventory(pcs->slot, 1, false);
		
		if(pcs->auto_consumed != 0xffffffff) //no message if the client consumed for us
			entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), eat_item->Name);
	}
	else if (pcs->type == 0x02) {
#if EQDEBUG >= 1
		LogFile->write(EQEMuLog::Debug, "Drinking from slot:%i", (int)pcs->slot);
#endif
		// 6000 is the max. value
		//m_pp.thirst_level += 1000;
		m_pp.thirst_level += eat_item->CastTime*cons_mod*6; //roughly 1 item per 60 minutes
		DeleteItemInInventory(pcs->slot, 1, false);
Again, today is my first day working with / writing C++ code. I have tested my changes, and they seem to work fine. However if anyone sees any major issues, please let me know. Thanks.

-Codemephit
Reply With Quote