parent
a61999d664
commit
9e433e1969
|
@ -52,4 +52,7 @@ public interface VipPrivilegeType {
|
||||||
|
|
||||||
int NEW_GENERAL_ATTACK_NUM = 3005;
|
int NEW_GENERAL_ATTACK_NUM = 3005;
|
||||||
|
|
||||||
|
int HOME_DAY_TIME_NUM = 4021;//每日浮生特权秒时间次数%
|
||||||
|
int HOME_ADD_EARNINGS = 4022;//浮生特权增加浮生门产出建筑产量
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2783,7 +2783,8 @@ public class HeroLogic {
|
||||||
for (int[] prop : property) {
|
for (int[] prop : property) {
|
||||||
int buff = 0;
|
int buff = 0;
|
||||||
// 家园装备强化属性
|
// 家园装备强化属性
|
||||||
buff += Optional.ofNullable(strengthenMap.get(intensifyMap.get(sEquipConfig.getPosition()))).map(SEquipStrengthen::getRate).orElse(0);
|
int strongeId = Optional.ofNullable(intensifyMap.get(sEquipConfig.getPosition())).orElse(0);
|
||||||
|
buff += Optional.ofNullable(strengthenMap.get(strongeId)).map(SEquipStrengthen::getRate).orElse(0);
|
||||||
// 突破
|
// 突破
|
||||||
buff += Optional.ofNullable(rankUpMap.get(homeRankUp)).map(v -> v.getRate()[sEquipConfig.getPosition() - 1]).orElse(0);
|
buff += Optional.ofNullable(rankUpMap.get(homeRankUp)).map(v -> v.getRate()[sEquipConfig.getPosition() - 1]).orElse(0);
|
||||||
long value = prop[1] + (long) prop[1] / 100 *buff;
|
long value = prop[1] + (long) prop[1] / 100 *buff;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ljsd.jieling.logic.home;
|
package com.ljsd.jieling.logic.home;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
|
@ -51,7 +52,7 @@ public class HomeLogic {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
//xxxx 目前只允许升级一个建筑,多个建筑一键升级需要优化
|
//xxxx 目前只允许升级一个建筑,多个建筑一键升级需要优化
|
||||||
int id = proto.getIdsList().get(0);
|
int id = proto.getIdsList().get(0);
|
||||||
// 1:普通升级, 2:立即完成
|
// 1:普通升级, 2:立即完成 3:取消升级 4:特权加速
|
||||||
int type = proto.getType();
|
int type = proto.getType();
|
||||||
ArrayList<CommonProto.ArchitectureInfo> list = new ArrayList<>();
|
ArrayList<CommonProto.ArchitectureInfo> list = new ArrayList<>();
|
||||||
// 当前时间
|
// 当前时间
|
||||||
|
@ -95,7 +96,7 @@ public class HomeLogic {
|
||||||
info.setUpLvEndTime(now + endTime);
|
info.setUpLvEndTime(now + endTime);
|
||||||
}
|
}
|
||||||
// 特殊情况
|
// 特殊情况
|
||||||
else if (info.getUpLvEndTime() <= now){
|
if (info.getUpLvEndTime() <= now){
|
||||||
// 升级
|
// 升级
|
||||||
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
||||||
// 可以继续升级
|
// 可以继续升级
|
||||||
|
@ -104,25 +105,18 @@ public class HomeLogic {
|
||||||
info.setUpLvEndTime(landLevel1.getTime() + now);
|
info.setUpLvEndTime(landLevel1.getTime() + now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 取消
|
|
||||||
if (type == 3){
|
|
||||||
info.setUpLvEndTime(0);
|
|
||||||
}
|
|
||||||
// 立即完成
|
// 立即完成
|
||||||
if (type == 2 && info.getUpLvEndTime() > now){
|
if (type == 2){
|
||||||
// 验证特权次数
|
|
||||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(), 1);
|
|
||||||
// 无特权,消耗道具
|
|
||||||
if (!countBol || proto.getPrivilageTypeId() == 0) {
|
|
||||||
// 条件: 单位/s 道具id 道具数量
|
// 条件: 单位/s 道具id 道具数量
|
||||||
String[] stringValue = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_LATTICE_PRICE).split("#");
|
int[] intValues = SSpecialConfig.getIntegerArrayValue(SSpecialConfig.HONGMENG_LATTICE_PRICE);
|
||||||
// 立即升级消耗的道具
|
// 立即升级消耗的道具
|
||||||
double time = Math.max(info.getUpLvEndTime() - now,0);
|
int time = Math.max(info.getUpLvEndTime() - now, 0);
|
||||||
|
if (time > 0){
|
||||||
// 每一个单位的消耗
|
// 每一个单位的消耗
|
||||||
double oneCost = Integer.parseInt(stringValue[0]) * Integer.parseInt(stringValue[2]);
|
int oneCost = intValues[0] * intValues[2];
|
||||||
// 总消耗数量,向上取整
|
// 总消耗数量,向上取整
|
||||||
double count = Math.ceil(time / oneCost);
|
int count = (int) Math.ceil((double) time/oneCost);
|
||||||
int[][] cost1 = {{Integer.parseInt(stringValue[1]), (int) count}};
|
int[][] cost1 = {{intValues[1], count}};
|
||||||
boolean itemCost = ItemUtil.itemCost(user, cost1, BIReason.ARCHITECTURE_IMMEDIATELY_UP_LEVEL, 0);
|
boolean itemCost = ItemUtil.itemCost(user, cost1, BIReason.ARCHITECTURE_IMMEDIATELY_UP_LEVEL, 0);
|
||||||
if (!itemCost) {
|
if (!itemCost) {
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "浮生门建筑升级,立刻升级失败道具不足,建筑levelId:" + info.getId() + ",道具要求:" + Arrays.toString(cost1));
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "浮生门建筑升级,立刻升级失败道具不足,建筑levelId:" + info.getId() + ",道具要求:" + Arrays.toString(cost1));
|
||||||
|
@ -130,6 +124,27 @@ public class HomeLogic {
|
||||||
}
|
}
|
||||||
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
||||||
}
|
}
|
||||||
|
// 取消升级
|
||||||
|
if (type == 3){
|
||||||
|
info.setUpLvEndTime(0);
|
||||||
|
}
|
||||||
|
// 特权加速
|
||||||
|
if (type == 4){
|
||||||
|
// 验证特权次数
|
||||||
|
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.HOME_DAY_TIME_NUM, 1);
|
||||||
|
if (!countBol) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"特权加速,特权次数不足");
|
||||||
|
}
|
||||||
|
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.BUILDING_TIME_REDUCE);
|
||||||
|
int time = now + value;
|
||||||
|
// 加速后是否达到升级时间
|
||||||
|
if (time >= info.getUpLvEndTime()){
|
||||||
|
info.setUpLvEndTime(0);
|
||||||
|
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
||||||
|
}else {
|
||||||
|
info.setUpLvEndTime(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
ItemUtil.itemCost(user, items, BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
ItemUtil.itemCost(user, items, BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
||||||
// 最后更新
|
// 最后更新
|
||||||
user.getPlayerInfoManager().putArchitectureInfo(landLevel.getPoolID(),info);
|
user.getPlayerInfoManager().putArchitectureInfo(landLevel.getPoolID(),info);
|
||||||
|
@ -217,7 +232,13 @@ public class HomeLogic {
|
||||||
// 配置表参数,生产道具id
|
// 配置表参数,生产道具id
|
||||||
int itemId = homeLandLevel.getGain()[0];
|
int itemId = homeLandLevel.getGain()[0];
|
||||||
// 每分钟生产数量
|
// 每分钟生产数量
|
||||||
int minutesNum = homeLandLevel.getGain()[1];
|
double minutesNum = homeLandLevel.getGain()[1];
|
||||||
|
// 特权
|
||||||
|
boolean allowed = user.getPlayerInfoManager().checkFunctionIsAllowed(VipPrivilegeType.HOME_ADD_EARNINGS);
|
||||||
|
if (allowed){
|
||||||
|
int[][]condition= SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(VipPrivilegeType.HOME_ADD_EARNINGS).getCondition();
|
||||||
|
minutesNum = minutesNum + minutesNum * condition[0][1] / 10000;
|
||||||
|
}
|
||||||
// 可领取上限
|
// 可领取上限
|
||||||
int getNumMax = homeLandLevel.getStorage()[0][1];
|
int getNumMax = homeLandLevel.getStorage()[0][1];
|
||||||
// 存储总上限,数值可能为0,0表示没有上限
|
// 存储总上限,数值可能为0,0表示没有上限
|
||||||
|
@ -232,14 +253,14 @@ public class HomeLogic {
|
||||||
// 可领取的数量,总上限
|
// 可领取的数量,总上限
|
||||||
long maxLimit = totalMax - itemNum;
|
long maxLimit = totalMax - itemNum;
|
||||||
// 可领取的数量,单位上限
|
// 可领取的数量,单位上限
|
||||||
long unitLimit = Math.min(minutesNum*time, getNumMax);
|
double unitLimit = Math.min(minutesNum*time, getNumMax);
|
||||||
// 可领取的数量
|
// 可领取的数量
|
||||||
long getNum = Math.min(maxLimit, unitLimit);
|
double getNum = Math.min(maxLimit, unitLimit);
|
||||||
if (totalMax == 0){
|
if (totalMax == 0){
|
||||||
getNum = unitLimit;
|
getNum = unitLimit;
|
||||||
}
|
}
|
||||||
// 走掉落,进背包
|
// 走掉落,进背包
|
||||||
ItemUtil.drop(user, new long[][]{{itemId, getNum}}, BIReason.ARCHITECTURE_EARNINGS, drop);
|
ItemUtil.drop(user, new long[][]{{itemId, (long) Math.ceil(getNum)}}, BIReason.ARCHITECTURE_EARNINGS, drop);
|
||||||
// 未领取的数量
|
// 未领取的数量
|
||||||
int time2 = (int) ((unitLimit - getNum) / minutesNum * 60);
|
int time2 = (int) ((unitLimit - getNum) / minutesNum * 60);
|
||||||
info.setProductionStartTime(nowInt - time2);
|
info.setProductionStartTime(nowInt - time2);
|
||||||
|
|
|
@ -127,6 +127,8 @@ public class SSpecialConfig implements BaseConfig {
|
||||||
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
|
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
|
||||||
public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性
|
public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性
|
||||||
|
|
||||||
|
public static final String BUILDING_TIME_REDUCE = "BuildingTimeReduce";//浮生特权每日每次减少建筑升级时间:秒
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue