vip权限

back_recharge
wangyuan 2020-01-08 17:58:36 +08:00
parent a0fe74fa22
commit cb1954d8a2
31 changed files with 255 additions and 141 deletions

View File

@ -214,7 +214,7 @@ function BattleMain.Execute(args, fightData, optionData)
Random.SetSeed(args.seed) Random.SetSeed(args.seed)
BattleLogic.Init(args.maxTime, fightData, optionData) BattleLogic.Init(args.maxTime, fightData, optionData)
BattleLogic.Type = _type BattleLogic.Type = _type
if _type == 9 then if _type == 9 or _type == 10 then
AddRecord(fightData) AddRecord(fightData)
end end
BattleLogic.StartOrder() BattleLogic.StartOrder()
@ -263,7 +263,19 @@ function BattleMain.Execute(args, fightData, optionData)
else else
resultList.result = BattleLogic.Result resultList.result = BattleLogic.Result
end end
--print("result:"..BattleLogic.Result)
if _type == 10 then
local playerDamage=0
for k,v in pairs(BattleRecord)do
if v.camp == 0 then
playerDamage = playerDamage + v.damage
end
end
resultList.duration = playerDamage --TODO:公会boss的持续时间传递的是我方总伤害值
else
resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate
end
addBattleData() addBattleData()
return resultList return resultList

View File

@ -215,7 +215,7 @@ function BattleMain.Execute(args, fightData, optionData)
Random.SetSeed(args.seed) Random.SetSeed(args.seed)
BattleLogic.Init(args.maxTime, fightData, optionData) BattleLogic.Init(args.maxTime, fightData, optionData)
BattleLogic.Type = _type BattleLogic.Type = _type
if _type == 9 then if _type == 9 or _type == 10 then
AddRecord(fightData) AddRecord(fightData)
end end
BattleLogic.StartOrder() BattleLogic.StartOrder()
@ -265,9 +265,18 @@ function BattleMain.Execute(args, fightData, optionData)
resultList.result = BattleLogic.Result resultList.result = BattleLogic.Result
end end
resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate if _type == 10 then
local playerDamage=0
for k,v in pairs(BattleRecord)do
if v.camp == 0 then
playerDamage = playerDamage + v.damage
end
end
resultList.duration = playerDamage --TODO:公会boss的持续时间传递的是我方总伤害值
else
resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate
end
--print("result:"..BattleLogic.Result)
addBattleData() addBattleData()
return resultList return resultList

View File

@ -3,26 +3,19 @@ package com.ljsd.jieling.core.function;
import com.ljsd.jieling.core.FunctionManager; import com.ljsd.jieling.core.FunctionManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction; import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
import com.ljsd.jieling.logic.family.GuildFightLogic; import com.ljsd.jieling.logic.family.GuildFightLogic;
import config.SGuildBossConfig;
import manager.STableManager;
import java.util.Map;
public class GuildBossFunction implements FunctionManager { public class GuildBossFunction implements FunctionManager {
@Override @Override
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception { public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
int times = timeControllerOfFunction.getTimes(); int times = timeControllerOfFunction.getTimes();
Map<Integer, SGuildBossConfig> config = STableManager.getConfig(SGuildBossConfig.class);
int id = times%config.size(); GuildFightLogic.updateGuildBossInfoByTimes(times);
if(id == 0){
id = config.size();
}
GuildFightLogic.updateGuildBossInfo(config.get(id));
} }
@Override @Override
public void closeAction() throws Exception { public void closeAction() throws Exception {
GuildFightLogic.updateGuildBossInfo(null); GuildFightLogic.updateGuildBossInfoByTimes(-1);
} }
} }

View File

@ -131,6 +131,8 @@ public class RedisKey {
public static final String RANDOM_CARD_RANK="RANDOM_CARD_RANK"; public static final String RANDOM_CARD_RANK="RANDOM_CARD_RANK";
public static final String RANDOM_CARD_PERFECT_RANK = "RANDOM_CARD_PERFECT_RANK"; public static final String RANDOM_CARD_PERFECT_RANK = "RANDOM_CARD_PERFECT_RANK";
public static final String GUILD_BOSS_RANK = "GUILD_BOSS_RANK";
public static final String FAMILY_ID = "FAMILY_ID"; public static final String FAMILY_ID = "FAMILY_ID";
public static final String FAMILY_JOIN = "FAMILY_JOIN"; public static final String FAMILY_JOIN = "FAMILY_JOIN";
@ -223,6 +225,8 @@ public class RedisKey {
public final static String PIDGIDTEMP = "PIDGIDTEMP"; public final static String PIDGIDTEMP = "PIDGIDTEMP";
public final static String GUILDBOSS_ARENA_RECORD = "GUILDBOSS_ARENA_RECORD";
public static Set<String> familyKey = new HashSet<>(); public static Set<String> familyKey = new HashSet<>();

View File

@ -6,6 +6,7 @@ import com.ljsd.GameApplication;
import com.ljsd.common.mogodb.util.GlobalData; import com.ljsd.common.mogodb.util.GlobalData;
import com.ljsd.jieling.util.ConfigurableApplicationContextManager; import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.RedisConnectionFailureException;
import util.StringUtil;
import util.TimeUtils; import util.TimeUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -132,6 +133,15 @@ public class RedisUtil {
return key == null ? null : redisTemplate.opsForValue().get(key); return key == null ? null : redisTemplate.opsForValue().get(key);
} }
public <T> T get(String type,String key,Class<T> tClass) {
String rkey = getKey(type, key);
String s = redisTemplate.opsForValue().get(rkey);
if(StringUtil.isEmpty(s)){
return null;
}
return gson.fromJson(s,tClass);
}
public Object getAndDelete(String key) { public Object getAndDelete(String key) {
Object value = redisTemplate.opsForValue().get(key); Object value = redisTemplate.opsForValue().get(key);
del(key); del(key);
@ -213,6 +223,11 @@ public class RedisUtil {
} }
} }
public <T> void set(String type, String rkey, T t) {
String key = getKey(type, rkey);
redisTemplate.opsForValue().set(key, gson.toJson(t));
}
/** /**
* *
* *

View File

@ -101,8 +101,7 @@ public interface BIReason {
int CHAMPIION_BET_WIN_REWARD = 60 ; // 巅峰赛竞猜赢取 int CHAMPIION_BET_WIN_REWARD = 60 ; // 巅峰赛竞猜赢取
int GUILD_BOSS_FIGHT_BASE_REWARD = 61;//工会boss基础奖励 int GUILD_BOSS_FIGHT_REWARD = 61;//工会boss奖励
int GUILD_BOSS_FIGHT_RANDOM_REWARD = 62;//工会boss随机奖励
int CHAMPIONM_EXCHANGE_REWARD = 1050;//巅峰赛兑换奖励 int CHAMPIONM_EXCHANGE_REWARD = 1050;//巅峰赛兑换奖励

View File

@ -1081,8 +1081,8 @@ public class MapLogic {
mapManager.setHighestTower(mapManager.getTower()); mapManager.setHighestTower(mapManager.getTower());
AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType()); AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType());
// TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000)) // TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))
if(towerRank.getScore(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))>towerRank.getScoreById(user.getId(),0)){ if(towerRank.getScore(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))>towerRank.getScoreById(user.getId(),"")){
towerRank.addRank(user.getId(),0,mapManager.getTower(),(int)mapManager.getCurrTowerTime()/1000); towerRank.addRank(user.getId(),"",mapManager.getTower(),(int)mapManager.getCurrTowerTime()/1000);
// RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))); // RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000)));
} }
} }
@ -2122,7 +2122,7 @@ public class MapLogic {
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false); // String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId()); // RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,0,sMainLevelConfig.getVirtureId()); RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,"",sMainLevelConfig.getVirtureId());
} }
// public void getMainLevelRankInfo(ISession session) throws Exception { // public void getMainLevelRankInfo(ISession session) throws Exception {
@ -2330,7 +2330,7 @@ public class MapLogic {
//排行榜 //排行榜
// String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false); // String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false);
// RedisUtil.getInstence().zsetAddOneOffsetByTime(rankKey, String.valueOf(user.getId()), checkFightId); // RedisUtil.getInstence().zsetAddOneOffsetByTime(rankKey, String.valueOf(user.getId()), checkFightId);
RankContext.getRankEnum(RankEnum.MONSTER_ATTACK_RANK.getType()).addRank(uid,0,checkFightId); RankContext.getRankEnum(RankEnum.MONSTER_ATTACK_RANK.getType()).addRank(uid,"",checkFightId);
//归还水滴 //归还水滴
Map<Integer,Integer> itemMap = new HashMap<>(1); Map<Integer,Integer> itemMap = new HashMap<>(1);
itemMap.put( Global.DROP,1); itemMap.put( Global.DROP,1);
@ -2883,7 +2883,7 @@ public class MapLogic {
// User user = UserManager.getUser(session.getUid()); // User user = UserManager.getUser(session.getUid());
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM); int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM);
PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(type).getRank(session.getUid(),0,1, rankEndLine); PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(type).getRank(session.getUid(),"",1, rankEndLine);
// Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.TOWER_RANK, "", 0, rankEndLine); // Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.TOWER_RANK, "", 0, rankEndLine);

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.dao.Item; import com.ljsd.jieling.logic.dao.Item;
import com.ljsd.jieling.logic.dao.PlayerManager; import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.player.PlayerLogic;
import util.MathUtils; import util.MathUtils;
import config.SVipLevelConfig; import config.SVipLevelConfig;
import manager.STableManager; import manager.STableManager;
@ -257,10 +258,7 @@ public class MapManager extends MongoBase {
if(recoveryItemInfo == null){ if(recoveryItemInfo == null){
return; return;
} }
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(user.getPlayerInfoManager().getVipLevel()); Integer heroTimes = PlayerLogic.getInstance().getMaxCountByPrivilegeType(user,recoveryItemInfo[3]);
Map<Integer, Integer> privilegeMap = sVipLevelConfig.getPrivilegeMap();
Integer heroTimes = privilegeMap.get(recoveryItemInfo[3]);
int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryItemInfo[2]; int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryItemInfo[2];
if(itemNum>=heroTimes){ if(itemNum>=heroTimes){
item.setEndingTime(updateTime); item.setEndingTime(updateTime);

View File

@ -44,10 +44,10 @@ public class FourtyTwoBehavior extends BaseBehavior {
AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType()); AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType());
// Double zSetScore = RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", String.valueOf(user.getId())); // Double zSetScore = RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", String.valueOf(user.getId()));
// TowerRankUtil.getRankNumber(mapManager.getTower(),(int)time/1000) // TowerRankUtil.getRankNumber(mapManager.getTower(),(int)time/1000)
if(towerRank.getScore(mapManager.getTower(),(int)time/1000)>towerRank.getScoreById(user.getId(),0)){ if(towerRank.getScore(mapManager.getTower(),(int)time/1000)>towerRank.getScoreById(user.getId(),"")){
// String key = RedisKey.getKey(RedisKey.TOWER_RANK,"",false); // String key = RedisKey.getKey(RedisKey.TOWER_RANK,"",false);
// RedisUtil.getInstence().zsetAddOne(key,String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)time/1000)); // RedisUtil.getInstence().zsetAddOne(key,String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)time/1000));
towerRank.addRank(user.getId(),0,mapManager.getTower(),(int)time/1000); towerRank.addRank(user.getId(),"",mapManager.getTower(),(int)time/1000);
} }
} }
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL, mapManager.getTower()); user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL, mapManager.getTower());

View File

@ -4,14 +4,11 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException; import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler; import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic; import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildFightLogic; import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData; import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.FightInfoProto; import com.ljsd.jieling.protocols.FightInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto; import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
@ -42,7 +39,7 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
// } // }
// MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,type,MessageTypeProto.MessageType.FIGHT_START_RESPONSE); // MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,type,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
// }else if(type == 2){ // }else if(type == 2){
// MapLogic.getInstance().startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE); // MapLogic.getInstance().startBossFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
// //
// }else if(type == 3){ // }else if(type == 3){
// MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE); // MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
@ -69,7 +66,7 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
}else if(type == 6){ }else if(type == 6){
MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE); MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
} else if(type == 7){ } else if(type == 7){
GuildFightLogic.startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE); GuildFightLogic.startBossFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else { }else {
throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong:" + type)); throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong:" + type));
} }

View File

@ -121,7 +121,7 @@ public class QuickStartMonsterFighter extends BaseHandler<FightInfoProto.QuickSt
//排行榜 //排行榜
// String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false); // String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false);
// RedisUtil.getInstence().zsetAddOneOffsetByTime(rankKey, String.valueOf(user.getId()), fightId); // RedisUtil.getInstence().zsetAddOneOffsetByTime(rankKey, String.valueOf(user.getId()), fightId);
RankContext.getRankEnum(RankEnum.MONSTER_ATTACK_RANK.getType()).addRank(uid,0,fightId); RankContext.getRankEnum(RankEnum.MONSTER_ATTACK_RANK.getType()).addRank(uid,"",fightId);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sFloodConfig.getReward(), BIReason.MONSTERATTACK_REWARD); CommonProto.Drop.Builder drop = ItemUtil.drop(user, sFloodConfig.getReward(), BIReason.MONSTERATTACK_REWARD);
FightInfoProto.QuickStartMonsterFightResponse builder = FightInfoProto.QuickStartMonsterFightResponse.newBuilder() FightInfoProto.QuickStartMonsterFightResponse builder = FightInfoProto.QuickStartMonsterFightResponse.newBuilder()

View File

@ -226,6 +226,9 @@ public class GlobalDataManaager implements IManager {
MapLogic.getInstance().updateEndlessSeason(globalSystemControl.getTimeControllerOfFunctionMap().get(FunctionIdEnum.Endless.getFunctionType()).getTimes()); MapLogic.getInstance().updateEndlessSeason(globalSystemControl.getTimeControllerOfFunctionMap().get(FunctionIdEnum.Endless.getFunctionType()).getTimes());
MapLogic.setEndlessMapId(getEndleeMapIdByLevel()); MapLogic.setEndlessMapId(getEndleeMapIdByLevel());
} }
if(globalSystemControl.getTimeControllerOfFunctionMap().containsKey(FunctionIdEnum.GuildBossFight.getFunctionType())){
GuildFightLogic.updateGuildBossInfoByTimes(globalSystemControl.getTimeControllerOfFunctionMap().get(FunctionIdEnum.GuildBossFight.getFunctionType()).getTimes());
}
} }
@ -320,6 +323,7 @@ public class GlobalDataManaager implements IManager {
FriendLogic.getInstance().refreshState(session); FriendLogic.getInstance().refreshState(session);
PlayerLogic.getInstance().sendTimingMail(user); PlayerLogic.getInstance().sendTimingMail(user);
user.getGuildMyInfo().setLastHurt(0);
if(fBuilder!=null){ if(fBuilder!=null){
fBuilder.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(user.getPlayerInfoManager().getSign()+1).setState(user.getPlayerInfoManager().getSignTotay()).build()); fBuilder.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(user.getPlayerInfoManager().getSign()+1).setState(user.getPlayerInfoManager().getSignTotay()).build());

View File

@ -38,7 +38,7 @@ class ForceRankActivity extends AbstractActivity {
return; return;
} }
UserForceChangeEvent forceChangeEvent = (UserForceChangeEvent) event; UserForceChangeEvent forceChangeEvent = (UserForceChangeEvent) event;
RankContext.getRankEnum(RankEnum.FORCE_RANK.getType()).addRank(forceChangeEvent.getUid(),id,forceChangeEvent.getForce()); RankContext.getRankEnum(RankEnum.FORCE_RANK.getType()).addRank(forceChangeEvent.getUid(),String.valueOf(id),forceChangeEvent.getForce());
} }
@ -60,7 +60,7 @@ class ForceRankActivity extends AbstractActivity {
activityMission.setValue(count); activityMission.setValue(count);
// String key = RedisKey.getKey(RedisKey.FORCE_RANK, "", false); // String key = RedisKey.getKey(RedisKey.FORCE_RANK, "", false);
// RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), count); // RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), count);
RankContext.getRankEnum(RankEnum.FORCE_RANK.getType()).addRank(user.getId(),id,count); RankContext.getRankEnum(RankEnum.FORCE_RANK.getType()).addRank(user.getId(),String.valueOf(id),count);
} }
} }
@ -89,7 +89,7 @@ class ForceRankActivity extends AbstractActivity {
} }
// Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, "", 0, maxRank-1); // Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, "", 0, maxRank-1);
Set<ZSetOperations.TypedTuple<String>> rankInfo = RankContext.getRankEnum(RankEnum.FORCE_RANK.getType()).getRankByKey(id,0,maxRank - 1); Set<ZSetOperations.TypedTuple<String>> rankInfo = RankContext.getRankEnum(RankEnum.FORCE_RANK.getType()).getRankByKey(String.valueOf(id),0,maxRank - 1);
int rank = 1; int rank = 1;
int nowTime = (int) (TimeUtils.now() / 1000); int nowTime = (int) (TimeUtils.now() / 1000);
for (ZSetOperations.TypedTuple<String> item : rankInfo) { for (ZSetOperations.TypedTuple<String> item : rankInfo) {

View File

@ -53,14 +53,14 @@ public class LimitRandomCardActivity extends AbstractActivity {
return; return;
} }
AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType()); AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType());
int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid(),id)).intValue(); int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid(),String.valueOf(id))).intValue();
if(scoreById==-1){ if(scoreById==-1){
scoreById=0; scoreById=0;
} }
randomRank.addRank(cardEvent.getUid(),id,scoreById+cardEvent.getScore()); randomRank.addRank(cardEvent.getUid(),String.valueOf(id),scoreById+cardEvent.getScore());
Predicate<int[]> pre = a-> (SCHero.getHeroByPieceId(a[0])!=null&&SCHero.getHeroByPieceId(a[0]).getNatural()>=13); Predicate<int[]> pre = a-> (SCHero.getHeroByPieceId(a[0])!=null&&SCHero.getHeroByPieceId(a[0]).getNatural()>=13);
Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(),id, TimeUtils.now()/1000,a[0]); Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(),String.valueOf(id), TimeUtils.now()/1000,a[0]);
Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer); Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer);
update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore()); update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore());

View File

@ -589,7 +589,8 @@ public class ArenaLogic {
arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"", fightId, ArenaRecord.class); arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"", fightId, ArenaRecord.class);
}else if(type == 1){ }else if(type == 1){
arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.ARENA_RRECORD, Integer.toString(uid), fightId, ArenaRecord.class); arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.ARENA_RRECORD, Integer.toString(uid), fightId, ArenaRecord.class);
}else if(type == 3){
arenaRecord = RedisUtil.getInstence().get(RedisKey.GUILDBOSS_ARENA_RECORD, fightId, ArenaRecord.class);
} }
if(arenaRecord == null){ if(arenaRecord == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("arena_rrecord null")); throw new ErrorCodeException(ErrorCode.newDefineCode("arena_rrecord null"));

View File

@ -27,6 +27,8 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic; import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic; import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.rank.rankImpl.GuildBossRank;
import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto; import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.Family; import com.ljsd.jieling.protocols.Family;
@ -63,6 +65,7 @@ public class GuildFightLogic {
private static SGuildBossConfig curSGuildBossConfig; // 为null代表关闭 private static SGuildBossConfig curSGuildBossConfig; // 为null代表关闭
public static int bossSeason;
public static int getStatus() { public static int getStatus() {
return status; return status;
@ -1041,7 +1044,7 @@ public class GuildFightLogic {
} }
public static void startFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception { public static void startBossFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
if(curSGuildBossConfig == null){ if(curSGuildBossConfig == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
@ -1062,9 +1065,9 @@ public class GuildFightLogic {
String fightInfo =Integer.toString(monsterId); String fightInfo =Integer.toString(monsterId);
String key = RedisKey.getKey(RedisKey.GUILD_MONSTER_INFO, String.valueOf(uid), false); String key = RedisKey.getKey(RedisKey.GUILD_MONSTER_INFO, String.valueOf(uid), false);
RedisUtil.getInstence().set(key, fightInfo, -1); RedisUtil.getInstence().set(key, fightInfo, -1);
//扣除预先道具
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder(); FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
BehaviorUtil.getLevelDifficultyifficuFightInfo(user, FightType.GuildBossFight,monsterId, teamId, 90, fightStartResponse, RedisKey.GUILD_MONSTER_FIGHT); BehaviorUtil.getLevelDifficultyifficuFightInfo(user, FightType.GuildBossFight,monsterId, teamId, SGuildSetting.sGuildSetting.getBossTime(), fightStartResponse, RedisKey.GUILD_MONSTER_FIGHT);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
} }
@ -1079,24 +1082,32 @@ public class GuildFightLogic {
LOGGER.info("endFight() uid=>{} fightKey={},fightId={} fightInfos == null", uid, fightKey); LOGGER.info("endFight() uid=>{} fightKey={},fightId={} fightInfos == null", uid, fightKey);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
FightEvent fightEvent = new FightEvent(uid, -1, 90,frames, GameFightType.GuildBossFight); FightEvent fightEvent = new FightEvent(uid, -1, SGuildSetting.sGuildSetting.getBossTime(),frames, GameFightType.GuildBossFight);
FightResult fightResult = FightDispatcher.dispatcher(fightEvent); FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1); PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
//校验结果码 1胜利 //校验结果码 1胜利
int[] checkResult = fightResult.getCheckResult(); int myHurt = 2000;
int myHurt = 1000;
if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){ if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){
user.getGuildMyInfo().setMaxBossHurt(myHurt); user.getGuildMyInfo().setMaxBossHurt(myHurt);
} }
if(myHurt>user.getGuildMyInfo().getLastHurt()){
//排行榜更新
String rkey = user.getPlayerInfoManager().getGuildId() + RedisKey.Delimiter_colon + bossSeason;
double scoreById = RankEnum.toRank(RankEnum.GUILD_BOSS_RANK.getType()).getScoreById(uid, rkey);
if(myHurt>scoreById){
RankEnum.toRank(RankEnum.GUILD_BOSS_RANK.getType()).addRank(uid,rkey,myHurt);
ArenaRecord arenaRecord = new ArenaRecord();
arenaRecord.setFightData(fightResult.getFightData().toByteArray());
RedisUtil.getInstence().set(RedisKey.GUILDBOSS_ARENA_RECORD, Integer.toString(uid),arenaRecord);
}
}
user.getGuildMyInfo().setLastHurt(myHurt); user.getGuildMyInfo().setLastHurt(myHurt);
SGuildBossRewardConfig sGuildBossRewardConfig = SGuildBossRewardConfig.getIndexByHurt(myHurt); SGuildBossRewardConfig sGuildBossRewardConfig = SGuildBossRewardConfig.getIndexByHurt(myHurt);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sGuildBossRewardConfig.getReward(), 1, 0, BIReason.GUILD_BOSS_FIGHT_BASE_REWARD); CommonProto.Drop.Builder drop = ItemUtil.drop(user, sGuildBossRewardConfig.getReward(), 1, 0, BIReason.GUILD_BOSS_FIGHT_REWARD);
CommonProto.Drop.Builder randomDrop = ItemUtil.drop(user, sGuildBossRewardConfig.getReward(), 1, 0, BIReason.GUILD_BOSS_FIGHT_RANDOM_REWARD);
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder(); FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
fightEndResponse.setEnventDrop(drop); fightEndResponse.setEnventDrop(drop);
fightEndResponse.setMissionDrop(randomDrop);
fightEndResponse.setEssenceValue(myHurt); fightEndResponse.setEssenceValue(myHurt);
fightEndResponse.build(); fightEndResponse.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
@ -1104,8 +1115,71 @@ public class GuildFightLogic {
public static void updateGuildBossInfo(SGuildBossConfig sGuildBossConfig){ public static void updateGuildBossInfoByTimes(int times) {
curSGuildBossConfig = sGuildBossConfig; if(times == -1){
ThreadManager.getScheduledExecutor().execute(()->{
try {
sendBossFightReward(bossSeason);
} catch (Exception e) {
e.printStackTrace();
}
});
bossSeason = times;
return;
}
Map<Integer, SGuildBossConfig> config = STableManager.getConfig(SGuildBossConfig.class);
int id = times%config.size();
if(id == 0){
id = config.size();
}
bossSeason = times;
curSGuildBossConfig = config.get(id);
}
public static void sendBossFightReward( int season) throws Exception {
String title= SErrorCodeEerverConfig.getI18NMessage("arena_daily_reward_title");;
String content = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_title");;
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
int now = (int)(TimeUtils.now()/1000);
float[][] bossReward = SGuildSetting.sGuildSetting.getBossReward();
List<String> delKeys = new ArrayList<>();
for(GuildInfo guildInfo : guildInfoMap.values()){
int guildId = guildInfo.getId();
String rkey =guildId + RedisKey.Delimiter_colon + season;
Set<ZSetOperations.TypedTuple<String>> bossHurtRankInfo = RankEnum.toRank(RankEnum.GUILD_BOSS_RANK.getType()).getRankByKey(rkey, 0, 1);
if(bossHurtRankInfo==null || bossHurtRankInfo.isEmpty()){
continue;
}
int maxHurt = bossHurtRankInfo.iterator().next().getScore().intValue();
int[][] mineReward = new int[bossReward.length][];
int j=0;
for(int i=0;i<bossReward.length;i++){
int itemNum = (int) (bossReward[i][1] * maxHurt);
if(itemNum==0){
continue;
}
mineReward[j] = new int[2];
mineReward[j][0] =(int)bossReward[i][0];
mineReward[j++][1] =itemNum;
}
String rewardByRank = StringUtil.parseArrayToString(mineReward);
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
Iterator<Set<Integer>> iterator = members.values().iterator();
while (iterator.hasNext()){
Set<Integer> uids = iterator.next();
for(Integer uid : uids){
MailLogic.getInstance().sendMail(uid,title,content,rewardByRank,now, Global.MAIL_EFFECTIVE_TIME);
}
}
delKeys.add( RankEnum.toRank(RankEnum.GUILD_BOSS_RANK.getType()).getRedisKey() + rkey);
}
MongoUtil.getLjsdMongoTemplate().lastUpdate();
RedisUtil.getInstence().del(delKeys.toArray(new String[0]));
} }
public static SGuildBossConfig getCurSGuildBossConfig() { public static SGuildBossConfig getCurSGuildBossConfig() {

View File

@ -128,7 +128,7 @@ public class FightUtil {
} }
public static int[] getFightFromRedis(FightEvent fightEvent) throws Exception { public static FightResult getFightFromRedis(FightEvent fightEvent) throws Exception {
GameFightType fightType = fightEvent.getFightType(); GameFightType fightType = fightEvent.getFightType();
int playerId = fightEvent.getAttackUid(); int playerId = fightEvent.getAttackUid();
String frames = fightEvent.getFrames(); String frames = fightEvent.getFrames();
@ -148,7 +148,13 @@ public class FightUtil {
List<CommonProto.FightTeamInfo> monsterTeamList = BehaviorUtil.getFightTeamInfos(valueMap); List<CommonProto.FightTeamInfo> monsterTeamList = BehaviorUtil.getFightTeamInfos(valueMap);
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList); LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
LuaValue getOptionData = FightDataUtil.getOptionData(frames); LuaValue getOptionData = FightDataUtil.getOptionData(frames);
return CheckFight.getInstance().checkFight(seed,fightTime, getFightData, getOptionData,fightType.getFightType());
FightResult.Builder fightResult = FightResult.newBuilder();
int[] fightResultInfo = CheckFight.getInstance().checkFight(seed, fightTime, getFightData, getOptionData, fightType.getFightType());
fightResult.setCheckResult(fightResultInfo);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(fightType.getFightType().getType()).setHeroFightInfos(fightTeamInfo).addAllMonsterList(monsterTeamList).setFightSeed(seed).setFightMaxTime(fightTime).build();
fightResult.setFightData(fightData);
return fightResult.build();
} }

View File

@ -9,7 +9,6 @@ public class DefaultOfRedisCacheFightHandler implements IFightEventProcesor {
@Override @Override
public FightResult process(FightEvent fightEvent) throws Exception { public FightResult process(FightEvent fightEvent) throws Exception {
int[] fightResult = FightUtil.getFightFromRedis(fightEvent); return FightUtil.getFightFromRedis(fightEvent);
return FightResult.newBuilder().setCheckResult(fightResult).build();
} }
} }

View File

@ -305,23 +305,21 @@ public class PlayerLogic {
} }
public void sendVipDailyOrLevlUpReward(User user, int vipLevel,int reson) throws Exception { public void sendVipDailyOrLevlUpReward(User user, int vipLevel,int reson) throws Exception {
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel);
Map<Integer, Integer> privilegeMap = sVipLevelConfig.getPrivilegeMap();
int[][] dailyGifts = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDailyGift(); int[][] dailyGifts = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDailyGift();
for(int[] dailyGift : dailyGifts){ for(int[] dailyGift : dailyGifts){
if(privilegeMap!=null&&privilegeMap.containsKey(dailyGift[1])){ int num = PlayerLogic.getInstance().getMaxCountByPrivilegeType(user, dailyGift[1]);
if(num>0){
Item item = user.getItemManager().getItem(dailyGift[0]); Item item = user.getItemManager().getItem(dailyGift[0]);
Integer num = privilegeMap.get(dailyGift[1]);
int hadNum=0; int hadNum=0;
if(item!=null){ if(item!=null){
hadNum=item.getItemNum(); hadNum=item.getItemNum();
} }
if(hadNum<num){ if(hadNum<num){
Map<Integer,Integer> itemMap = new HashMap<>(1); Map<Integer,Integer> itemMap = new HashMap<>(1);
if(reson == BIReason.VIP_LEVEL_REWARD && vipLevel!=0){ /* if(reson == BIReason.VIP_LEVEL_REWARD && vipLevel!=0){
Map<Integer, Integer> privilegePreMap = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel - 1).getPrivilegeMap(); Map<Integer, Integer> privilegePreMap = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel - 1).getPrivilegeMap();
hadNum = privilegePreMap.get(dailyGift[1]); hadNum = privilegePreMap.get(dailyGift[1]);
} }*/
itemMap.put(dailyGift[0],num-hadNum); itemMap.put(dailyGift[0],num-hadNum);
ItemUtil.addItem(user,itemMap,null, reson); ItemUtil.addItem(user,itemMap,null, reson);
} }
@ -781,7 +779,7 @@ public class PlayerLogic {
} }
return false; return false;
} }
public int getMaxCountByPrivilege(User user,int privilegeId){ private int getMaxCountByPrivilege(User user,int privilegeId){
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId); SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType()); Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
int mCount = 0; int mCount = 0;

View File

@ -9,9 +9,9 @@ import com.ljsd.jieling.protocols.PlayerInfoProto;
*/ */
public interface IRank { public interface IRank {
PlayerInfoProto.RankResponse getRank(int uid,int activityId,int page,int rankEndLine) throws Exception ; PlayerInfoProto.RankResponse getRank(int uid,String rkey,int page,int rankEndLine) throws Exception ;
void addRank(int uid,int activityId,double... data); void addRank(int uid,String rkey,double... data);
int getParam1(double data); int getParam1(double data);

View File

@ -19,7 +19,8 @@ public enum RankEnum {
MAIN_LEVEL_RANK(3,RedisKey.MAIN_LEVEL_RANK, MainLevelRank::new),//param1通关关卡Id param2无 param3:无 MAIN_LEVEL_RANK(3,RedisKey.MAIN_LEVEL_RANK, MainLevelRank::new),//param1通关关卡Id param2无 param3:无
MONSTER_ATTACK_RANK(4,RedisKey.MONSTER_ATTACK_RANK,MonsterAttackRank::new),//param1兽潮层数 param2无 param3:无 MONSTER_ATTACK_RANK(4,RedisKey.MONSTER_ATTACK_RANK,MonsterAttackRank::new),//param1兽潮层数 param2无 param3:无
RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK, RandomCardRank::new),//param1抽取积分 param2无 param3:无 RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK, RandomCardRank::new),//param1抽取积分 param2无 param3:无
RANDOM_CARD_PERFECT_RANK(11,RedisKey.RANDOM_CARD_PERFECT_RANK,RandomCardPerfectRank::new)//param1时间 param2英雄tempId param3:uid RANDOM_CARD_PERFECT_RANK(11,RedisKey.RANDOM_CARD_PERFECT_RANK,RandomCardPerfectRank::new),//param1时间 param2英雄tempId param3:uid
GUILD_BOSS_RANK(12,RedisKey.GUILD_BOSS_RANK,GuildBossRank::new),//param1时间 param2英雄tempId param3:uid
; ;
private int type; private int type;
private String redisKey; private String redisKey;

View File

@ -33,7 +33,11 @@ public class RankLogic {
} }
public void getRank(ISession session, int type, int activityId,MessageTypeProto.MessageType messageType) throws Exception { public void getRank(ISession session, int type, int activityId,MessageTypeProto.MessageType messageType) throws Exception {
int page = 1; int page = 1;
PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(type).getRank(session.getUid(),activityId,1, -1); String rkey = "";
if(activityId != 0){
rkey = String.valueOf(activityId);
}
PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(type).getRank(session.getUid(),rkey,1, -1);
MessageUtil.sendMessage(session,1,messageType.getNumber(),rankResponse,true); MessageUtil.sendMessage(session,1,messageType.getNumber(),rankResponse,true);
} }
} }

View File

@ -28,13 +28,13 @@ public abstract class AbstractRank implements IRank {
/** /**
* *
* @param activityId id * @param rkey key id bossid++ key
* @param uid id * @param uid id
* @param rankEndLine 线 * @param rankEndLine 线
* @return * @return
* @throws Exception * @throws Exception
*/ */
public PlayerInfoProto.RankResponse getRank(int uid,int activityId,int page,int rankEndLine) throws Exception { public PlayerInfoProto.RankResponse getRank(int uid,String rkey,int page,int rankEndLine) throws Exception {
if(rankEndLine==-1){ if(rankEndLine==-1){
rankEndLine = 100; rankEndLine = 100;
} }
@ -43,23 +43,24 @@ public abstract class AbstractRank implements IRank {
page = 1; page = 1;
} }
int start = (page - 1) * rankEndLine, end = page * rankEndLine - 1; int start = (page - 1) * rankEndLine, end = page * rankEndLine - 1;
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = getRankByKey(activityId,start,end); Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = getRankByKey(rkey,start,end);
if(start==0){ if(start==0){
start=1; start=1;
} }
PlayerInfoProto.RankResponse.Builder allUserResponse = getAllUserResponse(zsetreverseRangeWithScores,start); PlayerInfoProto.RankResponse.Builder allUserResponse = getAllUserResponse(zsetreverseRangeWithScores,start);
//当前用户信息 //当前用户信息
getMyInfo(user,activityId,allUserResponse); getMyInfo(user,rkey,allUserResponse);
return allUserResponse.build(); return allUserResponse.build();
} }
/** /**
* *
* @param uid id * @param uid id
* @param rkey redis key
* @param data getScore * @param data getScore
*/ */
public void addRank(int uid,int activityId,double... data){ public void addRank(int uid,String rkey,double... data){
String key = RedisKey.getKey(redisKey,String.valueOf(activityId),false); String key = RedisKey.getKey(redisKey,rkey,false);
RedisUtil.getInstence().zsetAddOne(key,String.valueOf(uid), getScore(data)); RedisUtil.getInstence().zsetAddOne(key,String.valueOf(uid), getScore(data));
} }
public AbstractRank(int type,String redisKey){ public AbstractRank(int type,String redisKey){
@ -74,8 +75,8 @@ public abstract class AbstractRank implements IRank {
return type; return type;
} }
public Set<ZSetOperations.TypedTuple<String>> getRankByKey(int activityId,int start,int end){ public Set<ZSetOperations.TypedTuple<String>> getRankByKey(String rkey,int start,int end){
return RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, String.valueOf(activityId), start, end); return RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, rkey, start, end);
} }
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores,int start) throws Exception{ protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores,int start) throws Exception{
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder(); PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
@ -107,9 +108,9 @@ public abstract class AbstractRank implements IRank {
builder.addRanks(everyRank); builder.addRanks(everyRank);
} }
protected void getMyInfo(User user,int activityId,PlayerInfoProto.RankResponse.Builder allUserResponse){ protected void getMyInfo(User user,String rkey,PlayerInfoProto.RankResponse.Builder allUserResponse){
int myRank= RedisUtil.getInstence().getZSetreverseRank(redisKey,String.valueOf(activityId),Integer.toString(user.getId())).intValue(); int myRank= RedisUtil.getInstence().getZSetreverseRank(redisKey,rkey,Integer.toString(user.getId())).intValue();
Double zSetScore = RedisUtil.getInstence().getZSetScore(redisKey, String.valueOf(activityId), Integer.toString(user.getId())); Double zSetScore = RedisUtil.getInstence().getZSetScore(redisKey, rkey, Integer.toString(user.getId()));
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder() CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
.setRank(myRank) .setRank(myRank)
.setParam1(getParam1(zSetScore)) .setParam1(getParam1(zSetScore))
@ -162,7 +163,8 @@ public abstract class AbstractRank implements IRank {
public int getParam3(double data) { public int getParam3(double data) {
return getDataByScore(data).length>2?getDataByScore(data)[2]:0; return getDataByScore(data).length>2?getDataByScore(data)[2]:0;
} }
public double getScoreById(int uid,int activityId){
return RedisUtil.getInstence().getZSetScore(redisKey, String.valueOf(activityId), String.valueOf(uid)); public double getScoreById(int uid,String rkey){
return RedisUtil.getInstence().getZSetScore(redisKey,rkey, String.valueOf(uid));
} }
} }

View File

@ -0,0 +1,27 @@
package com.ljsd.jieling.logic.rank.rankImpl;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.protocols.PlayerInfoProto;
public class GuildBossRank extends AbstractRank{
public GuildBossRank(int type, String redisKey) {
super(type, redisKey);
}
@Override
public int[] getDataByScore(double score) {
return new int[]{(int)score};
}
@Override
public double getScore(double... data) {
return data[0];
}
@Override
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
rkey = UserManager.getUser(uid).getPlayerInfoManager().getGuildId() + ":" + GuildFightLogic.bossSeason;
return super.getRank(uid, rkey, page, rankEndLine);
}
}

