上报战斗修改

back_recharge
lvxinran 2021-01-22 15:32:37 +08:00
parent 0ae007f55f
commit 18b4fdfb9c
1 changed files with 23 additions and 11 deletions

View File

@ -37,10 +37,7 @@ import util.MathUtils;
import util.StringUtil;
import util.TimeUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -62,17 +59,32 @@ public class GMRequestHandler extends BaseHandler{
String command = gmCommand.getCommand();
int uid = iSession.getUid();
LOGGER.error("gm commond is {}",command);
if(command.startsWith("//check_fight")){
FIGHT_LOGGER.error(command);
CommonProto.GmResponse.Builder gmBuilder = CommonProto.GmResponse.newBuilder();
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true);
return;
}
// if(command.startsWith("//check_fight")){
// FIGHT_LOGGER.error(command);
// CommonProto.GmResponse.Builder gmBuilder = CommonProto.GmResponse.newBuilder();
// MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true);
// return;
// }
if(command.startsWith("//check_fight")){
if(command.startsWith("//")){
PrintWriter printWriter = new PrintWriter(new FileOutputStream( new File(SysUtil.getPath("conf/check_fight" + uid + ".txt"))));
//保存前端战斗数据
printWriter.print(command);
printWriter.print("\n");
//保存后端战斗数据
FileReader fileReader = new FileReader(SysUtil.getPath("luafight/BattleRecord/log-" + uid + ".txt"));
BufferedReader reader= new BufferedReader(fileReader);
String line = reader.readLine();
while(line!=null){
printWriter.print(line);
printWriter.print("\n");
line = reader.readLine();
}
printWriter.flush();
fileReader.close();
reader.close();
printWriter.close();
CommonProto.GmResponse.Builder gmBuilder = CommonProto.GmResponse.newBuilder();
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true);