diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java index 1f541524b..a6baba298 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java @@ -102,7 +102,7 @@ public class PlayerLogic { /** * 起名字 * @param name - * @param type + * @param type 1:玩家起名 2: 阵容起名 3 玩家改名 */ public void resetUserName(ISession iSession, String name, int type,int teamPosId) throws Exception { int uid = iSession.getUid(); @@ -114,7 +114,7 @@ public class PlayerLogic { if (checkName(iSession, name, msgId)){ return; } - if (type == 1) { + if (type == 1||type == 3) { // 检查名字是否被占用 if (PlayerLogic.getInstance().isExistName(name)) { MessageUtil.sendErrorResponse(iSession, 0, msgId, SErrorCodeEerverConfig.getI18NMessage("name_repeat_txt")); @@ -135,18 +135,21 @@ public class PlayerLogic { teamPosManager.getTeamNames().put(teamPosId,name); } - //检查下 - int[][] cost = new int[1][]; - int[] temp = new int[2]; - temp[0] = Global.CHANGENAME; - temp[1] = 1; - cost[0] = temp; + if(type==3){ + //检查下 + int[][] cost = new int[1][]; + int[] temp = new int[2]; + temp[0] = Global.CHANGENAME; + temp[1] = 1; + cost[0] = temp; - boolean enoughCost = ItemUtil.itemCost(user,cost,BIReason.CHANGE_NAME,0); - if(!enoughCost){ - MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); - return; + boolean enoughCost = ItemUtil.itemCost(user,cost,BIReason.CHANGE_NAME,0); + if(!enoughCost){ + MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); + return; + } } + MessageUtil.sendMessage(iSession,1,msgId,null,true); }