探索事件
parent
3bc2c1df69
commit
73ad9d7c4c
|
|
@ -52,22 +52,20 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
return;
|
||||
}
|
||||
PlayerInfoProto.ExplorerMapEventResponse.Builder builder = PlayerInfoProto.ExplorerMapEventResponse.newBuilder();
|
||||
// MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapEventResponse.getNumber(), builder.build(), true);
|
||||
int id = proto.getId();
|
||||
Map<Integer, SExploreEvent> exploreEventConfig = STableManager.getConfig(SExploreEvent.class);
|
||||
if(!exploreEventConfig.containsKey(id)){
|
||||
if (!exploreEventConfig.containsKey(id)) {
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapEventResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
List<KeyVal> eventList = user.getPlayerInfoManager().getExploreEvent();
|
||||
int index = 0;
|
||||
for(int i =0;i<eventList.size();i++){
|
||||
if(index == 0 && eventList.get(i).getKey() == id){
|
||||
for (int i = 0; i < eventList.size(); i++) {
|
||||
if (index == 0 && eventList.get(i).getKey() == id) {
|
||||
index = i;
|
||||
}
|
||||
if(index != 0 && eventList.get(i).getKey() == id){
|
||||
if(eventList.get(i).getVal()<eventList.get(index).getVal()){
|
||||
if (index != 0 && eventList.get(i).getKey() == id) {
|
||||
if (eventList.get(i).getVal() < eventList.get(index).getVal()) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
|
@ -75,7 +73,7 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
/* 1兽潮
|
||||
2心魔
|
||||
3宝箱*/
|
||||
if(exploreEventConfig.get(id).getType() == 1){
|
||||
if (exploreEventConfig.get(id).getType() == 1) {
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), 20, "",
|
||||
GameFightType.ExploreShouChaoFight, exploreEventConfig.get(id).getMonsterGroup(), 3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
|
|
@ -84,32 +82,32 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
.setFightSeed(fightResult.getSeed())
|
||||
.setHeroFightInfos(fightResult.getFightTeamInfo())
|
||||
.addAllMonsterList(fightResult.getMonsterTeamList())
|
||||
.setFightType(FightType.CrossLingMaiSecretFight.getType())
|
||||
.setFightId(FightUtil.getFightId(user.getId(), FightType.CrossLingMaiSecretFight.getType()))
|
||||
.setFightType(FightType.ExploreShouChao.getType())
|
||||
.setFightId(FightUtil.getFightId(user.getId(), FightType.ExploreShouChao.getType()))
|
||||
.build();
|
||||
builder.setFightData(fightData);
|
||||
builder.setFightResult(fightResult.getResult());
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{exploreEventConfig.get(id).getRewardGroup()}, 1, 0, BIReason.EXPLORE_EVENT_MONSTER);
|
||||
builder.setDrop(drop);
|
||||
if((int) fightResult.getCheckResult()[0] == 1){
|
||||
if ((int) fightResult.getCheckResult()[0] == 1) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EXPLORE, MissionType.EXPLORE_REPELMONSTER_NUM,
|
||||
1);
|
||||
}
|
||||
}else if(exploreEventConfig.get(id).getType() == 2){
|
||||
} else if (exploreEventConfig.get(id).getType() == 2) {
|
||||
int defUid = user.getPlayerInfoManager().getExploreEventMatchDefUid();
|
||||
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(defUid);
|
||||
if (csPlayer == null){
|
||||
if (csPlayer == null) {
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
CrossArenaManager crossArenaManager = null;
|
||||
if(GameApplication.serverId != csPlayer.getServerId()){
|
||||
if (GameApplication.serverId != csPlayer.getServerId()) {
|
||||
crossArenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
|
||||
}
|
||||
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(user,TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), null, null);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(user, TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), null, null);
|
||||
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, TeamEnum.FORMATION_NORMAL.getTeamId(), null, crossArenaManager);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), false);
|
||||
FightResult fightResult = GetWorldArenaChallengeRequestHandler.getFightForPVP(uid, defUid,
|
||||
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce< csPlayer.getMainLineForce(),FightType.ExploreXinMo);
|
||||
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce < csPlayer.getMainLineForce(), FightType.ExploreXinMo);
|
||||
int seed = fightResult.getSeed();
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
||||
|
|
@ -120,14 +118,14 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
.setFightId(FightUtil.getFightId(uid, FightType.ExploreXinMo.getType()))
|
||||
.build();
|
||||
builder.setFightData(fightData);
|
||||
builder.setFightResult( (int) fightResult.getCheckResult()[0]);
|
||||
builder.setFightResult((int) fightResult.getCheckResult()[0]);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{exploreEventConfig.get(id).getRewardGroup()}, 1, 0, BIReason.EXPLORE_EVENT_MONSTER);
|
||||
builder.setDrop(drop);
|
||||
if((int) fightResult.getCheckResult()[0] == 1){
|
||||
if ((int) fightResult.getCheckResult()[0] == 1) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EXPLORE, MissionType.EXPLORE_REPELXINMO_NUM,
|
||||
1);
|
||||
}
|
||||
}else if(exploreEventConfig.get(id).getType() == 3){
|
||||
} else if (exploreEventConfig.get(id).getType() == 3) {
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{exploreEventConfig.get(id).getRewardGroup()}, 1, 0, BIReason.EXPLORE_EVENT_BOX);
|
||||
builder.setDrop(drop);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EXPLORE, MissionType.EXPLORE_PICKYM_NUM,
|
||||
|
|
@ -137,4 +135,4 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
user.getPlayerInfoManager().setExploreEvent(eventList);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapEventResponse.getNumber(), builder.build(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,11 +247,10 @@ public class ExplorerMapLogic {
|
|||
public static void sendDisappearEvent(User user){
|
||||
ISession sess = OnlineUserManager.sessionMap.get(user.getId());
|
||||
List<KeyVal> event = user.getPlayerInfoManager().getExploreEvent();
|
||||
List<KeyVal> filtEvent = event.stream().filter(n->n.getVal()>=TimeUtils.nowInt()).collect(Collectors.toList());
|
||||
if(event.size() != filtEvent.size()){
|
||||
user.getPlayerInfoManager().setExploreEvent(filtEvent);
|
||||
if(event.removeIf(n->n.getVal() < TimeUtils.nowInt())){
|
||||
user.getPlayerInfoManager().setExploreEvent(event);
|
||||
PlayerInfoProto.ExplorerMapIndicationResponse.Builder indication = PlayerInfoProto.ExplorerMapIndicationResponse.newBuilder();
|
||||
for (KeyVal keyVal : filtEvent) {
|
||||
for (KeyVal keyVal : event) {
|
||||
indication.addRandEvent(CommonProto.CommKeyVal.newBuilder().setKey(keyVal.getKey()).setVal(keyVal.getVal()).
|
||||
setVal2(keyVal.getVa2()).build());
|
||||
}
|
||||
|
|
@ -444,7 +443,6 @@ public class ExplorerMapLogic {
|
|||
/*int minute = calendar.get(Calendar.MINUTE);
|
||||
if (minute == 0) {
|
||||
sendRandomEvent(user);
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}*/
|
||||
sendRandomEvent(user);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue