装备优化修改
parent
3934507fe8
commit
4109833298
|
@ -32,72 +32,72 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
//todo 对用户频繁访问加限流处理。
|
//todo 对用户频繁访问加限流处理。
|
||||||
public class HandlerLogicThread extends Thread{
|
public class HandlerLogicThread extends Thread{
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(HandlerLogicThread.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(HandlerLogicThread.class);
|
||||||
private static Set<Integer> whiteMsg = new HashSet<>();
|
// private static Set<Integer> whiteMsg = new HashSet<>();
|
||||||
|
|
||||||
static {
|
// static {
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_OUT_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_OUT_REQUEST_VALUE);
|
||||||
|
//
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_CALL_CHIEF_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_CALL_CHIEF_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBOMB_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBOMB_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBUFF_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBUFF_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_RESET_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_RESET_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_EXECUTION_REFRESH_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_EXECUTION_REFRESH_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_OUT_CONSUME_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_OUT_CONSUME_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_REQUEST_VALUE);
|
||||||
|
//
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_ITEMINFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_ITEMINFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_EQUIP_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_EQUIP_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_POKEMON_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_POKEMON_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_TEAMPOS_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_TEAMPOS_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_WORKSHOP_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_WORKSHOP_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_MAIL_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_MAIL_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_ACTIVITY_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_ACTIVITY_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_FUNCTIONOFTIME_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_FUNCTIONOFTIME_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_FRIEND_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_FRIEND_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_STARE_INFOS_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_STARE_INFOS_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ARENA_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ARENA_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_RINGFIRE_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_RINGFIRE_INFO_REQUEST_VALUE);
|
||||||
|
//
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST_VALUE);
|
||||||
|
//
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_MISSION_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_MISSION_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.REFRESH_ITEM_NUM_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.REFRESH_ITEM_NUM_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.STORE_GOODS_REFRESH_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.STORE_GOODS_REFRESH_REQUEST_VALUE);
|
||||||
//日后删除
|
// //日后删除
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE);
|
||||||
|
//
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.BLESS_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.BLESS_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_FIGHT_ROUND_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.FAMILY_FIGHT_ROUND_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_MEMBER_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_MEMBER_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);
|
||||||
|
//
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE);
|
||||||
whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE);
|
// whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
public ConcurrentLinkedQueue<PacketNetData> handlerLinkedQueue = new ConcurrentLinkedQueue();
|
public ConcurrentLinkedQueue<PacketNetData> handlerLinkedQueue = new ConcurrentLinkedQueue();
|
||||||
public ConcurrentLinkedQueue<AyyncWorker> ayyncWorkerConcurrentLinkedQueue = new ConcurrentLinkedQueue();
|
public ConcurrentLinkedQueue<AyyncWorker> ayyncWorkerConcurrentLinkedQueue = new ConcurrentLinkedQueue();
|
||||||
|
|
||||||
|
@ -146,11 +146,11 @@ public class HandlerLogicThread extends Thread{
|
||||||
MessageUtil.sendErrorResponse(session,-1,msgId+1,"funciton not");
|
MessageUtil.sendErrorResponse(session,-1,msgId+1,"funciton not");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
b = checkIsPermit(msgId, session);
|
// b = checkIsPermit(msgId, session);
|
||||||
if(!b){
|
// if(!b){
|
||||||
MessageUtil.sendErrorResponse(session,-1,msgId+1,"在地图探索中,不可以操作");
|
// MessageUtil.sendErrorResponse(session,-1,msgId+1,"在地图探索中,不可以操作");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgId != MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE) {
|
if (msgId != MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE) {
|
||||||
|
@ -212,24 +212,15 @@ public class HandlerLogicThread extends Thread{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean checkIsPermit(int msgId, ISession session) throws Exception {
|
// private boolean checkIsPermit(int msgId, ISession session) throws Exception {
|
||||||
int uid = session.getUid();
|
// int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
// User user = UserManager.getUser(uid);
|
||||||
int curMapId = 0;
|
// int curMapId = 0;
|
||||||
//todo 暂时删除
|
// //todo 暂时删除
|
||||||
// int curMapId = user.getMapManager().getCurMapId();
|
//// int curMapId = user.getMapManager().getCurMapId();
|
||||||
|
//
|
||||||
if(curMapId!=0 && msgId == MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE){
|
// return true;
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(curMapId);
|
// }
|
||||||
if(sChallengeConfig.getType()==4){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(curMapId!=0 && !whiteMsg.contains(msgId)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean checkFunctionIsOpen(int msgId, ISession session ) {
|
private boolean checkFunctionIsOpen(int msgId, ISession session ) {
|
||||||
|
|
|
@ -141,6 +141,7 @@ public interface BIReason {
|
||||||
int EXCEPTION_TREASURE_REWARD = 77;//天空密境积分奖励
|
int EXCEPTION_TREASURE_REWARD = 77;//天空密境积分奖励
|
||||||
|
|
||||||
int PROUD_REWARD = 78;//膜拜获得金币奖励
|
int PROUD_REWARD = 78;//膜拜获得金币奖励
|
||||||
|
int EQUIP_UNLOAD_REWARD = 79;
|
||||||
|
|
||||||
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
||||||
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
||||||
|
@ -258,6 +259,8 @@ public interface BIReason {
|
||||||
int TRIAL_ADD_HP_CONSUME = 1062;//试炼回春散消耗
|
int TRIAL_ADD_HP_CONSUME = 1062;//试炼回春散消耗
|
||||||
|
|
||||||
int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分
|
int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分
|
||||||
|
int EQUIP_WEAR_CONSUME = 1064;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -102,9 +102,8 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
||||||
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
|
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
|
||||||
inner.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build());
|
inner.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build());
|
||||||
}
|
}
|
||||||
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap();
|
for(Integer equipId : hero.getEquipByPositionMap().values()){
|
||||||
for(String equipId : hero.getEquipByPositionMap().values()){
|
inner.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||||
inner.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
|
||||||
}
|
}
|
||||||
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||||
inner.setHero(CBean2Proto.getHero(hero));
|
inner.setHero(CBean2Proto.getHero(hero));
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.logic.dao.Equip;
|
import com.ljsd.jieling.logic.dao.Equip;
|
||||||
|
import com.ljsd.jieling.logic.dao.Item;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
|
@ -58,8 +59,6 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
||||||
if (equipId == 0) {
|
if (equipId == 0) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
Set<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
|
||||||
|
|
||||||
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(needStar);
|
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(needStar);
|
||||||
if (null == sEquipStarsConfig) {
|
if (null == sEquipStarsConfig) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
@ -68,58 +67,43 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
||||||
if (null == sTargetEquipStarsConfig) {
|
if (null == sTargetEquipStarsConfig) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
int needcount = sEquipStarsConfig.getRankupCount();
|
int needCount = sEquipStarsConfig.getRankupCount();
|
||||||
if (equipByIDs.size() / needcount < proto.getNum()) {
|
// //check cost
|
||||||
//数据不够
|
|
||||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
//check cost
|
|
||||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||||
for (int i = 0; i < proto.getNum(); i++) {
|
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
||||||
int[][] sumConsume = sTargetEquipStarsConfig.getRankupResources();
|
for(int[] consumeArray:sumConsume){
|
||||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
consumeMap.put(consumeArray[0],consumeArray[1]*proto.getNum());
|
||||||
}
|
}
|
||||||
|
consumeMap.put(equipId,needCount*proto.getNum());
|
||||||
|
|
||||||
boolean enough = ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
boolean enough = ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||||
if (!enough) {
|
if (!enough) {
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
|
//
|
||||||
//drop
|
// //drop
|
||||||
int[][] dropItems = new int[1][];
|
int[][] dropItems = new int[1][];
|
||||||
dropItems[0] = new int[2];
|
dropItems[0] = new int[2];
|
||||||
dropItems[0][0] = targetEquip;
|
dropItems[0][0] = targetEquip;
|
||||||
dropItems[0][1] = proto.getNum();
|
dropItems[0][1] = proto.getNum();
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
|
||||||
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||||
|
|
||||||
//remove hero
|
|
||||||
int i = 1;
|
|
||||||
for (String id : equipByIDs) {
|
|
||||||
if (i > proto.getNum() * needcount) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
response.addEquipIds(id);
|
|
||||||
user.getEquipManager().remove(id);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
response.setDrop(drop);
|
response.setDrop(drop);
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Map<Integer, Map<Integer, Integer>> euipTppes = STableManager.getFigureConfig(ItemStaticConfig.class).getEuipTppes();
|
|
||||||
Map<Integer, Integer> integerIntegerMap = new TreeMap<>(euipTppes.getOrDefault(proto.getType(), new HashMap<>()));
|
|
||||||
|
|
||||||
Set<String> equipadds =new HashSet<>();
|
Map<Integer, Map<Integer, Integer>> equipComplexConfig = STableManager.getFigureConfig(ItemStaticConfig.class).getEuipTppes();
|
||||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
|
||||||
List< CommonProto.Equip> equips = new LinkedList<>();
|
Map<Integer, Integer> typeComplexMap = new TreeMap<>(equipComplexConfig.getOrDefault(proto.getType(), new HashMap<>()));
|
||||||
Set<String> newids = new HashSet<>();
|
|
||||||
Map<Integer, Integer> consumeMapTem = new HashMap<>();
|
Map<Integer,Integer> consumeMap = new HashMap<>();
|
||||||
for (Map.Entry<Integer, Integer> entry : integerIntegerMap.entrySet()) {
|
Map<Integer,Integer> countMap = new HashMap<>();
|
||||||
|
for (Map.Entry<Integer, Integer> entry : typeComplexMap.entrySet()) {
|
||||||
//star conf
|
//star conf
|
||||||
int targetstar = entry.getKey()+1;
|
int targetStar = entry.getKey()+1;
|
||||||
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetstar);
|
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetStar);
|
||||||
if (null == sTargetEquipStarsConfig) {
|
if (null == sTargetEquipStarsConfig) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +112,7 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int targetEquipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), targetstar);
|
int targetEquipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), targetStar);
|
||||||
if (targetEquipId == 0) {
|
if (targetEquipId == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -138,54 +122,67 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TreeSet<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
int equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
||||||
int canConNum =equipByIDs.size()/sEquipStarsConfig.getRankupCount();
|
int canConNum =(countMap.getOrDefault(equipId,0)+equipByIDs)/sEquipStarsConfig.getRankupCount();
|
||||||
if(canConNum<=0){
|
if(canConNum<=0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//check cost
|
//check cost
|
||||||
boolean enough;
|
boolean enough;
|
||||||
int needcount=0;
|
int equipNeedCount=0;
|
||||||
|
|
||||||
|
//进行合成
|
||||||
|
Map<Integer, Integer> consumeMapTem = new HashMap<>();
|
||||||
|
|
||||||
for (int i = 0; i < canConNum; i++) {
|
for (int i = 0; i < canConNum; i++) {
|
||||||
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
||||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMapTem);
|
//数组变map
|
||||||
enough = ItemUtil.checkCost(user, consumeMapTem);
|
Map<Integer, Integer> consumeOnce = new HashMap<>();
|
||||||
|
for(int[] item : sumConsume){
|
||||||
|
consumeOnce.put(item[0],consumeMapTem.getOrDefault(item[0],0)+item[1]+consumeMap.getOrDefault(item[0],0));
|
||||||
|
}
|
||||||
|
enough = ItemUtil.checkCost(user, consumeOnce);
|
||||||
if (!enough) {
|
if (!enough) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
for(int[] consume:sumConsume){
|
||||||
//生成装备 混合消耗
|
consumeMapTem.put(consume[0],consumeMapTem.getOrDefault(consume[0],0)+consume[1]);
|
||||||
Equip equip = new Equip(user.getId(),targetEquipId);
|
|
||||||
user.getEquipManager().addEquip(user,equip);
|
|
||||||
newids.add(equip.getId());//后面合成可能会被删除
|
|
||||||
|
|
||||||
needcount += sEquipStarsConfig.getRankupCount();
|
|
||||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
|
||||||
}
|
}
|
||||||
|
countMap.put(targetEquipId,countMap.getOrDefault(targetEquipId,0)+1);
|
||||||
|
equipNeedCount += sEquipStarsConfig.getRankupCount();
|
||||||
|
// HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//消耗装备
|
//消耗装备
|
||||||
int i = 1;
|
int needEquipMax = countMap.getOrDefault(equipId,0)+equipByIDs;
|
||||||
for (String id : equipByIDs.descendingSet()) {
|
if(equipNeedCount>needEquipMax){
|
||||||
if (i > needcount) {
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
break;
|
}else if(equipNeedCount<=countMap.getOrDefault(equipId,0)){
|
||||||
|
int less = countMap.getOrDefault(equipId, 0) - equipNeedCount;
|
||||||
|
if(less==0){
|
||||||
|
countMap.remove(equipId);
|
||||||
|
}else{
|
||||||
|
countMap.put(equipId,less);
|
||||||
}
|
}
|
||||||
if(!newids.contains(id)){
|
}else{
|
||||||
equipadds.add(id);
|
consumeMapTem.put(equipId,consumeMapTem.getOrDefault(equipId,0)+equipNeedCount-countMap.getOrDefault(equipId,0));
|
||||||
}else {
|
countMap.remove(equipId);
|
||||||
newids.remove(id);
|
|
||||||
}
|
}
|
||||||
user.getEquipManager().remove(id);
|
for(Map.Entry<Integer, Integer> consumeEntry:consumeMapTem.entrySet()){
|
||||||
i++;
|
consumeMap.put(consumeEntry.getKey(),consumeMap.getOrDefault(consumeEntry.getKey(),0)+consumeEntry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String id:newids) {
|
int[][] createArray = new int[countMap.size()][];
|
||||||
equips.add(CBean2Proto.getEquipProto( user.getEquipManager().getEquipMap().get(id)));
|
int index = 0 ;
|
||||||
|
for(Map.Entry<Integer, Integer> createEntry:countMap.entrySet()){
|
||||||
|
|
||||||
|
createArray[index] = new int[]{createEntry.getKey(),createEntry.getValue()};
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder().addAllEquipId(equips);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user,createArray,BIReason.COMPLEX_EQUIP);
|
||||||
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||||
response.addAllEquipIds(equipadds);
|
|
||||||
response.setDrop(drop);
|
response.setDrop(drop);
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ public class Cmd_fixequip extends GmAbstract{
|
||||||
user.getEquipManager().getEquipMap().values().forEach(equip -> equip.setHeroId(""));
|
user.getEquipManager().getEquipMap().values().forEach(equip -> equip.setHeroId(""));
|
||||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||||
user.getHeroManager().getHeroMap().values().forEach(hero -> {
|
user.getHeroManager().getHeroMap().values().forEach(hero -> {
|
||||||
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||||
Set<Integer> removeHeroEquip = new HashSet<>();
|
Set<Integer> removeHeroEquip = new HashSet<>();
|
||||||
for(Map.Entry<Integer,String> item : equipByPositionMap.entrySet()){
|
for(Map.Entry<Integer,Integer> item : equipByPositionMap.entrySet()){
|
||||||
if(!equipMap.containsKey(item.getValue())){
|
if(!equipMap.containsKey(item.getValue())){
|
||||||
removeHeroEquip.add(item.getKey());
|
removeHeroEquip.add(item.getKey());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class Equip extends PropertyItem implements Cloneable{
|
public class Equip extends PropertyItem implements Cloneable{
|
||||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);
|
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class Hero extends MongoBase {
|
||||||
|
|
||||||
private int star;
|
private int star;
|
||||||
|
|
||||||
private Map<Integer,String> equipByPositionMap;
|
private Map<Integer,Integer> equipByPositionMap;
|
||||||
|
|
||||||
private Map<Integer,Integer> soulEquipByPositionMap;
|
private Map<Integer,Integer> soulEquipByPositionMap;
|
||||||
|
|
||||||
|
@ -144,32 +144,32 @@ public class Hero extends MongoBase {
|
||||||
return star;
|
return star;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, String> getEquipByPositionMap() {
|
public Map<Integer, Integer> getEquipByPositionMap() {
|
||||||
return equipByPositionMap==null?new HashMap<>():equipByPositionMap;
|
return equipByPositionMap==null?new HashMap<>():equipByPositionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEquipByPositionMap(Map<Integer, String> equipByPositionMap) throws Exception {
|
public void setEquipByPositionMap(Map<Integer, Integer> equipByPositionMap) throws Exception {
|
||||||
updateString("equipByPositionMap",equipByPositionMap);
|
updateString("equipByPositionMap",equipByPositionMap);
|
||||||
this.equipByPositionMap = equipByPositionMap;
|
this.equipByPositionMap = equipByPositionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEquipPositionMap(int position,String equipId) throws Exception {
|
public void updateEquipPositionMap(int position,int equipId) throws Exception {
|
||||||
updateString("equipByPositionMap." + position ,equipId);
|
updateString("equipByPositionMap." + position ,equipId);
|
||||||
this.equipByPositionMap.put(position,equipId);
|
this.equipByPositionMap.put(position,equipId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMutliEquipPositionMap(Map<Integer,String> equipByPositionMapTmp) throws Exception {
|
public void updateMutliEquipPositionMap(Map<Integer,Integer> equipByPositionMapTmp) throws Exception {
|
||||||
this.equipByPositionMap.putAll(equipByPositionMapTmp);
|
this.equipByPositionMap.putAll(equipByPositionMapTmp);
|
||||||
updateString("equipByPositionMap" ,equipByPositionMap);
|
updateString("equipByPositionMap" ,equipByPositionMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeEquip(int position){
|
public void removeEquip(int position){
|
||||||
String value = this.equipByPositionMap.get(position);
|
if (!equipByPositionMap.containsKey(position)){
|
||||||
if (value!=null){
|
return;
|
||||||
|
}
|
||||||
removeString(getMongoKey()+".equipByPositionMap." + position);
|
removeString(getMongoKey()+".equipByPositionMap." + position);
|
||||||
this.equipByPositionMap.remove(position);
|
this.equipByPositionMap.remove(position);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Map<Integer, Integer> getSoulEquipByPositionMap() {
|
public Map<Integer, Integer> getSoulEquipByPositionMap() {
|
||||||
|
|
|
@ -864,20 +864,19 @@ public class ExpeditionLogic {
|
||||||
Hero newHero = new Hero(uid,tempid,finalstar,hero);
|
Hero newHero = new Hero(uid,tempid,finalstar,hero);
|
||||||
|
|
||||||
EquipManager equipManager = user.getEquipManager();
|
EquipManager equipManager = user.getEquipManager();
|
||||||
for (Map.Entry<Integer, String> next : hero.getEquipByPositionMap().entrySet()) {
|
for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
|
||||||
String equipId = next.getValue();
|
Integer equipId = next.getValue();
|
||||||
PropertyItem equip = equipManager.getEquipMap().get(equipId);
|
PropertyItem equip = equipManager.getEquipMap().get(equipId);
|
||||||
if (equip == null) {
|
if (equip == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Equip newequip = new Equip(uid, equip.getEquipId());
|
|
||||||
// if(isTemp){
|
// if(isTemp){
|
||||||
// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||||
// }else {
|
// }else {
|
||||||
user.getExpeditionManager().addEquip(user, newequip);
|
user.getExpeditionManager().addEquip(user, newequip);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
newHero.updateEquipPositionMap(next.getKey(), newequip.getId());
|
newHero.updateEquipPositionMap(next.getKey(), equipId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -128,13 +128,13 @@ public class HeroLogic{
|
||||||
int uid = iSession.getUid();
|
int uid = iSession.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
List<CommonProto.Equip> equipList = new ArrayList<>();
|
List<CommonProto.Equip> equipList = new ArrayList<>();
|
||||||
if(type==1){
|
// if(type==1){
|
||||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
// Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||||
for(PropertyItem equipInfo: equipMap.values()){
|
// for(PropertyItem equipInfo: equipMap.values()){
|
||||||
if(equipInfo instanceof Equip)
|
// if(equipInfo instanceof Equip)
|
||||||
equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
// equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//宝器
|
//宝器
|
||||||
if(type==4){
|
if(type==4){
|
||||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||||
|
@ -142,6 +142,8 @@ public class HeroLogic{
|
||||||
if(equipInfo instanceof Jewel)
|
if(equipInfo instanceof Jewel)
|
||||||
equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1066,20 +1068,21 @@ public class HeroLogic{
|
||||||
skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
|
skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
|
||||||
skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
|
skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
|
||||||
|
|
||||||
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
//装备没有技能不用计算
|
||||||
if(!equipByPositionMap.isEmpty()){
|
// Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||||
Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
|
// if(!equipByPositionMap.isEmpty()){
|
||||||
for(Integer position : equipSkillPositionTemaplge){
|
// Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
|
||||||
String equipId = equipByPositionMap.get(position);
|
// for(Integer position : equipSkillPositionTemaplge){
|
||||||
if(StringUtil.isEmpty(equipId)){
|
// Integer equipId = equipByPositionMap.get(position);
|
||||||
continue;
|
// if(equipId==null){
|
||||||
}
|
// continue;
|
||||||
int skillId = equipMap.get(equipId).getSkill();
|
// }
|
||||||
if(skillId!=0){
|
// int skillId = equipMap.get(equipId).getSkill();
|
||||||
skillList.add(skillId);
|
// if(skillId!=0){
|
||||||
}
|
// skillList.add(skillId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
//魂印
|
//魂印
|
||||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||||
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
||||||
|
@ -1306,22 +1309,17 @@ public class HeroLogic{
|
||||||
//装备总战力评分
|
//装备总战力评分
|
||||||
int equipForce=0;
|
int equipForce=0;
|
||||||
boolean needRemove = false;
|
boolean needRemove = false;
|
||||||
Iterator<Map.Entry<Integer, String>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
|
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
|
||||||
Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
|
Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
|
||||||
while (iterator.hasNext()){
|
while (iterator.hasNext()){
|
||||||
Map.Entry<Integer, String> next = iterator.next();
|
Map.Entry<Integer, Integer> next = iterator.next();
|
||||||
String equipId = next.getValue();
|
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(next.getValue());
|
||||||
PropertyItem equip = equipMap.get(equipId);
|
int[][] property = sEquipConfig.getProperty();
|
||||||
if(equip == null){
|
Map<Integer,Integer> propertyValueByIdMap = new HashMap<>();
|
||||||
needRemove = true;
|
for(int[] prop:property){
|
||||||
continue;
|
propertyValueByIdMap.put(prop[0],prop[1]);
|
||||||
}
|
}
|
||||||
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
|
||||||
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
|
||||||
// LOGGER.info("cal equip = {}",equip.getEquipId());
|
|
||||||
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
||||||
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
|
||||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip.getEquipId());
|
|
||||||
equipForce+=sEquipConfig.getScore();
|
equipForce+=sEquipConfig.getScore();
|
||||||
suiteNumByIdMap.put(sEquipConfig.getSuiteID(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
|
suiteNumByIdMap.put(sEquipConfig.getSuiteID(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
|
||||||
}
|
}
|
||||||
|
@ -1340,11 +1338,11 @@ public class HeroLogic{
|
||||||
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
|
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
|
||||||
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
|
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
|
||||||
for(Hero heroTmp : heroMap.values()){
|
for(Hero heroTmp : heroMap.values()){
|
||||||
Iterator<Map.Entry<Integer, String>> iterator1 = heroTmp.getEquipByPositionMap().entrySet().iterator();
|
Iterator<Map.Entry<Integer, Integer>> iterator1 = heroTmp.getEquipByPositionMap().entrySet().iterator();
|
||||||
boolean isUpate = false;
|
boolean isUpate = false;
|
||||||
while (iterator1.hasNext()){
|
while (iterator1.hasNext()){
|
||||||
Map.Entry<Integer, String> next = iterator1.next();
|
Map.Entry<Integer, Integer> next = iterator1.next();
|
||||||
String equipId = next.getValue();
|
Integer equipId = next.getValue();
|
||||||
PropertyItem equip = equipMap.get(equipId);
|
PropertyItem equip = equipMap.get(equipId);
|
||||||
if(equip == null){
|
if(equip == null){
|
||||||
iterator1.remove();
|
iterator1.remove();
|
||||||
|
@ -1735,31 +1733,31 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkEquipForWear(Hero hero,EquipManager equipManager,List<String> equipIds, Map<Integer,String> equipInfos ){
|
//新版穿装备
|
||||||
|
private boolean checkEquipForWear(Hero hero,User user,List<String> equipIds, Map<Integer,Integer> equipInfos ) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
if(equipIds == null || equipIds.isEmpty()){
|
if(equipIds == null || equipIds.isEmpty()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Map<String, PropertyItem> equipMap = equipManager.getEquipMap();
|
if(hero==null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for(String equipId : equipIds){
|
for(String equipId : equipIds){
|
||||||
PropertyItem equip =equipMap.get(equipId);
|
int equip = Integer.parseInt(equipId);
|
||||||
if( null == equip || null == hero ){
|
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(!StringUtil.isEmpty(equip.getHeroId()) && !equip.getHeroId().equals(hero.getId())){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int equipIdTid = equip.getEquipId();
|
|
||||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
|
|
||||||
int position = sEquipConfig.getPosition();
|
int position = sEquipConfig.getPosition();
|
||||||
|
boolean itemCost = ItemUtil.itemCost(user, new int[][]{{equip, 1}}, BIReason.EQUIP_WEAR_CONSUME, 1);
|
||||||
|
if(!itemCost){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int professionLimit = sEquipConfig.getProfessionLimit();
|
int professionLimit = sEquipConfig.getProfessionLimit();
|
||||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||||
if(professionLimit!=0 && scHero.getProfession()!= professionLimit){
|
if(professionLimit!=0 && scHero.getProfession()!= professionLimit){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
equipInfos.put(position,equipId);
|
equipInfos.put(position,equip);
|
||||||
}
|
|
||||||
if(equipInfos.size()!=equipIds.size()){
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1774,18 +1772,26 @@ public class HeroLogic{
|
||||||
Hero hero = user.getHeroManager().getHeroMap().get(heroId);
|
Hero hero = user.getHeroManager().getHeroMap().get(heroId);
|
||||||
EquipManager equipManager = user.getEquipManager();
|
EquipManager equipManager = user.getEquipManager();
|
||||||
if(type==1){
|
if(type==1){
|
||||||
Map<Integer,String> equipInfoTmp = new HashMap<>(6);
|
Map<Integer,Integer> equipInfoTmp = new HashMap<>(4);
|
||||||
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){
|
if(!checkEquipForWear(hero,user,equipIds,equipInfoTmp)){
|
||||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
|
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
|
||||||
}
|
}
|
||||||
hero.getEquipByPositionMap().forEach((Integer position,String equipId) -> {
|
List<Integer> equipUnload = new ArrayList<>(4);
|
||||||
if(equipInfoTmp.containsKey(position) && !equipId.equals(equipInfoTmp.get(position))){
|
for(Map.Entry<Integer,Integer> entry :hero.getEquipByPositionMap().entrySet()){
|
||||||
equipManager.getEquipMap().get(equipId).setHeroId("");
|
if(!equipInfoTmp.containsKey(entry.getKey()) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
equipUnload.add(entry.getValue());
|
||||||
|
}
|
||||||
|
int[][] unloadArray = new int[equipUnload.size()][];
|
||||||
|
for(int i = 0 ; i <unloadArray.length;i++){
|
||||||
|
unloadArray[i] = new int[]{equipUnload.get(i),1};
|
||||||
|
}
|
||||||
|
if(unloadArray.length!=0){
|
||||||
|
ItemUtil.drop(user, unloadArray, BIReason.EQUIP_UNLOAD_REWARD);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
hero.updateMutliEquipPositionMap(equipInfoTmp);
|
hero.updateMutliEquipPositionMap(equipInfoTmp);
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
|
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
|
||||||
equipIds.forEach(equipId->equipManager.getEquipMap().get(equipId).setHeroId(heroId));
|
|
||||||
}else if(type ==2){
|
}else if(type ==2){
|
||||||
for(String jId:equipIds){
|
for(String jId:equipIds){
|
||||||
wearJewel(hero,equipManager,jId);
|
wearJewel(hero,equipManager,jId);
|
||||||
|
@ -1842,25 +1848,32 @@ public class HeroLogic{
|
||||||
if( hero == null || equipIds.isEmpty()){
|
if( hero == null || equipIds.isEmpty()){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
|
||||||
if(type==1){
|
if(type==1){
|
||||||
List<Integer> positions = new ArrayList<>();
|
List<Integer> positions = new ArrayList<>();
|
||||||
for(String equipId : equipIds){
|
for(String equipId : equipIds){
|
||||||
PropertyItem equip = equipMap.get(equipId);
|
//
|
||||||
if(null == equip || StringUtil.isEmpty(equip.getHeroId())){
|
int equipIdTid =Integer.parseInt(equipId);
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
|
||||||
}
|
|
||||||
int equipIdTid = equip.getEquipId();
|
|
||||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
|
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
|
||||||
int position = sEquipConfig.getPosition();
|
int position = sEquipConfig.getPosition();
|
||||||
|
Integer currEquip = hero.getEquipByPositionMap().get(position);
|
||||||
|
if(currEquip == null || currEquip != equipIdTid){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
positions.add(position);
|
positions.add(position);
|
||||||
}
|
}
|
||||||
equipIds.forEach(equidId->equipMap.get(equidId).setHeroId(""));
|
if(positions.size()==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
for(Integer position : positions){
|
|
||||||
hero.removeEquip(position);
|
|
||||||
}
|
}
|
||||||
|
int[][] dropEquip = new int[positions.size()][];
|
||||||
|
for(int i = 0 ; i <dropEquip.length;i++){
|
||||||
|
int currEquip= hero.getEquipByPositionMap().get(positions.get(i));
|
||||||
|
dropEquip[i] = new int[]{currEquip,1};
|
||||||
|
hero.removeEquip(positions.get(i));
|
||||||
|
}
|
||||||
|
ItemUtil.drop(user,dropEquip,BIReason.EQUIP_UNLOAD_REWARD);
|
||||||
|
|
||||||
}else if(type==2){
|
}else if(type==2){
|
||||||
|
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||||
for(String equipId:equipIds){
|
for(String equipId:equipIds){
|
||||||
if(!hero.getJewelInfo().contains(equipId)||equipMap.get(equipId)==null){
|
if(!hero.getJewelInfo().contains(equipId)||equipMap.get(equipId)==null){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
|
|
@ -581,17 +581,23 @@ public class ItemLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定装备的所有装备 过滤掉已穿戴
|
* 获取指定装备的数量 过滤掉已穿戴
|
||||||
* @param user
|
* @param user
|
||||||
* @param equipid
|
* @param equipid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static TreeSet<String> getEquipByID(User user, int equipid) {
|
public static int getEquipByID(User user, int equipId) throws Exception {
|
||||||
TreeSet<String> equiplist = new TreeSet<>();
|
Item item = user.getItemManager().getItemMap().get(equipId);
|
||||||
user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
|
if(item==null){
|
||||||
StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) && stringEquipEntry.getValue().getEquipId() == equipid
|
return 0;
|
||||||
).forEach(stringEquipEntry -> equiplist.add(stringEquipEntry.getKey()));
|
}
|
||||||
return equiplist;
|
|
||||||
|
|
||||||
|
// TreeSet<String> equiplist = new TreeSet<>();
|
||||||
|
// user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
|
||||||
|
// StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) && stringEquipEntry.getValue().getEquipId() == equipid
|
||||||
|
// ).forEach(stringEquipEntry -> equiplist.add(stringEquipEntry.getKey()));
|
||||||
|
return item.getItemNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ public class PlayerLogic {
|
||||||
int vipLevel = playerInfoManager.getVipLevel();
|
int vipLevel = playerInfoManager.getVipLevel();
|
||||||
playerInfoManager.setVipLevel(vipLevel+1);
|
playerInfoManager.setVipLevel(vipLevel+1);
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,playerInfoManager.getVipLevel());
|
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,playerInfoManager.getVipLevel());
|
||||||
// CombatLogic.getInstance().getNewAdventureReward(user, true);
|
// CombatLogic.getInstance().getNewAdventureReward(user, true,TimeUtils.nowInt());
|
||||||
List<CommonProto.UserMissionInfo> missionList = new ArrayList<>();
|
List<CommonProto.UserMissionInfo> missionList = new ArrayList<>();
|
||||||
MissionLoigc.getVipMission(user,missionList);
|
MissionLoigc.getVipMission(user,missionList);
|
||||||
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||||
|
@ -654,8 +654,8 @@ public class PlayerLogic {
|
||||||
for(String equipId : hero.getJewelInfo()){
|
for(String equipId : hero.getJewelInfo()){
|
||||||
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
||||||
}
|
}
|
||||||
for(String equipId : hero.getEquipByPositionMap().values()){
|
for(Integer equipId : hero.getEquipByPositionMap().values()){
|
||||||
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
builder.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||||
}
|
}
|
||||||
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||||
builder.setHero(CBean2Proto.getHero(hero));
|
builder.setHero(CBean2Proto.getHero(hero));
|
||||||
|
|
|
@ -79,11 +79,7 @@ public class CBean2Proto {
|
||||||
return itemProto;
|
return itemProto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommonProto.Hero getHero(Hero hero){ Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
public static CommonProto.Hero getHero(Hero hero){
|
||||||
List<String> equipList = new ArrayList<>();
|
|
||||||
if(equipByPositionMap!=null && !equipByPositionMap.isEmpty()){
|
|
||||||
equipList.addAll(equipByPositionMap.values());
|
|
||||||
}
|
|
||||||
List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
|
List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
|
||||||
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
|
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
|
||||||
if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){
|
if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){
|
||||||
|
@ -103,7 +99,7 @@ public class CBean2Proto {
|
||||||
.setBreakId(hero.getBreakId())
|
.setBreakId(hero.getBreakId())
|
||||||
.setStarBreakId(hero.getStarBreakId())
|
.setStarBreakId(hero.getStarBreakId())
|
||||||
.setCreateTime(hero.getCreateTime())
|
.setCreateTime(hero.getCreateTime())
|
||||||
.addAllEquipIdList(equipList)
|
.addAllEquipIdList(hero.getEquipByPositionMap().values())
|
||||||
.setEspecialEquipLevel(hero.getEspecialEquipLevel())
|
.setEspecialEquipLevel(hero.getEspecialEquipLevel())
|
||||||
.addAllSoulPos(soulPoss)
|
.addAllSoulPos(soulPoss)
|
||||||
.setLockState(hero.getIsLock())
|
.setLockState(hero.getIsLock())
|
||||||
|
@ -165,6 +161,9 @@ public class CBean2Proto {
|
||||||
return equipProto.build();
|
return equipProto.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CommonProto.Equip getEquipProto(int equipId) {
|
||||||
|
return CommonProto.Equip.newBuilder().setEquipId(equipId).build();
|
||||||
|
}
|
||||||
|
|
||||||
public static CommonProto.Drop getDrop(TemporaryItems temporaryItems) {
|
public static CommonProto.Drop getDrop(TemporaryItems temporaryItems) {
|
||||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||||
|
|
|
@ -493,10 +493,10 @@ public class ItemUtil {
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case GlobalItemType.SOUL_MARK:
|
case GlobalItemType.SOUL_MARK:
|
||||||
case GlobalItemType.ITEM:
|
case GlobalItemType.ITEM:
|
||||||
|
case GlobalItemType.EQUIP:
|
||||||
return itemMap;
|
return itemMap;
|
||||||
case GlobalItemType.CARD:
|
case GlobalItemType.CARD:
|
||||||
return cardMap;
|
return cardMap;
|
||||||
case GlobalItemType.EQUIP:
|
|
||||||
case GlobalItemType.ESPECIAL_EQUIP:
|
case GlobalItemType.ESPECIAL_EQUIP:
|
||||||
case GlobalItemType.JEWEL:
|
case GlobalItemType.JEWEL:
|
||||||
return equipMap;
|
return equipMap;
|
||||||
|
@ -738,22 +738,6 @@ public class ItemUtil {
|
||||||
sendToFront.add(CBean2Proto.getItem(item,-1));
|
sendToFront.add(CBean2Proto.getItem(item,-1));
|
||||||
LOGGER.info("the uid={},the curMapId={},add item={},addItemNum={},totalItemNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),entry.getValue(),item.getItemNum());
|
LOGGER.info("the uid={},the curMapId={},add item={},addItemNum={},totalItemNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),entry.getValue(),item.getItemNum());
|
||||||
}
|
}
|
||||||
Set<PropertyItem> equips = temporaryItems.equips;
|
|
||||||
|
|
||||||
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
|
|
||||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(entry.getKey());
|
|
||||||
if (sEquipConfig == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Integer nums = entry.getValue();
|
|
||||||
for(int i=0;i<nums;i++){
|
|
||||||
Equip equip = new Equip(user.getId(), entry.getKey());
|
|
||||||
equips.add(equip);
|
|
||||||
equipProtoList.add(CBean2Proto.getEquipProto(equip));
|
|
||||||
}
|
|
||||||
LOGGER.info("the uid={},the curMapId={},add equip={},equipNum={},totalEquipNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),nums,equips.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
mapManager.setTemporaryItems(temporaryItems);
|
mapManager.setTemporaryItems(temporaryItems);
|
||||||
if (dropBuilder != null) {
|
if (dropBuilder != null) {
|
||||||
dropBuilder.addAllItemlist(itemProtoList);
|
dropBuilder.addAllItemlist(itemProtoList);
|
||||||
|
@ -1232,6 +1216,7 @@ public class ItemUtil {
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case GlobalItemType.ITEM:
|
case GlobalItemType.ITEM:
|
||||||
case GlobalItemType.SOUL_MARK:
|
case GlobalItemType.SOUL_MARK:
|
||||||
|
case GlobalItemType.EQUIP:
|
||||||
putcountMap(itemId,itemNum,itemMap);
|
putcountMap(itemId,itemNum,itemMap);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue