summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/pc.c35
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c2
6 files changed, 30 insertions, 16 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 2962aaa8b..77e6d6055 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -889,7 +889,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un
#if PACKETVER < 4
*rhand = sd->status.look.weapon;
- *lhand = sd->status.shield;
+ *lhand = sd->status.look.shield;
#else
if (sd->equip_index[EQI_HAND_R] >= 0 &&
sd->inventory_data[sd->equip_index[EQI_HAND_R]])
@@ -9450,7 +9450,7 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
// Character Looks
#if PACKETVER < 4
clif->changelook(&sd->bl, LOOK_WEAPON, sd->status.look.weapon);
- clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
+ clif->changelook(&sd->bl, LOOK_SHIELD, sd->status.look.shield);
#else
clif->changelook(&sd->bl,LOOK_WEAPON,0);
#endif
diff --git a/src/map/pc.c b/src/map/pc.c
index c30161a0c..a8a715a70 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -895,10 +895,19 @@ int pc_setequipindex(struct map_session_data *sd)
}
if (sd->status.inventory[i].equip & EQP_HAND_L) {
- if (sd->inventory_data[i] != NULL && sd->inventory_data[i]->type == IT_WEAPON)
- sd->weapontype2 = sd->inventory_data[i]->subtype;
- else
+ if (sd->inventory_data[i] != NULL) {
+ if (sd->inventory_data[i]->type == IT_WEAPON)
+ sd->weapontype2 = sd->inventory_data[i]->subtype;
+ else
+ sd->weapontype2 = W_FIST;
+ if (sd->inventory_data[i]->type == IT_ARMOR)
+ sd->has_shield = true;
+ else
+ sd->has_shield = false;
+ } else {
sd->weapontype2 = W_FIST;
+ sd->has_shield = false;
+ }
}
}
}
@@ -5947,7 +5956,7 @@ int pc_checkallowskill(struct map_session_data *sd)
// Spurt requires bare hands (feet, in fact xD)
status_change_end(&sd->bl, SC_STRUP, INVALID_TIMER);
- if(sd->status.shield <= 0) { // Skills requiring a shield
+ if (!sd->has_shield) { // Skills requiring a shield
for (i = 0; i < ARRAYLENGTH(scs_list); i++)
if(sd->sc.data[scs_list[i]])
status_change_end(&sd->bl, scs_list[i], INVALID_TIMER);
@@ -8891,7 +8900,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
sd->status.clothes_color=val;
break;
case LOOK_SHIELD:
- sd->status.shield=val;
+ sd->status.look.shield = val;
break;
case LOOK_SHOES:
break;
@@ -9772,18 +9781,21 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n,
(pos & EQP_HAND_L)) {
if (id != NULL) {
if (id->type == IT_WEAPON) {
- sd->status.shield = 0;
+ sd->has_shield = false;
+ sd->status.look.shield = 0;
sd->weapontype2 = id->subtype;
} else if (id->type == IT_ARMOR) {
- sd->status.shield = id->view_sprite;
+ sd->has_shield = true;
+ sd->status.look.shield = id->view_sprite;
sd->weapontype2 = W_FIST;
}
} else {
- sd->status.shield = 0;
+ sd->has_shield = false;
+ sd->status.look.shield = 0;
sd->weapontype2 = W_FIST;
}
pc->calcweapontype(sd);
- clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
+ clif->changelook(&sd->bl, LOOK_SHIELD, sd->status.look.shield);
}
//Added check to prevent sending the same look on multiple slots ->
//causes client to redraw item on top of itself. (suggested by Lupus)
@@ -10001,10 +10013,11 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos)
status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER); // Unequipping => stop dancing.
}
if (pos & EQP_HAND_L) {
- sd->status.shield = 0;
+ sd->has_shield = false;
+ sd->status.look.shield = 0;
sd->weapontype2 = W_FIST;
pc->calcweapontype(sd);
- clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
+ clif->changelook(&sd->bl, LOOK_SHIELD, sd->status.look.shield);
}
if (pos & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) {
sd->status.head_bottom = 0;
diff --git a/src/map/pc.h b/src/map/pc.h
index 62129b5ae..8615f00f2 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -308,6 +308,7 @@ struct map_session_data {
short nameid;
int64 tick;
} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
+ bool has_shield; ///< Whether the character is wearing a shield.
int16 weapontype; ///< Weapon type considering both hands (@see enum weapon_type).
int16 weapontype1; ///< Weapon type in the right/primary hand (@see enum weapon_type).
int16 weapontype2; ///< Weapon type in the left/secondary hand (@see enum weapon_type).
diff --git a/src/map/script.c b/src/map/script.c
index 58dd65173..09f6377ef 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15525,7 +15525,7 @@ BUILDIN(getlook)
case LOOK_HEAD_MID: val = sd->status.head_mid; break; //5
case LOOK_HAIR_COLOR: val = sd->status.hair_color; break; //6
case LOOK_CLOTHES_COLOR: val = sd->status.clothes_color; break; //7
- case LOOK_SHIELD: val = sd->status.shield; break; //8
+ case LOOK_SHIELD: val = sd->status.look.shield; break; //8
case LOOK_SHOES: break; //9
case LOOK_ROBE: val = sd->status.robe; break; //12
case LOOK_BODY2: val=sd->status.body; break; //13
diff --git a/src/map/skill.c b/src/map/skill.c
index 4649ace42..25d85e746 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14245,7 +14245,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
}
break;
case ST_SHIELD:
- if(sd->status.shield <= 0) {
+ if (!sd->has_shield) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
diff --git a/src/map/status.c b/src/map/status.c
index ed29e85be..733eb5f6f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4326,7 +4326,7 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1];
if (sd->weapontype > MAX_SINGLE_WEAPON_TYPE)
amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2] / 4;
- if ( sd->status.shield )
+ if (sd->has_shield)
amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][MAX_SINGLE_WEAPON_TYPE];
switch (sd->weapontype) {
case W_BOW: