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 03-03-2013, 11:11 PM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default I need to fix this folks

This Code is stock :

Code:
// Note: The client calculates exp separately, we cant change this function
// Add: You can set the values you want now, client will be always sync :) - Merkur
uint32 Client::GetEXPForLevel(uint16 check_level)
{

	uint16 check_levelm1 = check_level-1;
	float mod;
	if (check_level < 31)
		mod = 1.0;
	else if (check_level < 36)
		mod = 1.1;
	else if (check_level < 41)
		mod = 1.2;
	else if (check_level < 46)
		mod = 1.3;
	else if (check_level < 52)
		mod = 1.4;
	else if (check_level < 53)
		mod = 1.5;
	else if (check_level < 54)
		mod = 1.6;
	else if (check_level < 55)
		mod = 1.7;
	else if (check_level < 56)
		mod = 1.9;
	else if (check_level < 57)
		mod = 2.1;
	else if (check_level < 58)
		mod = 2.3;
	else if (check_level < 59)
		mod = 2.5;
	else if (check_level < 60)
		mod = 2.7;
	else if (check_level < 61)
		mod = 3.0;
	else
		mod = 3.1;
	
	float base = (check_levelm1)*(check_levelm1)*(check_levelm1);

	mod *= 1000;
	
	return(uint32(base * mod));
}
Alright well on raid Addicts we used some other code.. which didn't appear to me to be DRASTICALLY different, another GM I had made this code since we couldn't go past level 87.. Now when I am trying to remove this code and go with what you guys wrote, I can't keep any character on my server to what they were originally .. Max level on my server is 100, and they all revert to level 1.. I set them to 100 either by #setexp, or #level, and they just all revert BACK to level 1..

Please Help ! I want to go with what you guys wrote and not some weirdness but it seems my database is stuck on it's old ways.. Is there some way I can repair this issue?

At the top it says
Quote:
// Add: You can set the values you want now, client will be always sync - Merkur
but that's not ringing true right now , no offense :(

Morty
Reply With Quote
  #2  
Old 03-03-2013, 11:59 PM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default

I know i'm a total n00b by the way and please forgive me devs for even allowing my change to go in in the first place..

I have changed the code to this for now, and it seems to have fixed my problem however I still desire a vender recommended solution please


Code:
// Note: The client calculates exp separately, we cant change this function
// Add: You can set the values you want now, client will be always sync :) - Merkur
uint32 Client::GetEXPForLevel(uint16 check_level)
{

	uint16 check_levelm1 = check_level-1;
	float mod;
	if (check_level < 101)
		mod = 1.0;
	else if (check_level < 36)
		mod = 1.1;
	else if (check_level < 41)
		mod = 1.2;
	else if (check_level < 46)
		mod = 1.3;
	else if (check_level < 52)
		mod = 1.4;
	else if (check_level < 53)
		mod = 1.5;
	else if (check_level < 54)
		mod = 1.6;
	else if (check_level < 55)
		mod = 1.7;
	else if (check_level < 56)
		mod = 1.9;
	else if (check_level < 57)
		mod = 2.1;
	else if (check_level < 58)
		mod = 2.3;
	else if (check_level < 59)
		mod = 2.5;
	else if (check_level < 60)
		mod = 2.7;
	else if (check_level < 101)
		mod = 3.0;
	else
		mod = 3.1;
	
	float base = (check_levelm1)*(check_levelm1)*(check_levelm1);

	mod *= 1000;
	
	return(uint32(base * mod));
}
Reply With Quote
  #3  
Old 03-04-2013, 12:36 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

I suggest checking if the value returned by GetEXPForLevel is being cast to a signed int anywhere. 3000(98^3) would be wrapping if that is the case (where going from lvl 99 to 100).
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #4  
Old 03-04-2013, 01:01 AM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default

Look dude, I don't speak dev that's why I've never posted in here Can you please send that in English? Love ya guys!
Reply With Quote
  #5  
Old 03-04-2013, 02:42 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

Quote:
Originally Posted by KingMort View Post
Look dude, I don't speak dev
And this is why you fail.
Reply With Quote
  #6  
Old 03-04-2013, 12:06 PM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default

