车迟斗法挑战人数问题处理
parent
fe4e985187
commit
b0918e4071
|
|
@ -37,8 +37,9 @@ public class CarDelayFunction implements FunctionManager {
|
||||||
String guildKey = RedisUtil.getInstence().getKey(guildRank.getRedisKey(), "");
|
String guildKey = RedisUtil.getInstence().getKey(guildRank.getRedisKey(), "");
|
||||||
String crossKey = RedisUtil.getInstence().getKey(personRank.getCrossRedisKey(), "",false);
|
String crossKey = RedisUtil.getInstence().getKey(personRank.getCrossRedisKey(), "",false);
|
||||||
String crossGuildKey = RedisUtil.getInstence().getKey(guildRank.getCrossRedisKey(), "",false);
|
String crossGuildKey = RedisUtil.getInstence().getKey(guildRank.getCrossRedisKey(), "",false);
|
||||||
|
String carPeopleNum = RedisUtil.getInstence().getKey(RedisKey.CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM,"");
|
||||||
|
|
||||||
String[] delKeys = {key,guildKey,crossKey,crossGuildKey};
|
String[] delKeys = {key,guildKey,crossKey,crossGuildKey,carPeopleNum};
|
||||||
RedisUtil.getInstence().rename(60*60*16, backName, delKeys);
|
RedisUtil.getInstence().rename(60*60*16, backName, delKeys);
|
||||||
// String userLevelGuild = RedisUtil.getInstence().getKey(RedisKey.USER_LEVEL_GUILD_INFO, "");
|
// String userLevelGuild = RedisUtil.getInstence().getKey(RedisKey.USER_LEVEL_GUILD_INFO, "");
|
||||||
// delKeys.add(userLevelGuild);
|
// delKeys.add(userLevelGuild);
|
||||||
|
|
|
||||||
|
|
@ -310,6 +310,7 @@ public class RedisKey {
|
||||||
// 车迟斗法
|
// 车迟斗法
|
||||||
public static final String CAR_DEALY_RANK = "CAR_DEALY_RANK";
|
public static final String CAR_DEALY_RANK = "CAR_DEALY_RANK";
|
||||||
public static final String CAR_DEALY_GUILD_RANK = "CAR_DEALY_GUILD_RANK";
|
public static final String CAR_DEALY_GUILD_RANK = "CAR_DEALY_GUILD_RANK";
|
||||||
|
public static final String CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM = "CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM";
|
||||||
|
|
||||||
//公会战进攻获得星数排行榜
|
//公会战进攻获得星数排行榜
|
||||||
public static final String FAMILY_FIGHT_STAR_RANK = "FAMILY_FIGHT_STAR_RANK";
|
public static final String FAMILY_FIGHT_STAR_RANK = "FAMILY_FIGHT_STAR_RANK";
|
||||||
|
|
|
||||||
|
|
@ -1425,7 +1425,7 @@ public class RedisUtil {
|
||||||
RedisKey.WORLD_ARENA_MY_PRON.equals(type) || RedisKey.WORLD_ARENA_RRECORD.equals(type) ||
|
RedisKey.WORLD_ARENA_MY_PRON.equals(type) || RedisKey.WORLD_ARENA_RRECORD.equals(type) ||
|
||||||
RedisKey.TOKEN.equals(type) || RedisKey.USER_SERVER_INFO.equals(type) ||
|
RedisKey.TOKEN.equals(type) || RedisKey.USER_SERVER_INFO.equals(type) ||
|
||||||
RedisKey.CDKEY.equals(type) || RedisKey.ServerArenaJob.equals(type) ||
|
RedisKey.CDKEY.equals(type) || RedisKey.ServerArenaJob.equals(type) ||
|
||||||
RedisKey.CROSS_SERVER_GROUP.equals(type)
|
RedisKey.CROSS_SERVER_GROUP.equals(type) || RedisKey.CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM.equals(type)
|
||||||
) {
|
) {
|
||||||
result = type + RedisKey.Delimiter_colon + key;
|
result = type + RedisKey.Delimiter_colon + key;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import rpc.protocols.FightInfoProto;
|
||||||
import rpc.protocols.MessageTypeProto;
|
import rpc.protocols.MessageTypeProto;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|
@ -96,13 +97,12 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
int challengeId = proto.getChalleageId();
|
int challengeId = proto.getChalleageId();
|
||||||
int battleRound = sWorldBossSetting.getBattleRound();
|
int battleRound = sWorldBossSetting.getBattleRound();
|
||||||
CommonProto.FightData fightData;
|
CommonProto.FightData fightData;
|
||||||
boolean isNew = !guildInfo.getCarFightSb().containsKey(uid);
|
|
||||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||||
|
|
||||||
AbstractRank personRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_RANK.getType());
|
AbstractRank personRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_RANK.getType());
|
||||||
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_GUILD_RANK.getType());
|
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_GUILD_RANK.getType());
|
||||||
switch (type){
|
switch (type){
|
||||||
case 1:{
|
case 1:{//挑战
|
||||||
int monsterId = STableManager.getConfig(SWorldBossConfig.class).get(GuildFightLogic.carDelayProgressIndication.getBossIndexId()).getMonsterId();
|
int monsterId = STableManager.getConfig(SWorldBossConfig.class).get(GuildFightLogic.carDelayProgressIndication.getBossIndexId()).getMonsterId();
|
||||||
PVEFightEvent pvpFightEvent = new PVEFightEvent(uid,teamId, battleRound,"", GameFightType.CarBossChallenge,monsterId,3);
|
PVEFightEvent pvpFightEvent = new PVEFightEvent(uid,teamId, battleRound,"", GameFightType.CarBossChallenge,monsterId,3);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||||
|
|
@ -116,15 +116,15 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
if(hurt!=0){
|
if(hurt!=0){
|
||||||
if (crossGroup > 0){
|
if (crossGroup > 0){
|
||||||
personRank.incrementCrossRankScore(uid,"",gainScore);
|
personRank.incrementCrossRankScore(uid,"",gainScore);
|
||||||
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore);
|
||||||
}else {
|
}else {
|
||||||
personRank.incrementRankScore(uid,"",gainScore);
|
personRank.incrementRankScore(uid,"",gainScore);
|
||||||
guildRank.incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
guildRank.incrementRankScore(guildInfo.getId(),"",gainScore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.CAR_PLAY,1);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.CAR_PLAY,1);
|
||||||
}break;
|
}break;
|
||||||
case 2:{
|
case 2:{//抢夺
|
||||||
FightResult fightResult;
|
FightResult fightResult;
|
||||||
String challengeName;
|
String challengeName;
|
||||||
String challengeNameColor;
|
String challengeNameColor;
|
||||||
|
|
@ -177,16 +177,16 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
if (crossGroup > 0){
|
if (crossGroup > 0){
|
||||||
personRank.incrementCrossRankScore(uid,"",gainScore);
|
personRank.incrementCrossRankScore(uid,"",gainScore);
|
||||||
personRank.incrementCrossRankScore(challengeId,"",-gainScore);
|
personRank.incrementCrossRankScore(challengeId,"",-gainScore);
|
||||||
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore);
|
||||||
if(challengeGuild!=0){
|
if(challengeGuild!=0){
|
||||||
guildRank.incrementCrossRankScore(challengeGuild,"",-gainScore,0);
|
guildRank.incrementCrossRankScore(challengeGuild,"",-gainScore);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
personRank.incrementRankScore(uid,"",gainScore);
|
personRank.incrementRankScore(uid,"",gainScore);
|
||||||
personRank.incrementRankScore(challengeId,"",-gainScore);
|
personRank.incrementRankScore(challengeId,"",-gainScore);
|
||||||
guildRank.incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
guildRank.incrementRankScore(guildInfo.getId(),"",gainScore);
|
||||||
if(challengeGuild!=0){
|
if(challengeGuild!=0){
|
||||||
guildRank.incrementRankScore(challengeGuild,"",-gainScore,0);
|
guildRank.incrementRankScore(challengeGuild,"",-gainScore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -229,6 +229,10 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
new Object[]{nameColor, user.getPlayerInfoManager().getNickName()});
|
new Object[]{nameColor, user.getPlayerInfoManager().getNickName()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 公会人数处理
|
||||||
|
carDealyFightPeopleNum(uid,guildInfo.getId());
|
||||||
|
|
||||||
hurt = fightResult.getDuration();
|
hurt = fightResult.getDuration();
|
||||||
String key;
|
String key;
|
||||||
String challengeKey;
|
String challengeKey;
|
||||||
|
|
@ -268,4 +272,13 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FAST_FIGHT_CHALLENGE_RESPONSE_VALUE,build,true);
|
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FAST_FIGHT_CHALLENGE_RESPONSE_VALUE,build,true);
|
||||||
ReportUtil.onReportEvent(user, ReportEventEnum.COMPLETE_CHECHI.getType(),sWorldBossSetting.getid(),type,1,gainScore);
|
ReportUtil.onReportEvent(user, ReportEventEnum.COMPLETE_CHECHI.getType(),sWorldBossSetting.getid(),type,1,gainScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int carDealyFightPeopleNum(int uid, int guildId){
|
||||||
|
HashSet value = RedisUtil.getInstence().getMapValue(RedisKey.CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM, "", String.valueOf(guildId), HashSet.class);
|
||||||
|
if (!value.contains(uid) && uid != 0){
|
||||||
|
value.add(uid);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM, "", String.valueOf(guildId),value);
|
||||||
|
}
|
||||||
|
return value.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,6 @@ public abstract class AbstractRank implements IRank {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public long getParam1(Double data) {
|
public long getParam1(Double data) {
|
||||||
|
|
||||||
return getDataByScore(data).length>0?getDataByScore(data)[0]:0;
|
return getDataByScore(data).length>0?getDataByScore(data)[0]:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,23 @@ import com.ljsd.jieling.core.FunctionIdEnum;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.handler.FastChallengeHandler;
|
||||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||||
|
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||||
|
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||||
import org.springframework.data.redis.core.ZSetOperations;
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
import rpc.protocols.PlayerInfoProto;
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
|
|
@ -22,6 +29,69 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
||||||
super(type, redisKey);
|
super(type, redisKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getCrossOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||||
|
GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(Integer.parseInt(data.getValue()));
|
||||||
|
if (mapEntry == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(mapEntry.getLeaderUId());
|
||||||
|
if (csPlayer == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
|
.setRank(index)
|
||||||
|
.setParam1(getParam1(data.getScore()))
|
||||||
|
.setParam2(getParam2(0,csPlayer.getGuildId()))
|
||||||
|
.setParam3(getParam3(data.getScore()));
|
||||||
|
CommonProto.UserRank.Builder oneUserRank = getCrossOneUserRank(csPlayer,everyRankInfo);
|
||||||
|
builder.addRanks(oneUserRank);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonProto.UserRank.Builder getFirstByCross(String rKey){
|
||||||
|
Set<ZSetOperations.TypedTuple<String>> rankByKey =
|
||||||
|
RedisUtil.getInstence().getZsetreverseRangeWithScores(getCrossRedisKey(),rKey, 0, 0, false);
|
||||||
|
CommonProto.UserRank.Builder builder = CommonProto.UserRank.newBuilder();
|
||||||
|
if(rankByKey.size()!=1){
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZSetOperations.TypedTuple<String> data = rankByKey.iterator().next();
|
||||||
|
GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(Integer.parseInt(data.getValue()));
|
||||||
|
if (mapEntry == null){
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(mapEntry.getLeaderUId());
|
||||||
|
if (csPlayer == null){
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
|
.setRank(1)
|
||||||
|
.setParam1(getParam1(data.getScore()))
|
||||||
|
.setParam2(getParam2(0, csPlayer.getGuildId()))
|
||||||
|
.setParam3(getParam3(data.getScore()));
|
||||||
|
builder = getCrossOneUserRank(csPlayer,everyRankInfo);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getCrossMyInfo(User user,String rkey,PlayerInfoProto.RankResponse.Builder allUserResponse){
|
||||||
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
|
if (guildId == 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int myRank= RedisUtil.getInstence().getZSetreverseRank(getCrossRedisKey(), rkey, Integer.toString(guildId),false).intValue();
|
||||||
|
Double zSetScore = RedisUtil.getInstence().getZSetScore(getCrossRedisKey(), rkey, Integer.toString(guildId),false);
|
||||||
|
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
|
.setRank(myRank)
|
||||||
|
.setParam1(getParam1(zSetScore))
|
||||||
|
.setParam2(getParam2(0,guildId))
|
||||||
|
.build();
|
||||||
|
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||||
TimeControllerOfFunction controller = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Car_Delay);
|
TimeControllerOfFunction controller = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Car_Delay);
|
||||||
|
|
@ -41,13 +111,12 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long[] getDataByScore(Double score) {
|
public long getParam1(Double data) {
|
||||||
return new long[]{ score.longValue()/1000,score.longValue()%1000};
|
return (long) getScore(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public int getParam2(int uid, int guildId) {
|
||||||
public double getScore(double... data) {
|
return FastChallengeHandler.carDealyFightPeopleNum(uid,guildId);
|
||||||
return (long) (data[0]*1000 + data[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -62,8 +131,7 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
||||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
.setRank(index)
|
.setRank(index)
|
||||||
.setParam1(getParam1(data.getScore()))
|
.setParam1(getParam1(data.getScore()))
|
||||||
.setParam2(getParam2(data.getScore()));
|
.setParam2(getParam2(0,guildId));
|
||||||
|
|
||||||
CommonProto.UserRank everyRank = CommonProto.UserRank.newBuilder()
|
CommonProto.UserRank everyRank = CommonProto.UserRank.newBuilder()
|
||||||
.setGuildName(familyName)
|
.setGuildName(familyName)
|
||||||
.setRankInfo(everyRankInfo)
|
.setRankInfo(everyRankInfo)
|
||||||
|
|
@ -79,7 +147,8 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
||||||
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
.setRank(myRank)
|
.setRank(myRank)
|
||||||
.setParam1(getParam1(zSetScore))
|
.setParam1(getParam1(zSetScore))
|
||||||
.setParam2(getParam2(zSetScore)).build();
|
.setParam2(getParam2(0,guildId))
|
||||||
|
.build();
|
||||||
allUserResponse.setMyRankInfo(towerRankInfo);
|
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue