前端gm指令 后期屏蔽

back_recharge
zhangshanxue 2020-02-20 17:46:26 +08:00
parent d902f1d34e
commit ae01d515ec
3 changed files with 12 additions and 65 deletions

View File

@ -44,7 +44,7 @@ public class GmService implements RPCRequestGMIFace.Iface {
}
static Result exeCmd(String cmd){
public static Result exeCmd(String cmd){
LOGGER.info("gm________________________"+cmd);
Result result = new Result();
@ -53,34 +53,6 @@ public class GmService implements RPCRequestGMIFace.Iface {
GmInterface obj;
try {
if(cmd.contains("restartthread")){
LOGGER.info("restartthread....");
HandlerLogicThread handlerLogicThread = new HandlerLogicThread();
ProtocolsManager.getInstance().handlerThreads[Integer.parseInt(arg[1].trim())] = handlerLogicThread;
handlerLogicThread.setPriority(9);//优先级最高
handlerLogicThread.setName("h-" + Integer.parseInt(arg[1].trim()));
handlerLogicThread.start();
return result;
}
if(cmd.contains("hotfix")){
List<User> usersInDB = MongoUtil.getLjsdMongoTemplate().findAll("user", User.class);
List<Integer> sendIds = new ArrayList<>(usersInDB.size());
for(User user1 : usersInDB){
User userInMem = UserManager.getUserInMem(user1.getId());
if(userInMem == null){
continue;
}
sendIds.add(user1.getId());
}
InnerMessageUtil.broadcastWithRandom( user->{
LOGGER.info("hotfix user={}",user.getId());
MongoUtil.getLjsdMongoTemplate().save(user);
}
, sendIds, Math.min(10, 10));
result.setResultCode(1);
return result;
}
obj = (GmInterface) Class.forName(
GmInterface.class.getPackage().getName() + ".Cmd_"
+ arg[0].toLowerCase()).newInstance();
@ -98,40 +70,6 @@ public class GmService implements RPCRequestGMIFace.Iface {
if (obj instanceof GmRoleAbstract) {
//todo
Map<Integer, String> rechargeInfoMap = new HashMap<>();
if(cmd.contains("recharge")){
File file = new File("../conf/BuyGoodsLogic.log");
LOGGER.info("file path={}",file.getAbsolutePath());
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
String readLine = null;
Gson gson = new Gson();
while ( (readLine= bufferedReader.readLine())!=null){
if(readLine.contains("class")){
continue;
}
String[] split = readLine.split(",");
String uidStr = split[0].split("=")[1];
int uid = Integer.parseInt(uidStr);
String rechargeInfoStr = rechargeInfoMap.get(uid);
RechargeInfo rechargeInfo = new RechargeInfo();
if( rechargeInfoStr != null){
rechargeInfo = gson.fromJson(rechargeInfoStr,RechargeInfo.class);
}
String goodStr = split[1].split("=")[1];
int goodID = Integer.parseInt(goodStr);
if(goodID == 8 || goodID == 7){
rechargeInfo.setHadBuyFound(1);
}
Map<Integer, Integer> buyGoodsTimes = rechargeInfo.getBuyGoodsTimes();
Integer buyCount = buyGoodsTimes.get(goodID);
if(buyCount == null){
buyCount =0;
}
buyCount++;
buyGoodsTimes.put(goodID,buyCount);
rechargeInfoMap.put(uid,gson.toJson(rechargeInfo));
}
}
List<Integer> sendIds = new LinkedList<>();

View File

@ -1,5 +1,8 @@
package com.ljsd.jieling.handler.chat;
import com.ljsd.GameApplication;
import com.ljsd.GmService;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.chat.logic.ChatLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
@ -21,6 +24,13 @@ public class SendChatInfoHandler extends BaseHandler{
int chatType = sendChatInfoReqest.getChatType();
String message = sendChatInfoReqest.getMessage();
int friendId = sendChatInfoReqest.getFriendId();
ChatLogic.getInstance().sendChatMessage(iSession,chatType,message,friendId);
if(message.startsWith("0|//")&&GameApplication.serverProperties.isDebug()){
GmService.exeCmd(message.substring(4));
ChatLogic.getInstance().sendChatMessage(iSession,chatType,message+"gm命令",friendId);
}else {
ChatLogic.getInstance().sendChatMessage(iSession,chatType,message,friendId);
}
}
}

View File

@ -384,7 +384,6 @@ public class ExpeditionLogic {
}
SnapFightInfo fightInfo = new SnapFightInfo();
int force = sArenaRobotConfig.getTotalForce();
System.out.println(sArenaRobotConfig.getId() + "::" + force + "\r\n");
Map<String, FamilyHeroInfo> heroAllAttribute = new HashMap<>();
Map<Integer, Integer> heroStarsMap = sArenaRobotConfig.getStarOfHeroMap();
Map<String, Double> bossHP = new HashMap<>();