View Full Version : hard coded class skill caps
loudent2
05-29-2003, 10:25 AM
I can't help but notice that skill caps by class are hard coded in the server. Doing a search will net you a couple dozen places where there's "case <class>: case <class>GM:"
Is anyone working on moving these values to a table in the database?
I have some free time this weekend to do some work but don't want to start something someone is already working on.
Bigpull
05-29-2003, 11:25 AM
Pointless er i mean why? DB querys just slow stuff down and bloat the HD space required.
#include "maxskill.h"
#include <iostream>
int main(void){
for (int class = 0; class <= 15; class++){
cout<<"Some crap here";
for (int skill = 0; skill <= 73; skill++){
cout<<"Some more crap here";
}
cout<<"Last crap here"<<endl;
}
return 0;
}
Now really before you go and connect the table think about how many times the db is going to get queried, take 5 melee chars at max haste with fast weapons, gives you about 20 query per second, just for the weapon skill, Another 20 for thier Offense checks. Now scale that up to a real raid size where melee class range from 1/3rd to 1/2 or more of the raid ;)
loudent2
05-29-2003, 11:50 AM
I'm not suggesting you read the database everytime.
Wouldn't it be preferable that you have some class that wraps 2 values. (lets call it CClassSkillCap) Skill cap and Per-Level skill cap. You then have a class that is wraps a vector of classes(eq classes) that each has a vector CClassSkillCap. One for each skill.
Whether you store these in the database or they're hard coded in the source they're read once on start-up. Then when you need to check for max skill you pass in race, class and level
pseudo-pseudo code:
maxskilllevel = Classvector[class].Classskillcap[skill].m_skillcap;
plvlmaxlevel = ((level+1) * (Classvector[class].Classskillcap[skill].m_plvlskillcap))
rlevel = (maxskilllevel > plvlmaxlevel) ? plvlmaxlevel : maxskilllevel;
There might have to be a couple tweaks to handle special advancements, trade skills and race based overrides but it should clean up a great deal of those class switch statements. With the list centralized it would be easier to make edits. The reason I suggested it go in the database is because it would allow world serverops to alter values for their world without re-building the source.
Bigpull
05-29-2003, 01:10 PM
Bah i was typeing and talking and left out the function call.
int8 Mob::MaxSkill(int16 skillid, int16 class_, int16 level)
Or if you haven't noticed it yet common/MaxSkill.cpp
/* TODO:
Load MaxSkillTable function into ram as a really big matrix:
MaxSkillTable[skillid][race][eqclass][level]
in preperation for that, dont put anything that wont work in
that table into MaxSkillTable (ie, AA checks, skill values that
depend on other skill values, etc), put it into MaxSkill instead
*/
int8 MaxSkill(int16 skillid, int16 race, int16 eqclass, int16 level) {
int8 ret = MaxSkillTable(skillid, race, eqclass, level);
return ret;
}
/* SPECIAL VALUES:
level:
0 = "skill level at character create"
TODO: catch levels > 65 (ie, npcs)
race:
NPCs will always have their skills maxed, and often ignore class
restrictions, accomplished by the special values below.
EMU_RACE_NPC
EMU_RACE_PET
EMU_RACE_UNKNOWN
return value:
TODO: Find out the specal values for the client for "your class/race doesnt have this skill" and
"must put one point in at GM", etc
*/
MaxSkillTable[74][17][16][66]
I don't feel like doing the math but i'm pretty sure I don't want to load that (zones*zones_on_server)+World times on any of my servers. I'll hook up a new share in cvs for non win32 people.
Use
if (MaxSkillTableMMF.Open("EQEMuMaxSkillTable", tmpMemSize)) {
Like in EMuShareMem/NPCtypes.cpp line 72
if (NPCTypesMMF.Open("EQEMuNPCTypes", tmpMemSize)) {
Or you might conflict with one of the others we only check the first letter after EQEMu on the unix side because i really don't think we'll ever have that many =)
with the database.LoadMaxSkillTable() in world/net.cpp
If you want to get ambitious include the class_skill table we use for GM trainer windows.
loudent2
05-29-2003, 01:50 PM
Ok, am home now and actually looking through the source.
Incidentally I think storing this info as MaxSkillTable[skillid][race][eqclass][level] is a bad idea as well.
Only the max skills for each class and the per level max skill. This would reduce it number of classes*number of skills*2. at 1 byte per value you end up with a pretty small chunk of memory.
Anyway I'll delve a little deeper into the source.
loudent2
05-29-2003, 02:22 PM
bah, I got lost in MMFs, MMFMutexs, Semaphores and how they relate to data. I'll leave this to those more comfortable with the source and stick with small stuff.
Bigpull
05-29-2003, 02:31 PM
You need the race for racial skills. Sneak hide forage ect
loudent2
05-29-2003, 02:36 PM
Yes, but the race based bonuses could be checked seperately.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.