Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
b9f2d0d096
|
@ -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; // 改名消耗
|
||||
|
||||
}
|
|
@ -20,7 +20,7 @@ public interface GlobalItemType {
|
|||
int RINGTYPE=9; // 矿石
|
||||
int SecretBox=10; // 宝箱
|
||||
int HEAD_FRAME = 11;//头像框
|
||||
|
||||
int CHANGE_NAME_CARD = 12;//改名道具卡
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
int RANDOM_USE = 1; // 随机使用
|
||||
|
|
|
@ -8,14 +8,15 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.util.EmojiUtil;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.ShieldedWordUtils;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -27,12 +28,19 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
String name;
|
||||
if (args.length == 1) {
|
||||
name = args[0];
|
||||
return doCheck(name);
|
||||
if (doCheck(name)) {
|
||||
return true;
|
||||
}else {
|
||||
LOGGER.error("名称检查失败");
|
||||
return false;
|
||||
}
|
||||
} else if (args.length == 0) {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
name = PlayerLogic.getInstance().getRandomName2();
|
||||
if (doCheck(name)) {
|
||||
return true;
|
||||
}else {
|
||||
LOGGER.error("名称检查失败");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -75,20 +83,26 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
String key = RedisKey.getKey(RedisKey.C_User_Name_Key, name, false);
|
||||
RedisUtil.getInstence().set(key, String.valueOf(getUser().getId()), RedisKey.REDIS_OVER_FOREVER);
|
||||
|
||||
Map<Integer,Integer> itemMap = new HashMap<>(1);
|
||||
itemMap.put( Global.CHANGENAME,1);
|
||||
ItemUtil.addItem(user,itemMap,null, BIReason.GM_CHANGENAME);
|
||||
Map<Integer, Integer> itemMap = new HashMap<>(1);
|
||||
itemMap.put(Global.CHANGENAME, 1);
|
||||
ItemUtil.addItem(user, itemMap, null, BIReason.GM_CHANGENAME);
|
||||
|
||||
//sendmail
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("change_name_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("change_name_txt");
|
||||
|
||||
int[][] values=new int[1][2];
|
||||
values[0][0]= Global.CHANGENAME;
|
||||
values[0][1]=1;
|
||||
int[][] values = new int[1][2];
|
||||
values[0][0] = Global.CHANGENAME;
|
||||
values[0][1] = 1;
|
||||
String mailReward = ItemUtil.getMailReward(values);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if (null != sessionByUid) {
|
||||
PlayerInfoProto.PlayerBackCInfoIndication build = PlayerInfoProto.PlayerBackCInfoIndication.newBuilder().setNickName(name).build();
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.PLAYER_BACKCINFO_INDICATION_VALUE, build, true);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
||||
public class Cmd_kick extends GmGlobleAbstract {
|
||||
|
||||
|
@ -8,7 +12,11 @@ public class Cmd_kick extends GmGlobleAbstract {
|
|||
public boolean exec(String[] args) throws Exception {
|
||||
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
instance.kickOldUser(getUser().getId(), "", 000, "LOSE HEART PACKET!!!!", 0);
|
||||
ISession session= OnlineUserManager.getSessionByUid(getUser().getId());
|
||||
if (session != null) {
|
||||
MessageUtil.sendErrorCode(session, ErrorCode.kickUserCode, "您已被踢下线!");
|
||||
instance.kickOldUser(getUser().getId(), "", ErrorCode.kickUserCode, "LOSE HEART PACKET!!!!", 0);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.GmService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class GmAbstract implements GmInterface{
|
||||
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(GmAbstract.class);
|
||||
public String msg = "";
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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();
|
||||
|
@ -110,10 +110,11 @@ public class PlayerLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
|
||||
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"));
|
||||
|
@ -133,6 +134,22 @@ public class PlayerLogic {
|
|||
}
|
||||
teamPosManager.getTeamNames().put(teamPosId,name);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
MessageUtil.sendMessage(iSession,1,msgId,null,true);
|
||||
}
|
||||
|
||||
|
|
|
@ -406,6 +406,7 @@ public class ItemUtil {
|
|||
case GlobalItemType.MINERAL:
|
||||
case GlobalItemType.HEAD_FRAME:
|
||||
case GlobalItemType.SecretBox:
|
||||
case GlobalItemType.CHANGE_NAME_CARD:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
case GlobalItemType.RANDOM_ITME:
|
||||
|
|
Loading…
Reference in New Issue