summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c10
-rw-r--r--src/common/mmo.h2
-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
8 files changed, 36 insertions, 22 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 09aa8684b..c02ee33ef 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -461,7 +461,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
(p->option != cp->option) ||
(p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) ||
(p->pet_id != cp->pet_id) || (p->look.weapon != cp->look.weapon) || (p->hom_id != cp->hom_id) ||
- (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) ||
+ (p->ele_id != cp->ele_id) || (p->look.shield != cp->look.shield) || (p->head_top != cp->head_top) ||
(p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) ||
(p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) ||
(p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) ||
@@ -490,7 +490,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point,
p->str, p->agi, p->vit, p->int_, p->dex, p->luk,
p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id,
- p->look.weapon, p->shield, p->head_top, p->head_mid, p->head_bottom,
+ p->look.weapon, p->look.shield, p->head_top, p->head_mid, p->head_bottom,
mapindex_id2name(p->last_point.map), p->last_point.x, p->last_point.y,
mapindex_id2name(p->save_point.map), p->save_point.x, p->save_point.y, p->rename,
(unsigned long)p->delete_date, // FIXME: platform-dependent size
@@ -1095,7 +1095,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.look.weapon, 0, NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.look.shield, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, NULL, NULL)
@@ -1209,7 +1209,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->look.weapon, 0, NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->look.shield, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, NULL, NULL)
@@ -1947,7 +1947,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) {
WBUFW(buf,58) = p->base_level;
WBUFW(buf,60) = min(p->skill_point, INT16_MAX);
WBUFW(buf,62) = p->head_bottom;
- WBUFW(buf,64) = p->shield;
+ WBUFW(buf,64) = p->look.shield;
WBUFW(buf,66) = p->head_top;
WBUFW(buf,68) = p->head_mid;
WBUFW(buf,70) = p->hair_color;
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 1ade0caa9..4b120e812 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -614,8 +614,8 @@ struct mmo_charstatus {
struct {
short weapon; ///< Weapon view sprite id.
+ short shield; ///< Shield view sprite id.
} look;
- short shield; // view-id
short head_top,head_mid,head_bottom;
short robe;
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: