Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 11-24-2008, 06:28 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default Food/Drink Stats - Fixed

Tonight, I finally got around to looking into why food stats weren't adding to actual stats (shown in #showstats). It turns out that all of the code to calculate food was already there, but the code for calculating item bonuses wasn't allowing food/drink to work.

In bonuses.cpp around line 182, after this:
Code:
	if (!inst->IsEquipable(GetBaseRace(),GetClass()))
	{
Add this line:
Code:
		if ((!inst->GetItem()->ItemType == ItemTypeFood) && (!inst->GetItem()->ItemType == ItemTypeFood))

And that whole IF should look like this when you are done adding it:

Code:
	if (!inst->IsEquipable(GetBaseRace(),GetClass()))
	{
		if ((!inst->GetItem()->ItemType == ItemTypeFood) && (!inst->GetItem()->ItemType == ItemTypeFood))
			return;
	}
If anyone has any issues with this or thinks it may cause a problem or open possible exploits, let me know. I can't think of any. Also, if someone knows of a better way to write it that might be easier on the CPU, feel free to post it. Otherwise, I will get this added to SVN very soon. And, just in time for Thanksgiving too *WINK*
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 11-24-2008, 07:25 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by trevius View Post
Tonight, I finally got around to looking into why food stats weren't adding to actual stats (shown in #showstats). It turns out that all of the code to calculate food was already there, but the code for calculating item bonuses wasn't allowing food/drink to work.

In bonuses.cpp around line 182, after this:
Code:
	if (!inst->IsEquipable(GetBaseRace(),GetClass()))
	{
Add this line:
Code:
		if ((!inst->GetItem()->ItemType == ItemTypeFood) && (!inst->GetItem()->ItemType == ItemTypeFood))

And that whole IF should look like this when you are done adding it:

Code:
	if (!inst->IsEquipable(GetBaseRace(),GetClass()))
	{
		if ((!inst->GetItem()->ItemType == ItemTypeFood) && (!inst->GetItem()->ItemType == ItemTypeFood))
			return;
	}
If anyone has any issues with this or thinks it may cause a problem or open possible exploits, let me know. I can't think of any. Also, if someone knows of a better way to write it that might be easier on the CPU, feel free to post it. Otherwise, I will get this added to SVN very soon. And, just in time for Thanksgiving too *WINK*
I think I would recommend moving that part below where we convert the item instance (inst) to an item (item), that way we basically don't have to convert multiple times:

Code:
void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug) {
	if(!inst || !inst->IsType(ItemClassCommon))
	{
		return;
	}
	if(inst->GetAugmentType()==0 && isAug == true)
	{
		return;
	}

	const Item_Struct *item = inst->GetItem();

	if (GetLevel() < item->ReqLevel)
	{
		return;
	}
	if (!inst->IsEquipable(GetBaseRace(),GetClass()) && item->ItemType != ItemTypeFood && item->ItemType != ItemTypeFood)
	{

		return;
	}
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #3  
Old 11-24-2008, 07:53 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ahh lol, good idea! I didn't even notice that conversion was there. Looks like this take a little extra work out of checking req level too I will test out the code and see how it goes. If all seems ok, I think this should be ready for adding to SVN at any time.

Though, I think maybe keeping it like this might be slightly better. This way, it doesn't have to check equipable items to see if they are food. Pretty minor, but every bit helps:

Code:
	const Item_Struct *item = inst->GetItem();

	if (GetLevel() < item->ReqLevel)
	{
		return;
	}

	if (!inst->IsEquipable(GetBaseRace(),GetClass()))
	{
		if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink)
			return;
	}
Oh, and while looking at the code I submitted above, I can't for the life of me figure out why it is actually working for Drinks too. I checked and confirmed that it is indeed the same code I am running on the server now. And, it is only checking for ItemTypeFood, but doing it twice... And somehow, Drinks still work.

Either way, I will get this tested and submitted tonight if it looks good.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 11-24-2008 at 04:12 PM..
Reply With Quote
  #4  
Old 10-10-2016, 11:55 PM
NostalgiaEQ
Banned
 
Join Date: Sep 2016
Location: us
Posts: 201
Default

This is the current server code and it doesn't look like bonus' are working. any thoughts?

Code:
const EQEmu::ItemBase *item = inst->GetItem();

	if (!isTribute && !inst->IsEquipable(GetBaseRace(), GetClass())) {
		if (item->ItemType != EQEmu::item::ItemTypeFood && item->ItemType != EQEmu::item::ItemTypeDrink)
			return;
Reply With Quote
  #5  
Old 10-11-2016, 08:07 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

I don't think that we handle food/drink correctly...

It will be addressed in the inventory rework since I'm having to rewrite all code that touches items.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #6  
Old 10-12-2016, 12:00 AM
NostalgiaEQ
Banned
 
Join Date: Sep 2016
Location: us
Posts: 201
Default

Quote:
Originally Posted by Uleat View Post
I don't think that we handle food/drink correctly...

It will be addressed in the inventory rework since I'm having to rewrite all code that touches items.
Much appreciated
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 03:55 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3