探索事件
parent
d3da540689
commit
d2c5355948
|
@ -60,16 +60,23 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explore
|
|||
}
|
||||
List<KeyVal> eventList = user.getPlayerInfoManager().getExploreEvent();
|
||||
int index = 0;
|
||||
boolean isGetIndex = false;
|
||||
for (int i = 0; i < eventList.size(); i++) {
|
||||
if (index == 0 && eventList.get(i).getKey() == id) {
|
||||
index = i;
|
||||
isGetIndex = true;
|
||||
}
|
||||
if (index != 0 && eventList.get(i).getKey() == id) {
|
||||
if (eventList.get(i).getVal() < eventList.get(index).getVal()) {
|
||||
index = i;
|
||||
isGetIndex = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isGetIndex){
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapEventResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
}
|
||||
/* 1兽潮
|
||||
2心魔
|
||||
3宝箱*/
|
||||
|
|
|
@ -234,14 +234,19 @@ public class ExplorerMapLogic {
|
|||
SExplore rankExplore = limitConfig.get(randomMapId);
|
||||
int randomEventId = random.nextInt(rankExplore.getEventList().length);
|
||||
int eventId = rankExplore.getEventList()[randomEventId];
|
||||
LOGGER.info("explore add eventId:" + eventId + " randomMapId: " + randomMapId);
|
||||
LOGGER.info("explore add eventId:" + eventId + " randomMapId: " + randomMapId+1);
|
||||
user.getPlayerInfoManager().addExploreEvent(new KeyVal(eventId, TimeUtils.nowInt() + exploreEventConfig.get(eventId).getTime(), randomMapId + 1));
|
||||
PlayerInfoProto.ExplorerMapIndicationResponse.Builder indication = PlayerInfoProto.ExplorerMapIndicationResponse.newBuilder();
|
||||
List<KeyVal> event = user.getPlayerInfoManager().getExploreEvent();
|
||||
//删除过期的
|
||||
if(event.removeIf(n->n.getVal() < TimeUtils.nowInt())){
|
||||
user.getPlayerInfoManager().setExploreEvent(event);
|
||||
}
|
||||
for (KeyVal keyVal : event) {
|
||||
indication.addRandEvent(CommonProto.CommKeyVal.newBuilder().setKey(keyVal.getKey()).setVal(keyVal.getVal()).
|
||||
setVal2(keyVal.getVa2()).build());
|
||||
}
|
||||
|
||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, indication.build(), true);
|
||||
}
|
||||
public static void sendDisappearEvent(User user){
|
||||
|
@ -286,8 +291,9 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
LOGGER.info("离线玩家队伍id", keyVal.getKey());
|
||||
//探索事件
|
||||
long gapDay = TimeUtils.getGapDaysByTwoTime( TimeUtils.getTimeStamp2(keyVal.getValue().getBatteTime()*1000L), TimeUtils.getTimeStamp2(offlineEndTime*1000L));
|
||||
long gapDay = TimeUtils.getGapDaysByTwoTime(TimeUtils.getTimeStamp2(keyVal.getValue().getBatteTime()*1000L), TimeUtils.getTimeStamp2(offlineEndTime*1000L));
|
||||
for(int i = 0;i< gapDay;i++){
|
||||
LOGGER.error("gapDay------------------------>{}",i);
|
||||
sendRandomEvent(user);
|
||||
}
|
||||
for (int i = keyVal.getValue().getBatteTime(); i <= offlineEndTime; i = i + battleInterval) {
|
||||
|
|
Loading…
Reference in New Issue