跨服切磋
parent
3cde69f3b8
commit
15544cbab8
|
@ -16,6 +16,6 @@ public class PlayWithSbHandler extends BaseHandler<ArenaInfoProto.PlayWithSbRequ
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processWithProto(ISession iSession, ArenaInfoProto.PlayWithSbRequest proto) throws Exception {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 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 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 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){
|
if(myforce<deforce){
|
||||||
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
|
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue