back_recharge
parent
6c9252f157
commit
3021511e7e
|
@ -39,7 +39,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
|
|
||||||
User user = UserManager.getUserForLogin(userId);
|
User user = UserManager.getUserForLogin(userId);
|
||||||
|
|
||||||
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), user.getMapManager().getCurMapId());
|
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), user.getMapManager().getMaxMapId(), user.getMapManager().getCurMapId());
|
||||||
|
|
||||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
||||||
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||||
|
|
|
@ -63,25 +63,27 @@ public class MapLogic {
|
||||||
public void enterMap(ISession iSession, int mapId, int teamId, MessageTypeProto.MessageType messageType) throws Exception {
|
public void enterMap(ISession iSession, int mapId, int teamId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
int uid = iSession.getUid();
|
int uid = iSession.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
MapManager mapManager = user.getMapManager();
|
||||||
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
|
if (teamId != 0) {
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "阵容不存在");
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
return;
|
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
|
||||||
}
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "阵容不存在");
|
||||||
Set<String> heroes = new HashSet<>(teamPosHeroInfos.size());
|
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
|
||||||
if (hero == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hero.setCurHp(HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.HP_TYPE));
|
Set<String> heroes = new HashSet<>(teamPosHeroInfos.size());
|
||||||
heroes.add(heroInfo.getHeroId());
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
|
if (hero == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hero.setCurHp(HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.HP_TYPE));
|
||||||
|
heroes.add(heroInfo.getHeroId());
|
||||||
|
}
|
||||||
|
if (heroes.size() != teamPosHeroInfos.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mapManager.setHeroes(heroes);
|
||||||
}
|
}
|
||||||
if (heroes.size() != teamPosHeroInfos.size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MapManager mapManager = user.getMapManager();
|
|
||||||
mapManager.setHeroes(heroes);
|
|
||||||
if (mapManager.getCurMapId() == 0) {
|
if (mapManager.getCurMapId() == 0) {
|
||||||
user.getPlayerInfoManager().setMapId(mapId);
|
user.getPlayerInfoManager().setMapId(mapId);
|
||||||
mapManager.setCurMapId(mapId);
|
mapManager.setCurMapId(mapId);
|
||||||
|
|
|
@ -125,8 +125,8 @@ public class STableManager {
|
||||||
public static <T> Map<Integer, Map<Integer, T>> getMapConfig(Class<T> clazz) throws Exception {
|
public static <T> Map<Integer, Map<Integer, T>> getMapConfig(Class<T> clazz) throws Exception {
|
||||||
Map<Integer, Map<Integer, T>> map = new HashMap<>();
|
Map<Integer, Map<Integer, T>> map = new HashMap<>();
|
||||||
String tableName = clazz.getAnnotation(Table.class).name();
|
String tableName = clazz.getAnnotation(Table.class).name();
|
||||||
int mapType = 101;
|
int mapType = 100;
|
||||||
for (int i = 101; i < 1000; i++) {
|
for (int i = 100; i < 1000; i++) {
|
||||||
Map<Integer, T> mapConf = new HashMap<>();
|
Map<Integer, T> mapConf = new HashMap<>();
|
||||||
tableName = tableName + "_"+ i;
|
tableName = tableName + "_"+ i;
|
||||||
String path = SysUtil.getPath("conf", "server", tableName + ".txt");
|
String path = SysUtil.getPath("conf", "server", tableName + ".txt");
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
public class CBean2Proto {
|
public class CBean2Proto {
|
||||||
|
|
||||||
|
|
||||||
public static CommonProto.Player getPlayer(int uid, PlayerManager playerManager, int mapId) {
|
public static CommonProto.Player getPlayer(int uid, PlayerManager playerManager, int maxMapId, int mapId) {
|
||||||
CommonProto.Player player = CommonProto.Player
|
CommonProto.Player player = CommonProto.Player
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.setUid(uid)
|
.setUid(uid)
|
||||||
|
@ -25,7 +25,7 @@ public class CBean2Proto {
|
||||||
.setVipLevel(playerManager.getVipLevel())
|
.setVipLevel(playerManager.getVipLevel())
|
||||||
.setFamilyId(playerManager.getFamilyId())
|
.setFamilyId(playerManager.getFamilyId())
|
||||||
.setHead(playerManager.getHead())
|
.setHead(playerManager.getHead())
|
||||||
.setCurMapId(mapId == 0 ? 101 : mapId)
|
.setCurMapId((maxMapId == 0 && mapId == 0) ? 100 : mapId)
|
||||||
.build();
|
.build();
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue