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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2008, 10:49 PM
Toriad
Fire Beetle
 
Join Date: Apr 2004
Posts: 21
Default FIX: Skills not capping properly.

For me the skills were not capping properly and I found out that the DB query was off at least for PEQ? Maybe I just jumped blindly, if so let me know....

Replace GetSkillCap in database.cpp with this

Code:
int8 Database::GetSkillCap(int8 skillid, int8 in_race, int8 in_class, int16 in_level)
{
	int8 skill_level = 0, skill_formula = 0;
	int16 base_cap = 0, skill_cap = 0, skill_cap2 = 0, skill_cap3 = 0;
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	int32	affected_rows = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;
	//Fetch the data from DB.
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT cap from skill_caps where skillID = %i && class = %i && level = %i", skillid, in_class, in_level), errbuf, &result, &affected_rows)) //if (RunQuery(query, MakeAnyLenString(&query, "SELECT level, formula, pre50cap, post50cap, post60cap from skillcaps where skill = %i && class = %i", skillid, in_class), errbuf, &result, &affected_rows))
	{
		if (affected_rows != 0)
		{
			row = mysql_fetch_row(result);
			LogFile->write(EQEMuLog::Debug, "row[0] = %i", atoi(row[0]));
			skill_cap = atoi(row[0]);
			/*skill_level = atoi(row[0]);
			skill_formula = atoi(row[1]);
			skill_cap = atoi(row[2]);
			if (atoi(row[3]) > skill_cap)
				skill_cap2 = (atoi(row[3])-skill_cap)/10; //Split the post-50 skill cap into difference between pre-50 cap and post-50 cap / 10 to determine amount of points per level.
			skill_cap3 = atoi(row[4]);*/
		}
		delete[] query;
		mysql_free_result(result);
	}
	
	int race_skill = GetRaceSkill(skillid,in_race);

	if (race_skill > 0 && (race_skill > skill_cap || skill_cap == 0 || in_level < skill_level))
		return race_skill;

	if (skill_cap == 0) //Can't train this skill at all.
		return 255; //Untrainable

	/*if (in_level < skill_level)
		return 254; //Untrained*/

	/*//Determine pre-51 level-based cap
	if (skill_formula > 0)
		base_cap = in_level*skill_formula+skill_formula;
	if (base_cap > skill_cap || skill_formula == 0)
		base_cap = skill_cap;
	//If post 50, add post 50 cap to base cap.
	if (in_level > 50 && skill_cap2 > 0)
		base_cap += skill_cap2*(in_level-50);
	//No cap should ever go above its post50cap
	if (skill_cap3 > 0 && base_cap > skill_cap3)
		base_cap = skill_cap3;
	//Base cap is now the max value at the person's level, return it!*/
	return skill_cap;
}
Reply With Quote
  #2  
Old 02-02-2008, 10:59 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I don't think this code is actually still being used in the server, at least I looked at the unmodified code and it seems old.. is uses skillcaps table for instance and we use skill_caps now...

Can you explain what exactly is wrong with skill caps, what were you trying to fix?
Reply With Quote
  #3  
Old 02-02-2008, 11:05 AM
Toriad
Fire Beetle
 
Join Date: Apr 2004
Posts: 21
Default

When I was level one, as long as I used offeense it kept going up, it never stopped at 10, like the skillcaps table said it should. I was trying to make it so it would. On a side note where is this skills_caps table? I didn't see any tables...
Reply With Quote
  #4  
Old 02-02-2008, 12:00 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Quote:
Originally Posted by Toriad View Post
On a side note where is this skills_caps table? I didn't see any tables...
Then that's your problem The table is in the newest PEQ release as well as our CVS, and I am sure Angelox's newest db has it as well.
Reply With Quote
  #5  
Old 02-02-2008, 12:10 PM
Toriad
Fire Beetle
 
Join Date: Apr 2004
Posts: 21
Default

I have that table, but it still wasn't working... SELECT * FROM peq.skill_caps s;

The old DB query in the code was

Code:
//if (RunQuery(query, MakeAnyLenString(&query, "SELECT level, formula, pre50cap, post50cap, post60cap from skillcaps where skill = %i && class = %i", skillid, in_class), errbuf, &result, &affected_rows))
That was the old query however, I dont have a skillcaps table i did have skill_caps but it didn't have any of those fields which is why i changed it to

Code:
if (RunQuery(query, MakeAnyLenString(&query, "SELECT cap from skill_caps where skillID = %i && class = %i && level = %i", skillid, in_class, in_level), errbuf, &result, &affected_rows))
That is what I changed it to... Which seemed to fix the problem, maybe the latest source code already had this change? but when I downloaded the source from latest emu it was like the old.

Last edited by Toriad; 02-02-2008 at 08:13 PM..
Reply With Quote
  #6  
Old 02-02-2008, 06:57 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default

I think that what KLS is saying is that the code you pasted above isn't the code that loads skill caps any more. Pretty sure the current code for skill caps is in shareddb.cpp in the DBLoadSkillCaps function, which does have the correct query:
Code:
"SELECT skillID,class,level,cap FROM skill_caps ORDER BY skillID,class,level"
That's not to say that the issue didn't occur, just that more information needs to be provided in order to reproduce the problem.
Reply With Quote
  #7  
Old 02-02-2008, 07:23 PM
Toriad
Fire Beetle
 
Join Date: Apr 2004
Posts: 21
Default

I didn't mean to say he was incorrect and if thats how it came out I sincerely apologize.

I cannot give more information that that...

I was at level 1 using a 1hslash weapon, i got 11 offense at level 1 which according to my database said was incorrect.. When I modified the code to what I put in the posts above I was capped at 10 offense at elvel 1.
Reply With Quote
  #8  
Old 02-03-2008, 02:12 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

That's very bizarre, I wasn't able to reproduce this, either on my test server or TGC. Both are running the same code more or less and are the newest.
Reply With Quote
  #9  
Old 02-03-2008, 11:16 AM
Toriad
Fire Beetle
 
Join Date: Apr 2004
Posts: 21
Default

Hmm, Ok maybe I'm just retarded somehow -shrugs- sorry for all the trobule, feel free to delete this topic.
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 12: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