summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-05 20:51:58 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-05 20:51:58 +0000
commitce9b9e74f648f3dd52e4161d3183612ecd002f80 (patch)
treeb6069d2b4687cd979685c6d803ec93a5e54d0590 /src/map/itemdb.c
parentd9a43b19b761c9d1726fc971044634cd3fa917b8 (diff)
downloadhercules-ce9b9e74f648f3dd52e4161d3183612ecd002f80.tar.gz
hercules-ce9b9e74f648f3dd52e4161d3183612ecd002f80.tar.bz2
hercules-ce9b9e74f648f3dd52e4161d3183612ecd002f80.tar.xz
hercules-ce9b9e74f648f3dd52e4161d3183612ecd002f80.zip
Merging RREmu into rAthena -- quite a few stuff yet to be renamed, but we'll get it sorted.
Some of the stuff included in RREmu that is now part of rAthena: - RE Drop Rate Modifier - RE Experience Rate Modifier - RE Weapon MATK - RE Shield ASPD job-specific penalty - RE Cast Time - Renewal-specific item DEF - 3.1 classes. - All-New Mounts - Official Magical Reflection - And other perks, such as fully-functional @mapflag also merged eAthena 15006 into rAthena. For Bugs, Comments and Suggestions: http://rathena.org/board/tracker/ git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15009 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index d8a8bb2cc..00d4176c5 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -706,7 +706,35 @@ static int itemdb_gendercheck(struct item_data *id)
return (battle_config.ignore_items_gender) ? 2 : id->sex;
}
-
+/**
+ * [RRInd]
+ * For backwards compatibility, in Renewal mode, MATK from weapons comes from the atk slot
+ * We use a ':' delimiter which, if not found, assumes the weapon does not provide any matk.
+ **/
+void itemdb_rr_split_atoi(char *str, int *atk, int *matk) {
+ int i, val[2];
+
+ for (i=0; i<2; i++) {
+ if (!str) break;
+ val[i] = atoi(str);
+ str = strchr(str,':');
+ if (str)
+ *str++=0;
+ }
+ if( i == 0 ) {
+ *atk = *matk = 0;
+ return;//no data found
+ }
+ if( i == 1 ) {//Single Value, we assume it's the ATK
+ *atk = val[0];
+ *matk = 0;
+ return;
+ }
+ //We assume we have 2 values.
+ *atk = val[0];
+ *matk = val[1];
+ return;
+}
/*==========================================
* processes one itemdb entry
*------------------------------------------*/
@@ -736,7 +764,7 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
id->type = atoi(str[3]);
- if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_DELAYCONSUME && id->type < IT_CASH ) || id->type >= IT_MAX )
+ if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_THROWWEAPON && id->type < IT_CASH ) || id->type >= IT_MAX )
{// catch invalid item types
ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %d. IT_ETC will be used.\n", id->type, nameid);
id->type = IT_ETC;
@@ -773,7 +801,11 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
id->value_buy, id->value_sell, nameid, id->jname);
id->weight = atoi(str[6]);
+#if RRMODE
+ itemdb_rr_split_atoi(str[7],&id->atk,&id->matk);
+#else
id->atk = atoi(str[7]);
+#endif
id->def = atoi(str[8]);
id->range = atoi(str[9]);
id->slot = atoi(str[10]);
@@ -835,7 +867,14 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
*------------------------------------------*/
static int itemdb_readdb(void)
{
- const char* filename[] = { "item_db.txt", "item_db2.txt" };
+ /**
+ * ro-resources inheritance: item_db -> item_db_re -> item_db2 (user customs)
+ **/
+#if RRMODE
+ const char* filename[] = { "item_db.txt","item_db_re.txt","item_db2.txt" };
+#else
+ const char* filename[] = { "item_db.txt","item_db2.txt" };
+#endif
int fi;
for( fi = 0; fi < ARRAYLENGTH(filename); ++fi )
@@ -947,7 +986,11 @@ static int itemdb_readdb(void)
*======================================*/
static int itemdb_read_sqldb(void)
{
+#if RRMODE
+ const char* item_db_name[] = { item_db_db, item_db_re_db, item_db2_db };
+#else
const char* item_db_name[] = { item_db_db, item_db2_db };
+#endif
int fi;
for( fi = 0; fi < ARRAYLENGTH(item_db_name); ++fi )