Yes I understand I "FAIL" because that is why I posted this so that I can get help with this and not "FAIL" ..

Please help me to understand how I can check the value returned by "GetEXPForLevel" ??
Reply With Quote
  #7  
Old 03-04-2013, 02:19 PM
orionsun
Banned
 
Join Date: May 2009
Location: USA
Posts: 22
Default

You are the least technical network whatever you claim to be. Its basic stuff like this that undermines all the boasting you do lol.

Lets break this down...

Your code:
Code:
else if (check_level < 101)
		mod = 3.0;
The equation:
Code:
float base = (check_levelm1)*(check_levelm1)*(check_levelm1);
mod *= 1000;
return(uint32(base * mod))
Basic math time...

check_levelm1 = 100 <-- Character level(lets test max)
mod = 3.0 <-- This is the modifier a level 100 char has

base = 100 * 100 * 100 = 1,000,000
mod = 3.0 * 1000 = 3,000

return val = 1,000,000, * 3,000 = 3,000,000,000

The max value a uint32 can hold is ~2.14 billion.

A monkey could figure out where to go from here... good luck.
Reply With Quote
  #8  
Old 03-04-2013, 03:59 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

The maximum value of a uint32 is 4,294,967,295. It's possible that is it being converted to a signed value somewhere along the way which would make anything over 2,147,483,647 become negative.
Reply With Quote
  #9  
Old 03-04-2013, 05:24 PM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Thanks guys for explaining this. I didn't have the patience yesterday.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #10  
Old 03-04-2013, 07:17 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Quote:
Originally Posted by lerxst2112 View Post
And this is why you fail.
Quote:
Originally Posted by orionsun View Post
You are the least technical network whatever you claim to be. Its basic stuff like this that undermines all the boasting you do
Yeah that pretty much sums this clown up.
Reply With Quote
  #11  
Old 03-04-2013, 07:38 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Mort, dude, didn't you just hire a 'brilliant' coder? Why couldn't he fix it? "Brilliant" and "better than me" are two different things, just saying. You've been doing this for 10 years, you should be able to speak in fluent C++ by now.
Reply With Quote
  #12  
Old 03-04-2013, 07:50 PM
jimrocken
Fire Beetle
 
Join Date: Aug 2010
Posts: 14
Default

i don't see coding there except the maximum value a uint32 can hold (could google for that... just saying...)

it really is basic math... sorry mort but i kinda have to agree on this one... that was pretty simple...
Reply With Quote
  #13  
Old 03-04-2013, 08:42 PM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

I had a go at expressing the exp curve as a single (mathematical) function. With those strange coefficients I think you could only get a pretty rough approximation because of the relatively large numbers being used.

To Mort: Try setting a character to level 89. If that works try setting them to 90. If setting them to 90 fails then this issue is almost certainly the result of an integer being cast incorrectly.

To fix that, search your code for references to GetEXPForLevel. Look for code that is simliar to 'int x = GetEXPForLevel(blah)' and change it to 'uint32 x = GetEXPForLevel(blah)'. If it is not that simple, then you will have to start looking at the uses of 'x' in other parts of the code.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?

Last edited by Drajor; 03-04-2013 at 08:43 PM.. Reason: Spelt incorrectly, incorrectly. Oh I funnies.
Reply With Quote
  #14  
Old 03-04-2013, 09:27 PM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default

Thank you for the assistance will look into this. And thank you for the criticism and everything... Appreciate you all. Like I said in the beginning of the post as far as C++ stuff goes I am n00bsauce.. I don't mean to upset anyone by my questions here, I thought that this was a forum that was for Support not flames and rants. As a Network Analyst my job is to build networks, servers, and troubleshoot workstations, no where in my job description is coding of any kind. Apologies if you thought I had boasted about coding at some point? I can only ever remember telling people I suck at this . Please forgive my ignorance, I don't mean to upset anyone I just want to fix my problem.

Mort
Reply With Quote
  #15  
Old 03-04-2013, 09:39 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Do we need to change this to double from float and add a con check for '(base*mod) > ~0'?
__________________
Uleat of Bertoxxulous

Compilin' Dirty
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 11:54 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