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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2012, 03:16 AM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 187
Default Fix: Low level damage cap

Server rules for lower level melee damage caps aren't working as intended.

In attack.cpp.client::attack;

I think this:
Code:
		if(GetLevel() < 10 && max_hit > 20)
			max_hit = (RuleI(Combat, HitCapPre10));
		else if(GetLevel() < 20 && max_hit > 40)
			max_hit = (RuleI(Combat, HitCapPre20));
Should be more like this:

Code:
		if(GetLevel() < 10 && max_hit > RuleI(Combat, HitCapPre10))
			max_hit = (RuleI(Combat, HitCapPre10));
		else if(GetLevel() < 20 && max_hit > RuleI(Combat, HitCapPre20))
			max_hit = (RuleI(Combat, HitCapPre20));
Not sure if it's efficient to use a variable instead for the rule value.
Reply With Quote
  #2  
Old 12-03-2012, 04:49 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Without looking at the code for getting rule values, I would use a few static const variables in this instance. Assuming you do not need to update these values during run-time.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #3  
Old 12-03-2012, 05:05 AM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 187
Default

I removed the code altogether for my purposes
Reply With Quote
  #4  
Old 12-03-2012, 05:16 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Haha me too!
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #5  
Old 12-03-2012, 10:04 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default

Kind of dumb to replace a dynamic rule that you can change yourself in the rules table then to change code with a static value.

You can set the values of those rules in the `rules_values` table.
Reply With Quote
  #6  
Old 12-03-2012, 10:25 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

I meant read the value from the DB into a static const.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #7  
Old 12-03-2012, 10:27 AM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 187
Default

Hi Akkadius,

Not sure if you realised from my original post, but with the current code, if you change the pre-10 cap to 100, it will mean that if a player uses a 12 damage weapon and hit for 24, their max damage becomes the cap (100). The cap needs to be included in the if statement.
Reply With Quote
  #8  
Old 12-03-2012, 10:33 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

I'll add this into SVN later. Good catch.
Reply With Quote
  #9  
Old 12-03-2012, 10:43 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Rules can be changed at runtime, so it probably would not be good to cache the value. Even if you did all you're saving is a function call and a lookup by index in a static array, so I'd say not worth worrying about at all.
Reply With Quote
  #10  
Old 12-03-2012, 02:45 PM
Tabasco's Avatar
Tabasco
Discordant
 
Join Date: Sep 2009
Posts: 269
Default

I didn't realize this hadn't made it in yet.
http://www.eqemulator.org/forums/showthread.php?t=35541
Reply With Quote
  #11  
Old 12-03-2012, 04:22 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

To be honest me either Tabasco. I recall you posting it ages ago D:
Reply With Quote
  #12  
Old 12-04-2012, 12:45 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

It looks like part of it made it in, because Bots were changed as well where before they didn't use the rules at all, but not completely.
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:46 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