summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 06:08:29 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 06:08:29 +0000
commit4f23ac6a3862cbf1b1cbd8bea240c9fdf9290937 (patch)
treef4e4422d5cb25f76dcf4dd3053ee13f057c5cae5 /src/map/itemdb.c
parent2dadd8a880bdea8b94d69d83a1dd8b6569552ada (diff)
downloadhercules-4f23ac6a3862cbf1b1cbd8bea240c9fdf9290937.tar.gz
hercules-4f23ac6a3862cbf1b1cbd8bea240c9fdf9290937.tar.bz2
hercules-4f23ac6a3862cbf1b1cbd8bea240c9fdf9290937.tar.xz
hercules-4f23ac6a3862cbf1b1cbd8bea240c9fdf9290937.zip
- Modified the equip_job field in the item_db to be a hexadecimal value for easier handling.
- Updated item_db.sql to this new file format (even though it's equip_jobs field is still a integer) - Added upgrade_svn5951.sql for those who would like to convert their existing items. - Added doc/item_db.txt to explain each of the fields in db/item_db.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5951 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index d9f75a6e7..9b48efec9 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -194,12 +194,17 @@ struct item_data* itemdb_exists(int nameid)
* to the format used by the map server. [Skotlex]
*------------------------------------------
*/
-static void itemdb_jobid2mapid(unsigned int *bclass, int jobmask)
+static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
{
int i;
bclass[0]= bclass[1]= bclass[2]= 0;
//Base classes
- for (i = JOB_NOVICE; i <= JOB_THIEF; i++)
+ if (jobmask & 1<<JOB_NOVICE)
+ { //Both Novice/Super-Novice are counted with the same ID
+ bclass[0] |= 1<<MAPID_NOVICE;
+ bclass[1] |= 1<<MAPID_NOVICE;
+ }
+ for (i = JOB_NOVICE+1; i <= JOB_THIEF; i++)
{
if (jobmask & 1<<i)
bclass[0] |= 1<<(MAPID_NOVICE+i);
@@ -233,17 +238,15 @@ static void itemdb_jobid2mapid(unsigned int *bclass, int jobmask)
if (jobmask & 1<<JOB_ROGUE)
bclass[2] |= 1<<MAPID_THIEF;
//Special classes that don't fit above.
- if (jobmask & 1<<JOB_SUPER_NOVICE)
- bclass[1] |= 1<<MAPID_NOVICE;
- if (jobmask & 1<<24) //Taekwon boy
+ if (jobmask & 1<<21) //Taekwon boy
bclass[0] |= 1<<MAPID_TAEKWON;
- if (jobmask & 1<<25) //Star Gladiator
+ if (jobmask & 1<<22) //Star Gladiator
bclass[1] |= 1<<MAPID_TAEKWON;
- if (jobmask & 1<<26) //Soul Linker
+ if (jobmask & 1<<23) //Soul Linker
bclass[2] |= 1<<MAPID_TAEKWON;
- if (jobmask & 1<<27) //Gunslinger
+ if (jobmask & 1<<JOB_GUNSLINGER)
bclass[0] |= 1<<MAPID_GUNSLINGER;
- if (jobmask & 1<<28) //Ninja
+ if (jobmask & 1<<JOB_NINJA)
bclass[0] |= 1<<MAPID_NINJA;
}
@@ -911,7 +914,7 @@ static int itemdb_read_sqldb(void)
ShowWarning("itemdb_read_sqldb: Item %d (%s) specifies %d slots, but the server only supports up to %d\n", nameid, id->jname, id->slot, MAX_SLOTS);
id->slot = MAX_SLOTS;
}
- itemdb_jobid2mapid(id->class_base, (sql_row[11] != NULL) ? atoi(sql_row[11]) : 0);
+ itemdb_jobid2mapid(id->class_base, (sql_row[11] != NULL) ? (unsigned int)strtol(sql_row[11], NULL, 0) : 0);
id->class_upper= (sql_row[12] != NULL) ? atoi(sql_row[12]) : 0;
id->sex = (sql_row[13] != NULL) ? atoi(sql_row[13]) : 0;
id->equip = (sql_row[14] != NULL) ? atoi(sql_row[14]) : 0;
@@ -1054,7 +1057,7 @@ static int itemdb_readdb(void)
ShowWarning("itemdb_readdb: Item %d (%s) specifies %d slots, but the server only supports up to %d\n", nameid, id->jname, id->slot, MAX_SLOTS);
id->slot = MAX_SLOTS;
}
- itemdb_jobid2mapid(id->class_base, atoi(str[11]));
+ itemdb_jobid2mapid(id->class_base, (unsigned int)strtol(str[11],NULL,0));
id->class_upper = atoi(str[12]);
id->sex = atoi(str[13]);
if(id->equip != atoi(str[14])){