【家园功能1.0.4】日志完善内容
parent
ad1cf08eae
commit
fed5fcf59b
|
@ -65,12 +65,12 @@ public class HomeLogic {
|
||||||
// 建筑信息验证
|
// 建筑信息验证
|
||||||
ArchitectureInfo info = user.getPlayerInfoManager().getArchitectureInfoMap().get(id);
|
ArchitectureInfo info = user.getPlayerInfoManager().getArchitectureInfoMap().get(id);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
LOGGER.error("浮生门,玩家信息,建筑id不存在:{}", id);
|
LOGGER.error("浮生门建筑升级,数据库内找不到建筑poolId:{}", id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SHomeLandLevel landLevel = config.get(info.getId());
|
SHomeLandLevel landLevel = config.get(info.getId());
|
||||||
if (landLevel == null){
|
if (landLevel == null){
|
||||||
LOGGER.error("浮生门,表信息,建筑id不存在:{}", info.getId());
|
LOGGER.error("浮生门建筑升级,策划表内找不到建筑levelId:{}", info.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//升级前置条件
|
//升级前置条件
|
||||||
|
@ -78,26 +78,26 @@ public class HomeLogic {
|
||||||
if (rule != null){
|
if (rule != null){
|
||||||
ArchitectureInfo info1 = user.getPlayerInfoManager().getArchitectureInfoMap().get(rule[0]);
|
ArchitectureInfo info1 = user.getPlayerInfoManager().getArchitectureInfoMap().get(rule[0]);
|
||||||
if (info1 == null){
|
if (info1 == null){
|
||||||
LOGGER.error("浮生门,前置建筑未解锁,升级的建筑:{},前置建筑:{}",id,rule[0]);
|
LOGGER.error("浮生门建筑升级,前置建筑未解锁,升级建筑levelId:{},前置建筑poolId:{}",id,rule[0]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int level = Optional.ofNullable(config.get(info1.getId())).map(SHomeLandLevel::getlevel).orElse(0);
|
int level = Optional.ofNullable(config.get(info1.getId())).map(SHomeLandLevel::getlevel).orElse(0);
|
||||||
if (level < rule[1]){
|
if (level < rule[1]){
|
||||||
LOGGER.error("浮生门,前置建筑等级不足,升级的建筑:{},前置建筑等级:{}",id,level);
|
LOGGER.error("浮生门建筑升级,前置建筑等级不足,升级建筑levelId:{},前置建筑levelId:{}",id,info1.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 最高等级
|
// 最高等级
|
||||||
int maxId = config.values().stream().filter(v->v.getPoolID()==landLevel.getPoolID()).mapToInt(SHomeLandLevel::getlevel).max().orElse(0);
|
int maxId = config.values().stream().filter(v->v.getPoolID()==landLevel.getPoolID()).mapToInt(SHomeLandLevel::getlevel).max().orElse(0);
|
||||||
if (info.getId() == maxId) {
|
if (info.getId() == maxId) {
|
||||||
LOGGER.error("浮生门,建筑等级最高,id:{}", info.getId());
|
LOGGER.error("浮生门建筑升级,建筑等级最高,id:{}", info.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 需要消耗的道具
|
// 需要消耗的道具
|
||||||
int[][] items = landLevel.getCost();
|
int[][] items = landLevel.getCost();
|
||||||
boolean cost = ItemUtil.checkCostLong(user, items, 1);
|
boolean cost = ItemUtil.checkCostLong(user, items, 1);
|
||||||
if (!cost) {
|
if (!cost) {
|
||||||
LOGGER.error("浮生门,建筑升级要求道具不足,id:{}", info.getId());
|
LOGGER.error("浮生门建筑升级,建筑升级要求道具不足,建筑levelId:{},道具要求:{}", info.getId(),Arrays.toString(items));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 普通升级
|
// 普通升级
|
||||||
|
@ -136,7 +136,7 @@ public class HomeLogic {
|
||||||
int[][] cost1 = {{Integer.parseInt(stringValue[1]), (int) count}};
|
int[][] cost1 = {{Integer.parseInt(stringValue[1]), (int) 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){
|
||||||
LOGGER.error("浮生门,立刻升级失败,道具不足,id:{}", info.getId());
|
LOGGER.error("浮生门建筑升级,立刻升级失败,道具不足,建筑levelId:{},道具要求:{}", info.getId(),Arrays.toString(cost1));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class HomeLogic {
|
||||||
else {
|
else {
|
||||||
ArchitectureInfo info = infoMap.get(poolId);
|
ArchitectureInfo info = infoMap.get(poolId);
|
||||||
if (info == null){
|
if (info == null){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"当前玩家未解锁改建筑,id:"+poolId);
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"当前玩家未解锁改建筑,poolId:"+poolId);
|
||||||
}
|
}
|
||||||
oneArchitectureEarnings(user,info,nowInt,drop);
|
oneArchitectureEarnings(user,info,nowInt,drop);
|
||||||
}
|
}
|
||||||
|
@ -220,13 +220,13 @@ public class HomeLogic {
|
||||||
Map<Integer, SHomeLandLevel> config = STableManager.getConfig(SHomeLandLevel.class);
|
Map<Integer, SHomeLandLevel> config = STableManager.getConfig(SHomeLandLevel.class);
|
||||||
SHomeLandLevel homeLandLevel = config.get(info.getId());
|
SHomeLandLevel homeLandLevel = config.get(info.getId());
|
||||||
if (homeLandLevel == null) {
|
if (homeLandLevel == null) {
|
||||||
LOGGER.error("建筑收获,表id不存,id:{}", info.getId());
|
LOGGER.error("建筑收获,策划表id找不到,levelId:{}", info.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<Integer, SHomeLand> homeLandMap = STableManager.getConfig(SHomeLand.class);
|
Map<Integer, SHomeLand> homeLandMap = STableManager.getConfig(SHomeLand.class);
|
||||||
SHomeLand sHomeLand = homeLandMap.get(homeLandLevel.getPoolID());
|
SHomeLand sHomeLand = homeLandMap.get(homeLandLevel.getPoolID());
|
||||||
if (sHomeLand == null || sHomeLand.getType() == 2){
|
if (sHomeLand == null || sHomeLand.getType() == 2){
|
||||||
LOGGER.error("功能类建筑不能收获,id:{}", info.getId());
|
LOGGER.error("建筑收获,功能类建筑不能收获,levelId:{}", info.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 收益时间/分
|
// 收益时间/分
|
||||||
|
@ -243,7 +243,7 @@ public class HomeLogic {
|
||||||
// 获取已获得的数量
|
// 获取已获得的数量
|
||||||
long itemNum = Optional.ofNullable(user.getItemManager().getItem(itemId)).map(Item::getItemNum).orElse(0L);
|
long itemNum = Optional.ofNullable(user.getItemManager().getItem(itemId)).map(Item::getItemNum).orElse(0L);
|
||||||
if (totalMax != 0 && itemNum >= totalMax) {
|
if (totalMax != 0 && itemNum >= totalMax) {
|
||||||
LOGGER.error("家园资源物品到达上限,id:{}", itemId);
|
LOGGER.error("建筑收获,家园资源物品到达上限,levelId:{},道具id:{},道具数量:{}",info.getId(),itemId,itemNum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 可领取的数量,总上限
|
// 可领取的数量,总上限
|
||||||
|
@ -274,7 +274,7 @@ public class HomeLogic {
|
||||||
*/
|
*/
|
||||||
private void oneLandEarnings(User user, LandInfo info, int nowInt, CommonProto.Drop.Builder drop) throws Exception {
|
private void oneLandEarnings(User user, LandInfo info, int nowInt, CommonProto.Drop.Builder drop) throws Exception {
|
||||||
if (info.getEndTime() > nowInt || info.getEndTime() == 0){
|
if (info.getEndTime() > nowInt || info.getEndTime() == 0){
|
||||||
LOGGER.error("地块奖励不可领取,id:{}",info.getId());
|
LOGGER.error("栖云阁,地块奖励不可领取,地块id:{}",info.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
info.setHeroTid(0);
|
info.setHeroTid(0);
|
||||||
|
@ -294,7 +294,7 @@ public class HomeLogic {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
LandInfo landInfo = user.getPlayerInfoManager().getLandInfoMap().get(proto.getId());
|
LandInfo landInfo = user.getPlayerInfoManager().getLandInfoMap().get(proto.getId());
|
||||||
if (landInfo == null){
|
if (landInfo == null){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块未解锁,id:"+proto.getId());
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块未解锁,地块id:"+proto.getId());
|
||||||
}
|
}
|
||||||
HashSet<Integer> agos = user.getPlayerInfoManager().getHeroDispatchAgos();
|
HashSet<Integer> agos = user.getPlayerInfoManager().getHeroDispatchAgos();
|
||||||
PlayerInfoProto.WanderDispatchResponse.Builder builder = PlayerInfoProto.WanderDispatchResponse.newBuilder();
|
PlayerInfoProto.WanderDispatchResponse.Builder builder = PlayerInfoProto.WanderDispatchResponse.newBuilder();
|
||||||
|
@ -303,15 +303,15 @@ public class HomeLogic {
|
||||||
// 普通派遣
|
// 普通派遣
|
||||||
if (type == 1){
|
if (type == 1){
|
||||||
if (landInfo.getEndTime() != 0){
|
if (landInfo.getEndTime() != 0){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,id:"+proto.getId());
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,地块id:"+proto.getId());
|
||||||
}
|
}
|
||||||
if (agos.contains(proto.getHeroTid())){
|
if (agos.contains(proto.getHeroTid())){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,id:"+proto.getHeroTid());
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,heroTid:"+proto.getHeroTid());
|
||||||
}
|
}
|
||||||
// 验证特权次数
|
// 验证特权次数
|
||||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||||
if (!countBol){
|
if (!countBol){
|
||||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,id:"+proto.getId());
|
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,地块id:"+proto.getId());
|
||||||
}
|
}
|
||||||
user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
||||||
// TODO: 2021/12/20 派遣时间
|
// TODO: 2021/12/20 派遣时间
|
||||||
|
@ -325,15 +325,15 @@ public class HomeLogic {
|
||||||
// 立即完成
|
// 立即完成
|
||||||
if (type == 2){
|
if (type == 2){
|
||||||
if (landInfo.getEndTime() != 0){
|
if (landInfo.getEndTime() != 0){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,id:"+proto.getId());
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,地块id:"+proto.getId());
|
||||||
}
|
}
|
||||||
if (agos.contains(proto.getHeroTid())){
|
if (agos.contains(proto.getHeroTid())){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,id:"+proto.getHeroTid());
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,heroTid:"+proto.getHeroTid());
|
||||||
}
|
}
|
||||||
// 验证特权次数
|
// 验证特权次数
|
||||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||||
if (!countBol){
|
if (!countBol){
|
||||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,id:"+proto.getId());
|
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,地块id:"+proto.getId());
|
||||||
}
|
}
|
||||||
user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
||||||
// TODO: 2021/12/20 奖励
|
// TODO: 2021/12/20 奖励
|
||||||
|
|
Loading…
Reference in New Issue