fix car rank
parent
8829b678d5
commit
c0362839a7
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.core.function;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
|
@ -24,11 +25,16 @@ public class CarDelayFunction implements FunctionManager {
|
|||
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
|
||||
List<String> delKeys = new ArrayList<>();
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_DEALY_RANK, "");
|
||||
String guildKey = RedisUtil.getInstence().getKey(RedisKey.CAR_DEALY_GUILD_RANK, "");
|
||||
delKeys.add(key);
|
||||
Set<String> zset = RedisUtil.getInstence().getZset(key, 0, -1);
|
||||
zset.forEach(item->{
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_SB,item));
|
||||
delKeys.add(guildKey);
|
||||
delKeys.add(guildKey);
|
||||
Set<String> guildSet = RedisUtil.getInstence().getZset(guildKey, 0, -1);
|
||||
guildSet.forEach(guildId->{
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(guildId));
|
||||
guildInfo.clearCarFightSb();
|
||||
});
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
RedisUtil.getInstence().del(delKeys.toArray(new String[0]));
|
||||
}
|
||||
|
||||
|
@ -42,6 +48,7 @@ public class CarDelayFunction implements FunctionManager {
|
|||
String personTitle = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_personreward_title");
|
||||
|
||||
int nowTime = TimeUtils.nowInt();
|
||||
int times=0;
|
||||
for(ZSetOperations.TypedTuple<String> item : personRangeWithScores){
|
||||
rank++;
|
||||
String value = item.getValue();
|
||||
|
@ -49,7 +56,11 @@ public class CarDelayFunction implements FunctionManager {
|
|||
String rewardByRank = personRewardConfigTreeMap.floorEntry(rank).getValue();
|
||||
String personContent = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_personreward_txt",new Object[]{rank});
|
||||
MailLogic.getInstance().sendMail(uid,personTitle,personContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
if(times++%20==0){
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
}
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
String guildTitle = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_title");
|
||||
Set<ZSetOperations.TypedTuple<String>> guildRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_DEALY_GUILD_RANK, "", 0, -1);
|
||||
for(ZSetOperations.TypedTuple<String> item : guildRangeWithScores){
|
||||
|
@ -63,10 +74,14 @@ public class CarDelayFunction implements FunctionManager {
|
|||
for(Set<Integer> uids : values){
|
||||
for(Integer uid:uids){
|
||||
MailLogic.getInstance().sendMail(uid,guildTitle,guildContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
if(times++%20==0){
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,7 +257,6 @@ public class RedisKey {
|
|||
public static final String DEATH_PATH_TOTAL_GUILD_RANK = "DEATH_PATH_TOTAL_GUILD_RANK";
|
||||
|
||||
|
||||
public final static String CAR_CHALLENGE_SB = "CAR_CHALLENGE_SB"; //车迟玩法挑战记录
|
||||
|
||||
public static final String DEATH_PAHT_TOTAL_CHALLENGE_COUNT = "DEATH_PAHT_TOTAL_CHALLENGE_COUNT";
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
|
@ -83,30 +84,34 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
hurt = fightResult.getCheckResult()[1];
|
||||
fightData = fightResult.getFightData();
|
||||
gainScore = (int) (hurt*(sWorldBossSetting.getScorePercent()/10000F));
|
||||
boolean isNew = guildInfo.addCarFightSb(uid);
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_RANK.getType()).incrementRankScore(uid,"",gainScore);
|
||||
guildInfo.addCarFightSb(uid);
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
||||
|
||||
|
||||
|
||||
}break;
|
||||
case 2:{
|
||||
Integer mapValue = RedisUtil.getInstence().getMapValue(RedisKey.CAR_CHALLENGE_SB, String.valueOf(uid), String.valueOf(challeageId), Integer.class);
|
||||
if(mapValue!=null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CAR_CHALLENGE_SB, String.valueOf(uid), String.valueOf(challeageId), 1);
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarPersonChallenge,challeageId,GlobalsDef.CAR_DELAY_TEAM);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||
fightData = fightResult.getFightData();
|
||||
int fight = fightResult.getCheckResult()[0];
|
||||
String content = "";
|
||||
String challengeContent = "";
|
||||
String challengeName = UserManager.getUser(challeageId).getPlayerInfoManager().getNickName();
|
||||
PlayerManager playerInfoManager = UserManager.getUser(challeageId).getPlayerInfoManager();
|
||||
String challengeName = playerInfoManager.getNickName();
|
||||
if(fight == 1){
|
||||
int challenegScore = RedisUtil.getInstence().getZSetScore(RankEnum.CAR_DEALY_RANK.getRedisKey(), "", String.valueOf(challeageId)).intValue();
|
||||
if(challenegScore !=-1){
|
||||
gainScore = (int) (challenegScore*(sWorldBossSetting.getGrabPercent()/10000F));
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_RANK.getType()).incrementRankScore(uid,"",gainScore);
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_RANK.getType()).incrementRankScore(challeageId,"",-gainScore);
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(guildInfo.getId(),"",gainScore,0);
|
||||
int chanllengeGuild = playerInfoManager.getGuildId();
|
||||
if(chanllengeGuild!=0){
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(chanllengeGuild,"",-gainScore,0);
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("worldboss_battle_win",new Object[]{challengeName,gainScore});
|
||||
|
|
|
@ -78,7 +78,6 @@ public class GetCarChallengeListHandler extends BaseHandler {
|
|||
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.CAR_DEALY_RANK, "", String.valueOf(uid)).intValue();
|
||||
}
|
||||
Family.GetCarChallenegListResponse.Builder builder = Family.GetCarChallenegListResponse.newBuilder().setMyRank(myRank).setMyScore(myscore);
|
||||
Map<Integer, Integer> records = RedisUtil.getInstence().getMapValues(RedisKey.CAR_CHALLENGE_SB, String.valueOf(uid), Integer.class, Integer.class);
|
||||
for(ZsetTypedTupleWithRank typedTupleWithRankitem: infos){
|
||||
ZSetOperations.TypedTuple<String> item = typedTupleWithRankitem.getItem();
|
||||
int challenegUid = Integer.parseInt(item.getValue());
|
||||
|
@ -91,7 +90,6 @@ public class GetCarChallengeListHandler extends BaseHandler {
|
|||
.setUserName(challenegeUser.getPlayerInfoManager().getNickName())
|
||||
.setScore(item.getScore().intValue())
|
||||
.setForce(HeroLogic.getInstance().calTeamTotalForce(challenegeUser,GlobalsDef.CAR_DELAY_TEAM,false))
|
||||
.setHadChallenge(records.containsKey(challenegUid)?1:0)
|
||||
.setRank(rank);
|
||||
for (TeamPosHeroInfo heroInfo:challenegeUser.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.CAR_DELAY_TEAM)) {
|
||||
Hero hero = challenegeUser.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
|
@ -114,9 +112,10 @@ public class GetCarChallengeListHandler extends BaseHandler {
|
|||
int rank=start+1;
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_DEALY_RANK, "", start, end);
|
||||
for(ZSetOperations.TypedTuple<String> item : zsetreverseRangeWithScores){
|
||||
if(!members.contains(Integer.parseInt(item.getValue()))){
|
||||
infos.add(new ZsetTypedTupleWithRank(item,rank++));
|
||||
if(members.add(Integer.parseInt(item.getValue()))){
|
||||
infos.add(new ZsetTypedTupleWithRank(item,rank));
|
||||
}
|
||||
rank++;
|
||||
}
|
||||
end=start;
|
||||
start-=matchNums;
|
||||
|
|
|
@ -232,11 +232,18 @@ public class GuildInfo extends MongoBase {
|
|||
updateString("intoLevel",intoLevel);
|
||||
}
|
||||
|
||||
public void addCarFightSb(int uid){
|
||||
public boolean addCarFightSb(int uid){
|
||||
if(!carFightSb.containsKey(uid)){
|
||||
carFightSb.put(uid,1);
|
||||
updateString("carFightSb." + uid,1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clearCarFightSb(){
|
||||
carFightSb.clear();
|
||||
updateString("carFightSb" ,carFightSb);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getCarFightSb() {
|
||||
|
|
|
@ -1229,10 +1229,14 @@ public class GuildFightLogic {
|
|||
|
||||
public static void minuteCheckForCarFight() throws Exception {
|
||||
int carProgressTmp =carProgress;
|
||||
int id =-1;
|
||||
int id =1;
|
||||
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Car_Delay);
|
||||
if (null == timeControllerOfFunction) {
|
||||
carProgress = -1;
|
||||
carProgressTmp = -1;
|
||||
if(carDelayProgressIndication!=null){
|
||||
id = carDelayProgressIndication.getBossIndexId();
|
||||
}
|
||||
}else{
|
||||
int times = timeControllerOfFunction.getTimes();
|
||||
int size = STableManager.getConfig(SWorldBossConfig.class).size();
|
||||
|
@ -1254,7 +1258,7 @@ public class GuildFightLogic {
|
|||
|
||||
int grapCompareStart =grabTime[0][0]*100 + grabTime[0][1];
|
||||
int grapCompaeEnd =grabTime[1][0]*100 + grabTime[1][1];
|
||||
if(sourceCompare>=battleCompareStart && sourceCompare<=battleCompaeEnd){
|
||||
if(sourceCompare>=battleCompareStart && sourceCompare<battleCompaeEnd){
|
||||
if(carProgressTmp == 1){
|
||||
return;
|
||||
}
|
||||
|
@ -1264,7 +1268,7 @@ public class GuildFightLogic {
|
|||
calendar.set(calendar.SECOND,0);
|
||||
endTime = (int)(calendar.getTimeInMillis()/1000);
|
||||
|
||||
}else if(sourceCompare>=grapCompareStart && sourceCompare<=grapCompaeEnd){
|
||||
}else if(sourceCompare>=grapCompareStart && sourceCompare<grapCompaeEnd){
|
||||
if(carProgressTmp == 3){
|
||||
return;
|
||||
}
|
||||
|
@ -1274,7 +1278,7 @@ public class GuildFightLogic {
|
|||
calendar.set(calendar.SECOND,0);
|
||||
endTime = (int)(calendar.getTimeInMillis()/1000);
|
||||
|
||||
}else if(sourceCompare>=battleCompaeEnd && sourceCompare<=grapCompareStart){
|
||||
}else if(sourceCompare>=battleCompaeEnd && sourceCompare<grapCompareStart){
|
||||
carProgressTmp = 2;
|
||||
}else{
|
||||
carProgressTmp = -1;
|
||||
|
|
|
@ -71,8 +71,7 @@ public abstract class AbstractRank implements IRank {
|
|||
* @param data
|
||||
*/
|
||||
public void incrementRankScore(int uid,String rkey,double... data){
|
||||
String key = RedisKey.getKey(redisKey,rkey,false);
|
||||
RedisUtil.getInstence().zsetAddOne(key,String.valueOf(uid), getScore(data));
|
||||
RedisUtil.getInstence().incrementZsetScore(redisKey,rkey,String.valueOf(uid), getScore(data));
|
||||
}
|
||||
|
||||
public AbstractRank(int type,String redisKey){
|
||||
|
|
|
@ -45,12 +45,13 @@ public class CarDealyGuildRank extends AbstractRank{
|
|||
|
||||
@Override
|
||||
public int[] getDataByScore(Double score) {
|
||||
return new int[0];
|
||||
return new int[]{(int) (score.longValue()/1000),(int) (score.longValue()%1000)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return 0;
|
||||
long score = (long) (data[0]*1000 + data[1]);
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +64,7 @@ public class CarDealyGuildRank extends AbstractRank{
|
|||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(guildInfo.getCarFightSb().size());
|
||||
.setParam2(getParam2(data.getScore()));
|
||||
|
||||
CommonProto.UserRank everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setGuildName(familyName)
|
||||
|
|
Loading…
Reference in New Issue