车迟斗法伤害溢出问题
parent
fb7ed91a36
commit
eb91e2169d
|
@ -20,18 +20,20 @@ import com.ljsd.jieling.logic.mission.GameEvent;
|
|||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.FightInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SWorldBossConfig;
|
||||
import config.SWorldBossSetting;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.FightInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightChallengeRequest>{
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
@ -44,7 +46,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
SWorldBossSetting sWorldBossSetting = STableManager.getConfig(SWorldBossSetting.class).get(1);
|
||||
GuildInfo guildInfo=null;
|
||||
GuildInfo guildInfo;
|
||||
int privilege;
|
||||
if(type == 1 || type == 2){
|
||||
guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
|
||||
|
@ -75,11 +77,11 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
|
||||
int hurt = 0;
|
||||
int gainScore = 0;
|
||||
int challeageId = proto.getChalleageId();
|
||||
long hurt;
|
||||
long gainScore = 0;
|
||||
int challengeId = proto.getChalleageId();
|
||||
int battleRound = sWorldBossSetting.getBattleRound();
|
||||
CommonProto.FightData fightData= null;
|
||||
CommonProto.FightData fightData;
|
||||
boolean isNew = !guildInfo.getCarFightSb().containsKey(uid);
|
||||
switch (type){
|
||||
case 1:{
|
||||
|
@ -89,9 +91,9 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
if(fightResult.getResult()==-1){
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
hurt = (int) fightResult.getDuration();
|
||||
hurt = fightResult.getDuration();
|
||||
fightData = fightResult.getFightData();
|
||||
gainScore = (int) (hurt*(sWorldBossSetting.getScorePercent()/10000F));
|
||||
gainScore = hurt*(sWorldBossSetting.getScorePercent()/10000);
|
||||
double myscore = gainScore;
|
||||
if(isNew){
|
||||
myscore+=TimeUtils.getDoubleTime();
|
||||
|
@ -103,13 +105,13 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.CAR_PLAY,1);
|
||||
}break;
|
||||
case 2:{
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarPersonChallenge,challeageId,GlobalsDef.CAR_DELAY_TEAM);
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarPersonChallenge,challengeId,GlobalsDef.CAR_DELAY_TEAM);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||
fightData = fightResult.getFightData();
|
||||
int fight = fightResult.getResult();
|
||||
String content;
|
||||
String challengeContent;
|
||||
PlayerManager playerInfoManager = UserManager.getUser(challeageId).getPlayerInfoManager();
|
||||
PlayerManager playerInfoManager = UserManager.getUser(challengeId).getPlayerInfoManager();
|
||||
String challengeName = playerInfoManager.getNickName();
|
||||
String challengeNameColor = playerInfoManager.getNameColor();
|
||||
String nameColor = user.getPlayerInfoManager().getNameColor();
|
||||
|
@ -118,16 +120,16 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
}
|
||||
|
||||
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));
|
||||
long challengeScore = RedisUtil.getInstence().getZSetScore(RankEnum.CAR_DEALY_RANK.getRedisKey(), "", String.valueOf(challengeId)).longValue();
|
||||
if(challengeScore !=-1){
|
||||
gainScore = challengeScore*(sWorldBossSetting.getGrabPercent()/10000);
|
||||
if(gainScore!=0){
|
||||
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_RANK.getType()).incrementRankScore(challengeId,"",-gainScore);
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
|
||||
int chanllengeGuild = playerInfoManager.getGuildId();
|
||||
if(chanllengeGuild!=0){
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(chanllengeGuild,"",-gainScore,0);
|
||||
int challengeGuild = playerInfoManager.getGuildId();
|
||||
if(challengeGuild!=0){
|
||||
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(challengeGuild,"",-gainScore,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,13 +143,13 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
challengeContent = SErrorCodeEerverConfig.getI18NMessage("worldboss_grab_lose",
|
||||
new Object[]{nameColor,user.getPlayerInfoManager().getNickName(),gainScore});
|
||||
}
|
||||
hurt = (int) fightResult.getDuration();
|
||||
hurt = fightResult.getDuration();
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(uid));
|
||||
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challeageId));
|
||||
String challengeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challengeId));
|
||||
if(hurt!=0){
|
||||
int time = (int) (System.currentTimeMillis() / 1000);
|
||||
RedisUtil.getInstence().zsetAddOne(key,content + "|" + challeageId+"|"+time,time);
|
||||
RedisUtil.getInstence().zsetAddOne(challenegeKey,challengeContent + "|" + uid+"|"+time, time);
|
||||
int time = TimeUtils.nowInt();
|
||||
RedisUtil.getInstence().zsetAddOne(key,content + "|" + challengeId+"|"+time,time);
|
||||
RedisUtil.getInstence().zsetAddOne(challengeKey,challengeContent + "|" + uid+"|"+time, time);
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.CAR_PLAY_LOOT,1);
|
||||
}break;
|
||||
|
|
|
@ -22,8 +22,8 @@ public enum RankEnum {
|
|||
RANDOM_CARD_PERFECT_RANK(11,RedisKey.RANDOM_CARD_PERFECT_RANK,RandomCardPerfectRank::new,false),//param1:时间 param2:英雄tempId param3:uid
|
||||
GUILD_BOSS_RANK(12,RedisKey.GUILD_BOSS_RANK,GuildBossRank::new,false),//param1:时间 param2:英雄tempId param3:uid
|
||||
GUILD_RED_PACKAGE_RANK(13,RedisKey.GUILD_RED_PACKAGE_RANK,GuildRedPackageRank::new,false),//param1:红包总价格 param2:无 param3:无
|
||||
CAR_DEALY_RANK(14,RedisKey.CAR_DEALY_RANK,CarDealyRank::new,false),//param1:伤害 param2:无 param3:无
|
||||
CAR_DEALY_GUILD_RANK(19,RedisKey.CAR_DEALY_GUILD_RANK,CarDealyGuildRank::new,false),//param1:伤害 param2:无 param3:无
|
||||
CAR_DEALY_RANK(14,RedisKey.CAR_DEALY_RANK,CarDealyRank::new,false),//车迟斗法个人 param1:伤害 param2:无 param3:无
|
||||
CAR_DEALY_GUILD_RANK(19,RedisKey.CAR_DEALY_GUILD_RANK,CarDealyGuildRank::new,false),//车迟斗法公会 param1:伤害 param2:无 param3:无
|
||||
DEATH_PATH_EVERY_PERSON_RANK(15,RedisKey.DEATH_PATH_EVERY_PERSON_RANK,DeathPathEveryPersonRank::new,true),//param1:当前阵玩家伤害 param2:无 param3:无
|
||||
DEATH_PATH_EVERY_GUILD_RANK(16,RedisKey.DEATH_PATH_EVERY_GUILD_RANK, DeathPathEveryGuildRank::new,true),//param1:当前阵公会伤害 param2:当前工会挑战人数 param3:无
|
||||
DEATH_PATH_TOTAL_PERSON_RANK(17,RedisKey.DEATH_PATH_TOTAL_PERSON_RANK,DeathPathTotalPersonRank::new,true),//param1:玩家总伤害 param2:无 param3:无
|
||||
|
|
|
@ -2,12 +2,11 @@ package com.ljsd.jieling.logic.rank.rankImpl;
|
|||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
public class CarDealyGuildRank extends AbstractRank{
|
||||
public CarDealyGuildRank(int type, String redisKey) {
|
||||
|
@ -21,8 +20,7 @@ public class CarDealyGuildRank extends AbstractRank{
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
long score = (long) (data[0]*1000 + data[1]);
|
||||
return score;
|
||||
return (long) (data[0]*1000 + data[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue