战报和法宝公告功能提交

back_recharge
duhui 2020-12-18 11:27:25 +08:00
commit 637f25930f
34 changed files with 365 additions and 45 deletions

View File

@ -18,6 +18,9 @@ public enum FightType {
EXPEDITION(13), // 远征
GuildChallenge(14), //公会副本
NewGeneral(15),//新将
TenDespairArray(16),//十绝阵
Firend(17),//好友
;

View File

@ -14,6 +14,7 @@ import com.ljsd.jieling.logic.activity.event.UserForceChangeEvent;
import com.ljsd.jieling.logic.activity.eventhandler.UserForceUpEventHandler;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightRecordLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.thrift.idl.InvalidOperException;
import com.ljsd.jieling.thrift.idl.RPCRequestGMIFace;
@ -56,8 +57,6 @@ public class GmService implements RPCRequestGMIFace.Iface {
try {
String[] parameters = java.util.Arrays.copyOfRange(arg, 1, arg.length);
if (obj instanceof GmRoleAbstract) {
//todo
Map<Integer, String> rechargeInfoMap = new HashMap<>();
@ -97,7 +96,7 @@ public class GmService implements RPCRequestGMIFace.Iface {
int uid = Integer.parseInt(value);
sendIds.add(uid);
}
}else{
} else {
String[] ids = parameters[0].split("#");
for (String id : ids) {
sendIds.add(Integer.valueOf(id));
@ -123,6 +122,19 @@ public class GmService implements RPCRequestGMIFace.Iface {
} else {
LOGGER.info("gm________________________start"+cmd);
obj.exec(parameters);
// 获取玩家战报系统
if (cmd.contains("fightrecord")) {
if (cmd.contains("delete")) {
FightRecordLogic.getInstance().delete();
} else if (cmd.contains("all")){
String allValue = FightRecordLogic.getInstance().getAll(Integer.parseInt(parameters[2]));
result.setResultMsg(allValue);
} else {
String oneRecord = FightRecordLogic.getInstance().getOneRecord(parameters[0]);
result.setResultMsg(oneRecord);
}
}
LOGGER.info("gm________________________end"+cmd);
}

View File

@ -232,7 +232,7 @@ public class ChatLogic {
*
* @param multiple 0
*/
public void sendSysChatMessage(String message,int messageType ,int itemId, int type,int startTime, int endTime, int priorityLevel, int multiple) {
public void sendSysChatMessage(String message,int messageType ,String itemId, int type,int startTime, int endTime, int priorityLevel, int multiple) {
long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_SYS_MSG_ID+ GameApplication.serverId);
ChatProto.ChatInfo chatInfo = CBean2Proto.getSysChatInfoBuilder(message,messageType,itemId ,type,startTime,endTime,priorityLevel,multiple,messageId);
MessageCache.addSystemMsg(chatInfo,messageId);

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.handler.Expedition;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
@ -9,6 +10,7 @@ import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.fight.DefFightSnapData;
import com.ljsd.jieling.logic.fight.FightRecordLogic;
import com.ljsd.jieling.logic.fight.FightUtil;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
@ -110,12 +112,19 @@ public class StartExpeditionBattleRequest extends BaseHandler<Expedition.StartEx
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
fightStartResponse.setFightData(CommonProto.FightData.newBuilder()
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightMaxTime(maxTime)
.setFightSeed(seed)
.setHeroFightInfos(fightTeamInfo)
.addMonsterList(deffightTeamInfo)
.build());
.setFightType(FightType.StoryFight.getType())
.setFightId(FightUtil.getFightId(user.getId(), FightType.StoryFight.getType()))
.build();
fightStartResponse.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.EXPEDITION_START_BATTLE_RESONSE_VALUE, fightStartResponse.build(), true);
}

View File

@ -14,10 +14,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.PVPFightEvent;
import com.ljsd.jieling.logic.fight.*;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
@ -140,6 +137,11 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
fightData.toBuilder().setFightId(FightUtil.getFightId(uid,fightData.getFightType()));
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
guildInfo.addCarFightSb(uid);
user.getGuildMyInfo().setCarPlayTime(TimeUtils.nowInt());
FightInfoProto.FastFightChallengeResponse build = FightInfoProto.FastFightChallengeResponse.newBuilder().setHurt(hurt).setScore(gainScore).setFightData(fightData).build();

View File

@ -119,7 +119,7 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage("Dial_Reward_txt", new Object[]{nickName, sItem.getName()});
int sysType = sGlobalActivity.getType() == 30 ? Global.LUCKWHEEL : Global.LUCKWHEEL_ADVANCE;
ChatLogic.getInstance().sendSysChatMessage(message, sysType, 0, 0, 0, 0, 0, 0);
ChatLogic.getInstance().sendSysChatMessage(message, sysType, "0", 0, 0, 0, 0, 0);
}

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.handler.activity;
import com.google.protobuf.GeneratedMessage;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
@ -8,9 +9,7 @@ import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.*;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.util.ItemUtil;
@ -82,16 +81,20 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
}
// 战斗逻辑
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.FORMATION_NORMAL, 1000, "", GameFightType.GuildChallenge, monsterGroupId, 3);
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.FORMATION_NORMAL, 1000, "", GameFightType.NewGeneral, monsterGroupId, 3);
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightMaxTime(20)
.setFightSeed(fightResult.getSeed())
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addAllMonsterList(fightResult.getMonsterTeamList())
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
.setFightType(FightType.NewGeneral.getType())
.setFightId(FightUtil.getFightId(user.getId(), FightType.NewGeneral.getType()))
.build();
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
// 战斗结果,第二位是伤害
int[] checkResult = fightResult.getCheckResult();

View File

@ -9,6 +9,7 @@ import rpc.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
@Deprecated
public class AdventureBossChallengeHandler extends BaseHandler{
@Override
public MessageTypeProto.MessageType getMessageCode() {

View File

@ -7,6 +7,7 @@ import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.FightRecordLogic;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.result.FightResult;
@ -506,6 +507,9 @@ public class JourneyMap {
pveFightEvent.setMonsterRemainHp(hps);
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
int[] checkResult = fightResult.getCheckResult();
MapInfoProto.JourneyFightResponse.Builder response =MapInfoProto.JourneyFightResponse.newBuilder();

View File

@ -3149,9 +3149,14 @@ public class MapLogic {
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addAllMonsterList(fightResult.getMonsterTeamList())
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
.build();
int[] checkResult = fightResult.getCheckResult();
builder.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
if(checkResult[0]>0){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
builder.setDrop(drop);

View File

@ -1,8 +1,10 @@
package com.ljsd.jieling.handler.map.behavior;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.googlecode.protobuf.format.JsonFormat;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.logic.fight.FightRecordLogic;
import com.ljsd.jieling.logic.fight.FightUtil;
import com.ljsd.jieling.util.CBean2Proto;
import config.MapPointConfig;
@ -186,8 +188,11 @@ public class BehaviorUtil {
fightData.setFightSeed(seed);
fightData.setFightMaxTime(maxTime);
fightData.setFightType(FightType.MapExploreFight.getType());
fightData.setFightId(FightUtil.getFightId(user.getId(),FightType.MapExploreFight.getType()));
fightStartRespons.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData.build());
String key = RedisKey.getKey(RedisKey.FIGHT, Integer.toString(user.getId()), false);
Map<String,Object> fightInfo = new HashMap<>();
@ -334,7 +339,7 @@ public class BehaviorUtil {
}
}
public static void getLevelDifficultyifficuFightInfo(User user,FightType fightType,int groupId,int teamId, int maxTime,FightInfoProto.FightStartResponse.Builder fightStartRespons,String fightKey) {
public static void getLevelDifficultyifficuFightInfo(User user,FightType fightType,int groupId,int teamId, int maxTime,FightInfoProto.FightStartResponse.Builder fightStartRespons,String fightKey) throws JsonProcessingException {
CommonProto.FightData.Builder fightData = CommonProto.FightData.newBuilder();
CommonProto.FightTeamInfo fightTeamInfo = getFightTeamInfo(user, teamId,true);
fightData.setHeroFightInfos(fightTeamInfo);
@ -351,8 +356,11 @@ public class BehaviorUtil {
fightData.setFightSeed(seed);
fightData.setFightType(fightType.getType());
fightData.setFightMaxTime(maxTime);
fightData.setFightId(FightUtil.getFightId(user.getId(),fightType.getType()));
fightStartRespons.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData.build());
String key = RedisKey.getKey(fightKey,Integer.toString(user.getId()), false);
Map<String,Object> fightInfo = new HashMap<>();

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.FightRecordLogic;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.result.FightResult;
@ -279,6 +280,10 @@ public class EndlessMap extends AbstractMap{
fastFightResponseBuilder.setEnventDrop(drop.build());
fastFightResponseBuilder.setResult(resultCode);
fastFightResponseBuilder.setFightData(fightResult.getFightData());
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
//todo 临时粘贴
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());

View File

@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.dao.TeamPosManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.FightRecordLogic;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.result.FightResult;
@ -498,6 +499,9 @@ public class TowerMap extends AbstractMap {
fastFightResponseBuilder.setResult(resultCode);
fastFightResponseBuilder.setEssenceValue(trialInfo.getEnergy());
fastFightResponseBuilder.setFightData(fightResult.getFightData());
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, checkResult[1]);
ReportUtil.onReportEvent(user,ReportEventEnum.CHALLENGE_PANOPTIC_MIRROR_ENEMY.getType(),trialInfo.getFloor(),resultCode==1?"胜利":"失败");

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.handler.monsterAttack;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
@ -83,8 +84,13 @@ public class QuickStartMonsterFighter extends BaseHandler<FightInfoProto.QuickSt
.setFightSeed(fightResult.getSeed())
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addAllMonsterList(fightResult.getMonsterTeamList())
.setFightType(FightType.MonterFight.getType())
.setFightId(FightUtil.getFightId(uid,FightType.MonterFight.getType()))
.build();
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightDataBuild);
if (resultCode == 0) {
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
FightInfoProto.QuickStartMonsterFightResponse builder = FightInfoProto.QuickStartMonsterFightResponse.newBuilder()

View File

@ -0,0 +1,12 @@
package com.ljsd.jieling.kefu;
public class Cmd_fightrecord extends GmAbstract {
@Override
public boolean exec(String[] args) throws Exception {
if (args.length < 2) {
return false;
}
return true;
}
}

View File

@ -31,7 +31,7 @@ public class Cmd_sendmsg extends GmAbstract {
String content = stringBuilder.toString();
Gson gson = new Gson();
ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder();
chatInfo.setItemId(0);
chatInfo.setItemId("0");
chatInfo.setMessageId(0);
chatInfo.setTimes(System.currentTimeMillis());
chatInfo.setMsg(content);

View File

@ -247,9 +247,14 @@ public class SituationLogic {
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addAllMonsterList(fightResult.getMonsterTeamList())
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
.build();
int[] checkResult = fightResult.getCheckResult();
builder.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
//挑战成功
if(checkResult[0]>0){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sRaceTowerConfig.getFirstReward(), 1, 0, BIReason.SITUATION_CHALLENGE_REWARD);
@ -289,8 +294,16 @@ public class SituationLogic {
builder.setSeed(fightSeed);
builder.setFightTeamInfo(fightTeamInfo);
builder.setMonsterTeamList(monsterfightTeamInfos);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(fightEvent.getFightType().getFightType().getType()).setHeroFightInfos(fightTeamInfo).addAllMonsterList(monsterfightTeamInfos).setFightSeed(fightSeed).setFightMaxTime(fightEvent.getMostTime()).build();
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightType(fightEvent.getFightType().getFightType().getType())
.setHeroFightInfos(fightTeamInfo)
.addAllMonsterList(monsterfightTeamInfos)
.setFightSeed(fightSeed)
.setFightMaxTime(fightEvent.getMostTime())
.setFightId(FightUtil.getFightId(fightEvent.getAttackUid(),fightEvent.getFightType()))
.build();
builder.setFightData(fightData);
return builder.build();
}

View File

@ -115,7 +115,7 @@ public class LuckyCatActivity extends AbstractActivity {
SItem sItem = SItem.getsItemMap().get(temp2[0]);
String message = SErrorCodeEerverConfig.getI18NMessage("luck_cat_take_reward_content", new Object[]{nickName, sItem.getName(), temp2[1]});
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKCAT, 0, 0, 0, 0, 0, 0);
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKCAT, "0", 0, 0, 0, 0, 0);
reportTakeActivityReward(user,reward,missionId);
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();

View File

@ -1,8 +1,7 @@
package com.ljsd.jieling.logic.arena;
import com.ljsd.fight.ArenaRecord;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.db.mongo.MongoUtil;
@ -236,8 +235,14 @@ public class ArenaLogic {
.setFightSeed(seed)
.setHeroFightInfos(fightTeamInfo)
.addMonsterList(deffightTeamInfo)
.setFightType(FightType.ArenaFight.getType())
.setFightId(FightUtil.getFightId(mine.getId(),FightType.ArenaFight.getType()))
.build();
builder.setFightData(build);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(mine,build);
//数据互换
byte[] snapRecord = build.toByteArray();
arenaRecord.setFightData(snapRecord);
@ -603,7 +608,12 @@ public class ArenaLogic {
.setFightSeed(seed)
.setHeroFightInfos(fightTeamInfo)
.addMonsterList(deffightTeamInfo)
.setFightType(FightType.Firend.getType())
.setFightId(FightUtil.getFightId(mine.getId(),FightType.Firend.getType()))
.build();
ArenaInfoProto.PlayWithSbResponse response = ArenaInfoProto.PlayWithSbResponse.newBuilder().setFightData(build).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.PLAY_WITH_SB_RESPONSE_VALUE,response,true);

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.family;
import com.ljsd.GameApplication;
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.chat.logic.ChatLogic;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.GlobalsDef;
@ -16,9 +17,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.*;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
@ -242,7 +241,7 @@ public class DeathPathLogic {
String gid = firstGuild.iterator().next().getValue();
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(gid));
String message = SErrorCodeEerverConfig.getI18NMessage("guildwar_content", new Object[]{guildInfo.getName()});
ChatLogic.getInstance().sendSysChatMessage(message, Global.DEATH_PATH_FIRST, 0, 0, 0, 0, 0, 0);
ChatLogic.getInstance().sendSysChatMessage(message, Global.DEATH_PATH_FIRST, "0", 0, 0, 0, 0, 0);
break;
default:
break;
@ -341,7 +340,13 @@ public class DeathPathLogic {
.setFightSeed(fightResult.getSeed())
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addAllMonsterList(fightResult.getMonsterTeamList())
.setFightType(FightType.TenDespairArray.getType())
.setFightId(FightUtil.getFightId(uid,FightType.TenDespairArray.getType()))
.build();
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
//更新排行榜数据
tasks.offer(new DeathPathTask(uid,guildId,damage,pathId,groupId));
//挑战次数记录

View File

@ -15,9 +15,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.GuildCache;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightDispatcher;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.*;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.player.PlayerLogic;
@ -338,7 +336,12 @@ public class GuildChallengeLogic {
response.setDrop(drop);
if(fightData!=null){
fightData.toBuilder().setFightId(FightUtil.getFightId(uid,fightData.getFightType()));
response.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
}
response.setKill(kill);

View File

@ -524,7 +524,13 @@ public class GuildFightLogic {
.setFightSeed(dispatcher.getSeed())
.setHeroFightInfos(dispatcher.getFightTeamInfo())
.addMonsterList(dispatcher.getDefFightTeamInfo())
.setFightType(FightType.GuildFight.getType())
.setFightId(FightUtil.getFightId(userAttack.getId(),FightType.GuildFight.getType()))
.build();
// 记录战报
FightRecordLogic.getInstance().addRecordMap(userAttack,fightData);
Family.FamilyFightAttackResponse response = Family.FamilyFightAttackResponse.newBuilder().setResult(fightResult[0]).setStarCount(getStar).setData(fightData).build();
userAttack.getUserMissionManager().onGameEvent(userAttack, GameEvent.FAMILY_FIGHT_ATTACK);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);

View File

@ -8,6 +8,7 @@ import com.ljsd.fight.ArenaRecord;
import com.ljsd.jieling.logic.fight.result.FightResult;
import rpc.protocols.CommonProto;
import manager.STableManager;
import org.luaj.vm2.ast.Str;
public class AreFightPro implements EndFightProcessor {
ArenaRecord arenaRecord;
@ -54,12 +55,15 @@ public class AreFightPro implements EndFightProcessor {
int warTime = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getWarTime();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.setFightType(9)
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addMonsterList(fightResult.getDefFightTeamInfo())
.setFightSeed(fightResult.getSeed())
.setFightMaxTime(warTime).build();
.setFightMaxTime(warTime)
.setFightId(fightResult.getFightData().getFightId())
.build();
arenaRecord.setFightData(build.toByteArray());
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecord.getId(),arenaRecord);

View File

@ -14,7 +14,9 @@ public class FightDispatcher {
public static FightResult dispatcher(FightEvent fightEvent) throws Exception {
// 获取类型
GameFightType fightType = fightEvent.getFightType();
// 战斗逻辑
return fightType.getFightEventProcesor().process(fightEvent);
}

View File

@ -0,0 +1,120 @@
package com.ljsd.jieling.logic.fight;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.googlecode.protobuf.format.JsonFormat;
import com.ljsd.jieling.logic.dao.root.User;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import rpc.protocols.CommonProto;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class FightRecordLogic {
//私有构造方法
private FightRecordLogic (){
}
//声明成员变量
private static FightRecordLogic instance ;
//对外提供接口获取该实例
public static FightRecordLogic getInstance(){
if(instance == null){
synchronized (FightRecordLogic.class){
//两次判断是否为null
if(instance==null){
instance = new FightRecordLogic();
}
}
}
return instance;
}
private ConcurrentHashMap<Integer,MultiValueMap<Integer,String>> recordMap = new ConcurrentHashMap<>();
public ConcurrentHashMap<Integer, MultiValueMap<Integer, String>> getRecordMap() {
return recordMap;
}
// 一种类型存储上限
private static int max = 10;
public void setRecordMap(ConcurrentHashMap<Integer, MultiValueMap<Integer, String>> recordMap) {
this.recordMap = recordMap;
}
public void addRecordMap(User user, CommonProto.FightData fightData) throws JsonProcessingException {
// 玩家id
int uid = user.getId();
// 战斗类型
int multiKey = fightData.getFightType();
// 获取玩家的战斗数据
MultiValueMap<Integer, String> multiValueMap = recordMap.getOrDefault(uid, new LinkedMultiValueMap<Integer, String>());
// 根据类型获取战斗数据
List<String> strings = multiValueMap.getOrDefault(multiKey,new ArrayList<>());
// 类型大于十条删除最早的一条
if (strings.size() >= max){
strings.remove(0);
}
// protobuf转字符串
String str = JsonFormat.printToString(fightData);
strings.add(str);
// 重新赋值
multiValueMap.put(multiKey,strings);
System.out.println("fightId======================="+fightData.getFightId());
recordMap.put(uid,multiValueMap);
}
/**
*
* @param fightId id_id_id_
* @return
* @throws JsonProcessingException
*/
public String getOneRecord(String fightId){
String[] split = fightId.split("_");
// 玩家id
int uid = Integer.parseInt(split[0]);
// 战斗类型key
int multiKey = Integer.parseInt(split[2]);
// 获取玩家的全部战斗数据
MultiValueMap<Integer, String> valueMap = recordMap.get(uid);
if (valueMap == null){
return null;
}
// 获取类型数据
List<String> strings = valueMap.get(multiKey);
if (strings.isEmpty()){
return null;
}
// 遍历
for (int i = 0; i < strings.size(); i++) {
String item = strings.get(i);
// 初始化
CommonProto.FightData.Builder data = CommonProto.FightData.newBuilder();
try {
// json转protobuf
JsonFormat.merge(item,data);
} catch (JsonFormat.ParseException e) {
e.printStackTrace();
}
// 找到该战斗id直接返回
if (fightId.equals(data.getFightId())){
// 返回结果
return item;
}
}
return null;
}
public void delete(){
recordMap.clear();
}
public String getAll(int uid){
MultiValueMap<Integer, String> valueMap = recordMap.getOrDefault(uid,new LinkedMultiValueMap<>());
return valueMap.toString();
}
}

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.fight;
import com.googlecode.protobuf.format.JsonFormat;
import com.ljsd.GameApplication;
import com.ljsd.fight.CheckFight;
import com.ljsd.fight.DefFightSnapData;
import com.ljsd.jieling.core.GlobalsDef;
@ -25,6 +26,7 @@ import com.ljsd.jieling.util.MonsterUtil;
import config.SArenaRobotConfig;
import config.SCHero;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.ast.Str;
import util.TimeUtils;
import java.util.ArrayList;
@ -117,7 +119,15 @@ public class FightUtil {
builder.setSeed(fightSeed);
builder.setFightTeamInfo(fightTeamInfo);
builder.setMonsterTeamList(monsterfightTeamInfos);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(fightEvent.getFightType().getFightType().getType()).setHeroFightInfos(fightTeamInfo).addAllMonsterList(monsterfightTeamInfos).setFightSeed(fightSeed).setFightMaxTime(fightEvent.getMostTime()).build();
String fightId = getFightId(fightEvent.getAttackUid(),fightEvent.getFightType());
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightType(fightEvent.getFightType().getFightType().getType())
.setHeroFightInfos(fightTeamInfo)
.addAllMonsterList(monsterfightTeamInfos)
.setFightSeed(fightSeed)
.setFightMaxTime(fightEvent.getMostTime())
.setFightId(fightId)
.build();
builder.setFightData(fightData);
return builder.build();
}
@ -171,7 +181,15 @@ public class FightUtil {
builder.setSeed(fightSeed);
builder.setFightTeamInfo(fightTeamInfo);
builder.setDefFightTeamInfo(deffightTeamInfo);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(fightEvent.getFightType().getFightType().getType()).setHeroFightInfos(fightTeamInfo).addMonsterList(deffightTeamInfo).setFightSeed(fightSeed).setFightMaxTime(fightEvent.getMostTime()).build();
String fightId = getFightId(fightEvent.getAttackUid(),fightEvent.getFightType());
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightType(fightEvent.getFightType().getFightType().getType())
.setHeroFightInfos(fightTeamInfo)
.addMonsterList(deffightTeamInfo)
.setFightSeed(fightSeed)
.setFightMaxTime(fightEvent.getMostTime())
.setFightId(fightId)
.build();
builder.setFightData(fightData);
return builder.build();
}
@ -206,7 +224,15 @@ public class FightUtil {
FightResult.Builder fightResult = FightResult.newBuilder();
int[] fightResultInfo = CheckFight.getInstance().checkFight(seed, fightTime, getFightData, getOptionData, fightType.getFightType());
fightResult.setCheckResult(fightResultInfo);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(fightType.getFightType().getType()).setHeroFightInfos(fightTeamInfo).addAllMonsterList(monsterTeamList).setFightSeed(seed).setFightMaxTime(fightTime).build();
String fightId = getFightId(playerId,fightType);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightType(fightType.getFightType().getType())
.setHeroFightInfos(fightTeamInfo)
.addAllMonsterList(monsterTeamList)
.setFightSeed(seed)
.setFightMaxTime(fightTime)
.setFightId(fightId)
.build();
fightResult.setFightData(fightData);
return fightResult.build();
}
@ -432,5 +458,24 @@ public class FightUtil {
}
/**
* id
* @param uid
* @param fightType
* @return
*/
public static String getFightId(int uid,GameFightType fightType){
return uid + "_"
+ GameApplication.serverId + "_"
+ fightType.getFightType().getType() + "_"
+ System.currentTimeMillis();
}
public static String getFightId(int uid,int fightType){
return uid + "_"
+ GameApplication.serverId + "_"
+ fightType + "_"
+ System.currentTimeMillis();
}
}

View File

@ -48,7 +48,7 @@ public enum GameFightType {
CarBossChallenge(FightType.CarBossFight,new DefaultWithoutHandFightHandler(),null),
CarPersonChallenge(FightType.CarBossFight,new PVPFightHandler(),null),
GuildChallenge(FightType.GuildChallenge,new DefaultWithoutHandFightHandler(),null),
NewGeneral(FightType.GuildChallenge,new DefaultWithoutHandFightHandler(),null),
;

View File

@ -1,8 +1,10 @@
package com.ljsd.jieling.logic.fight.result;
import rpc.protocols.CommonProto;
import com.googlecode.protobuf.format.JsonFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class FightResult {
@ -14,7 +16,7 @@ public class FightResult {
private CommonProto.FightData fightData;
List<CommonProto.FightTeamInfo> monsterTeamList;
private FightResult(){
public FightResult(){
}
@ -148,4 +150,38 @@ public class FightResult {
public void setId(long id) {
this.id = id;
}
@Override
public String toString() {
ArrayList<String> list = new ArrayList<>();
if (null != monsterTeamList && !monsterTeamList.isEmpty()){
monsterTeamList.forEach((item)->{
list.add(JsonFormat.printToString(item.toBuilder().build()));
});
}
String fightTeam = null;
if (fightTeamInfo != null){
fightTeam = JsonFormat.printToString(fightTeamInfo.toBuilder().build());
}
String defFightTeam = null;
if (defFightTeamInfo != null){
defFightTeam = JsonFormat.printToString(defFightTeamInfo.toBuilder().build());
}
String fightDataS = null;
if (fightData != null){
fightDataS = JsonFormat.printToString(fightData.toBuilder().build());
}
return "FightResult{" +
"checkResult=" + Arrays.toString(checkResult) +
", seed=" + seed +
", fightTeamInfo=" + fightTeam +
", defFightTeamInfo=" + defFightTeam +
", fightData=" + fightDataS +
", monsterTeamList=" + list.toString() +
'}';
}
}

View File

@ -1077,10 +1077,10 @@ public class HeroLogic{
// 觉醒飘字
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
String message = SErrorCodeEerverConfig.getI18NMessage("animal_awaken_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName()});
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, targetHero.getTemplateId(), 0, 0, 0, 0, 0);
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
} else if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_hero_content_parm)) {
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(), targetHero.getStar()});
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, targetHero.getTemplateId(), 0, 0, 0, 0, 0);
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
}
String consume = StringUtil.parseArrayToString(consumeMaterial);
// HERO_STRENGTHEN(13,"hero_strengthen", new CommonEventHandler(),new String[]{"hero_id","old_quality","new_quality","strengthen_type","cost_item_list","cost_hero_list"}),
@ -3279,7 +3279,7 @@ public class HeroLogic{
if(animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)) { //策划资质改成星级
String message = SErrorCodeEerverConfig.getI18NMessage("animal_starup_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(),animal.getName(),pokemon.getStar()});
if (!message.isEmpty()){
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,0,0,0,0,0,0);
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,"0",0,0,0,0,0);
}
}
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.POKEMON_ADVANCED_RESPONSE_VALUE,null,true);

View File

@ -716,7 +716,7 @@ public class ItemLogic {
return;
}
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_equiptalisman_content", new Object[]{user.getPlayerInfoManager().getNickName(), sItem.getName(), hero.getEspecialEquipLevel()});
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, sItem.getId(), 0, 0, 0, 0, 0);
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, sItem.getId()+"#"+hero.getEspecialEquipLevel(), 0, 0, 0, 0, 0);
}
if (HeroLogic.getInstance().isInTeam(user, heroId, 1)) {
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));

View File

@ -315,7 +315,7 @@ public class WorkShopLogic {
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{
nickName, ItemUtil.equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equip.getEquipId()).getName()});
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKY_LUCK,equip.getEquipId(),0,0,0,0,0);
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKY_LUCK,String.valueOf(equip.getEquipId()),0,0,0,0,0);
}
user.getEquipManager().addEquip(user,equip);
dropBuilder.addEquipId(CBean2Proto.getEquipProto(equip));

View File

@ -298,7 +298,7 @@ public class CBean2Proto {
return chatInfo.build();
}
public static ChatProto.ChatInfo getSysChatInfoBuilder(String message,int messageType,int itemId,int type,int startTime, int endTime, int priorityLevel, int multiple,long messageId) {
public static ChatProto.ChatInfo getSysChatInfoBuilder(String message,int messageType,String itemId,int type,int startTime, int endTime, int priorityLevel, int multiple,long messageId) {
ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder();
chatInfo.setItemId(itemId);
chatInfo.setMessageId(messageId);

View File

@ -1198,7 +1198,7 @@ public class ItemUtil {
if (item.getQuantity() >= SSpecialConfig.getIntegerValue(msgTem+"_parm")) {
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage(msgTem, new Object[]{nickName, equipQulityNameMap.get(item.getQuantity()), item.getName()});
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,equipId,0,0,0,0,0);
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,String.valueOf(equipId),0,0,0,0,0);
}
}
@ -1279,7 +1279,7 @@ public class ItemUtil {
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()});
if (!message.isEmpty()){
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,hero.getTemplateId(),0,0,0,0,0);
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,String.valueOf(hero.getTemplateId()),0,0,0,0,0);
}
}
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_HERO,heroStar[0],heroStar[1]);
@ -1646,7 +1646,7 @@ public class ItemUtil {
if (animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)&&reason!=BIReason.COMPOS_HERO_REWARD) { //策划资质改成星级
String message = SErrorCodeEerverConfig.getI18NMessage("animal_get_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), animal.getName()});
if (!message.isEmpty()){
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,0,0,0,0,0,0);
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,"0",0,0,0,0,0);
}
}
}

View File

@ -12,7 +12,9 @@ import java.util.Map;
public class SGlobalSystemConfig implements BaseConfig {
private int id;
private String name;
private int[] openRules;
private String systemOpen;
@ -70,7 +72,7 @@ public class SGlobalSystemConfig implements BaseConfig {
return id;
}
public int[] getOpenRules() {
public int[] getOpenRules() {
return openRules;
}