change adventure
parent
5ef3705a1d
commit
134c51cdfa
|
@ -104,6 +104,8 @@ public class SGameSetting implements BaseConfig {
|
|||
|
||||
private int maxEnergyGet;
|
||||
|
||||
private int adventureItem;
|
||||
|
||||
|
||||
private static SGameSetting gameSetting;
|
||||
|
||||
|
@ -307,4 +309,8 @@ public class SGameSetting implements BaseConfig {
|
|||
public int getMaxEnergyGet() {
|
||||
return maxEnergyGet;
|
||||
}
|
||||
|
||||
public int getAdventureItem() {
|
||||
return adventureItem;
|
||||
}
|
||||
}
|
|
@ -70,6 +70,8 @@ public interface BIReason {
|
|||
|
||||
int SUDDENLY_REWARD = 43; // 精英怪奖励
|
||||
|
||||
int FIRST_ADVENTURE_REWARD = 44; // 秘境首次奖励外敌挑战券
|
||||
|
||||
//道具消耗原因 1000开头
|
||||
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
|
||||
int SECRETBOX_CONSUME = 1001; //秘盒抽卡
|
||||
|
@ -120,4 +122,6 @@ public interface BIReason {
|
|||
int CREATE_GUILD_CONSUME = 1030; // 创建宗门消耗
|
||||
int ENDLESS_CONSUME_EXECUTION = 1031; //无尽副本消耗行动力
|
||||
|
||||
int ADVENTURE_CALL_BOSS_CONSUME = 1032; //召唤外敌消耗
|
||||
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.ljsd.jieling.handler.GameGM;
|
|||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.globals.GlobalGm;
|
||||
|
@ -206,7 +205,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
PlayerLogic.getInstance().resetUserName(iSession,prarm3,1,0);
|
||||
break;
|
||||
case GlobalGm.CREATE_INVADE:
|
||||
CombatLogic.getInstance().randomInvasionBoss(iSession.getUid(),prarm1,100,true);
|
||||
CombatLogic.getInstance().callInvasionBoss(iSession,true);
|
||||
break;
|
||||
case GlobalGm.SET_TOWER_NUMBER:
|
||||
MapLogic.getInstance().setTower(iSession.getUid(),prarm1);
|
||||
|
|
|
@ -8,14 +8,14 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AdventureFlushBossHandler extends BaseHandler {
|
||||
public class AdventureCallBossHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ADVENTURE_FLUSH_BOSS_REQUEST;
|
||||
return MessageTypeProto.MessageType.ADVENTURE_CALL_BOSS_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
CombatLogic.getInstance().flushArenaBoss(iSession);
|
||||
CombatLogic.getInstance().callInvasionBoss(iSession,false);
|
||||
}
|
||||
}
|
|
@ -4,15 +4,16 @@ import com.ljsd.common.mogodb.MongoBase;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AdventureStateInfo extends MongoBase {
|
||||
private int position;
|
||||
private int startTime;
|
||||
private int level;
|
||||
private String bossId; // boss唯一标识
|
||||
private int bossGroupId;
|
||||
private int findBossTime;
|
||||
|
||||
private Set<String> bossIds = new HashSet<>();
|
||||
public AdventureStateInfo(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -22,7 +23,7 @@ public class AdventureStateInfo extends MongoBase {
|
|||
this.position = position;
|
||||
this.level=1;
|
||||
this.startTime = now;
|
||||
this.findBossTime = now;
|
||||
bossIds = new HashSet<>();
|
||||
}
|
||||
|
||||
public int getStartTime() {
|
||||
|
@ -33,6 +34,10 @@ public class AdventureStateInfo extends MongoBase {
|
|||
return position;
|
||||
}
|
||||
|
||||
public Set<String> getBossIds() {
|
||||
return bossIds;
|
||||
}
|
||||
|
||||
public void setStartTime(int startTime) {
|
||||
updateString("startTime",startTime);
|
||||
this.startTime = startTime;
|
||||
|
@ -47,31 +52,18 @@ public class AdventureStateInfo extends MongoBase {
|
|||
this.level = level;
|
||||
}
|
||||
|
||||
public int getBossGroupId() {
|
||||
return bossGroupId;
|
||||
public void addBossGroup(String bossId){
|
||||
bossIds.add(bossId);
|
||||
updateString("bossIds",bossIds);
|
||||
}
|
||||
|
||||
public void setBossGroupId(int bossGroupId) {
|
||||
updateString("bossGroupId",bossGroupId);
|
||||
this.bossGroupId = bossGroupId;
|
||||
public void removeBossGroup(String bossId){
|
||||
bossIds.remove(bossId);
|
||||
updateString("bossIds",bossIds);
|
||||
}
|
||||
public void removeMutBossGroup(Set<String> bossIds){
|
||||
bossIds.removeAll(bossIds);
|
||||
updateString("bossIds",bossIds);
|
||||
}
|
||||
|
||||
public int getFindBossTime() {
|
||||
return findBossTime;
|
||||
}
|
||||
|
||||
public void setFindBossTime(int findBossTime) {
|
||||
updateString("findBossTime",findBossTime);
|
||||
this.findBossTime = findBossTime;
|
||||
}
|
||||
|
||||
|
||||
public String getBossId() {
|
||||
return bossId;
|
||||
}
|
||||
|
||||
public void setBossId(String bossId) {
|
||||
updateString("bossId",bossId);
|
||||
this.bossId = bossId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,102 +160,12 @@ public class CombatLogic {
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
FightInfoProto.GetAdventureStateInfoResponse.Builder builder = FightInfoProto.GetAdventureStateInfoResponse.newBuilder();
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
int flushBossNextTime=-1;
|
||||
if(!adventureStateInfoMap.isEmpty()){
|
||||
flushBossNextTime = getFlushBossNextTime(uid, null,builder, adventureStateInfoMap);
|
||||
}
|
||||
FightInfoProto.GetAdventureStateInfoResponse adventureStateInfoResponse = CBean2Proto.getAdventureStateInfoResponse(adventureStateInfoMap);
|
||||
OnlineUserManager.orderAdventureUids.add(uid);
|
||||
builder.setNextBossFlushTime(flushBossNextTime);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_INFO_RESPONSE_VALUE,adventureStateInfoResponse,true);
|
||||
}
|
||||
|
||||
public void flushArenaBoss(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
FightInfoProto.AdventureBossFlushResponse.Builder builder = FightInfoProto.AdventureBossFlushResponse.newBuilder();
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
int flushBossNextTime=-1;
|
||||
if(!adventureStateInfoMap.isEmpty()){
|
||||
flushBossNextTime = getFlushBossNextTime(uid, builder,null, adventureStateInfoMap);
|
||||
}
|
||||
builder.setNextFlushTime(flushBossNextTime);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_FLUSH_BOSS_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
private int getFlushBossNextTime(int uid, FightInfoProto.AdventureBossFlushResponse.Builder flushBuilder, FightInfoProto.GetAdventureStateInfoResponse.Builder getStatebuilder, Map<Integer, AdventureStateInfo> adventureStateInfoMap) throws Exception {
|
||||
long nowMs = TimeUtils.now();
|
||||
int now = (int)(nowMs/1000);
|
||||
int flushBossNextTime = -1;
|
||||
for(AdventureStateInfo adventureStateInfo : adventureStateInfoMap.values()){
|
||||
CommonProto.AdventureStateInfo.Builder builder1 = CommonProto.AdventureStateInfo.newBuilder()
|
||||
.setPositionId(adventureStateInfo.getPosition())
|
||||
.setLevel(adventureStateInfo.getLevel())
|
||||
.setStateTime(now-adventureStateInfo.getStartTime());
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getConfig().get(adventureStateInfo.getPosition());
|
||||
int nextFlushTime = sAdventureConfig.getInvasionBossRefresh();
|
||||
int findBossTime = adventureStateInfo.getFindBossTime();
|
||||
int remainTime =sAdventureConfig.getInvasionBossHolding()-(now - findBossTime);
|
||||
boolean need = false;
|
||||
int randomTimes =0;
|
||||
if(StringUtil.isEmpty(adventureStateInfo.getBossId())){
|
||||
if(now-adventureStateInfo.getStartTime()>nextFlushTime){
|
||||
randomTimes = (now-adventureStateInfo.getStartTime())/nextFlushTime;
|
||||
}else{
|
||||
nextFlushTime = nextFlushTime -(now-adventureStateInfo.getStartTime());
|
||||
}
|
||||
}else{
|
||||
if(remainTime>0){
|
||||
AdventureBoss adventureBoss = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO, "", adventureStateInfo.getBossId(), AdventureBoss.class);
|
||||
need= true;
|
||||
if(adventureBoss == null){
|
||||
randomTimes = 1;
|
||||
remainTime=0;
|
||||
need=false;
|
||||
}
|
||||
|
||||
}else{
|
||||
if(remainTime+nextFlushTime<0){
|
||||
randomTimes = (now-findBossTime-sAdventureConfig.getInvasionBossHolding())/nextFlushTime;
|
||||
remainTime=0;
|
||||
}else{
|
||||
nextFlushTime = remainTime+nextFlushTime;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(randomTimes>0){
|
||||
int bossGroupId = randomInvasionBoss(uid, adventureStateInfo.getPosition(),randomTimes,false);
|
||||
if(bossGroupId>0){
|
||||
remainTime =sAdventureConfig.getInvasionBossHolding()-(now-adventureStateInfo.getFindBossTime());
|
||||
nextFlushTime+=remainTime+nextFlushTime;
|
||||
need=true;
|
||||
}
|
||||
}
|
||||
if(need){
|
||||
CommonProto.AdventureBossSimpleInfo build = CommonProto.AdventureBossSimpleInfo.newBuilder().setArenaId(adventureStateInfo.getPosition())
|
||||
.setBossGroupId(adventureStateInfo.getBossGroupId())
|
||||
.setRemainTime(remainTime)
|
||||
.build();
|
||||
if(flushBuilder!=null){
|
||||
flushBuilder.setAdventureBossSimpleInfo(build);
|
||||
}else{
|
||||
builder1.setAdventureBossSimpleInfo(build);
|
||||
}
|
||||
}
|
||||
if(getStatebuilder!=null){
|
||||
getStatebuilder.addAdventureStateInfoList(builder1);
|
||||
}
|
||||
|
||||
if(flushBossNextTime == -1 || flushBossNextTime>nextFlushTime){
|
||||
flushBossNextTime = nextFlushTime;
|
||||
}
|
||||
}
|
||||
return flushBossNextTime;
|
||||
}
|
||||
|
||||
//挑战首次
|
||||
public void adventureChallenge(ISession iSession,int arenaId,int teamId,int skipFight) throws Exception {
|
||||
|
@ -294,6 +204,11 @@ public class CombatLogic {
|
|||
int fightResult = checkResult[0];
|
||||
if(fightResult == 1){
|
||||
adventureManager.addAdventureStation(new AdventureStateInfo(arenaId));
|
||||
int[][] drop= new int[1][];
|
||||
drop[0] = new int[2];
|
||||
drop[0][0]=SGameSetting.getGameSetting().getAdventureItem();
|
||||
drop[0][1] = 1;
|
||||
ItemUtil.drop(user,drop,BIReason.FIRST_ADVENTURE_REWARD);
|
||||
}
|
||||
FightInfoProto.AdventurnChallengeResponse.Builder builder = FightInfoProto.AdventurnChallengeResponse.newBuilder().setFightResult(fightResult);
|
||||
|
||||
|
@ -304,7 +219,6 @@ public class CombatLogic {
|
|||
.addAllMonsterList(monsterGroupList)
|
||||
.build();
|
||||
builder.setFightData(fightData);
|
||||
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
|
@ -558,26 +472,46 @@ public class CombatLogic {
|
|||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
public int randomInvasionBoss(int uid,int arenaID,int randomTimes,boolean isGm) throws Exception {
|
||||
LOGGER.info("the uid={},the arenaId={},the times={}",uid,arenaID,randomTimes);
|
||||
public void callInvasionBoss(ISession iSession, boolean isGm) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
int arenaID = 0;
|
||||
for(Integer tmpArenaId : adventureStateInfoMap.keySet()){
|
||||
if(arenaID<tmpArenaId){
|
||||
arenaID = tmpArenaId;
|
||||
}
|
||||
}
|
||||
int msgId = MessageTypeProto.MessageType.ADVENTURE_CALL_BOSS_RESPONSE_VALUE;
|
||||
if(arenaID == 0){
|
||||
if(isGm){
|
||||
return ;
|
||||
}
|
||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
||||
return;
|
||||
}
|
||||
int[][] cost= new int[1][];
|
||||
cost[0] = new int[2];
|
||||
cost[0][0]=SGameSetting.getGameSetting().getAdventureItem();
|
||||
cost[0][1] = 1;
|
||||
boolean enough = ItemUtil.itemCost(user, cost, BIReason.ADVENTURE_CALL_BOSS_CONSUME, arenaID);
|
||||
if(!enough){
|
||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"次数不足");
|
||||
return;
|
||||
}
|
||||
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getConfig().get(arenaID);
|
||||
int[][][] invasionBoss = sAdventureConfig.getInvasionBoss();
|
||||
AdventureStateInfo adventureStateInfo = adventureStateInfoMap.get(arenaID);
|
||||
int levle = adventureStateInfo.getLevel();
|
||||
int[][] invasionBossWeightInfo = invasionBoss[levle - 1];
|
||||
int bossGroupID =0;
|
||||
int level = adventureStateInfo.getLevel();
|
||||
int[][] invasionBossWeightInfo = invasionBoss[level - 1];
|
||||
int totalWeight = 0;
|
||||
for(int[] item :invasionBossWeightInfo){
|
||||
totalWeight+=item[1];
|
||||
}
|
||||
int bossGroupID =0;
|
||||
int reallyRandomTimes=randomTimes;
|
||||
if(!isGm && randomTimes>3){
|
||||
reallyRandomTimes=3;
|
||||
}
|
||||
while (reallyRandomTimes-->0 && bossGroupID==0){
|
||||
while (bossGroupID==0){
|
||||
int randomInt = MathUtils.randomInt(totalWeight);
|
||||
for(int[] item :invasionBossWeightInfo){
|
||||
randomInt-=item[1];
|
||||
|
@ -587,36 +521,26 @@ public class CombatLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
int findBossTime = adventureStateInfo.getFindBossTime();
|
||||
int now = (int)(System.currentTimeMillis()/1000);
|
||||
if(isGm || bossGroupID == 0 || findBossTime == 0){
|
||||
|
||||
}else{
|
||||
int nextFindTime = findBossTime + sAdventureConfig.getInvasionBossRefresh() * (randomTimes - reallyRandomTimes);
|
||||
if(nextFindTime>now || (now - nextFindTime) > sAdventureConfig.getInvasionBossHolding() ){
|
||||
|
||||
}else{
|
||||
now=nextFindTime;
|
||||
}
|
||||
String bossId = KeyGenUtils.produceIdByModule(UUIDEnum.ADVENTUREBOSS, user.getId());
|
||||
Map<Integer, List<Integer>> monsterHpByGroup = MonsterUtil.getMonsterHpByGroup(bossGroupID);
|
||||
List<Integer> hps = monsterHpByGroup.get(0);
|
||||
int totalHp = 0;
|
||||
for(Integer hp: hps){
|
||||
totalHp+=hp;
|
||||
}
|
||||
String bossId="";
|
||||
if(bossGroupID != 0){
|
||||
bossId = KeyGenUtils.produceIdByModule(UUIDEnum.ADVENTUREBOSS, user.getId());
|
||||
Map<Integer, List<Integer>> monsterHpByGroup = MonsterUtil.getMonsterHpByGroup(bossGroupID);
|
||||
List<Integer> hps = monsterHpByGroup.get(0);
|
||||
int totalHp = 0;
|
||||
for(Integer hp: hps){
|
||||
totalHp+=hp;
|
||||
}
|
||||
AdventureBoss adventureBoss = new AdventureBoss(bossId,bossGroupID,arenaID,levle,uid,now,totalHp,hps);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId,adventureBoss);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(uid),bossId,0);
|
||||
MessageUtil.sendRedIndication(uid,GlobalsDef.SHARE_BOSS_RED_TYPE);
|
||||
}
|
||||
adventureStateInfo.setBossId(bossId);
|
||||
adventureStateInfo.setBossGroupId(bossGroupID);
|
||||
adventureStateInfo.setFindBossTime(now);
|
||||
return bossGroupID;
|
||||
AdventureBoss adventureBoss = new AdventureBoss(bossId,bossGroupID,arenaID,level,uid,now,totalHp,hps);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId,adventureBoss);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(uid),bossId,0);
|
||||
MessageUtil.sendRedIndication(uid,GlobalsDef.SHARE_BOSS_RED_TYPE);
|
||||
adventureStateInfo.addBossGroup(bossId);
|
||||
int remainTime =sAdventureConfig.getInvasionBossHolding()-(now - adventureBoss.getFindTime());
|
||||
FightInfoProto.AdventureCallBossResponse build = FightInfoProto.AdventureCallBossResponse.newBuilder().setAdventureBossInfo(CommonProto.AdventureBossSimpleInfo.newBuilder()
|
||||
.setArenaId(adventureStateInfo.getPosition())
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setRemainTime(remainTime)
|
||||
.build()).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,build,true);
|
||||
}
|
||||
|
||||
public void leftAdventurePos(ISession session,int type){
|
||||
|
@ -735,7 +659,8 @@ public class CombatLogic {
|
|||
if(adventureBoss.getFindUserId()!=uid){
|
||||
ISession findSession = OnlineUserManager.getSessionByUid(adventureBoss.getFindUserId());
|
||||
if(findSession!=null){
|
||||
MessageUtil.sendIndicationMessage(findSession,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_REFRESH_INDICATION_VALUE,null,true);
|
||||
FightInfoProto.AdventureBossKillIndication bossKilled = FightInfoProto.AdventureBossKillIndication.newBuilder().setBossId(adventureBoss.getBossId()).setPos(adventureBoss.getArenaId()).build();
|
||||
MessageUtil.sendIndicationMessage(findSession,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_KILL_INDICATION_VALUE,bossKilled,true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.jieling.config.SAdventureConfig;
|
||||
import com.ljsd.jieling.config.SGameSetting;
|
||||
import com.ljsd.jieling.config.SMonsterConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.Cell;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
|
@ -11,10 +14,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.ChatProto;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -401,4 +401,43 @@ public class CBean2Proto {
|
|||
.setName(user.getPlayerInfoManager().getNickName())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static FightInfoProto.GetAdventureStateInfoResponse getAdventureStateInfoResponse(Map<Integer, AdventureStateInfo> adventureStateInfoMap){
|
||||
FightInfoProto.GetAdventureStateInfoResponse.Builder builder = FightInfoProto.GetAdventureStateInfoResponse.newBuilder();
|
||||
long nowMs = TimeUtils.now();
|
||||
int now = (int)(nowMs/1000);
|
||||
for(AdventureStateInfo adventureStateInfo : adventureStateInfoMap.values()){
|
||||
CommonProto.AdventureStateInfo.Builder builder1 = CommonProto.AdventureStateInfo.newBuilder()
|
||||
.setPositionId(adventureStateInfo.getPosition())
|
||||
.setLevel(adventureStateInfo.getLevel())
|
||||
.setStateTime(now-adventureStateInfo.getStartTime());
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getConfig().get(adventureStateInfo.getPosition());
|
||||
Set<String> bossIds = adventureStateInfo.getBossIds();
|
||||
Set<String> removeCache = new HashSet<>();
|
||||
for(String bossId : bossIds){
|
||||
AdventureBoss adventureBoss = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO, "", bossId, AdventureBoss.class);
|
||||
if(adventureBoss != null){
|
||||
int findBossTime = adventureBoss.getFindTime();
|
||||
int remainTime =sAdventureConfig.getInvasionBossHolding()-(now - findBossTime);
|
||||
if(remainTime>0){
|
||||
builder1.addAdventureBossSimpleInfo(
|
||||
CommonProto.AdventureBossSimpleInfo.newBuilder().setArenaId(adventureStateInfo.getPosition())
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setRemainTime(remainTime)
|
||||
.build()
|
||||
);
|
||||
}else{
|
||||
removeCache.add(bossId);
|
||||
}
|
||||
}else{
|
||||
removeCache.add(bossId);
|
||||
}
|
||||
}
|
||||
if(!removeCache.isEmpty()){
|
||||
adventureStateInfo.removeMutBossGroup(removeCache);
|
||||
}
|
||||
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -631,37 +631,7 @@ public class ItemUtil {
|
|||
}
|
||||
List<CommonProto.Item> sendToFront = new ArrayList<>();
|
||||
List<CommonProto.Item> sendTemToFront = new ArrayList<>();
|
||||
int now = (int)(System.currentTimeMillis()/1000);
|
||||
for (Map.Entry<Integer, Integer> userItem : useItemMap.entrySet()) {
|
||||
int limit =0;
|
||||
if ((userItem.getKey() == Global.STAMINA)){
|
||||
Item item = user.getItemManager().getItemMap().get(Global.STAMINA);
|
||||
int itemNum = item.getItemNum();
|
||||
if(itemNum>=user.getPlayerInfoManager().getMaxStamina()){
|
||||
limit = user.getPlayerInfoManager().getMaxStamina();
|
||||
}else{
|
||||
MapManager.getEnergy(user);
|
||||
}
|
||||
}
|
||||
if (userItem.getKey() == Global.HEROSTORY_TICKET || userItem.getKey() == Global.INVASIONBOSS_TICKET ){
|
||||
Item item = user.getItemManager().getItemMap().get(userItem.getKey());
|
||||
int itemNum = 0;
|
||||
if(item!=null){
|
||||
itemNum = item.getItemNum();
|
||||
}
|
||||
int maxTimes = SGameSetting.getGameSetting().getHeroTimes();
|
||||
if(userItem.getKey() == Global.INVASIONBOSS_TICKET){
|
||||
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(user.getPlayerInfoManager().getVipLevel());
|
||||
Map<Integer, Integer> privilegeMap = sVipLevelConfig.getPrivilegeMap();
|
||||
maxTimes = privilegeMap.get(VipPrivilegeType.CHALLENGE_INVASIONBOSS_LIMIT);
|
||||
}
|
||||
if(itemNum>=maxTimes){
|
||||
limit = user.getPlayerInfoManager().getMaxStamina();
|
||||
}else{
|
||||
MapManager.getTimesRecoveryTicket(user,userItem.getKey());
|
||||
}
|
||||
|
||||
}
|
||||
Item temporaryItem = temporaryItemList.get(userItem.getKey());
|
||||
int needCount = userItem.getValue();
|
||||
if (temporaryItem != null) {
|
||||
|
@ -691,9 +661,6 @@ public class ItemUtil {
|
|||
KtEventUtils.onKtEvent(user, eventType,reason,GlobalsDef.subReason,myItem.getItemId(),needCount,0);
|
||||
} else {
|
||||
myItem.setItemNum(myItem.getItemNum() - needCount);
|
||||
if(myItem.getItemNum()<limit){
|
||||
myItem.setEndingTime(now);
|
||||
}
|
||||
KtEventUtils.onKtEvent(user, eventType,reason,GlobalsDef.subReason,myItem.getItemId(),needCount,myItem.getItemNum());
|
||||
}
|
||||
sendToFront.add(CBean2Proto.getItem(myItem,-1));
|
||||
|
|
Loading…
Reference in New Issue