View File

@ -50,8 +50,8 @@ public class MainLevelRank extends AbstractRank {
} }
@Override @Override
public Set<ZSetOperations.TypedTuple<String>> getRankByKey(int activityId,int start, int end) { public Set<ZSetOperations.TypedTuple<String>> getRankByKey(String rkey,int start, int end) {
Set<ZSetOperations.TypedTuple<String>> rankByKey = super.getRankByKey(0,start, end); Set<ZSetOperations.TypedTuple<String>> rankByKey = super.getRankByKey(rkey,start, end);
return rankByKey; return rankByKey;
} }

View File

@ -26,7 +26,7 @@ public class RandomCardPerfectRank extends AbstractRank {
} }
@Override @Override
public void addRank(int uid,int activityId, double... data) { public void addRank(int uid,String rkey, double... data) {
String key = RedisKey.getKey(redisKey,"",false); String key = RedisKey.getKey(redisKey,"",false);
double[] doubles = new double[3]; double[] doubles = new double[3];
System.arraycopy(data, 0, doubles, 0, data.length); System.arraycopy(data, 0, doubles, 0, data.length);

View File

@ -15,9 +15,9 @@ public class TowerRank extends AbstractRank {
} }
@Override @Override
public PlayerInfoProto.RankResponse getRank(int uid,int activityId,int page,int rankEndLine) throws Exception { public PlayerInfoProto.RankResponse getRank(int uid,String rkey,int page,int rankEndLine) throws Exception {
rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM); rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM);
return super.getRank(uid,activityId,1, rankEndLine); return super.getRank(uid,rkey,1, rankEndLine);
} }
@Override @Override

