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