|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Support::Windows Servers Support forum for Windows EQEMu users. |
|
|
|
03-03-2013, 11:11 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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
|
|
|
|
|
|
|
03-03-2013, 11:59 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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));
}
|
|
|
|
03-04-2013, 12:36 AM
|
|
Developer
|
|
Join Date: Nov 2012
Location: Halas
Posts: 355
|
|
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?
|
03-04-2013, 01:01 AM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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!
|
03-04-2013, 02:42 AM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,743
|
|
Quote:
Originally Posted by KingMort
Look dude, I don't speak dev
|
And this is why you fail.
|
03-04-2013, 12:06 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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" ??
|
03-04-2013, 02:19 PM
|
Banned
|
|
Join Date: May 2009
Location: USA
Posts: 22
|
|
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.
|
03-04-2013, 03:59 PM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,743
|
|
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.
|
03-04-2013, 05:24 PM
|
|
Developer
|
|
Join Date: Nov 2012
Location: Halas
Posts: 355
|
|
Thanks guys for explaining this. I didn't have the patience yesterday.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
|
03-04-2013, 07:17 PM
|
Discordant
|
|
Join Date: Dec 2005
Posts: 435
|
|
Quote:
Originally Posted by lerxst2112
And this is why you fail.
|
Quote:
Originally Posted by orionsun
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.
|
03-04-2013, 07:38 PM
|
Discordant
|
|
Join Date: Jan 2013
Posts: 284
|
|
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.
|
03-04-2013, 07:50 PM
|
Fire Beetle
|
|
Join Date: Aug 2010
Posts: 14
|
|
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...
|
03-04-2013, 08:42 PM
|
|
Developer
|
|
Join Date: Nov 2012
Location: Halas
Posts: 355
|
|
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.
|
03-04-2013, 09:27 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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
|
03-04-2013, 09:39 PM
|
|
Developer
|
|
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
|
|
Do we need to change this to double from float and add a con check for '(base*mod) > ~0'?
__________________
Uleat of Bertoxxulous
Compilin' Dirty
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:15 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|