跨服切磋

lvxinran 2021-07-31 00:13:02 +08:00
parent 3cde69f3b8
commit 15544cbab8
2 changed files with 18 additions and 9 deletions

View File

@ -16,6 +16,6 @@ public class PlayWithSbHandler extends BaseHandler<ArenaInfoProto.PlayWithSbRequ
@Override
public void processWithProto(ISession iSession, ArenaInfoProto.PlayWithSbRequest proto) throws Exception {
ArenaLogic.getInstance().playWithSb(iSession,proto.getChallengeUid(),proto.getMyteamId());
ArenaLogic.getInstance().playWithSb(iSession,proto.getChallengeUid(),proto.getMyteamId(),proto.getCross());
}
}

View File

@ -626,18 +626,27 @@ public class ArenaLogic {
}
}
public void playWithSb(ISession session,int challengeUid,int myteamId) throws Exception {
//0为本服 1为跨服
public void playWithSb(ISession session,int challengeUid,int myteamId,int cross) throws Exception {
User mine = UserManager.getUser(session.getUid());
User defUser = UserManager.getUser(challengeUid);
if(!defUser.getTeamPosManager().getTeamPosForHero().containsKey(1)){
throw new ErrorCodeException(ErrorCode.newDefineCode("对方未设置阵容"));
}
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, myteamId, false);
int deforce = HeroLogic.getInstance().calTeamTotalForce(defUser, 1, false);
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(mine,myteamId,true);
CommonProto.FightTeamInfo deffightTeamInfo = BehaviorUtil.getFightTeamInfo(defUser,1,false);
CommonProto.FightTeamInfo deffightTeamInfo = null;
int deforce;
if(cross==0){
User defUser = UserManager.getUser(challengeUid);
if(!defUser.getTeamPosManager().getTeamPosForHero().containsKey(1)){
throw new ErrorCodeException(ErrorCode.newDefineCode("对方未设置阵容"));
}
deforce = HeroLogic.getInstance().calTeamTotalForce(defUser, 1, false);
deffightTeamInfo= BehaviorUtil.getFightTeamInfo(defUser,1,false);
}else{
//跨服切磋
ArenaOfUser user = CrossServiceLogic.getInstance().query(challengeUid);
deforce= user.getHeroManager().getTotalForce();
deffightTeamInfo = FightUtil.makeCrossPersonData(user);
}
if(myforce<deforce){
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
}