View Single Post
  #6  
Old 08-21-2013, 12:36 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

These aren't 100% related.

In terms of the verification server side see:
Code:
		if(!CanHaveSkill(skill)) {
			mlog(CLIENT__ERROR, "Tried to train skill %d, which is not allowed.", skill);
			return;
		}

		uint16 skilllevel = GetRawSkill(skill);
		if(skilllevel == 0) {
			//this is a new skill..
			uint16 t_level = SkillTrainLevel(skill, GetClass());
			if (t_level == 0)
			{
				return;
			}
			SetSkill(skill, t_level);
		}
It appears that it will bail out if you can't learn the skill. It will also bail out if SkillTrainLevel() is zero (never can train the skill). Though that doesn't appear to be good enough so I'll take a look at it.


The other bug you're talking about is a client bug that appears because sony's skillcaps does not play nice with the client.

The following script is one that's been tossed around a bit for creating a non-buggy skillcaps file from the current DB.
Code:
use DBI;

my $db = "eqdb";
my $user = "user";
my $pass = "password";
my $host = "localhost";
my $skill_caps_file = "SkillCaps.txt";
my $source = "DBI:mysql:database=$db;host=$host";
my $dbh = DBI->connect($source, $user, $pass) || die "Could not create db handle\n";

sub skill_usable {
    my $skill_id = shift;
    my $class = shift;
    
    my $sth = $dbh->prepare("SELECT max(`cap`) FROM skill_caps WHERE `class`=$class and `skillID`=$skill_id");
    $sth->execute();
    if(my $val = $sth->fetch()) {
        if(@$val[0] == 0) {
            return 0;
        } else {
            return 1;
        }
    }
    
    return 0;
}

sub get_skill {
    my $skill_id = shift;
    my $class = shift;
    my $level = shift;
    
    my $sth = $dbh->prepare("SELECT cap FROM skill_caps WHERE `class`=$class and `skillID`=$skill_id and `level`=$level");
    $sth->execute();
    if(my $val = $sth->fetch()) {
        return @$val[0];
    }
    
    return 0;
}

open(SKILLS, ">$skill_caps_file") or die "Unable to open skills file for export: $skill_caps_file\n";

for($class_i = 1; $class_i <= 16; $class_i++) {
    for($skill_i = 0; $skill_i <= 77; $skill_i++) {
        print "($class_i, $skill_i)\n";
        if(skill_usable($skill_i, $class_i) == 1) {
            for($level_i = 1; $level_i <= 90; $level_i++) {
                my $cap = get_skill($skill_i, $class_i, $level_i);
                my $line = $class_i . "^" . $skill_i . "^" . $level_i . "^" . $cap . "^0\n";
                print SKILLS $line;
            }
        }
    }
}

close (SKILLS);
Reply With Quote