Changed gold points to parameters
This commit is contained in:
parent
c28886ee0e
commit
b97987e4e7
@ -24807,7 +24807,7 @@ void clif_goldpc_info( struct map_session_data& sd ){
|
|||||||
}else{
|
}else{
|
||||||
p.unitPoint = 1;
|
p.unitPoint = 1;
|
||||||
}
|
}
|
||||||
p.point = (int32)pc_readreg2( &sd, GOLDPC_POINT_VAR );
|
p.point = (int32)pc_readparam( &sd, SP_GOLDPC_POINTS );
|
||||||
if( sd.goldpc_tid != INVALID_TIMER ){
|
if( sd.goldpc_tid != INVALID_TIMER ){
|
||||||
p.accumulatePlaySecond = (int32)( 3600 - battle_config.feature_goldpc_time + pc_readreg2( &sd, GOLDPC_SECONDS_VAR ) );
|
p.accumulatePlaySecond = (int32)( 3600 - battle_config.feature_goldpc_time + pc_readreg2( &sd, GOLDPC_SECONDS_VAR ) );
|
||||||
}else{
|
}else{
|
||||||
|
@ -486,6 +486,7 @@ enum _sp {
|
|||||||
SP_CASHPOINTS, SP_KAFRAPOINTS,
|
SP_CASHPOINTS, SP_KAFRAPOINTS,
|
||||||
SP_PCDIECOUNTER, SP_COOKMASTERY,
|
SP_PCDIECOUNTER, SP_COOKMASTERY,
|
||||||
SP_ACHIEVEMENT_LEVEL,
|
SP_ACHIEVEMENT_LEVEL,
|
||||||
|
SP_GOLDPC_POINTS,
|
||||||
|
|
||||||
// Mercenaries
|
// Mercenaries
|
||||||
SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
|
SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
|
||||||
|
@ -2156,27 +2156,15 @@ TIMER_FUNC(pc_goldpc_update){
|
|||||||
|
|
||||||
// TODO: add mapflag to disable?
|
// TODO: add mapflag to disable?
|
||||||
|
|
||||||
int32 points = (int32)pc_readreg2( sd, GOLDPC_POINT_VAR );
|
int64 points = pc_readparam( sd, SP_GOLDPC_POINTS );
|
||||||
|
|
||||||
if( points < battle_config.feature_goldpc_max_points ){
|
|
||||||
if( battle_config.feature_goldpc_vip && pc_isvip( sd ) ){
|
if( battle_config.feature_goldpc_vip && pc_isvip( sd ) ){
|
||||||
points += 2;
|
points += 2;
|
||||||
}else{
|
}else{
|
||||||
points += 1;
|
points += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
points = std::min( points, battle_config.feature_goldpc_max_points );
|
pc_setparam( sd, SP_GOLDPC_POINTS, points );
|
||||||
|
|
||||||
pc_setreg2( sd, GOLDPC_POINT_VAR, points );
|
|
||||||
pc_setreg2( sd, GOLDPC_SECONDS_VAR, 0 );
|
|
||||||
|
|
||||||
if( points < battle_config.feature_goldpc_max_points ){
|
|
||||||
sd->goldpc_tid = add_timer( gettick() + battle_config.feature_goldpc_time * 1000, pc_goldpc_update, sd->bl.id, (intptr_t)nullptr );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the client
|
|
||||||
clif_goldpc_info( *sd );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -10103,6 +10091,7 @@ int64 pc_readparam(struct map_session_data* sd,int64 type)
|
|||||||
#endif
|
#endif
|
||||||
case SP_CRIT_DEF_RATE: val = sd->bonus.crit_def_rate; break;
|
case SP_CRIT_DEF_RATE: val = sd->bonus.crit_def_rate; break;
|
||||||
case SP_ADD_ITEM_SPHEAL_RATE: val = sd->bonus.itemsphealrate2; break;
|
case SP_ADD_ITEM_SPHEAL_RATE: val = sd->bonus.itemsphealrate2; break;
|
||||||
|
case SP_GOLDPC_POINTS: val = pc_readreg2( sd, GOLDPC_POINT_VAR ); break;
|
||||||
default:
|
default:
|
||||||
ShowError("pc_readparam: Attempt to read unknown parameter '%lld'.\n", type);
|
ShowError("pc_readparam: Attempt to read unknown parameter '%lld'.\n", type);
|
||||||
return -1;
|
return -1;
|
||||||
@ -10354,6 +10343,26 @@ bool pc_setparam(struct map_session_data *sd,int64 type,int64 val_tmp)
|
|||||||
sd->cook_mastery = val;
|
sd->cook_mastery = val;
|
||||||
pc_setglobalreg(sd, add_str(COOKMASTERY_VAR), sd->cook_mastery);
|
pc_setglobalreg(sd, add_str(COOKMASTERY_VAR), sd->cook_mastery);
|
||||||
return true;
|
return true;
|
||||||
|
case SP_GOLDPC_POINTS:
|
||||||
|
val = cap_value( val, 0, battle_config.feature_goldpc_max_points );
|
||||||
|
|
||||||
|
pc_setreg2( sd, GOLDPC_POINT_VAR, val );
|
||||||
|
pc_setreg2( sd, GOLDPC_SECONDS_VAR, 0 );
|
||||||
|
|
||||||
|
// Make sure to always delete the timer
|
||||||
|
if( sd->goldpc_tid != INVALID_TIMER ){
|
||||||
|
delete_timer( sd->goldpc_tid, pc_goldpc_update );
|
||||||
|
sd->goldpc_tid = INVALID_TIMER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the system is enabled and the player can still earn some points restart the timer
|
||||||
|
if( battle_config.feature_goldpc_active && val < battle_config.feature_goldpc_max_points ){
|
||||||
|
sd->goldpc_tid = add_timer( gettick() + battle_config.feature_goldpc_time * 1000, pc_goldpc_update, sd->bl.id, (intptr_t)nullptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the client
|
||||||
|
clif_goldpc_info( *sd );
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
ShowError("pc_setparam: Attempted to set unknown parameter '%lld'.\n", type);
|
ShowError("pc_setparam: Attempted to set unknown parameter '%lld'.\n", type);
|
||||||
return false;
|
return false;
|
||||||
|
@ -612,6 +612,7 @@
|
|||||||
export_parameter(PCDIECOUNTER_VAR, SP_PCDIECOUNTER);
|
export_parameter(PCDIECOUNTER_VAR, SP_PCDIECOUNTER);
|
||||||
export_parameter(COOKMASTERY_VAR, SP_COOKMASTERY);
|
export_parameter(COOKMASTERY_VAR, SP_COOKMASTERY);
|
||||||
export_parameter(ACHIEVEMENTLEVEL, SP_ACHIEVEMENT_LEVEL);
|
export_parameter(ACHIEVEMENTLEVEL, SP_ACHIEVEMENT_LEVEL);
|
||||||
|
export_parameter(GOLDPC_POINT_VAR, SP_GOLDPC_POINTS);
|
||||||
|
|
||||||
export_constant2("bMaxHP",SP_MAXHP);
|
export_constant2("bMaxHP",SP_MAXHP);
|
||||||
export_constant2("bMaxSP",SP_MAXSP);
|
export_constant2("bMaxSP",SP_MAXSP);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user