探索事件
parent
c15ab64462
commit
86a91c0c2a
|
@ -9,7 +9,6 @@ import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
|
||||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||||
import com.ljsd.jieling.logic.activity.event.ExploreEvent;
|
import com.ljsd.jieling.logic.activity.event.ExploreEvent;
|
||||||
|
@ -225,6 +224,27 @@ public class ExplorerMapLogic {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendRandomEvent(User user) {
|
||||||
|
ISession sess = OnlineUserManager.sessionMap.get(user.getId());
|
||||||
|
Map<Integer, SExplore> config = STableManager.getConfig(SExplore.class);
|
||||||
|
Map<Integer, SExploreEvent> exploreEventConfig = STableManager.getConfig(SExploreEvent.class);
|
||||||
|
List<SExplore> limitConfig = config.values().stream().filter(n -> n.getLevel() <= user.getPlayerInfoManager().getLevel()).collect(Collectors.toList());
|
||||||
|
Random random = new Random();
|
||||||
|
int randomMapId = random.nextInt(limitConfig.size());
|
||||||
|
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);
|
||||||
|
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();
|
||||||
|
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 void calOfflineReward(User user) throws Exception {
|
public void calOfflineReward(User user) throws Exception {
|
||||||
//计算离线奖励
|
//计算离线奖励
|
||||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||||
|
@ -252,6 +272,11 @@ public class ExplorerMapLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOGGER.info("离线玩家队伍id", keyVal.getKey());
|
LOGGER.info("离线玩家队伍id", keyVal.getKey());
|
||||||
|
//探索事件
|
||||||
|
long gapDay = TimeUtils.getGapDaysByTwoTime( TimeUtils.getTimeStamp2(keyVal.getValue().getBatteTime()*1000L), TimeUtils.getTimeStamp2(offlineEndTime*1000L));
|
||||||
|
for(int i = 0;i< gapDay;i++){
|
||||||
|
sendRandomEvent(user);
|
||||||
|
}
|
||||||
for (int i = keyVal.getValue().getBatteTime(); i <= offlineEndTime; i = i + battleInterval) {
|
for (int i = keyVal.getValue().getBatteTime(); i <= offlineEndTime; i = i + battleInterval) {
|
||||||
//复活玩家
|
//复活玩家
|
||||||
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= i) {
|
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= i) {
|
||||||
|
@ -289,14 +314,6 @@ public class ExplorerMapLogic {
|
||||||
if (now < user.getPlayerInfoManager().getLoginTime() + 60000) {
|
if (now < user.getPlayerInfoManager().getLoginTime() + 60000) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//整点刷出随机事件
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
int minute = calendar.get(Calendar.MINUTE);
|
|
||||||
//sendRandomEvent(user);
|
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
|
||||||
if(minute == 0){
|
|
||||||
sendRandomEvent(user);
|
|
||||||
}
|
|
||||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||||
if (explorer == null || explorer.size() == 0) {
|
if (explorer == null || explorer.size() == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -384,7 +401,6 @@ public class ExplorerMapLogic {
|
||||||
MailLogic.getInstance().sendMail(uid, title, content,
|
MailLogic.getInstance().sendMail(uid, title, content,
|
||||||
"", TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
"", TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String title = SErrorCodeEerverConfig.getI18NMessage("exploresuccess_mail_title");
|
String title = SErrorCodeEerverConfig.getI18NMessage("exploresuccess_mail_title");
|
||||||
String content = SErrorCodeEerverConfig.getFormatMessage("exploresuccess_mail_txt", new Object[]{
|
String content = SErrorCodeEerverConfig.getFormatMessage("exploresuccess_mail_txt", new Object[]{
|
||||||
teamName, mapName, hour, explorer.get(id).getKillNum(), explorer.get(id).getDeathNum()});
|
teamName, mapName, hour, explorer.get(id).getKillNum(), explorer.get(id).getDeathNum()});
|
||||||
|
@ -407,6 +423,17 @@ public class ExplorerMapLogic {
|
||||||
if (delayId.size() > 0) {
|
if (delayId.size() > 0) {
|
||||||
user.getPlayerInfoManager().setExplorer(explorer);
|
user.getPlayerInfoManager().setExplorer(explorer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//探索有消耗 整点刷出随机事件
|
||||||
|
if (explorer.size() > 0) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
/*int minute = calendar.get(Calendar.MINUTE);
|
||||||
|
if (minute == 0) {
|
||||||
|
sendRandomEvent(user);
|
||||||
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
|
}*/
|
||||||
|
sendRandomEvent(user);
|
||||||
|
}
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -414,22 +441,6 @@ public class ExplorerMapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendRandomEvent(User user){
|
|
||||||
//map
|
|
||||||
Map<Integer, SExplore> config = STableManager.getConfig(SExplore.class);
|
|
||||||
Map<Integer, SExploreEvent> exploreEventConfig = STableManager.getConfig(SExploreEvent.class);
|
|
||||||
List<SExplore> limitConfig = config.values().stream().filter(n->n.getLevel()<= user.getPlayerInfoManager().getLevel()).collect(Collectors.toList());
|
|
||||||
Random random = new Random();
|
|
||||||
int randomMapId = random.nextInt(limitConfig.size());
|
|
||||||
SExplore rankExplore = limitConfig.get(randomMapId);
|
|
||||||
//user.getPlayerInfoManager().getExploreEvent();
|
|
||||||
|
|
||||||
int randomEventId = random.nextInt(rankExplore.getEventList().length);
|
|
||||||
int eventId = rankExplore.getEventList()[randomEventId];
|
|
||||||
LOGGER.error("explore add eventId:"+eventId+" randomMapId: "+randomMapId);
|
|
||||||
user.getPlayerInfoManager().addExploreEvent(new KeyVal(eventId,TimeUtils.nowInt()+exploreEventConfig.get(eventId).getTime(),randomMapId+1));
|
|
||||||
|
|
||||||
}
|
|
||||||
public static class Instance {
|
public static class Instance {
|
||||||
public final static ExplorerMapLogic instance = new ExplorerMapLogic();
|
public final static ExplorerMapLogic instance = new ExplorerMapLogic();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue