Sfoglia il codice sorgente

Only start the timer if you have not reached the maximum already

Lemongrass3110 2 anni fa
parent
commit
cc7215a496
2 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. 6 3
      src/map/clif.cpp
  2. 1 1
      src/map/pc.cpp

+ 6 - 3
src/map/clif.cpp

@@ -24907,15 +24907,18 @@ void clif_goldpc_info( struct map_session_data& sd ){
 		struct PACKET_ZC_GOLDPCCAFE_POINT p = {};
 
 		p.packetType = HEADER_ZC_GOLDPCCAFE_POINT;
-		p.active = sd.goldpc_tid != INVALID_TIMER;
+		p.active = true;
 		if( battle_config.feature_goldpc_vip && pc_isvip( &sd ) ){
 			p.unitPoint = 2;
 		}else{
 			p.unitPoint = 1;
 		}
 		p.point = (int32)pc_readreg2( &sd, GOLDPC_POINT_VAR );
-		// TODO: check if we should send max value, if disabled/max reached
-		p.accumulatePlaySecond = (int32)( 3600 - battle_config.feature_goldpc_time + pc_readreg2( &sd, GOLDPC_SECONDS_VAR ) );
+		if( sd.goldpc_tid != INVALID_TIMER ){
+			p.accumulatePlaySecond = (int32)( 3600 - battle_config.feature_goldpc_time + pc_readreg2( &sd, GOLDPC_SECONDS_VAR ) );
+		}else{
+			p.accumulatePlaySecond = 3600;
+		}
 
 		clif_send( &p, sizeof( p ), &sd.bl, SELF );
 	}

+ 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 ){
+	if( battle_config.feature_goldpc_active && pc_readreg2( sd, GOLDPC_POINT_VAR ) < battle_config.feature_goldpc_max_points ){
 		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 );