View File

@ -394,10 +394,8 @@ public class StoreLogic {
add += sPlayerLevelConfig.getExtraAdd(); add += sPlayerLevelConfig.getExtraAdd();
}else if(type == 2){ }else if(type == 2){
int addPrivageId = extra[1]; int addPrivageId = extra[1];
int vipLevel = user.getPlayerInfoManager().getVipLevel(); PlayerLogic.getInstance().getMaxCountByPrivilegeType(user,addPrivageId);
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel); add += PlayerLogic.getInstance().getMaxCountByPrivilegeType(user,addPrivageId);
Map<Integer, Integer> privilegeMap = sVipLevelConfig.getPrivilegeMap();
add +=privilegeMap.get(addPrivageId);
} }
} }
} }

View File

@ -70,9 +70,9 @@ public class SGuildSetting implements BaseConfig {
public static SGuildSetting sGuildSetting; public static SGuildSetting sGuildSetting;
private int[] bossTime; private int bossTime;
private int[][] bossReward; private float[][] bossReward;
@Override @Override
@ -205,4 +205,12 @@ public class SGuildSetting implements BaseConfig {
public int[][] getRenameCost() { public int[][] getRenameCost() {
return renameCost; return renameCost;
} }
public int getBossTime() {
return bossTime;
}
public float[][] getBossReward() {
return bossReward;
}
} }

View File

@ -14,8 +14,6 @@ public class SVipLevelConfig implements BaseConfig {
private static TreeMap<Integer,Integer> money2vip ; private static TreeMap<Integer,Integer> money2vip ;
private int vipLevel; private int vipLevel;
private int[][] privileges;
private int[][] vipBoxDailyReward; private int[][] vipBoxDailyReward;
private int[][] vipBoxReward; private int[][] vipBoxReward;
@ -24,24 +22,12 @@ public class SVipLevelConfig implements BaseConfig {
private int moneyLimit; private int moneyLimit;
private Map<Integer,Integer> privilegeMap;
@Override @Override
public void init() throws Exception { public void init() throws Exception {
Map<Integer, SVipLevelConfig> config = STableManager.getConfig(SVipLevelConfig.class); Map<Integer, SVipLevelConfig> config = STableManager.getConfig(SVipLevelConfig.class);
money2vip = new TreeMap<>(); money2vip = new TreeMap<>();
for(SVipLevelConfig sVipLevelConfig : config.values()){ for(SVipLevelConfig sVipLevelConfig : config.values()){
int[][] privileges = sVipLevelConfig.getPrivileges();
if(privileges!=null&&privileges.length>0){
Map<Integer,Integer> privilegeMap = new HashMap<>(privileges.length);
for(int[] temp : privileges){
privilegeMap.put(temp[0],temp[1]);
}
sVipLevelConfig.setPrivilegeMap(privilegeMap);
}
money2vip.put(sVipLevelConfig.getMoneyLimit(),sVipLevelConfig.getVipLevel()); money2vip.put(sVipLevelConfig.getMoneyLimit(),sVipLevelConfig.getVipLevel());
} }
sVipLevelConfigMap =config; sVipLevelConfigMap =config;
@ -64,22 +50,10 @@ public class SVipLevelConfig implements BaseConfig {
return vipLevel; return vipLevel;
} }
public int[][] getPrivileges() {
return privileges;
}
public int[][] getVipBoxReward() { public int[][] getVipBoxReward() {
return vipBoxReward; return vipBoxReward;
} }
public Map<Integer, Integer> getPrivilegeMap() {
return privilegeMap;
}
public void setPrivilegeMap(Map<Integer, Integer> privilegeMap) {
this.privilegeMap = privilegeMap;
}
public int[][] getVipBoxDailyReward() { public int[][] getVipBoxDailyReward() {
return vipBoxDailyReward; return vipBoxDailyReward;
} }
@ -92,15 +66,8 @@ public class SVipLevelConfig implements BaseConfig {
return moneyLimit; return moneyLimit;
} }
public void setMoneyLimit(int moneyLimit) {
this.moneyLimit = moneyLimit;
}
public static TreeMap<Integer, Integer> getMoney2vip() { public static TreeMap<Integer, Integer> getMoney2vip() {
return money2vip; return money2vip;
} }
public static void setMoney2vip(TreeMap<Integer, Integer> money2vip) {
SVipLevelConfig.money2vip = money2vip;
}
} }

