升星校验
parent
d500fd4e66
commit
a60edcf3dd
|
@ -94,7 +94,7 @@ public class SCHero implements BaseConfig{
|
||||||
if(!consumeMaterialInfoByStarTmp.containsKey(star)){
|
if(!consumeMaterialInfoByStarTmp.containsKey(star)){
|
||||||
consumeMaterialInfoByStarTmp.put(star,new HashMap<>());
|
consumeMaterialInfoByStarTmp.put(star,new HashMap<>());
|
||||||
}
|
}
|
||||||
consumeMaterialInfoByStarTmp.get(star).put(position,new ConsumeMaterialInfo(position,nums));
|
consumeMaterialInfoByStarTmp.get(star).put(position,new ConsumeMaterialInfo(groupID,nums));
|
||||||
}
|
}
|
||||||
scHero.setConsumeMaterialInfoOfPositionByStar(consumeMaterialInfoByStarTmp);
|
scHero.setConsumeMaterialInfoOfPositionByStar(consumeMaterialInfoByStarTmp);
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,7 @@ package com.ljsd.jieling.logic.hero;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.*;
|
import com.ljsd.jieling.config.*;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.globals.Global;
|
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||||
|
@ -351,23 +349,35 @@ public class HeroLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<Integer,SCHero.ConsumeMaterialInfo> consumeMaterialInfoByPosition = scHero.getConsumeMaterialInfoOfPositionByStar(oldStar + 1);
|
Map<Integer,SCHero.ConsumeMaterialInfo> consumeMaterialInfoByPosition = scHero.getConsumeMaterialInfoOfPositionByStar(oldStar + 1);
|
||||||
|
if(consumeMaterialInfoByPosition ==null){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean canUse = true;
|
boolean canUse = true;
|
||||||
List<String> removeHeroIds = new ArrayList<>();
|
Set<String> removeHeroIds = new HashSet<>();
|
||||||
|
int needTotalHeroNums = 0;
|
||||||
|
if(consumeMaterialInfoByPosition.size()!=consumeMaterialsList.size()){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"所选英雄不符合");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for(HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList){
|
for(HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList){
|
||||||
int position = consumeMaterial1.getPosition();
|
int position = consumeMaterial1.getPosition();
|
||||||
SCHero.ConsumeMaterialInfo consumeMaterialInfo = consumeMaterialInfoByPosition.get(position);
|
SCHero.ConsumeMaterialInfo consumeMaterialInfo = consumeMaterialInfoByPosition.get(position);
|
||||||
|
int nums = consumeMaterialInfo.getNums();
|
||||||
|
needTotalHeroNums+=nums;
|
||||||
List<String> heroIdsList = consumeMaterial1.getHeroIdsList();
|
List<String> heroIdsList = consumeMaterial1.getHeroIdsList();
|
||||||
SHeroRankupGroup sHeroRankupGroup = SHeroRankupGroup.getsHeroRankupGroup(consumeMaterialInfo.getGroupID());
|
SHeroRankupGroup sHeroRankupGroup = SHeroRankupGroup.getsHeroRankupGroup(consumeMaterialInfo.getGroupID());
|
||||||
|
int isSame = sHeroRankupGroup.getIssame();
|
||||||
|
int starLimit = sHeroRankupGroup.getStarLimit();
|
||||||
|
int isSameClan = sHeroRankupGroup.getIsSameClan();
|
||||||
|
int isId = sHeroRankupGroup.getIsId();
|
||||||
for(String consumeHero : heroIdsList){
|
for(String consumeHero : heroIdsList){
|
||||||
Hero hero = heroManager.getHero(consumeHero);
|
Hero hero = heroManager.getHero(consumeHero);
|
||||||
if( null == hero ){
|
if( null == hero ){
|
||||||
canUse =false;
|
canUse =false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int isSame = sHeroRankupGroup.getIssame();
|
|
||||||
int starLimit = sHeroRankupGroup.getStarLimit();
|
|
||||||
int isSameClan = sHeroRankupGroup.getIsSameClan();
|
|
||||||
int isId = sHeroRankupGroup.getIsId();
|
|
||||||
|
|
||||||
if( 1 == isSame) {
|
if( 1 == isSame) {
|
||||||
if(hero.getTemplateId() != targetHero.getTemplateId()){
|
if(hero.getTemplateId() != targetHero.getTemplateId()){
|
||||||
|
@ -400,6 +410,12 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
removeHeroIds.add(consumeHero);
|
removeHeroIds.add(consumeHero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(needTotalHeroNums!=removeHeroIds.size()){
|
||||||
|
canUse=false;
|
||||||
|
LOGGER.error("hero num not enough");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canUse){
|
if(!canUse){
|
||||||
|
@ -423,7 +439,7 @@ public class HeroLogic {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void recyleHeroBySystem(User user,List<String> removeHeroIds){
|
public void recyleHeroBySystem(User user,Set<String> removeHeroIds){
|
||||||
HeroManager heroManager = user.getHeroManager();
|
HeroManager heroManager = user.getHeroManager();
|
||||||
for(String useHeroId : removeHeroIds){
|
for(String useHeroId : removeHeroIds){
|
||||||
heroManager.removeHero(useHeroId);
|
heroManager.removeHero(useHeroId);
|
||||||
|
|
Loading…
Reference in New Issue