From 74cdd2aabac3b6f74fe84a77301245ffc876db6f Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 2 May 2012 05:02:59 +0000 Subject: Fixed bugreport:5650 GN Cart Remodeling weight boost should now be working properly. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16042 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 2 +- src/map/clif.c | 2 +- src/map/pc.c | 4 +++- src/map/pc.h | 2 +- src/map/status.c | 10 ++++++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/map/battle.c b/src/map/battle.c index 9ea7f5595..ce75e0446 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1760,7 +1760,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo case MC_CARTREVOLUTION: skillratio += 50; if(sd && sd->cart_weight) - skillratio += 100*sd->cart_weight/battle_config.max_cart_weight; // +1% every 1% weight + skillratio += 100*sd->cart_weight/sd->cart_weight_max; // +1% every 1% weight else if (!sd) skillratio += 100; //Max damage for non players. break; diff --git a/src/map/clif.c b/src/map/clif.c index 35cc6e21e..bf97046f2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2885,7 +2885,7 @@ void clif_updatestatus(struct map_session_data *sd,int type) WFIFOW(fd,2)=sd->cart_num; WFIFOW(fd,4)=MAX_CART; WFIFOL(fd,6)=sd->cart_weight; - WFIFOL(fd,10)=battle_config.max_cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; len=14; break; diff --git a/src/map/pc.c b/src/map/pc.c index 193c1ab4d..16ce1e21d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4122,7 +4122,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun return 1; } - if( (w = data->weight*amount) + sd->cart_weight > battle_config.max_cart_weight ) + if( (w = data->weight*amount) + sd->cart_weight > sd->cart_weight_max ) return 1; i = MAX_CART; @@ -5724,6 +5724,8 @@ int pc_skillup(struct map_session_data *sd,int skill_num) clif_skillup(sd,skill_num); clif_updatestatus(sd,SP_SKILLPOINT); + if( skill_num == GN_REMODELING_CART ) /* cart weight info was updated by status_calc_pc */ + clif_updatestatus(sd,SP_CARTINFO); if (!pc_has_permission(sd, PC_PERM_ALL_SKILL)) // may skill everything at any time anyways, and this would cause a huge slowdown clif_skillinfoblock(sd); } diff --git a/src/map/pc.h b/src/map/pc.h index c171b28e3..f607b9ada 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -170,7 +170,7 @@ struct map_session_data { struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) short equip_index[14]; unsigned int weight,max_weight; - int cart_weight,cart_num; + int cart_weight,cart_num,cart_weight_max; int fd; unsigned short mapindex; unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left. diff --git a/src/map/status.c b/src/map/status.c index 21b01252a..7277a7f1d 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2155,7 +2155,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) struct status_data *status; // pointer to the player's base status const struct status_change *sc = &sd->sc; struct s_skill b_skill[MAX_SKILL]; // previous skill tree - int b_weight, b_max_weight; // previous weight + int b_weight, b_max_weight, b_cart_weight_max; // previous weight int i,index; int skill,refinedef=0; @@ -2166,6 +2166,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) memcpy(b_skill, &sd->status.skill, sizeof(b_skill)); b_weight = sd->weight; b_max_weight = sd->max_weight; + b_cart_weight_max = sd->cart_weight_max; pc_calc_skilltree(sd); // スキルツリ?の計算 @@ -2861,6 +2862,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first) if((skill=pc_checkskill(sd,ALL_INCCARRY))>0) sd->max_weight += 2000*skill; + sd->cart_weight_max = battle_config.max_cart_weight + (pc_checkskill(sd, GN_REMODELING_CART)*5000); + if (pc_checkskill(sd,SM_MOVINGRECOVERY)>0) sd->regen.state.walk = 1; else @@ -2973,7 +2976,10 @@ int status_calc_pc_(struct map_session_data* sd, bool first) clif_updatestatus(sd,SP_MAXWEIGHT); pc_updateweightstatus(sd); } - + if( b_cart_weight_max != sd->cart_weight_max ) { + clif_updatestatus(sd,SP_CARTINFO); + } + calculating = 0; return 0; -- cgit v1.2.3-60-g2f50