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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-30-2009, 05:13 PM
cybernine186
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default Client::SetMana corrections

I have found some flaws in the Client::SetMana causing items like Manastone and Cannibalize to not work properly. Also Client::DoManaRegen() does a unnecessary call of the SendManaUpdatePacket(); twice.

Here is a diff of the latest version of PEQ. Please let me know how it works for you.

Code:
Index: zone/client.cpp
===================================================================
--- zone/client.cpp	(revision 1046)
+++ zone/client.cpp	(working copy)
@@ -1621,17 +1621,22 @@
 }
 
 const sint32& Client::SetMana(sint32 amount) {
-	bool update = false;
-	if (amount < 0)
+
+	// No negative amount
+	if (amount < 0) {
 		amount = 0;
-	if (amount > GetMaxMana())
+	}
+	
+	// Do not set above the maximum amount
+	if (amount > GetMaxMana()) {
 		amount = GetMaxMana();
-	if (amount != cur_mana)
-		update = true;
-	cur_mana = amount;
-	if (update)
-		Mob::SetMana(amount);
-	SendManaUpdatePacket();
+	}
+	
+	// Update mana and sent to client
+	if (amount != cur_mana) {
+		cur_mana = amount;
+		SendManaUpdatePacket();
+	}
 	return cur_mana;
 }
 
Index: zone/client_process.cpp
===================================================================
--- zone/client_process.cpp	(revision 1046)
+++ zone/client_process.cpp	(working copy)
@@ -1761,7 +1761,6 @@
 	regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
 	
 	SetMana(GetMana() + regen + RestRegenMana);
-	SendManaUpdatePacket();
 }
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 04:29 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