云游商人,装备升级逻辑修改
parent
8ac39917af
commit
6cbd8104e7
|
|
@ -924,20 +924,10 @@ public class ItemLogic {
|
|||
PlayerInfoProto.EquipUpLevelResponse.Builder response = PlayerInfoProto.EquipUpLevelResponse.newBuilder();
|
||||
response.setResult(false);
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int type = SComposeActivity.getTypeById(activityId,equipId);
|
||||
if(type == -1){
|
||||
LOGGER.error("type找不到配置,活动id:{},装备id:{}",activityId,equipId);
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
SComposeBook config = SComposeBook.getBookById(type,equipId);
|
||||
if(config == null){
|
||||
LOGGER.error("config找不到配置,type:{},装备id:{}",type,equipId);
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int[][] itemC = config.getNeedCost();
|
||||
if(itemC[0][0] != itemId || itemC[0][1] != itemNum){
|
||||
LOGGER.error("itemCost不匹配,item:{},num:{},conItem:{},conNum:{}",itemId,itemNum,itemC[0],itemC[1]);
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
Map<Integer, SComposeBook> config = STableManager.getConfig(SComposeBook.class);
|
||||
SComposeBook composeBook = config.get(equipId);
|
||||
if(composeBook == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"云游商人,idkey配置不存在:"+equipId);
|
||||
}
|
||||
ActivityMission misson = user.getActivityManager().getActivityMissionMap().get(activityId);
|
||||
if(misson == null){
|
||||
|
|
@ -945,24 +935,24 @@ public class ItemLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
Map<Integer, SComposeActivity> integerSComposeActivityMap = SComposeActivity.getConfigMap().get(activityId);
|
||||
int typeId = integerSComposeActivityMap.get(type).getId();
|
||||
int typeId = integerSComposeActivityMap.get(composeBook.getType()).getId();
|
||||
ActivityProgressInfo progress = misson.getActivityMissionMap().get(typeId);
|
||||
if(progress == null){
|
||||
LOGGER.error("progress为空,type:{}",type);
|
||||
LOGGER.error("progress为空,type:{}",composeBook.getType());
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
if(progress.getProgrss() <= 0){
|
||||
LOGGER.error("progress次数不足,num:{}",progress.getProgrss());
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
||||
}
|
||||
boolean itemCost = ItemUtil.itemCost(user, new int[][]{{equipId, 1},{itemId, itemNum}}, BIReason.EQUIP_UPLEVEL_COST, equipId);
|
||||
boolean itemCost = ItemUtil.itemCost(user, new int[][]{composeBook.getNeedItems()[0],composeBook.getNeedCost()[0]}, BIReason.EQUIP_UPLEVEL_COST, equipId);
|
||||
if(!itemCost){
|
||||
LOGGER.error("item不足,equipId:{},itemId:{},itemNum:{}",equipId,itemId,itemNum);
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
progress.setProgrss(progress.getProgrss()-1);
|
||||
user.getActivityManager().getActivityMissionMap().put(activityId,misson);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user,new int[][]{{config.getGoalItems()[0][0],config.getGoalItems()[0][1]}},BIReason.EQUIP_UPLEVEL_REWARD);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user,new int[][]{composeBook.getGoalItems()[0]},BIReason.EQUIP_UPLEVEL_REWARD);
|
||||
response.setResult(true);
|
||||
response.setDrop(drop);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue