Originally posted by [b]Skotlex[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=453
CODE
static int skill_get_index( int id )
{
// avoid ranges reserved for mapping guild/homun skills
if( id >= GD_SKILLRANGEMIN && id <= GD_SKILLRANGEMAX )
return 0;
if( id >= HM_SKILLRANGEMIN && id <= HM_SKILLRANGEMAX )
return 0;
// map skill number to skill id
if( id >= GD_SKILLBASE )
id = GD_SKILLRANGEMIN + id - GD_SKILLBASE;
if( id >= HM_SKILLBASE )
id = HM_SKILLRANGEMIN + id - HM_SKILLBASE;
// validate result
if( id <= 0 || id >= MAX_SKILL_DB )
return 0;
return id;
}
This is conceptually wrong, because 0 is not an invalid skill index, it is the skill index for NV_BASIC! It has minimal consequences since pretty much the only use for NV_BASIC is "pc_checkskill(sd, NV_BASIC)", but still, if anyone where to actually edit that skill to do stuff with it, the skill_get_index return value would make you think the skill ID is invalid. It should be changed to something else, perhaps -1 (in particular, if you try to validate the skill_db.txt information before reading it, this would make it impossible to define custom behaviour for NV_BASIC).