玩家改名消耗道具

back_recharge
zhangshanxue 2019-08-29 15:13:39 +08:00
parent 1e02099200
commit 49445bf595
2 changed files with 17 additions and 0 deletions

View File

@ -92,6 +92,7 @@ public interface BIReason {
int USER_ITEM = 1010; // 使用道具
int RANDOM_HERO_CONSUME = 1011;//聚灵
int UP_HERO_LEVEL_CONSUME = 1012; // 卡牌升级消耗
int START_DIFFICULT = 1013;//关卡开始战斗消耗
@ -134,4 +135,6 @@ public interface BIReason {
int MONSTERATTACK_CONSUME = 1033; // 妖兽来袭开启战斗消耗
int CHANGE_NAME = 1034; // 改名消耗
}

View File

@ -110,6 +110,7 @@ public class PlayerLogic {
User user = UserManager.getUser(uid);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
TeamPosManager teamPosManager = user.getTeamPosManager();
if (checkName(iSession, name, msgId)){
return;
}
@ -133,6 +134,19 @@ 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;
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);
}