车迟斗法挑战人数问题处理
parent
fe4e985187
commit
b0918e4071
|
@ -37,8 +37,9 @@ public class CarDelayFunction implements FunctionManager {
|
|||
String guildKey = RedisUtil.getInstence().getKey(guildRank.getRedisKey(), "");
|
||||
String crossKey = RedisUtil.getInstence().getKey(personRank.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);
|
||||
// String userLevelGuild = RedisUtil.getInstence().getKey(RedisKey.USER_LEVEL_GUILD_INFO, "");
|
||||
// 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_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";
|
||||
|
|
|
@ -1425,7 +1425,7 @@ public class RedisUtil {
|
|||
RedisKey.WORLD_ARENA_MY_PRON.equals(type) || RedisKey.WORLD_ARENA_RRECORD.equals(type) ||
|
||||
RedisKey.TOKEN.equals(type) || RedisKey.USER_SERVER_INFO.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;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import rpc.protocols.FightInfoProto;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
|
@ -96,13 +97,12 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
int challengeId = proto.getChalleageId();
|
||||
int battleRound = sWorldBossSetting.getBattleRound();
|
||||
CommonProto.FightData fightData;
|
||||
boolean isNew = !guildInfo.getCarFightSb().containsKey(uid);
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
|
||||
AbstractRank personRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_RANK.getType());
|
||||
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_GUILD_RANK.getType());
|
||||
switch (type){
|
||||
case 1:{
|
||||
case 1:{//挑战
|
||||
int monsterId = STableManager.getConfig(SWorldBossConfig.class).get(GuildFightLogic.carDelayProgressIndication.getBossIndexId()).getMonsterId();
|
||||
PVEFightEvent pvpFightEvent = new PVEFightEvent(uid,teamId, battleRound,"", GameFightType.CarBossChallenge,monsterId,3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||
|
@ -116,15 +116,15 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
if(hurt!=0){
|
||||
if (crossGroup > 0){
|
||||
personRank.incrementCrossRankScore(uid,"",gainScore);
|
||||
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
||||
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore);
|
||||
}else {
|
||||
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);
|
||||
}break;
|
||||
case 2:{
|
||||
case 2:{//抢夺
|
||||
FightResult fightResult;
|
||||
String challengeName;
|
||||
String challengeNameColor;
|
||||
|
@ -177,16 +177,16 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
if (crossGroup > 0){
|
||||
personRank.incrementCrossRankScore(uid,"",gainScore);
|
||||
personRank.incrementCrossRankScore(challengeId,"",-gainScore);
|
||||
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
||||
guildRank.incrementCrossRankScore(guildInfo.getId(),"",gainScore);
|
||||
if(challengeGuild!=0){
|
||||
guildRank.incrementCrossRankScore(challengeGuild,"",-gainScore,0);
|
||||
guildRank.incrementCrossRankScore(challengeGuild,"",-gainScore);
|
||||
}
|
||||
}else {
|
||||
personRank.incrementRankScore(uid,"",gainScore);
|
||||
personRank.incrementRankScore(challengeId,"",-gainScore);
|
||||
guildRank.incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
||||
guildRank.incrementRankScore(guildInfo.getId(),"",gainScore);
|
||||
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()});
|
||||
}
|
||||
}
|
||||
|
||||
// 公会人数处理
|
||||
carDealyFightPeopleNum(uid,guildInfo.getId());
|
||||
|
||||
hurt = fightResult.getDuration();
|
||||
String key;
|
||||
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);
|
||||
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
|
||||
public long getParam1(Double data) {
|
||||
|
||||
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.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.FastChallengeHandler;
|
||||
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.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.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
|
@ -22,6 +29,69 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
|||
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
|
||||
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
TimeControllerOfFunction controller = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Car_Delay);
|
||||
|
@ -41,13 +111,12 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
|||
}
|
||||
|
||||
@Override
|
||||
public long[] getDataByScore(Double score) {
|
||||
return new long[]{ score.longValue()/1000,score.longValue()%1000};
|
||||
public long getParam1(Double data) {
|
||||
return (long) getScore(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return (long) (data[0]*1000 + data[1]);
|
||||
public int getParam2(int uid, int guildId) {
|
||||
return FastChallengeHandler.carDealyFightPeopleNum(uid,guildId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,8 +131,7 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
|||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()));
|
||||
|
||||
.setParam2(getParam2(0,guildId));
|
||||
CommonProto.UserRank everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setGuildName(familyName)
|
||||
.setRankInfo(everyRankInfo)
|
||||
|
@ -79,7 +147,8 @@ public class CarDealyGuildRank extends CrossGuildForceRank{
|
|||
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(myRank)
|
||||
.setParam1(getParam1(zSetScore))
|
||||
.setParam2(getParam2(zSetScore)).build();
|
||||
.setParam2(getParam2(0,guildId))
|
||||
.build();
|
||||
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue