summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-06 18:47:11 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-06 18:47:11 +0000
commitf0fa9794bcdde0b1402bb7a7256265f59bbd7313 (patch)
tree7b63a598956cf1c3acf681c13112f5d6c4278e93 /src/map/status.c
parentb1b0860d1ca7e0f9ddb57756be9af11d9557d555 (diff)
downloadhercules-f0fa9794bcdde0b1402bb7a7256265f59bbd7313.tar.gz
hercules-f0fa9794bcdde0b1402bb7a7256265f59bbd7313.tar.bz2
hercules-f0fa9794bcdde0b1402bb7a7256265f59bbd7313.tar.xz
hercules-f0fa9794bcdde0b1402bb7a7256265f59bbd7313.zip
- Added EQP_/EQI_ constants in pc.h to identify equip position and equip indexes, makes equipping related code much easier to read.
- Also cleaned up pc_equipitem. When dual wielding or equipping accessories, if the client actually specifies one of the two positions, it will be taken into account. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7550 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 8d7acaf93..09d6992b2 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1618,15 +1618,15 @@ int status_calc_pc(struct map_session_data* sd,int first)
);
// Parse equipment.
- for(i=0;i<10;i++) {
+ for(i=0;i<EQI_MAX-1;i++) {
current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
if(index < 0)
continue;
- if(i == 9 && sd->equip_index[8] == index)
+ if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index)
continue;
- if(i == 5 && sd->equip_index[4] == index)
+ if(i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index)
continue;
- if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index))
+ if(i == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index))
continue;
if(!sd->inventory_data[index])
continue;
@@ -1647,7 +1647,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
if (wlv >= MAX_REFINE_BONUS)
wlv = MAX_REFINE_BONUS - 1;
- if(i == 8 && sd->status.inventory[index].equip == 0x20) {
+ if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L) {
wd = &sd->left_weapon; // Left-hand weapon
wa = status->lhw;
} else {
@@ -1692,8 +1692,8 @@ int status_calc_pc(struct map_session_data* sd,int first)
}
}
- if(sd->equip_index[10] >= 0){ // –î
- index = sd->equip_index[10];
+ if(sd->equip_index[EQI_AMMO] >= 0){ // –î
+ index = sd->equip_index[EQI_AMMO];
if(sd->inventory_data[index]){ // Arrows
sd->state.lr_flag = 2;
run_script(sd->inventory_data[index]->script,0,sd->bl.id,0);
@@ -1711,15 +1711,15 @@ int status_calc_pc(struct map_session_data* sd,int first)
status->def += (refinedef+50)/100;
//Parse Cards
- for(i=0;i<10;i++) {
+ for(i=0;i<EQI_MAX-1;i++) {
current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
if(index < 0)
continue;
- if(i == 9 && sd->equip_index[8] == index)
+ if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index)
continue;
- if(i == 5 && sd->equip_index[4] == index)
+ if(i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index)
continue;
- if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index))
+ if(i == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index))
continue;
if(sd->inventory_data[index]) {
@@ -1754,7 +1754,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&2)
continue;
}
- if(i == 8 && sd->status.inventory[index].equip == 0x20)
+ if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L)
{ //Left hand status.
sd->state.lr_flag = 1;
run_script(data->script,0,sd->bl.id,0);