View File

@ -8,7 +8,7 @@ import java.util.*;
public class ExcelUtils { public class ExcelUtils {
private static boolean isWrite = true; private static boolean isWrite = true;
private static String excelPath ="D:/excel/0.94/data_execl/base_data/"; //excel 文件 private static String excelPath ="F:/work2/data_execl/base_data/"; //excel 文件
// private static String excelPath ="D:/excel/0.94/data_execl/Map_data/"; //excel 文件 // private static String excelPath ="D:/excel/0.94/data_execl/Map_data/"; //excel 文件
private static String path = "conf/server/"; private static String path = "conf/server/";
private static Set<String> oldFileNames = new HashSet<>(); private static Set<String> oldFileNames = new HashSet<>();
@ -19,30 +19,28 @@ public class ExcelUtils {
String[] list = oldfile.list(); String[] list = oldfile.list();
oldFileNames.addAll(Arrays.asList(list)); oldFileNames.addAll(Arrays.asList(list));
readExcelData(); readExcelData();
// //只加载新文件 //只加载新文件
//// Set<String> newFileNames = new HashSet<>(); Set<String> newFileNames = new HashSet<>();
//// File newfile = new File(path); File newfile = new File(path);
//// String[] newList = newfile.list(); String[] newList = newfile.list();
//// newFileNames.addAll(Arrays.asList(newList)); newFileNames.addAll(Arrays.asList(newList));
//// newFileNames.removeAll(oldFileNames); newFileNames.removeAll(oldFileNames);
//// if(!newFileNames.isEmpty()){ if(!newFileNames.isEmpty()) {
//// for(String newFileName : newFileNames){ for (String newFileName : newFileNames) {
//// String finalNewFileName = newFileName.replaceAll(".txt", ""); String finalNewFileName = newFileName.replaceAll(".txt", "");
//// genJavaFile(finalNewFileName); genJavaFile(finalNewFileName);
//// } }
//// }
//// }
// genJavaFile("DialRewardSetting");
} }
public static void genJavaFile(String fileName){ public static void genJavaFile(String fileName){
Map<String,String> fieldInfo = new HashMap<>(); Map<String,String> fieldInfo = new HashMap<>();
File file = new File("conf/server/"+fileName +".txt"); File file = new File("conf/server/"+fileName +".txt");
StringBuffer stringBuffer = new StringBuffer("package com.ljsd.jieling.config;\n" + StringBuffer stringBuffer = new StringBuffer("package config;\n" +
"\n" + "\n" +
"import manager.STableManager;\n" + "import manager.STableManager;\n" +
"import com.ljsd.jieling.logic.Table;\n" + "import manager.Table;\n" +
"\n" + "\n" +
"import java.util.Map;\n" + "import java.util.Map;\n" +
"\n" + "\n" +