summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-15 14:15:16 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-15 14:15:16 +0000
commit0393c333d4333d59d4cdb5083a0d004b2de92cb6 (patch)
tree7cd078724bf5407ac7ed16dcda11b67a758d80fc /src/map
parent3bd071ef6561d6c8dc372585fde5e64ee54d5ec5 (diff)
downloadhercules-0393c333d4333d59d4cdb5083a0d004b2de92cb6.tar.gz
hercules-0393c333d4333d59d4cdb5083a0d004b2de92cb6.tar.bz2
hercules-0393c333d4333d59d4cdb5083a0d004b2de92cb6.tar.xz
hercules-0393c333d4333d59d4cdb5083a0d004b2de92cb6.zip
- Fixed and cleaned up script command 'equip'
- Fixed 'autoequip' items. - Fixed Aspd not being updated in your status window after Agi/Dex increasing statuses take effect. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7179 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/script.c17
-rw-r--r--src/map/status.c2
4 files changed, 11 insertions, 16 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 9f7fd1034..f8685109e 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -478,7 +478,7 @@ struct map_session_data {
unsigned showdelay :1;
unsigned showexp :1;
unsigned showzeny :1;
- unsigned mainchat :1; //[LuzZza]
+ unsigned mainchat :1; //[LuzZza]
unsigned noask :1; // [LuzZza]
unsigned trading :1; //[Skotlex] is 1 only after a trade has started.
unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE
diff --git a/src/map/pc.c b/src/map/pc.c
index 877c97366..75fd227d1 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2533,8 +2533,11 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount)
sd->inventory_data[i] = data;
clif_additem(sd,i,amount,0);
}
+
sd->weight += w;
clif_updatestatus(sd,SP_WEIGHT);
+ //Auto-equip
+ if(data->flag.autoequip) pc_equipitem(sd, i, data->equip);
return 0;
}
@@ -2673,9 +2676,6 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
pc_stop_attack(sd);
clif_takeitem(&sd->bl,&fitem->bl);
- if(itemdb_autoequip(fitem->item_data.nameid) != 0){
- pc_equipitem(sd, fitem->item_data.nameid, fitem->item_data.equip);
- }
map_clearflooritem(fitem->bl.id);
return 1;
}
diff --git a/src/map/script.c b/src/map/script.c
index 340daa228..ab4be0c5b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9771,28 +9771,23 @@ int buildin_unequip(struct script_state *st)
int buildin_equip(struct script_state *st)
{
- int nameid=0,count=0,i;
+ int nameid=0,i;
struct map_session_data *sd;
struct item_data *item_data;
sd = script_rid2sd(st);
nameid=conv_num(st,& (st->stack->stack_data[st->start+2]));
- if(nameid>=500 && (item_data = itemdb_search(nameid)) != NULL)
- for(i=0;i<MAX_INVENTORY;i++){
- if(sd->status.inventory[i].nameid==nameid)
- count+=sd->status.inventory[i].amount;
- }
- else{
+ if((item_data = itemdb_exists(nameid)) == NULL)
+ {
if(battle_config.error_log)
ShowError("wrong item ID : equipitem(%i)\n",nameid);
return 1;
}
-
- if(count){
- pc_equipitem(sd,nameid,item_data->equip);
- }
+ for(i=0;i<MAX_INVENTORY && sd->status.inventory[i].nameid!=nameid;i++);
+ if(i==MAX_INVENTORY) return 0;
+ pc_equipitem(sd,i,item_data->equip);
return 0;
}
diff --git a/src/map/status.c b/src/map/status.c
index 1dd982372..a26986316 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2364,8 +2364,8 @@ void status_calc_bl_sub_pc(struct map_session_data *sd, unsigned long flag)
}
}
}
-
if(flag&(SCB_ASPD|SCB_AGI|SCB_DEX)) {
+ flag|=SCB_ASPD;
if (sd->status.weapon < MAX_WEAPON_TYPE)
skill = aspd_base[sd->status.class_][sd->status.weapon]-(status->agi*4+status->dex)*aspd_base[sd->status.class_][sd->status.weapon]/1000;
else