Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2022, 03:49 PM
Ryuichi
Fire Beetle
 
Join Date: Jul 2008
Location: Colorado
Posts: 3
Default HP lost is 2x Dmg Taken

When in combat, the combat log will show, "x hits for 4 damage". However, when looking at my hitpoints in my inventory window, and at the hitpoint % on my health bar, I'm seeing 2x enemy damage reflected. I.e., I see HP: 92/100 (-8 hp), and 92%, respectively. Has anyone else experienced this, or have any immediate thoughts, before I put myself through the displeasure of suffering through the hot mess that is the server code?


Also, should the files in .\eqemu\shared\ folder rebuild with each server launch? Mine do not, unless I manually delete them first. Is this the intended behavior?
Reply With Quote
  #2  
Old 07-11-2022, 04:04 PM
Ryuichi
Fire Beetle
 
Join Date: Jul 2008
Location: Colorado
Posts: 3
Default

Revised my original post, so this response is no longer relevant.
Reply With Quote
  #3  
Old 07-12-2022, 05:43 PM
Ryuichi
Fire Beetle
 
Join Date: Jul 2008
Location: Colorado
Posts: 3
Default

I believe this to be a bug in the below code, and will post in the Bug section accordingly. For the sake of others, I'll include my findings here as well.

In mob.cpp, in the Mob::SendHPUpdate function, the cur_hp and max_hp values set in the packet are reduced by any HP gained from items. This is resulting in the client showing 2x the damage taken, both in the inventory window and on the health bar.

Code:
void Mob::SendHPUpdate(bool force_update_all)
{

	// If our HP is different from last HP update call - let's update selves
	if (IsClient()) {
		if (current_hp != last_hp || force_update_all) {

			LogHPUpdate(
				"[SendHPUpdate] Update HP of self [{}] current_hp [{}] max_hp [{}] last_hp [{}]",
				GetCleanName(), current_hp, max_hp, last_hp
			);

			auto client_packet     = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct));
			auto *hp_packet_client = (SpawnHPUpdate_Struct *) client_packet->pBuffer;

			hp_packet_client->cur_hp = static_cast<uint32>(CastToClient()->GetHP() - itembonuses.HP);
			hp_packet_client->spawn_id = GetID();
			hp_packet_client->max_hp = CastToClient()->GetMaxHP() - itembonuses.HP;

			CastToClient()->QueuePacket(client_packet);

			safe_delete(client_packet);

			ResetHPUpdateTimer();

			// Used to check if HP has changed to update self next round
			last_hp = current_hp;
		}
	}
	...
By making the following change, to remove the reduction of HP granted by items, the client is now showing values consistent with what the server is reporting.
Code:
hp_packet_client->cur_hp = CastToClient()->GetHP(); // static_cast<uint32>(CastToClient()->GetHP() - itembonuses.HP);
hp_packet_client->spawn_id = GetID();
hp_packet_client->max_hp = CastToClient()->GetMaxHP(); // CastToClient()->GetMaxHP() - itembonuses.HP;
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 10:53 PM.


 

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