Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
21b79fcf03
|
@ -103,6 +103,8 @@ public class RedisKey {
|
|||
|
||||
public static final String ADVENTRUEN_BOSS_RANK = "ADVENTRUEN_BOSS_RANK";
|
||||
|
||||
public static final String ADVENTRUEN_BOSS_HURT_DETAIL = "ADVENTRUEN_BOSS_HURT_DETAIL";
|
||||
|
||||
public static final String ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY = "ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY";
|
||||
|
||||
public static final String CHAT_WORD_MSG_ID = ":ChatWordMsgId:";
|
||||
|
|
|
@ -990,6 +990,18 @@ public class RedisUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public void increntMapEntryValue(String type, String key,String mapKey,int increntValue){
|
||||
String rkey = getKey(type, key);
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
redisTemplate.opsForHash().increment(rkey,mapKey,increntValue);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
TimeUtils.sleep(FAILED_SLEEP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getKey(String type,String key){
|
||||
|
|
|
@ -2299,8 +2299,7 @@ public class MapLogic {
|
|||
|
||||
public void getMainLevelInfo(ISession session) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MainLevelManager mainLevelManager = user.getMainLevelManager();
|
||||
PlayerInfoProto.GetMainLevelInfoResponse mainLevelInfoResponse = CBean2Proto.getMainLevelInfoResponse(mainLevelManager);
|
||||
PlayerInfoProto.GetMainLevelInfoResponse mainLevelInfoResponse = CBean2Proto.getMainLevelInfoResponse(user);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_RESPONSE_VALUE,mainLevelInfoResponse,true);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ import config.SPlayerLevelConfig;
|
|||
import manager.STableManager;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -83,7 +85,9 @@ public class UserManager {
|
|||
HeroManager heroManager = user.getHeroManager();
|
||||
Map<String, Hero> heroMap = heroManager.getHeroMap();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
teamPosManager.addTeamOfInitPlayer(heroMap.values());
|
||||
List<Hero> teamHeros = new ArrayList<>(1);
|
||||
teamHeros.add(heroMap.values().iterator().next());
|
||||
teamPosManager.addTeamOfInitPlayer(teamHeros);
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, 1, true);
|
||||
playerManager.setMaxForce(force);
|
||||
PlayerLogic.getInstance().vipflushEveryDay(user,null);
|
||||
|
|
|
@ -409,6 +409,9 @@ public class CombatLogic {
|
|||
if(!removeAdventureBosseInfo.isEmpty()){
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",removeAdventureBosseInfo.toArray());
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_OWN,"",removeAdventureBosseInfo.toArray());
|
||||
for(String removeId : removeAdventureBosseInfo){
|
||||
afterBossKilledClean(removeId);
|
||||
}
|
||||
}
|
||||
if(builder!=null){
|
||||
user.getPlayerInfoManager().removeRed(GlobalsDef.SHARE_BOSS_RED_TYPE);
|
||||
|
@ -470,41 +473,63 @@ public class CombatLogic {
|
|||
MessageUtil.sendRedIndication(uid,GlobalsDef.SHARE_BOSS_RED_TYPE);
|
||||
mainLevelManager.addBossGroup(bossId);
|
||||
int remainTime =sMainLevelConfig.getInvasionBossHolding()-(now - adventureBoss.getFindTime());
|
||||
FightInfoProto.AdventureCallBossResponse build = FightInfoProto.AdventureCallBossResponse.newBuilder().setAdventureBossInfo(CommonProto.AdventureBossSimpleInfo.newBuilder()
|
||||
.setArenaId(fightId)
|
||||
FightInfoProto.AdventureCallBossResponse build = FightInfoProto.AdventureCallBossResponse.newBuilder().setAdventureBossInfo( CommonProto.AdventureBossInfo.newBuilder()
|
||||
.setArenaId(adventureBoss.getArenaId())
|
||||
.setFindUid(adventureBoss.getFindUserId())
|
||||
.setFindName(user.getPlayerInfoManager().getNickName())
|
||||
.setBossId(adventureBoss.getBossId())
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setLevelTime(remainTime+now)
|
||||
.setBossId(bossId)
|
||||
.build()).build();
|
||||
.setLevelTime(remainTime + now)
|
||||
.setTotalHp(adventureBoss.getTotalHp())
|
||||
.setArenaLevel(adventureBoss.getArenaLevel())
|
||||
.setBossRemainlHp(adventureBoss.getRemainHp())
|
||||
.setMyHurt(0)
|
||||
).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,build,true);
|
||||
}
|
||||
|
||||
public void broadAdventureBoss(AdventureBoss adventureBoss,String findUserName,List<Integer> friends,int findUid){
|
||||
int arenaId = adventureBoss.getArenaId();
|
||||
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(arenaId);
|
||||
CommonProto.AdventureBossSimpleInfo build = CommonProto.AdventureBossSimpleInfo.newBuilder()
|
||||
.setArenaId(arenaId)
|
||||
int findBossTime = adventureBoss.getFindTime();
|
||||
int now = (int)(TimeUtils.now()/1000);
|
||||
int remainTime =sMainLevelConfig.getInvasionBossHolding()-(now - findBossTime);
|
||||
Map<Integer, Integer> bossHurtInfo = RedisUtil.getInstence().getMapValues(RedisKey.ADVENTRUEN_BOSS_HURT_DETAIL, adventureBoss.getBossId(), Integer.class, Integer.class);
|
||||
CommonProto.AdventureBossInfo.Builder builder = CommonProto.AdventureBossInfo.newBuilder()
|
||||
.setArenaId(adventureBoss.getArenaId())
|
||||
.setFindUid(adventureBoss.getFindUserId())
|
||||
.setFindName(findUserName)
|
||||
.setBossId(adventureBoss.getBossId())
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setLevelTime(sMainLevelConfig.getInvasionBossHolding() + (int)(TimeUtils.now()/1000))
|
||||
.setFindUserName(findUserName)
|
||||
.build();
|
||||
FightInfoProto.AdventureBossFindIndication adventureBossFindIndication = FightInfoProto.AdventureBossFindIndication.newBuilder().setAdventureBossSimpleInfo(build).build();
|
||||
.setLevelTime(remainTime + now)
|
||||
.setTotalHp(adventureBoss.getTotalHp())
|
||||
.setArenaLevel(adventureBoss.getArenaLevel())
|
||||
.setBossRemainlHp(adventureBoss.getRemainHp());
|
||||
|
||||
boolean isMine = false;
|
||||
for(Integer uid:friends){
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(uid);
|
||||
if(uid == findUid){
|
||||
isMine = true;
|
||||
}
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(uid);
|
||||
if(sessionByUid!=null){
|
||||
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_FIND_INDICATION_VALUE,adventureBossFindIndication,true);
|
||||
Integer hurt = bossHurtInfo.get(uid);
|
||||
if(hurt == null){
|
||||
hurt =0;
|
||||
}
|
||||
FightInfoProto.AdventureBossFindIndication build = FightInfoProto.AdventureBossFindIndication.newBuilder().setAdventureBossInfo(builder.setMyHurt(hurt)).build();
|
||||
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_FIND_INDICATION_VALUE,build,true);
|
||||
}
|
||||
}
|
||||
if(!isMine){
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(findUid);
|
||||
if(sessionByUid!=null){
|
||||
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_FIND_INDICATION_VALUE,adventureBossFindIndication,true);
|
||||
Integer hurt = bossHurtInfo.get(findUid);
|
||||
if(hurt == null){
|
||||
hurt =0;
|
||||
}
|
||||
FightInfoProto.AdventureBossFindIndication build = FightInfoProto.AdventureBossFindIndication.newBuilder().setAdventureBossInfo(builder.setMyHurt(hurt)).build();
|
||||
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_FIND_INDICATION_VALUE,build,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -593,7 +618,7 @@ public class CombatLogic {
|
|||
String killReward = sendRewardOfBossKilled(adventureBoss.getFindUserId(), uid, bossGroupId, adventureBoss.getArenaId(), adventureBoss.getArenaLevel());
|
||||
builder.setKillRewards(killReward);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.KILLINVASIONBOSS);
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId);
|
||||
afterBossKilledClean(bossId);
|
||||
int findUserId = adventureBoss.getFindUserId();
|
||||
User findUser = UserManager.getUser(findUserId);
|
||||
List<Integer> friends = findUser.getFriendManager().getFriends();
|
||||
|
@ -627,6 +652,7 @@ public class CombatLogic {
|
|||
costs[0] =new int[]{Global.INVASIONBOSS_TICKET,i};
|
||||
ItemUtil.itemCost(user, costs, BIReason.CHALLENGE_INVASIONBOSS_CONSUME, i);
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.ADVENTRUEN_BOSS_RANK,"",Integer.toString(uid),totalHurt);
|
||||
RedisUtil.getInstence().increntMapEntryValue(RedisKey.ADVENTRUEN_BOSS_HURT_DETAIL,bossId,Integer.toString(uid),totalHurt);
|
||||
FightInfoProto.AdventurenBossChallengeResponse build = builder.setHurtNums(totalHurt)
|
||||
.setFightResult(fightResult)
|
||||
.setConsumeFightTimes(i)
|
||||
|
@ -644,6 +670,12 @@ public class CombatLogic {
|
|||
|
||||
}
|
||||
|
||||
public void afterBossKilledClean(String bossId){
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId);
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.ADVENTRUEN_BOSS_HURT_DETAIL, bossId);
|
||||
RedisUtil.getInstence().del(key);
|
||||
}
|
||||
|
||||
private String sendRewardOfBossKilled(int findUserId,int killUid,int killBossGroupId, int arenaId,int arenaLevel) throws Exception {
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(killBossGroupId);
|
||||
int[] killReward = sMonsterGroup.getRewardgroup();
|
||||
|
|
|
@ -389,13 +389,13 @@ public class PlayerLogic {
|
|||
time = goodsInfo.getValue();
|
||||
}
|
||||
days = TimeUtils.differentDays(lastSendTime * 1000L,time * 1000L);
|
||||
if(days == 0){
|
||||
if(days <= 0){
|
||||
continue;
|
||||
}
|
||||
if(days == sRechargeCommodityConfig.getContiueDays()){
|
||||
remainDays = TimeUtils.differentDays(nowTime * 1000L, goodsInfo.getValue()*1000L)-1;
|
||||
if(remainDays<0){
|
||||
days-=1;
|
||||
}
|
||||
remainDays = TimeUtils.differentDays(nowTime * 1000L, goodsInfo.getValue()*1000L)-1;
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -456,9 +456,10 @@ public class CBean2Proto {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static PlayerInfoProto.GetMainLevelInfoResponse getMainLevelInfoResponse( MainLevelManager mainLevelManager){
|
||||
public static PlayerInfoProto.GetMainLevelInfoResponse getMainLevelInfoResponse( User user ){
|
||||
long nowMs = TimeUtils.now();
|
||||
int now = (int)(nowMs/1000);
|
||||
MainLevelManager mainLevelManager = user.getMainLevelManager();
|
||||
int state = mainLevelManager.getState();
|
||||
int duration = (int)(System.currentTimeMillis()/1000) - mainLevelManager.getStartTime();
|
||||
PlayerInfoProto.GetMainLevelInfoResponse.Builder builder = PlayerInfoProto.GetMainLevelInfoResponse.newBuilder()
|
||||
|
@ -468,8 +469,11 @@ public class CBean2Proto {
|
|||
|
||||
Map<Integer, HashSet<String>> bossIds = mainLevelManager.getBossIds();
|
||||
boolean update =false;
|
||||
Map<String, Integer> myHurtInfo = new HashMap<>(1);
|
||||
if(!bossIds.isEmpty()){
|
||||
myHurtInfo=RedisUtil.getInstence().getMapValues(RedisKey.ADVENTRUEN_BOSS_OWN, Integer.toString(user.getId()), String.class, Integer.class);
|
||||
}
|
||||
for(Map.Entry<Integer, HashSet<String>> item : bossIds.entrySet()){
|
||||
Integer fightId = item.getKey();
|
||||
Set<String> value = item.getValue();
|
||||
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(mainLevelManager.getFightId());
|
||||
Set<String> removeCache = new HashSet<>();
|
||||
|
@ -479,12 +483,17 @@ public class CBean2Proto {
|
|||
int findBossTime = adventureBoss.getFindTime();
|
||||
int remainTime =sMainLevelConfig.getInvasionBossHolding()-(now - findBossTime);
|
||||
if(remainTime>0){
|
||||
builder.addAdventureBossSimpleInfo(
|
||||
CommonProto.AdventureBossSimpleInfo.newBuilder()
|
||||
.setArenaId(fightId)
|
||||
builder.addAdventureBossInfo(CommonProto.AdventureBossInfo.newBuilder()
|
||||
.setArenaId(adventureBoss.getArenaId())
|
||||
.setFindUid(adventureBoss.getFindUserId())
|
||||
.setFindName(user.getPlayerInfoManager().getNickName())
|
||||
.setBossId(bossId)
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setMyHurt(myHurtInfo.get(bossId))
|
||||
.setLevelTime(remainTime+now)
|
||||
.setBossId(adventureBoss.getBossId())
|
||||
.setTotalHp(adventureBoss.getTotalHp())
|
||||
.setArenaLevel(adventureBoss.getArenaLevel())
|
||||
.setBossRemainlHp(adventureBoss.getRemainHp())
|
||||
.build()
|
||||
);
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue