数字小游戏挂机奖励
parent
ee077afb31
commit
e2d1096df6
|
@ -36,18 +36,18 @@ public class CompareNumRewardHandler extends BaseHandler<PlayerInfoProto.Compare
|
||||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||||
|
|
||||||
int levelId = playerManager.getCompareNumLevelId();
|
int levelId = playerManager.getCompareNumLevelId();
|
||||||
|
SCompareNumSetting config = SCompareNumSetting.getConfig(levelId);
|
||||||
|
if (config == null || config.getIncome() == null || config.getIncome().length == 0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
long now = TimeUtils.now();
|
long now = TimeUtils.now();
|
||||||
long startTime = playerManager.getCompareNumRewardStartTime();
|
long startTime = playerManager.getCompareNumRewardStartTime();
|
||||||
long timeMinutes = (now - startTime) / 1000 / 60;
|
long timeMinutes = (now - startTime) / 1000 / 60;
|
||||||
int accumulationTime = SSpecialConfig.getIntegerValue("Shenlingshilian_accumulation_time");
|
int accumulationTime = SSpecialConfig.getIntegerValue("Shenlingshilian_accumulation_time");
|
||||||
long max = Math.min(timeMinutes, accumulationTime);
|
long max = Math.min(timeMinutes, accumulationTime) / config.getIncomeTime();
|
||||||
if (max < 1){
|
if (max < 1){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||||
}
|
}
|
||||||
SCompareNumSetting config = SCompareNumSetting.getConfig(levelId);
|
|
||||||
if (config == null || config.getIncome() == null || config.getIncome().length == 0){
|
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
|
||||||
}
|
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getIncome(), max, BIReason.COMPARE_NUM_GAME_REWARD);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getIncome(), max, BIReason.COMPARE_NUM_GAME_REWARD);
|
||||||
PlayerInfoProto.CompareNumRewardResponse.Builder builder = PlayerInfoProto.CompareNumRewardResponse.newBuilder();
|
PlayerInfoProto.CompareNumRewardResponse.Builder builder = PlayerInfoProto.CompareNumRewardResponse.newBuilder();
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
|
|
|
@ -14,6 +14,7 @@ public class SCompareNumSetting implements BaseConfig {
|
||||||
private int[] buildID;
|
private int[] buildID;
|
||||||
private int[][] passReward;
|
private int[][] passReward;
|
||||||
private int[][] income;
|
private int[][] income;
|
||||||
|
private int incomeTime;
|
||||||
private int repeat;
|
private int repeat;
|
||||||
|
|
||||||
private static Map<Integer, SCompareNumSetting> sCompareNumSettingMap = new HashMap<>();
|
private static Map<Integer, SCompareNumSetting> sCompareNumSettingMap = new HashMap<>();
|
||||||
|
@ -97,5 +98,7 @@ public class SCompareNumSetting implements BaseConfig {
|
||||||
return chapter2List.get(chapterId);
|
return chapter2List.get(chapterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getIncomeTime() {
|
||||||
|
return incomeTime;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue