改名推送

back_recharge
zhangshanxue 2019-08-29 16:21:50 +08:00
parent 48d7ee726c
commit 9c676a4c6f
1 changed files with 15 additions and 12 deletions

View File

@ -102,7 +102,7 @@ public class PlayerLogic {
/** /**
* *
* @param name * @param name
* @param type * @param type 1: 2: 3
*/ */
public void resetUserName(ISession iSession, String name, int type,int teamPosId) throws Exception { public void resetUserName(ISession iSession, String name, int type,int teamPosId) throws Exception {
int uid = iSession.getUid(); int uid = iSession.getUid();
@ -114,7 +114,7 @@ public class PlayerLogic {
if (checkName(iSession, name, msgId)){ if (checkName(iSession, name, msgId)){
return; return;
} }
if (type == 1) { if (type == 1||type == 3) {
// 检查名字是否被占用 // 检查名字是否被占用
if (PlayerLogic.getInstance().isExistName(name)) { if (PlayerLogic.getInstance().isExistName(name)) {
MessageUtil.sendErrorResponse(iSession, 0, msgId, SErrorCodeEerverConfig.getI18NMessage("name_repeat_txt")); MessageUtil.sendErrorResponse(iSession, 0, msgId, SErrorCodeEerverConfig.getI18NMessage("name_repeat_txt"));
@ -135,18 +135,21 @@ public class PlayerLogic {
teamPosManager.getTeamNames().put(teamPosId,name); teamPosManager.getTeamNames().put(teamPosId,name);
} }
//检查下 if(type==3){
int[][] cost = new int[1][]; //检查下
int[] temp = new int[2]; int[][] cost = new int[1][];
temp[0] = Global.CHANGENAME; int[] temp = new int[2];
temp[1] = 1; temp[0] = Global.CHANGENAME;
cost[0] = temp; temp[1] = 1;
cost[0] = temp;
boolean enoughCost = ItemUtil.itemCost(user,cost,BIReason.CHANGE_NAME,0); boolean enoughCost = ItemUtil.itemCost(user,cost,BIReason.CHANGE_NAME,0);
if(!enoughCost){ if(!enoughCost){
MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足");
return; return;
}
} }
MessageUtil.sendMessage(iSession,1,msgId,null,true); MessageUtil.sendMessage(iSession,1,msgId,null,true);
} }