red indition & recharge
parent
f3bcc3c516
commit
4cd3f99c1c
|
@ -155,18 +155,18 @@ function BattleMain.Execute(args, fightData, optionData)
|
|||
--print("最终运行帧数:"..BattleLogic.CurFrame())
|
||||
--print("result:"..BattleLogic.Result)
|
||||
|
||||
--local time = string.format("%d-%d-%d-%d-%d-%d",
|
||||
-- os.date("%Y"),
|
||||
-- os.date("%m"),
|
||||
-- os.date("%d"),
|
||||
-- os.date("%H"),
|
||||
-- os.date("%M"),
|
||||
-- os.date("%S"))
|
||||
--local file = io.open("luafight/BattleRecord/record_"..time..".txt", "a")
|
||||
--file:write("fightData:\n"..PrintTable(_fightData).."\n")
|
||||
--file:write("optionData:\n"..PrintTable(_optionData).."\n")
|
||||
--file:write("seed:\n"..args.seed.."\n")
|
||||
--io.close(file)
|
||||
local time = string.format("%d-%d-%d-%d-%d-%d",
|
||||
os.date("%Y"),
|
||||
os.date("%m"),
|
||||
os.date("%d"),
|
||||
os.date("%H"),
|
||||
os.date("%M"),
|
||||
os.date("%S"))
|
||||
local file = io.open("../luafight/BattleRecord//record_"..time..".txt", "a")
|
||||
file:write("fightData:\n"..PrintTable(_fightData).."\n")
|
||||
file:write("optionData:\n"..PrintTable(_optionData).."\n")
|
||||
file:write("seed:\n"..args.seed.."\n")
|
||||
io.close(file)
|
||||
|
||||
return resultList
|
||||
end
|
||||
|
|
|
@ -3,6 +3,10 @@ package com.ljsd.jieling.core;
|
|||
public interface GlobalsDef {
|
||||
String DEFAULT_NAME = "无名妖灵师";
|
||||
|
||||
int MAIL_RED_TYPE = 1; // 邮件红点红点
|
||||
int SHARE_BOSS_RED_TYPE =2; // 分享外敌boss红点
|
||||
int ARENA_CHALLENGE_TYPE =3;// 竞技场防守记录红点
|
||||
|
||||
int addReason = 0;
|
||||
int subReason = 1;
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ public class RedisKey {
|
|||
|
||||
public static final String ADVENTRUEN_BOSS_RANK = "ADVENTRUEN_BOSS_RANK";
|
||||
|
||||
public static final String ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY = "ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY";
|
||||
|
||||
public static final String CHAT_WORD_MSG_ID = ":ChatWordMsgId:";
|
||||
|
||||
public static final String CHAT_SYS_MSG_ID = ":ChatSysMsgId:";
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.db.redis;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.common.mogodb.util.GlobalData;
|
||||
import com.ljsd.jieling.logic.dao.ArenaRecord;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -9,10 +10,13 @@ import com.ljsd.jieling.util.TimeUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.ReturnType;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import redis.clients.jedis.Protocol;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -939,6 +943,69 @@ public class RedisUtil {
|
|||
}
|
||||
|
||||
|
||||
private static final String LOCK_SUCCESS = "OK";
|
||||
private static final byte[] SET_IF_NOT_EXIST = "NX".getBytes();
|
||||
private static final byte[] SET_WITH_EXPIRE_TIME = "PX".getBytes();
|
||||
|
||||
//requestId:设置为值,用于解锁时,判断您是否是加锁者解锁
|
||||
//expireTime:过期时间,依据请求的处理时间,不应该大于1秒,建议设置为500毫秒
|
||||
public boolean tryGetDistributedLock(String type, String key, String requestId, int expireTime) {
|
||||
String rkey = getKey(type, key);
|
||||
RedisConnection connection = null;
|
||||
try {
|
||||
connection = redisTemplate.getConnectionFactory().getConnection();
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
Object result = connection.execute("SET",
|
||||
rkey.getBytes(), requestId.getBytes(), SET_IF_NOT_EXIST,
|
||||
SET_WITH_EXPIRE_TIME, Protocol.toByteArray(expireTime));
|
||||
if (result == null) {
|
||||
TimeUtils.sleep(100); //不能获取锁,延时100毫秒
|
||||
continue;
|
||||
}
|
||||
String strResult = new String((byte[]) result);
|
||||
if (strResult.equals(LOCK_SUCCESS)) {
|
||||
return true;
|
||||
}
|
||||
TimeUtils.sleep(200); //不能获取锁,延时100毫秒
|
||||
} catch (Exception e){
|
||||
LOGGER.error("tryGetDistributedLock->uid={},i={},rkey={},emsg={}",
|
||||
GlobalData.getLocalUserId(), i, rkey, e.getMessage(), e);
|
||||
TimeUtils.sleep(FAILED_SLEEP);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}finally {
|
||||
if(connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final static String UNLOCK_SCRIPT = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
|
||||
//requestId:加锁者,才能解锁
|
||||
public boolean releaseDistributedLock(String type, String key, String requestId) {
|
||||
String rkey = getKey(type, key);
|
||||
RedisConnection connection = null;
|
||||
try {
|
||||
connection = redisTemplate.getConnectionFactory().getConnection();
|
||||
Long result = connection.eval(UNLOCK_SCRIPT.getBytes(), ReturnType.INTEGER, 1, rkey.getBytes(), requestId.getBytes());
|
||||
if(result == null){
|
||||
return false;
|
||||
}
|
||||
if(result == 1){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
if(connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class LoginRequestHandler extends BaseHandler {
|
|||
loginRequest.getDpiS(),
|
||||
loginRequest.getOperatorS(),
|
||||
loginRequest.getOsVersionS(),
|
||||
LoginParamType.NETWORK_WIFI.equals(loginRequest.getNetworkS())?true:false);
|
||||
LoginParamType.NETWORK_WIFI.equals(loginRequest.getNetworkS()));
|
||||
switch (loginRequest.getPlatformS()){
|
||||
case LoginParamType.PLATFORM_ANDRIOD:
|
||||
paramEnvironmentSimpleBean.setIdfa_s(loginRequest.getIdfaSOrImeiS());
|
||||
|
|
|
@ -158,12 +158,16 @@ public class ArenaLogic {
|
|||
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(uid)).intValue();
|
||||
}
|
||||
|
||||
setMyArenaEnemys(uid,user);
|
||||
|
||||
ArenaInfoProto.ArenaChallengeResponse.Builder builder = ArenaInfoProto.ArenaChallengeResponse.newBuilder();
|
||||
if( enemyType == GlobalsDef.ARENA_PLAYER_TYPE){
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
User defUser = UserManager.getUser(challengeUid);
|
||||
fightResult = getFightResultByPersonToPerson(user, teamId, defUser, GlobalsDef.TEAM_ARENA_DEFENSE,arenaRecord,skipFight,builder);
|
||||
if(fightResult == -1){
|
||||
MessageUtil.sendErrorResponse(session, 0, MessageTypeProto.MessageType.ARENA_CHALLENGE_RESPONSE_VALUE, "战斗异常!");
|
||||
return;
|
||||
}
|
||||
defScore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(challengeUid)).intValue();
|
||||
defScoreChange = calScore(defScore, myscore,fightResult==1?0:1);
|
||||
myscoreChange = calScore(myscore, defScore,fightResult);
|
||||
|
@ -174,9 +178,14 @@ public class ArenaLogic {
|
|||
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,uid));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ARENA_RRECORD,Integer.toString(challengeUid),arenaRecord.getId(),arenaRecord);
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(challengeUid),defScoreChange);
|
||||
MessageUtil.sendRedIndication(challengeUid,GlobalsDef.ARENA_CHALLENGE_TYPE);
|
||||
}else{
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(challengeUid);
|
||||
fightResult = getFightResultByPersonToRobot(user, teamId,sArenaRobotConfig,skipFight,builder);
|
||||
if(fightResult == -1){
|
||||
MessageUtil.sendErrorResponse(session, 0, MessageTypeProto.MessageType.ARENA_CHALLENGE_RESPONSE_VALUE, "战斗异常!");
|
||||
return;
|
||||
}
|
||||
myscoreChange = calScore(myscore, defScore,fightResult);
|
||||
defScoreChange = calScore(defScore, myscore,fightResult==1?0:1);
|
||||
|
||||
|
@ -186,6 +195,7 @@ public class ArenaLogic {
|
|||
}else{
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(uid),myscoreChange);
|
||||
}
|
||||
setMyArenaEnemys(uid,user);
|
||||
arenaManager.updateChallenge(fightResult);
|
||||
//组战斗数据
|
||||
ArenaInfoProto.ArenaChallengeResponse build = builder.setMyScoreChange(myscoreChange).setDefScoreChange(defScoreChange).addAllArenaEnemys(getArenaEnemyList(arenaManager.getArenaEnemies())).build();
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.luaj.vm2.LuaValue;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import sun.misc.MessageUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -615,7 +616,6 @@ public class CombatLogic {
|
|||
if(sessionByUid!=null){
|
||||
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_FIND_INDICATION_VALUE,adventureBossFindIndication,true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -630,6 +630,7 @@ public class CombatLogic {
|
|||
List<Integer> friends = user.getFriendManager().getFriends();
|
||||
for(Integer friendId :friends){
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(friendId),bossId,0);
|
||||
MessageUtil.sendRedIndication(friendId, GlobalsDef.SHARE_BOSS_RED_TYPE);
|
||||
}
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
|
@ -639,98 +640,114 @@ public class CombatLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
SGameSetting sGameSetting = SGameSetting.getGameSetting();
|
||||
int invasionBossPrivilege = sGameSetting.getInvasionBossPrivilege();
|
||||
if(fightTimes<=0){
|
||||
if(fightTimes<=0 || StringUtil.isEmpty(bossId)){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
int [] a= new int[]{1,1};
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
int[][] costs = new int[1][];
|
||||
costs[0] =new int[]{SGameSetting.getGameSetting().getInvasionBossItem(),fightTimes};
|
||||
boolean enough = ItemUtil.itemCost(user, costs, BIReason.CHALLENGE_INVASIONBOSS_CONSUME, fightTimes);
|
||||
if(!enough){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"道具不足");
|
||||
return;
|
||||
}
|
||||
if(fightTimes==1 && skipFight==0){
|
||||
boolean allowed = user.getPlayerInfoManager().checkFunctionIsAllowed(VipPrivilegeType.UNLOCK_SKIP_FIGHT);
|
||||
boolean allowed =playerInfoManager.checkFunctionIsAllowed(VipPrivilegeType.UNLOCK_SKIP_FIGHT);
|
||||
if(!allowed){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"not allowed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
AdventureBoss adventureBoss = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO, "", bossId, AdventureBoss.class);
|
||||
if(adventureBoss == null){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"外敌已被击杀");
|
||||
|
||||
boolean check = playerInfoManager.check(invasionBossPrivilege, fightTimes);
|
||||
if(!check){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"over limit");
|
||||
return;
|
||||
}
|
||||
int bossGroupId = adventureBoss.getBossGroupId();
|
||||
Map<Integer,List<Integer>> hps = new HashMap<>(1);
|
||||
hps.put(0,adventureBoss.getRemainHps());
|
||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, teamId,true);
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
|
||||
//设置战斗随机种子
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
||||
FightInfoProto.AdventurenBossChallengeResponse.Builder builder = FightInfoProto.AdventurenBossChallengeResponse.newBuilder();
|
||||
if(fightTimes == 1 && skipFight == 0){
|
||||
CommonProto.FightData build = CommonProto.FightData.newBuilder()
|
||||
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
||||
.setFightSeed(seed)
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addAllMonsterList(monsterGroupList)
|
||||
.build();
|
||||
builder.setFightData(build);
|
||||
boolean isSuccess = RedisUtil.getInstence().tryGetDistributedLock(RedisKey.ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY, bossId, Integer.toString(uid), -1);
|
||||
if(isSuccess){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"激烈战斗中,请稍候重试");
|
||||
return;
|
||||
}
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getConfig().get(adventureBoss.getArenaId());
|
||||
int totalHurt=0;
|
||||
int fightResult=0;
|
||||
int i=0;
|
||||
for(;i<fightTimes;i++){
|
||||
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, sAdventureConfig.getInvasionBossTime(), getFightData, getOptionData);
|
||||
totalHurt+= updateBossAndGetHurtForFight(checkResult, adventureBoss);
|
||||
fightResult = checkResult[0];
|
||||
//发送击杀boss奖励和发现者奖励
|
||||
if(fightResult == 1){
|
||||
i = i+1;
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
try {
|
||||
AdventureBoss adventureBoss = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO, "", bossId, AdventureBoss.class);
|
||||
if(adventureBoss == null){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"外敌已被击杀");
|
||||
return;
|
||||
}
|
||||
int[][] costs = new int[1][];
|
||||
costs[0] =new int[]{SGameSetting.getGameSetting().getInvasionBossItem(),fightTimes};
|
||||
boolean enough = ItemUtil.itemCost(user, costs, BIReason.CHALLENGE_INVASIONBOSS_CONSUME, fightTimes);
|
||||
if(!enough){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,"道具不足");
|
||||
return;
|
||||
}
|
||||
int bossGroupId = adventureBoss.getBossGroupId();
|
||||
Map<Integer,List<Integer>> hps = new HashMap<>(1);
|
||||
hps.put(0,adventureBoss.getRemainHps());
|
||||
monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
||||
monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, teamId,true);
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
|
||||
//设置战斗随机种子
|
||||
seed = (int)(System.currentTimeMillis()/1000);
|
||||
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
}
|
||||
if(fightResult==0){
|
||||
Integer hurt = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN, Integer.toString(uid), bossId, Integer.class);
|
||||
if(hurt !=null){
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(uid),bossId,totalHurt+hurt);
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
||||
FightInfoProto.AdventurenBossChallengeResponse.Builder builder = FightInfoProto.AdventurenBossChallengeResponse.newBuilder();
|
||||
if(fightTimes == 1 && skipFight == 0){
|
||||
CommonProto.FightData build = CommonProto.FightData.newBuilder()
|
||||
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
||||
.setFightSeed(seed)
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addAllMonsterList(monsterGroupList)
|
||||
.build();
|
||||
builder.setFightData(build);
|
||||
}
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId,adventureBoss);
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getConfig().get(adventureBoss.getArenaId());
|
||||
int totalHurt=0;
|
||||
int fightResult=0;
|
||||
int i=0;
|
||||
for(;i<fightTimes;i++){
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, sAdventureConfig.getInvasionBossTime(), getFightData, getOptionData);
|
||||
totalHurt+= updateBossAndGetHurtForFight(checkResult, adventureBoss);
|
||||
fightResult = checkResult[0];
|
||||
//发送击杀boss奖励和发现者奖励
|
||||
if(fightResult == 1){
|
||||
i = i+1;
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
hps.put(0,adventureBoss.getRemainHps());
|
||||
monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
||||
monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
|
||||
//设置战斗随机种子
|
||||
seed = (int)(System.currentTimeMillis()/1000);
|
||||
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
}
|
||||
if(fightResult==0){
|
||||
Integer hurt = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN, Integer.toString(uid), bossId, Integer.class);
|
||||
if(hurt !=null){
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(uid),bossId,totalHurt+hurt);
|
||||
}
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId,adventureBoss);
|
||||
}
|
||||
playerInfoManager.updateVipPrivilage(invasionBossPrivilege,i);
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.ADVENTRUEN_BOSS_RANK,"",Integer.toString(uid),totalHurt);
|
||||
FightInfoProto.AdventurenBossChallengeResponse build = builder.setHurtNums(totalHurt)
|
||||
.setFightResult(fightResult)
|
||||
.setConsumeFightTimes(i)
|
||||
.setBossTotalHp(adventureBoss.getTotalHp())
|
||||
.setBossRemainHp(adventureBoss.getRemainHp())
|
||||
.build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,build,true);
|
||||
}catch (Exception e){
|
||||
LOGGER.error("the exception={}",e);
|
||||
}finally {
|
||||
RedisUtil.getInstence().releaseDistributedLock(RedisKey.ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY,bossId, Integer.toString(uid));
|
||||
}
|
||||
playerInfoManager.updateVipPrivilage(invasionBossPrivilege,i);
|
||||
|
||||
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.ADVENTRUEN_BOSS_RANK,"",Integer.toString(uid),totalHurt);
|
||||
FightInfoProto.AdventurenBossChallengeResponse build = builder.setHurtNums(totalHurt)
|
||||
.setFightResult(fightResult)
|
||||
.setConsumeFightTimes(i)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
private String sendRewardOfBossKilled(int findUserId,int killUid,int killBossGroupId, int arenaId,int arenaLevel) throws Exception {
|
||||
|
|
|
@ -794,7 +794,7 @@ public class HeroLogic {
|
|||
}
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(templatePropetyId);
|
||||
if(sPropertyConfig.getIfFormula() == 1){
|
||||
sb.append(propertyValue*0.1/(hero.getLevel()+10)/100).append(DIVISION);
|
||||
sb.append(propertyValue/(hero.getLevel()+10)/100).append(DIVISION);
|
||||
}else{
|
||||
if(sPropertyConfig.getStyle() == GlobalsDef.PERCENT_TYPE){
|
||||
sb.append(propertyValue/10000f).append(DIVISION);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.mail;
|
||||
|
||||
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;
|
||||
|
@ -260,11 +261,6 @@ public class MailLogic {
|
|||
Mail mail = new Mail(uid,title,content,reward,sendTime, mailEffectiveTime,"system",Global.MAIL_TYPE_SYS);
|
||||
user.getMailManager().addMail(mail);
|
||||
LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
ISession session = OnlineUserManager.sessionMap.get(uid);
|
||||
if(session!=null){
|
||||
PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(1).build();
|
||||
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.SEND_RED_POINT_INDICATION_VALUE,redPointInfo,true);
|
||||
}
|
||||
|
||||
MessageUtil.sendRedIndication(uid, GlobalsDef.MAIL_RED_TYPE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,10 +137,12 @@ public class BuyGoodsLogic {
|
|||
rewardStr = ItemUtil.getMailReward(baseReward);
|
||||
}
|
||||
|
||||
int saveAmt = rechargeInfo.getSaveAmt();
|
||||
if(sRechargeCommodityConfig.getAccumulativeRecharge() == 1){
|
||||
int saveAmt = rechargeInfo.getSaveAmt();
|
||||
rechargeInfo.setSaveAmt(price+saveAmt);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,rechargeInfo.getSaveAmt(),null);
|
||||
}
|
||||
|
||||
rechargeInfo.setSaveAmt(price+saveAmt);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,rechargeInfo.getSaveAmt(),null);
|
||||
buyGoodsTimes.put(goodsId,buyCount);
|
||||
rechargeInfo.setBuyGoodsTimes(buyGoodsTimes);
|
||||
|
||||
|
|
|
@ -676,7 +676,7 @@ public class ItemUtil {
|
|||
continue;
|
||||
}
|
||||
addEquip(user, entry.getKey(), equipList);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,entry.getKey(),1,user.getEquipManager().getEquipMap().size());
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,entry.getKey(),1,-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,15 @@ public class MessageUtil {
|
|||
sendMessage(sessionByUid, result, msgId, generatedMessage, flush);
|
||||
}
|
||||
|
||||
|
||||
public static void sendRedIndication(int sendUid,int redType) {
|
||||
ISession session = OnlineUserManager.sessionMap.get(sendUid);
|
||||
if(session!=null){
|
||||
PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(redType).build();
|
||||
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.SEND_RED_POINT_INDICATION_VALUE,redPointInfo,true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendMessage(ISession session, int result, int msgId, GeneratedMessage generatedMessage, boolean flush) {
|
||||
byte[] byteBuf = wrappedBuffer(session.getUid(), session.getToken(), session.getIndex(), result, msgId, generatedMessage);
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue