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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2008, 01:46 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default Exp Loss Rule , care to test it anyone?

This works on a scale of 0 -9 ; '0' will loose you about 1 blue on death and '9' will loose you almost a level. I based it on Cbodmers exploss code, as it seems more sane than the current one we use.

ruletypes.h at around line 26;
Code:
RULE_INT ( Character, DeathExpLossMultiplier, 3) //Angelox, adjust how much exp is lost
attack.cpp at around line 1716;
Code:
// figure out if they should lose exp
	float GetNum [] = {0.005f,0.015f,0.025f,0.035f,0.045f,0.055f,0.065f,0.075f,0.085f,0.095f };
	int Num = RuleI(Character, DeathExpLossMultiplier);
	float loss = GetNum[Num];
	exploss=(int)((float)GetEXP() * (loss)); //Angelox: loose % of total XP pending rule (choose 0-9)
And the SQL;
Code:
Insert into rule_values values (0, 'Character:DeathExpLossMultiplier', 3);
I've been testing it today, looks to be OK - hoping some one else will test too.

Last edited by Angelox; 10-25-2008 at 10:02 PM.. Reason: Default rule should be '3' and not '0'
Reply With Quote
  #2  
Old 10-25-2008, 01:53 PM
ChaosSlayer
Demi-God
 
Join Date: May 2007
Posts: 1,032
Default

how much is 1 yellow?
Reply With Quote
  #3  
Old 10-25-2008, 02:04 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

I think was around 3, I changed default - set to three, i put zero by mistake
Reply With Quote
  #4  
Old 10-25-2008, 02:25 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

You want to check the sanity of the rule setting, to stop a crash when accessing the array if someone sets it to an invalid value:

Code:
// figure out if they should lose exp
	float GetNum [] = {0.005f,0.015f,0.025f,0.035f,0.045f,0.055f,0.065f,0.075f,0.085f,0.095f };
	int Num = RuleI(Character, DeathExpLossMultiplier);
	if((Num < 0) || (Num > 9))
		Num = 0;
	float loss = GetNum[Num];
	exploss=(int)((float)GetEXP() * (loss)); //Angelox: lose % of total XP pending rule (choose 0-9)
I would also change GetNum & Num to more meaningful names.

Last edited by Derision; 10-25-2008 at 10:30 PM..
Reply With Quote
  #5  
Old 10-25-2008, 04:09 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Thanks - I'll let it stand around here a few days before committing it all, incase anyone else has more ideas.
I wasn't really sure why this never got in, probably just forgotten I guess.
Reply With Quote
  #6  
Old 10-26-2008, 06:24 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Just a thought, but couldn't we just set the rule to the % of a level we want to lose on death instead of predefined options?

common/ruletypes.h
Code:
RULE_REAL ( Character, DeathExpLossLevelPercent, 20) //1 yellow of exp lost on death by default. float for a little more accuracy if needed
zone/attack.cpp
Code:
// figure out if they should lose exp
	float loss = RuleR(Character, DeathExpLossLevelPercent) / 100.0f;
	exploss=(int)((float)GetEXP() * (loss)); //Angelox: loose % of total XP
SQL:
Code:
INSERT INFO rule_values VALUES (0, 'Character:DeathExpLossLevelPercent', 20);
__________________
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
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 05:12 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