|
@@ -3118,11 +3118,11 @@ static unsigned int status_calc_maxhpsp_pc(struct map_session_data* sd, unsigned
|
|
* Calculates player's weight
|
|
* Calculates player's weight
|
|
* @param sd: Player object
|
|
* @param sd: Player object
|
|
* @param flag: Calculation type
|
|
* @param flag: Calculation type
|
|
- * 1 - Item weight
|
|
|
|
- * 2 - Skill/Status/Configuration max weight bonus
|
|
|
|
|
|
+ * CALCWT_ITEM - Item weight
|
|
|
|
+ * CALCWT_MAXBONUS - Skill/Status/Configuration max weight bonus
|
|
* @return false - failed, true - success
|
|
* @return false - failed, true - success
|
|
*/
|
|
*/
|
|
-bool status_calc_weight(struct map_session_data *sd, uint8 flag)
|
|
|
|
|
|
+bool status_calc_weight(struct map_session_data *sd, enum e_status_calc_weight_opt flag)
|
|
{
|
|
{
|
|
int b_weight, b_max_weight, skill, i;
|
|
int b_weight, b_max_weight, skill, i;
|
|
struct status_change *sc;
|
|
struct status_change *sc;
|
|
@@ -3134,7 +3134,7 @@ bool status_calc_weight(struct map_session_data *sd, uint8 flag)
|
|
b_weight = sd->weight; // Store current weight for later comparison
|
|
b_weight = sd->weight; // Store current weight for later comparison
|
|
sd->max_weight = job_info[pc_class2idx(sd->status.class_)].max_weight_base + sd->status.str * 300; // Recalculate max weight
|
|
sd->max_weight = job_info[pc_class2idx(sd->status.class_)].max_weight_base + sd->status.str * 300; // Recalculate max weight
|
|
|
|
|
|
- if (flag&1) {
|
|
|
|
|
|
+ if (flag&CALCWT_ITEM) {
|
|
sd->weight = 0; // Reset current weight
|
|
sd->weight = 0; // Reset current weight
|
|
|
|
|
|
for(i = 0; i < MAX_INVENTORY; i++) {
|
|
for(i = 0; i < MAX_INVENTORY; i++) {
|
|
@@ -3144,8 +3144,9 @@ bool status_calc_weight(struct map_session_data *sd, uint8 flag)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (flag&2) {
|
|
|
|
|
|
+ if (flag&CALCWT_MAXBONUS) {
|
|
// Skill/Status bonus weight increases
|
|
// Skill/Status bonus weight increases
|
|
|
|
+ sd->max_weight += sd->add_max_weight; // From bAddMaxWeight
|
|
if ((skill = pc_checkskill(sd, MC_INCCARRY)) > 0)
|
|
if ((skill = pc_checkskill(sd, MC_INCCARRY)) > 0)
|
|
sd->max_weight += 2000 * skill;
|
|
sd->max_weight += 2000 * skill;
|
|
if (pc_isriding(sd) && pc_checkskill(sd, KN_RIDING) > 0)
|
|
if (pc_isriding(sd) && pc_checkskill(sd, KN_RIDING) > 0)
|
|
@@ -3173,24 +3174,24 @@ bool status_calc_weight(struct map_session_data *sd, uint8 flag)
|
|
* Calculates player's cart weight
|
|
* Calculates player's cart weight
|
|
* @param sd: Player object
|
|
* @param sd: Player object
|
|
* @param flag: Calculation type
|
|
* @param flag: Calculation type
|
|
- * 1 - Cart item weight
|
|
|
|
- * 2 - Skill/Status/Configuration max weight bonus
|
|
|
|
- * 4 - Whether to check for cart status
|
|
|
|
|
|
+ * CALCWT_ITEM - Cart item weight
|
|
|
|
+ * CALCWT_MAXBONUS - Skill/Status/Configuration max weight bonus
|
|
|
|
+ * CALCWT_CARTSTATE - Whether to check for cart state
|
|
* @return false - failed, true - success
|
|
* @return false - failed, true - success
|
|
*/
|
|
*/
|
|
-bool status_calc_cart_weight(struct map_session_data *sd, uint8 flag)
|
|
|
|
|
|
+bool status_calc_cart_weight(struct map_session_data *sd, enum e_status_calc_weight_opt flag)
|
|
{
|
|
{
|
|
int b_cart_weight_max, i;
|
|
int b_cart_weight_max, i;
|
|
|
|
|
|
nullpo_retr(false, sd);
|
|
nullpo_retr(false, sd);
|
|
|
|
|
|
- if (!pc_iscarton(sd) && !(flag&4))
|
|
|
|
|
|
+ if (!pc_iscarton(sd) && !(flag&CALCWT_CARTSTATE))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
b_cart_weight_max = sd->cart_weight_max; // Store cart max weight for later comparison
|
|
b_cart_weight_max = sd->cart_weight_max; // Store cart max weight for later comparison
|
|
sd->cart_weight_max = battle_config.max_cart_weight; // Recalculate max weight
|
|
sd->cart_weight_max = battle_config.max_cart_weight; // Recalculate max weight
|
|
|
|
|
|
- if (flag&1) {
|
|
|
|
|
|
+ if (flag&CALCWT_ITEM) {
|
|
sd->cart_weight = 0; // Reset current cart weight
|
|
sd->cart_weight = 0; // Reset current cart weight
|
|
sd->cart_num = 0; // Reset current cart item count
|
|
sd->cart_num = 0; // Reset current cart item count
|
|
|
|
|
|
@@ -3203,7 +3204,7 @@ bool status_calc_cart_weight(struct map_session_data *sd, uint8 flag)
|
|
}
|
|
}
|
|
|
|
|
|
// Skill bonus max weight increases
|
|
// Skill bonus max weight increases
|
|
- if (flag&2)
|
|
|
|
|
|
+ if (flag&CALCWT_MAXBONUS)
|
|
sd->cart_weight_max += (pc_checkskill(sd, GN_REMODELING_CART) * 5000);
|
|
sd->cart_weight_max += (pc_checkskill(sd, GN_REMODELING_CART) * 5000);
|
|
|
|
|
|
// Update the client if the new weight calculations don't match
|
|
// Update the client if the new weight calculations don't match
|
|
@@ -3258,6 +3259,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
|
|
sd->critical_rate = sd->hit_rate = sd->flee_rate = sd->flee2_rate = 100;
|
|
sd->critical_rate = sd->hit_rate = sd->flee_rate = sd->flee2_rate = 100;
|
|
sd->def_rate = sd->def2_rate = sd->mdef_rate = sd->mdef2_rate = 100;
|
|
sd->def_rate = sd->def2_rate = sd->mdef_rate = sd->mdef2_rate = 100;
|
|
sd->regen.state.block = 0;
|
|
sd->regen.state.block = 0;
|
|
|
|
+ sd->add_max_weight = 0;
|
|
|
|
|
|
// Zeroed arrays, order follows the order in pc.h.
|
|
// Zeroed arrays, order follows the order in pc.h.
|
|
// Add new arrays to the end of zeroed area in pc.h (see comments) and size here. [zzo]
|
|
// Add new arrays to the end of zeroed area in pc.h (see comments) and size here. [zzo]
|
|
@@ -3938,8 +3940,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
|
|
// ----- MISC CALCULATIONS -----
|
|
// ----- MISC CALCULATIONS -----
|
|
|
|
|
|
// Weight
|
|
// Weight
|
|
- status_calc_weight(sd, 2);
|
|
|
|
- status_calc_cart_weight(sd, 2);
|
|
|
|
|
|
+ status_calc_weight(sd, CALCWT_MAXBONUS);
|
|
|
|
+ status_calc_cart_weight(sd, CALCWT_MAXBONUS);
|
|
|
|
|
|
if (pc_checkskill(sd,SM_MOVINGRECOVERY)>0)
|
|
if (pc_checkskill(sd,SM_MOVINGRECOVERY)>0)
|
|
sd->regen.state.walk = 1;
|
|
sd->regen.state.walk = 1;
|