瀏覽代碼

Updated max recovery weight to 70% for renewal (#3309)

* Fixes #2622.
* Added a new battle config for renewal.
* Adjusted the battle config to support dropping the recovery weight to 0.
* Added the new weight limit packet.
Thanks to @functor-x and @Lemongrass3110!
Aleos 6 年之前
父節點
當前提交
b409936f8d
共有 9 個文件被更改,包括 46 次插入5 次删除
  1. 2 0
      conf/battle/player.conf
  2. 2 1
      src/map/battle.cpp
  3. 1 0
      src/map/battle.hpp
  4. 19 0
      src/map/clif.cpp
  5. 2 0
      src/map/clif.hpp
  6. 5 0
      src/map/clif_packetdb.hpp
  7. 7 1
      src/map/pc.cpp
  8. 3 2
      src/map/pc.hpp
  9. 5 1
      src/map/skill.cpp

+ 2 - 0
conf/battle/player.conf

@@ -61,7 +61,9 @@ natural_healsp_interval: 8000
 natural_heal_skill_interval: 10000
 natural_heal_skill_interval: 10000
 
 
 // The maximum weight for a character to carry when the character stops healing naturally. (in %)
 // The maximum weight for a character to carry when the character stops healing naturally. (in %)
+// For renewal: Requires client 20171025 or newer to display properly
 natural_heal_weight_rate: 50
 natural_heal_weight_rate: 50
+natural_heal_weight_rate_renewal: 70
 
 
 // Maximum atk speed. (Default 190, Highest allowed 199)
 // Maximum atk speed. (Default 190, Highest allowed 199)
 max_aspd: 190
 max_aspd: 190

+ 2 - 1
src/map/battle.cpp

@@ -8178,7 +8178,8 @@ static const struct _battle_data {
 	{ "natural_healhp_interval",            &battle_config.natural_healhp_interval,         6000,   NATURAL_HEAL_INTERVAL, INT_MAX, },
 	{ "natural_healhp_interval",            &battle_config.natural_healhp_interval,         6000,   NATURAL_HEAL_INTERVAL, INT_MAX, },
 	{ "natural_healsp_interval",            &battle_config.natural_healsp_interval,         8000,   NATURAL_HEAL_INTERVAL, INT_MAX, },
 	{ "natural_healsp_interval",            &battle_config.natural_healsp_interval,         8000,   NATURAL_HEAL_INTERVAL, INT_MAX, },
 	{ "natural_heal_skill_interval",        &battle_config.natural_heal_skill_interval,     10000,  NATURAL_HEAL_INTERVAL, INT_MAX, },
 	{ "natural_heal_skill_interval",        &battle_config.natural_heal_skill_interval,     10000,  NATURAL_HEAL_INTERVAL, INT_MAX, },
-	{ "natural_heal_weight_rate",           &battle_config.natural_heal_weight_rate,        50,     50,     101             },
+	{ "natural_heal_weight_rate",           &battle_config.natural_heal_weight_rate,        50,     0,      100             },
+	{ "natural_heal_weight_rate_renewal",   &battle_config.natural_heal_weight_rate_renewal,70,     0,      100             },
 	{ "arrow_decrement",                    &battle_config.arrow_decrement,                 1,      0,      2,              },
 	{ "arrow_decrement",                    &battle_config.arrow_decrement,                 1,      0,      2,              },
 	{ "max_aspd",                           &battle_config.max_aspd,                        190,    100,    199,            },
 	{ "max_aspd",                           &battle_config.max_aspd,                        190,    100,    199,            },
 	{ "max_third_aspd",                     &battle_config.max_third_aspd,                  193,    100,    199,            },
 	{ "max_third_aspd",                     &battle_config.max_third_aspd,                  193,    100,    199,            },

+ 1 - 0
src/map/battle.hpp

@@ -261,6 +261,7 @@ struct Battle_Config
 	int natural_healsp_interval;
 	int natural_healsp_interval;
 	int natural_heal_skill_interval;
 	int natural_heal_skill_interval;
 	int natural_heal_weight_rate;
 	int natural_heal_weight_rate;
+	int natural_heal_weight_rate_renewal;
 	int arrow_decrement;
 	int arrow_decrement;
 	int max_aspd;
 	int max_aspd;
 	int max_walk_speed;	//Maximum walking speed after buffs [Skotlex]
 	int max_walk_speed;	//Maximum walking speed after buffs [Skotlex]

+ 19 - 0
src/map/clif.cpp

@@ -20350,6 +20350,25 @@ void clif_parse_attendance_request( int fd, struct map_session_data* sd ){
 	pc_attendance_claim_reward(sd);
 	pc_attendance_claim_reward(sd);
 }
 }
 
 
+/// Send out the percentage of weight that causes it to be displayed in red.
+/// 0ADE <percentage>.L
+void clif_weight_limit( struct map_session_data* sd ){
+#if PACKETVER >= 20171025
+	nullpo_retv(sd);
+
+	int fd = sd->fd;
+
+	WFIFOHEAD(fd, packet_len(0xADE));
+	WFIFOW(fd, 0) = 0xADE;
+#ifdef RENEWAL
+	WFIFOL(fd, 2) = battle_config.natural_heal_weight_rate_renewal;
+#else
+	WFIFOL(fd, 2) = battle_config.natural_heal_weight_rate;
+#endif
+	WFIFOSET(fd, packet_len(0xADE));
+#endif
+}
+
 /*==========================================
 /*==========================================
  * Main client packet processing function
  * Main client packet processing function
  *------------------------------------------*/
  *------------------------------------------*/

+ 2 - 0
src/map/clif.hpp

@@ -1088,4 +1088,6 @@ enum out_ui_type : int8 {
 void clif_ui_open( struct map_session_data *sd, enum out_ui_type ui_type, int32 data );
 void clif_ui_open( struct map_session_data *sd, enum out_ui_type ui_type, int32 data );
 void clif_attendence_response( struct map_session_data *sd, int32 data );
 void clif_attendence_response( struct map_session_data *sd, int32 data );
 
 
+void clif_weight_limit( struct map_session_data* sd );
+
 #endif /* _CLIF_HPP_ */
 #endif /* _CLIF_HPP_ */

+ 5 - 0
src/map/clif_packetdb.hpp

@@ -2364,6 +2364,11 @@
 	packet(0x0ACC,18);
 	packet(0x0ACC,18);
 #endif
 #endif
 
 
+// 2017-10-25eRagexeRE
+#if PACKETVER >= 20171025
+	packet(0x0ADE,6);
+#endif
+
 // 2018-01-03aRagexeRE or 2018-01-03bRagexeRE
 // 2018-01-03aRagexeRE or 2018-01-03bRagexeRE
 #if PACKETVER >= 20180103
 #if PACKETVER >= 20180103
 	parseable_packet(0x0ae8,2,clif_parse_changedress,0);
 	parseable_packet(0x0ae8,2,clif_parse_changedress,0);

+ 7 - 1
src/map/pc.cpp

@@ -2015,7 +2015,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
 /*==========================================
 /*==========================================
  * Updates the weight status
  * Updates the weight status
  *------------------------------------------
  *------------------------------------------
- * 1: overweight 50%
+ * 1: overweight 50% for pre-renewal and 70% for renewal
  * 2: overweight 90%
  * 2: overweight 90%
  * It's assumed that SC_WEIGHT50 and SC_WEIGHT90 are only started/stopped here.
  * It's assumed that SC_WEIGHT50 and SC_WEIGHT90 are only started/stopped here.
  */
  */
@@ -2027,7 +2027,11 @@ void pc_updateweightstatus(struct map_session_data *sd)
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
 	old_overweight = (sd->sc.data[SC_WEIGHT90]) ? 2 : (sd->sc.data[SC_WEIGHT50]) ? 1 : 0;
 	old_overweight = (sd->sc.data[SC_WEIGHT90]) ? 2 : (sd->sc.data[SC_WEIGHT50]) ? 1 : 0;
+#ifdef RENEWAL
+	new_overweight = (pc_is90overweight(sd)) ? 2 : (pc_is70overweight(sd)) ? 1 : 0;
+#else
 	new_overweight = (pc_is90overweight(sd)) ? 2 : (pc_is50overweight(sd)) ? 1 : 0;
 	new_overweight = (pc_is90overweight(sd)) ? 2 : (pc_is50overweight(sd)) ? 1 : 0;
+#endif
 
 
 	if( old_overweight == new_overweight )
 	if( old_overweight == new_overweight )
 		return; // no change
 		return; // no change
@@ -11746,6 +11750,8 @@ void pc_damage_log_clear(struct map_session_data *sd, int id)
 void pc_scdata_received(struct map_session_data *sd) {
 void pc_scdata_received(struct map_session_data *sd) {
 	pc_inventory_rentals(sd); // Needed here to remove rentals that have Status Changes after chrif_load_scdata has finished
 	pc_inventory_rentals(sd); // Needed here to remove rentals that have Status Changes after chrif_load_scdata has finished
 
 
+	clif_weight_limit( sd );
+
 	if( pc_has_permission( sd, PC_PERM_ATTENDANCE ) && pc_attendance_enabled() && !pc_attendance_rewarded_today( sd ) ){
 	if( pc_has_permission( sd, PC_PERM_ATTENDANCE ) && pc_attendance_enabled() && !pc_attendance_rewarded_today( sd ) ){
 		clif_ui_open( sd, OUT_UI_ATTENDANCE, pc_attendance_counter( sd ) );
 		clif_ui_open( sd, OUT_UI_ATTENDANCE, pc_attendance_counter( sd ) );
 	}
 	}

+ 3 - 2
src/map/pc.hpp

@@ -909,8 +909,9 @@ extern struct s_job_info job_info[CLASS_COUNT];
 #define pc_isfalcon(sd)       ( (sd)->sc.option&OPTION_FALCON )
 #define pc_isfalcon(sd)       ( (sd)->sc.option&OPTION_FALCON )
 #define pc_isriding(sd)       ( (sd)->sc.option&OPTION_RIDING )
 #define pc_isriding(sd)       ( (sd)->sc.option&OPTION_RIDING )
 #define pc_isinvisible(sd)    ( (sd)->sc.option&OPTION_INVISIBLE && !((sd)->sc.data && (sd)->sc.data[SC__FEINTBOMB]) )
 #define pc_isinvisible(sd)    ( (sd)->sc.option&OPTION_INVISIBLE && !((sd)->sc.data && (sd)->sc.data[SC__FEINTBOMB]) )
-#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate )
-#define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
+#define pc_is50overweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * battle_config.natural_heal_weight_rate )
+#define pc_is70overweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * battle_config.natural_heal_weight_rate_renewal )
+#define pc_is90overweight(sd) ( (sd)->weight * 10 >= (sd)->max_weight * 9 )
 
 
 static inline bool pc_hasprogress(struct map_session_data *sd, enum e_wip_block progress) {
 static inline bool pc_hasprogress(struct map_session_data *sd, enum e_wip_block progress) {
 	return sd == NULL || (sd->state.workinprogress&progress) == progress;
 	return sd == NULL || (sd->state.workinprogress&progress) == progress;

+ 5 - 1
src/map/skill.cpp

@@ -15575,7 +15575,11 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
 			}
 			}
 			break;
 			break;
 		case ST_RECOV_WEIGHT_RATE:
 		case ST_RECOV_WEIGHT_RATE:
-			if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= (unsigned int)battle_config.natural_heal_weight_rate) {
+#ifdef RENEWAL
+			if(pc_is70overweight(sd)) {
+#else
+			if(pc_is50overweight(sd)) {
+#endif
 				clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
 				clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
 				return false;
 				return false;
 			}
 			}