探索事件
parent
86a91c0c2a
commit
3bc2c1df69
|
@ -107,7 +107,7 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explor
|
||||||
}
|
}
|
||||||
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.FORMATION_NORMAL.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();
|
||||||
|
|
|
@ -11,12 +11,15 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.SExploreEvent;
|
||||||
|
import manager.STableManager;
|
||||||
import org.springframework.data.redis.core.ZSetOperations;
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
import rpc.protocols.MessageTypeProto;
|
import rpc.protocols.MessageTypeProto;
|
||||||
import rpc.protocols.PlayerInfoProto;
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ExplorerMapEventXMBeforeBattleHandler extends BaseHandler<PlayerInfoProto.ExplorerXMEventChallengeBeforeRequest> {
|
public class ExplorerMapEventXMBeforeBattleHandler extends BaseHandler<PlayerInfoProto.ExplorerXMEventChallengeBeforeRequest> {
|
||||||
|
@ -33,11 +36,18 @@ public class ExplorerMapEventXMBeforeBattleHandler extends BaseHandler<PlayerIn
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerInfoProto.ExplorerXMEventChallengeBeforeResponse.Builder builder = PlayerInfoProto.ExplorerXMEventChallengeBeforeResponse.newBuilder();
|
PlayerInfoProto.ExplorerXMEventChallengeBeforeResponse.Builder builder = PlayerInfoProto.ExplorerXMEventChallengeBeforeResponse.newBuilder();
|
||||||
|
int eventId = proto.getEventId();
|
||||||
|
Map<Integer, SExploreEvent> exploreEventConfig = STableManager.getConfig(SExploreEvent.class);
|
||||||
|
if(!exploreEventConfig.containsKey(eventId)){
|
||||||
|
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerXMEventChallengeBeforeResponse.getNumber(), builder.build(), true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||||
String key = RedisUtil.getInstence().getKey(RedisKey.FORCE_CURR_RANK,String.valueOf(crossGroup),false);
|
String key = RedisUtil.getInstence().getKey(RedisKey.FORCE_CURR_RANK,String.valueOf(crossGroup),false);
|
||||||
Set<ZSetOperations.TypedTuple<String>> forceZetSort = RedisUtil.getInstence().getAllZsetRange(key);
|
Set<ZSetOperations.TypedTuple<String>> forceZetSort = RedisUtil.getInstence().getAllZsetRange(key);
|
||||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.FORMATION_NORMAL.getTeamId(), false);
|
int force = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), false);
|
||||||
final int forcelimit = force+force*500/10000;
|
int forceRange = exploreEventConfig.get(eventId).getForceRange();
|
||||||
|
final int forcelimit = force+force*forceRange/10000;
|
||||||
int matchUid = forceZetSort.stream().filter(n -> n.getScore() >= forcelimit).map(v -> Integer.parseInt(v.getValue())).findAny().orElse(0);
|
int matchUid = forceZetSort.stream().filter(n -> n.getScore() >= forcelimit).map(v -> Integer.parseInt(v.getValue())).findAny().orElse(0);
|
||||||
if(matchUid == 0){
|
if(matchUid == 0){
|
||||||
List<ZSetOperations.TypedTuple<String>> lst = new ArrayList<ZSetOperations.TypedTuple<String>>(forceZetSort); //
|
List<ZSetOperations.TypedTuple<String>> lst = new ArrayList<ZSetOperations.TypedTuple<String>>(forceZetSort); //
|
||||||
|
@ -48,7 +58,7 @@ public class ExplorerMapEventXMBeforeBattleHandler extends BaseHandler<PlayerIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO
|
//TODO
|
||||||
matchUid=10052935;
|
//matchUid=10052935;
|
||||||
//matchUid=10061221;
|
//matchUid=10061221;
|
||||||
//matchUid=10052631;
|
//matchUid=10052631;
|
||||||
user.getPlayerInfoManager().setExploreEventMatchDefUid(matchUid);
|
user.getPlayerInfoManager().setExploreEventMatchDefUid(matchUid);
|
||||||
|
|
|
@ -244,6 +244,20 @@ public class ExplorerMapLogic {
|
||||||
}
|
}
|
||||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, indication.build(), true);
|
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, indication.build(), true);
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
PlayerInfoProto.ExplorerMapIndicationResponse.Builder indication = PlayerInfoProto.ExplorerMapIndicationResponse.newBuilder();
|
||||||
|
for (KeyVal keyVal : filtEvent) {
|
||||||
|
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 {
|
||||||
//计算离线奖励
|
//计算离线奖励
|
||||||
|
@ -434,6 +448,7 @@ public class ExplorerMapLogic {
|
||||||
}*/
|
}*/
|
||||||
sendRandomEvent(user);
|
sendRandomEvent(user);
|
||||||
}
|
}
|
||||||
|
sendDisappearEvent(user);
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue