Преглед изворни кода

No points for autotraders!

Thanks to @secretdataz
Lemongrass3110 пре 2 година
родитељ
комит
95941df818
3 измењених фајлова са 9 додато и 1 уклоњено
  1. 6 0
      src/map/chrif.cpp
  2. 1 1
      src/map/pc.cpp
  3. 2 0
      src/map/pc.hpp

+ 6 - 0
src/map/chrif.cpp

@@ -339,6 +339,12 @@ int chrif_save(struct map_session_data *sd, int flag) {
 
 				// Store the seconds that already fully passed
 				pc_setreg2( sd, GOLDPC_SECONDS_VAR, battle_config.feature_goldpc_time - remaining / 1000 );
+
+				// If player starts autotrade, stop counting
+				if( flag&CSAVE_AUTOTRADE ){
+					delete_timer( sd->goldpc_tid, pc_goldpc_update );
+					sd->goldpc_tid = INVALID_TIMER;
+				}
 			}
 		}
 	}

+ 1 - 1
src/map/pc.cpp

@@ -2121,7 +2121,7 @@ void pc_reg_received(struct map_session_data *sd)
 	clif_instance_info( *sd );
 #endif
 
-	if( battle_config.feature_goldpc_active && pc_readreg2( sd, GOLDPC_POINT_VAR ) < battle_config.feature_goldpc_max_points ){
+	if( battle_config.feature_goldpc_active && pc_readreg2( sd, GOLDPC_POINT_VAR ) < battle_config.feature_goldpc_max_points && !sd->state.autotrade ){
 		sd->goldpc_tid = add_timer( gettick() + ( battle_config.feature_goldpc_time - pc_readreg2( sd, GOLDPC_SECONDS_VAR ) ) * 1000, pc_goldpc_update, sd->bl.id, (intptr_t)nullptr );
 #ifndef VIP_ENABLE
 		clif_goldpc_info( *sd );

+ 2 - 0
src/map/pc.hpp

@@ -1712,4 +1712,6 @@ void pc_macro_detector_disconnect(map_session_data &sd);
 void pc_macro_reporter_area_select(map_session_data &sd, const int16 x, const int16 y, const int8 radius);
 void pc_macro_reporter_process(map_session_data &ssd, map_session_data &tsd);
 
+TIMER_FUNC(pc_goldpc_update);
+
 #endif /* PC_HPP */