summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-21 16:03:12 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-21 16:03:12 +0000
commit6c6cfb325ea28e5bf8d137e057eb0716b0b8a4d0 (patch)
tree3cfbd2bc33d5d447e7bd26a4fb73b590c849909e /src/map
parenteb3546a33a9689a745e6497fc9e781f4e7f9b3c1 (diff)
downloadhercules-6c6cfb325ea28e5bf8d137e057eb0716b0b8a4d0.tar.gz
hercules-6c6cfb325ea28e5bf8d137e057eb0716b0b8a4d0.tar.bz2
hercules-6c6cfb325ea28e5bf8d137e057eb0716b0b8a4d0.tar.xz
hercules-6c6cfb325ea28e5bf8d137e057eb0716b0b8a4d0.zip
- Cleaned up some the code of pc_equipitem and clif_parse_EquipItem
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10045 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c24
-rw-r--r--src/map/pc.c43
2 files changed, 31 insertions, 36 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index bfb6d5500..d95f78c87 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9237,20 +9237,24 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
if(sd->sc.data[SC_BLADESTOP].timer!=-1 || sd->sc.data[SC_BERSERK].timer!=-1 )
return;
- if(!sd->status.inventory[index].identify) { // 未鑑定
+ if(!sd->status.inventory[index].identify) {
clif_equipitemack(sd,index,0,0); // fail
return;
}
- //ペット用装備であるかないか
- if(sd->inventory_data[index]) {
- if(sd->inventory_data[index]->type != IT_PETARMOR){
- if(sd->inventory_data[index]->type == IT_AMMO)
- pc_equipitem(sd,index,EQP_AMMO); //Client doesn't sends the position.
- else
- pc_equipitem(sd,index,RFIFOW(fd,4));
- } else
- pet_equipitem(sd,index);
+
+ if(!sd->inventory_data[index])
+ return;
+
+ if(sd->inventory_data[index]->type == IT_PETARMOR){
+ pet_equipitem(sd,index);
+ return;
}
+
+ //Client doesn't sends the position for ammo.
+ if(sd->inventory_data[index]->type == IT_AMMO)
+ pc_equipitem(sd,index,EQP_AMMO);
+ else
+ pc_equipitem(sd,index,RFIFOW(fd,4));
}
/*==========================================
diff --git a/src/map/pc.c b/src/map/pc.c
index 31fecc8f5..1f90b52f5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6419,25 +6419,25 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
sd->status.inventory[n].equip=pos;
if(pos & EQP_HAND_R) {
- if(sd->inventory_data[n])
- sd->weapontype1 = sd->inventory_data[n]->look;
+ if(id)
+ sd->weapontype1 = id->look;
else
sd->weapontype1 = 0;
pc_calcweapontype(sd);
clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
}
if(pos & EQP_HAND_L) {
- if(sd->inventory_data[n]) {
- if(sd->inventory_data[n]->type == IT_WEAPON) {
+ if(id) {
+ if(id->type == IT_WEAPON) {
sd->status.shield = 0;
if(sd->status.inventory[n].equip == EQP_HAND_L)
- sd->weapontype2 = sd->inventory_data[n]->look;
+ sd->weapontype2 = id->look;
else
sd->weapontype2 = 0;
}
else
- if(sd->inventory_data[n]->type == IT_ARMOR) {
- sd->status.shield = sd->inventory_data[n]->look;
+ if(id->type == IT_ARMOR) {
+ sd->status.shield = id->look;
sd->weapontype2 = 0;
}
}
@@ -6449,22 +6449,22 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
//Added check to prevent sending the same look on multiple slots ->
//causes client to redraw item on top of itself. (suggested by Lupus)
if(pos & EQP_HEAD_LOW) {
- if(sd->inventory_data[n] && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID)))
- sd->status.head_bottom = sd->inventory_data[n]->look;
+ if(id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID)))
+ sd->status.head_bottom = id->look;
else
sd->status.head_bottom = 0;
clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
if(pos & EQP_HEAD_TOP) {
- if(sd->inventory_data[n])
- sd->status.head_top = sd->inventory_data[n]->look;
+ if(id)
+ sd->status.head_top = id->look;
else
sd->status.head_top = 0;
clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
if(pos & EQP_HEAD_MID) {
- if(sd->inventory_data[n] && !(pos&EQP_HEAD_TOP))
- sd->status.head_mid = sd->inventory_data[n]->look;
+ if(id && !(pos&EQP_HEAD_TOP))
+ sd->status.head_mid = id->look;
else
sd->status.head_mid = 0;
clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
@@ -6475,29 +6475,20 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
pc_checkallowskill(sd); //Check if status changes should be halted.
-/* WTF? pc_checkequip returns an item index, pc_search_inventory expects a
- * nameid as argument. This function is totally broken, so most (all?) of the
- * time it would return arrow == -1 anyway...?? [Skotlex]
- arrow=pc_search_inventory(sd,pc_checkequip(sd,EQI_AMMO)); // Added by RoVeRT
- if (itemdb_look(sd->status.inventory[n].nameid) == W_BOW && (arrow >= 0)){ // Added by RoVeRT
- clif_arrowequip(sd,arrow);
- sd->status.inventory[arrow].equip=EQP_AMMO;
- }
-*/
status_calc_pc(sd,0);
if (flag) //Update skill data
clif_skillinfoblock(sd);
//OnEquip script [Skotlex]
- if (sd->inventory_data[n]) {
+ if (id) {
int i;
struct item_data *data;
- if (sd->inventory_data[n]->equip_script)
- run_script(sd->inventory_data[n]->equip_script,0,sd->bl.id,fake_nd->bl.id);
+ if (id->equip_script)
+ run_script(id->equip_script,0,sd->bl.id,fake_nd->bl.id);
if(itemdb_isspecial(sd->status.inventory[n].card[0]))
; //No cards
else
- for(i=0;i<sd->inventory_data[n]->slot; i++)
+ for(i=0;i<id->slot; i++)
{
if (!sd->status.inventory[n].card[i])
continue;