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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 11:15 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3