summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-10 18:57:14 +0000
committerParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-10 18:57:14 +0000
commit91f9047dcf18bdccda51c1066d6d0d76ababa61c (patch)
tree2b24b88dc2e860ac737c0cca72e9035586e704fe /src/map/itemdb.c
parent9a87c5b5ad061c2f92b87feadfd8baa6ad661ba5 (diff)
downloadhercules-91f9047dcf18bdccda51c1066d6d0d76ababa61c.tar.gz
hercules-91f9047dcf18bdccda51c1066d6d0d76ababa61c.tar.bz2
hercules-91f9047dcf18bdccda51c1066d6d0d76ababa61c.tar.xz
hercules-91f9047dcf18bdccda51c1066d6d0d76ababa61c.zip
Added an item_delay database usable for item-specific use delays.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14455 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index fb7cbe86f..2096ddf9e 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -27,7 +27,7 @@ static struct item_group itemgroup_db[MAX_ITEMGROUP];
struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex]
-
+int item_delays = 0;
/*==========================================
* 名前で検索用
@@ -661,6 +661,50 @@ static int itemdb_read_itemtrade(void)
return 0;
}
+/*==========================================
+ * Reads item delay amounts [Paradox924X]
+ *------------------------------------------*/
+static int itemdb_read_itemdelay(void)
+{
+ FILE *fp;
+ int nameid, j;
+ char line[1024], *str[10], *p;
+ struct item_data *id;
+
+ sprintf(line, "%s/item_delay.txt", db_path);
+ if ((fp = fopen(line,"r")) == NULL) {
+ ShowError("can't read %s\n", line);
+ return -1;
+ }
+
+ while(fgets(line, sizeof(line), fp))
+ {
+ if (item_delays == MAX_ITEMDELAYS) {
+ ShowError("itemdb_read_itemdelay: Too many entries specified in %s/item_delay.txt!\n", db_path);
+ break;
+ }
+ if (line[0] == '/' && line[1] == '/')
+ continue;
+ memset(str, 0, sizeof(str));
+ for (j = 0, p = line; j < 2 && p; j++) {
+ str[j] = p;
+ p = strchr(p, ',');
+ if(p) *p++ = 0;
+ }
+
+ if (j < 2 || str[0] == NULL ||
+ (nameid = atoi(str[0])) < 0 || !(id = itemdb_exists(nameid)))
+ continue;
+
+ id->delay = atoi(str[1]);
+ item_delays++;
+ }
+ fclose(fp);
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", item_delays, "item_delay.txt");
+
+ return 0;
+}
+
/*======================================
* Applies gender restrictions according to settings. [Skotlex]
*======================================*/
@@ -971,6 +1015,7 @@ static void itemdb_read(void)
itemdb_read_itemavail();
itemdb_read_noequip();
itemdb_read_itemtrade();
+ itemdb_read_itemdelay();
}
/*==========================================