summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-14 22:20:15 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-14 22:20:15 -0600
commit1f073198ce4a175191da2815c00cca11e81735d8 (patch)
treef953295d95db532750269918dbd13da19500687a
parentdc1c0ca6d41a3cb15a98cda7a324a948f40c90f7 (diff)
downloadtmwa-1f073198ce4a175191da2815c00cca11e81735d8.tar.gz
tmwa-1f073198ce4a175191da2815c00cca11e81735d8.tar.bz2
tmwa-1f073198ce4a175191da2815c00cca11e81735d8.tar.xz
tmwa-1f073198ce4a175191da2815c00cca11e81735d8.zip
Fix a bug in item loading
-rw-r--r--src/map/itemdb.c3
-rw-r--r--src/map/pc.c16
2 files changed, 8 insertions, 11 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 41ada0a..d9f77d3 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -293,7 +293,7 @@ static int itemdb_readdb(void)
if(line[0]=='/' && line[1]=='/')
continue;
memset(str,0,sizeof(str));
- for(j=0,np=p=line;j<18 && p;j++){
+ for(j=0,np=p=line;j<17 && p;j++){
while (*p == '\t' || *p == ' ') p++;
str[j]=p;
p=strchr(p,',');
@@ -342,6 +342,7 @@ static int itemdb_readdb(void)
if((p=strchr(np,'{'))==NULL)
continue;
id->use_script = parse_script(p,lines);
+
if((p=strchr(p+1,'{'))==NULL)
continue;
id->equip_script = parse_script(p,lines);
diff --git a/src/map/pc.c b/src/map/pc.c
index cae2d68..b900bd0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -543,8 +543,6 @@ int pc_isequip(struct map_session_data *sd,int n)
if(item->elv > 0 && sd->status.base_level < item->elv)
return 0;
- if(sd->status.class!=13 && sd->status.class!=4014 && sd->status.class!=21 && sd->status.class!=4022)
-
if(map[sd->bl.m].flag.pvp && (item->flag.no_equip==1 || item->flag.no_equip==3))
return 0;
if(map[sd->bl.m].flag.gvg && (item->flag.no_equip==2 || item->flag.no_equip==3))
@@ -3083,6 +3081,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
clif_skill_teleportmessage(sd,0);
return 0;
}
+
if(nameid == 602 && map[sd->bl.m].flag.noreturn)
return 0;
if(nameid == 604 && (map[sd->bl.m].flag.nobranch || map[sd->bl.m].flag.gvg))
@@ -3091,7 +3090,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
return 0;
if(item->elv > 0 && sd->status.base_level < item->elv)
return 0;
- if(sd->status.class!=13 && sd->status.class!=4014 && sd->status.class!=21 && sd->status.class!=4022)
+
return 1;
}
@@ -3105,18 +3104,15 @@ int pc_useitem(struct map_session_data *sd,int n)
nullpo_retr(1, sd);
- if(n >=0 && n < MAX_INVENTORY) {
+ if(n >=0 && n < MAX_INVENTORY && sd->inventory_data[n]) {
nameid = sd->status.inventory[n].nameid;
amount = sd->status.inventory[n].amount;
- if(sd->status.inventory[n].nameid <= 0 ||
- sd->status.inventory[n].amount <= 0 ||
- sd->sc_data[SC_BERSERK].timer!=-1 ||
- !pc_isUseitem(sd,n) ) {
+ if(sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0 || sd->sc_data[SC_BERSERK].timer!=-1 || !pc_isUseitem(sd,n) ) {
clif_useitemack(sd,n,0,0);
return 1;
}
- if(sd->inventory_data[n])
- run_script(sd->inventory_data[n]->use_script,0,sd->bl.id,0);
+
+ run_script(sd->inventory_data[n]->use_script,0,sd->bl.id,0);
clif_useitemack(sd,n,amount-1,1);
pc_delitem(sd,n,1,1);