d2skills.c
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "d2skills.h"
#include <stdio.h>
#include <stdlib.h>
const char* getSkillName(D2S_SKILL skillID) {
if(skillID > D2S_SKILL_NUMSKILLS || skillID < 0) {
fprintf(stderr,"libd2char error: skillID %d doesn't exist\n",skillID);
return NULL;
}
return skillNames[skillID];
}
D2S_SKILL getSkillIDFromCharOffset(D2S_CHARCLASS class, unsigned int offset) {
if(offset < 0 || offset > D2S_SKILL_MAXSKILLS_PER_CHAR) {
fprintf(stderr,"libd2char error: Invalid character skill offset: %d\n",offset);
return D2S_SKILL_UNKNOWN;
}
switch(class) {
case D2S_CHARCLASS_AMAZON:
return amazonSkills[offset];
break;
case D2S_CHARCLASS_SORCERESS:
return sorceressSkills[offset];
break;
case D2S_CHARCLASS_NECROMANCER:
return necromancerSkills[offset];
break;
case D2S_CHARCLASS_PALADIN:
return paladinSkills[offset];
break;
case D2S_CHARCLASS_BARBARIAN:
return barbarianSkills[offset];
break;
case D2S_CHARCLASS_DRUID:
return druidSkills[offset];
break;
case D2S_CHARCLASS_ASSASSIN:
return assassinSkills[offset];
break;
case D2S_CHARCLASS_UNKNOWN:
default:
return D2S_SKILL_UNKNOWN;
break;
}
}