Merge remote-tracking branch 'origin/master_test_gn' into master_test_gn
commit
b58df88870
|
@ -6,6 +6,8 @@ import com.ljsd.jieling.handler.map.MapManager;
|
|||
import com.ljsd.jieling.handler.map.TrialInfo;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
|
@ -38,28 +40,29 @@ class ExpectRankActivity extends AbstractActivity {
|
|||
@Override
|
||||
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
|
||||
|
||||
if(SGlobalActivity.getsGlobalActivityMap().get(id).getType() == 70){
|
||||
if (SGlobalActivity.getsGlobalActivityMap().get(id).getType() == 70) {
|
||||
//森罗幻境特殊处理
|
||||
if(SGlobalActivity.getsGlobalActivityMap().get(id).getOpenRanking()==1){
|
||||
if (SGlobalActivity.getsGlobalActivityMap().get(id).getOpenRanking() == 1) {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
//排除神秘关卡
|
||||
if(trialInfo.getFloor()<10000 && trialInfo.getFloor() > activityMission.getV()){
|
||||
activityMission.setV(trialInfo.getFloor());
|
||||
}else if(trialInfo.getFloor()>10000){
|
||||
activityMission.setV(trialInfo.getFloor()-10000);
|
||||
|
||||
int floor = 0 ;
|
||||
if (trialInfo.getFloor() < 10000 && trialInfo.getFloor() > activityMission.getV()) {
|
||||
floor = trialInfo.getFloor();
|
||||
} else if (trialInfo.getFloor() > 10000) {
|
||||
floor = trialInfo.getFloor() - 10000;
|
||||
}
|
||||
RankContext.getRankEnum(RankEnum.EXPERT_RANK.getType()).addRank(user.getId(),String.valueOf(id),activityMission.getV());
|
||||
}else{
|
||||
activityMission.setV(count + activityMission.getV());
|
||||
RankContext.getRankEnum(RankEnum.EXPERT_RANK.getType()).addRank(user.getId(), String.valueOf(id), floor);
|
||||
} else {
|
||||
activityMission.setV(count + activityMission.getV());
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
activityMission.setV(count + activityMission.getV());
|
||||
if(SGlobalActivity.getsGlobalActivityMap().get(id).getOpenRanking()==1){
|
||||
if (SGlobalActivity.getsGlobalActivityMap().get(id).getOpenRanking() == 1) {
|
||||
// String key = RedisKey.getKey(RedisKey.EXPERT_RANK, String.valueOf(id), false);
|
||||
// RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), activityMission.getV());
|
||||
RankContext.getRankEnum(RankEnum.EXPERT_RANK.getType()).addRank(user.getId(),String.valueOf(id),activityMission.getV());
|
||||
RankContext.getRankEnum(RankEnum.EXPERT_RANK.getType()).addRank(user.getId(), String.valueOf(id), activityMission.getV());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +103,7 @@ class ExpectRankActivity extends AbstractActivity {
|
|||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getV();
|
||||
if (value < values[1][0]) {
|
||||
// MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not");
|
||||
// MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -112,28 +115,27 @@ class ExpectRankActivity extends AbstractActivity {
|
|||
ThreadManager.getScheduledExecutor().execute(this::sendReward);
|
||||
}
|
||||
|
||||
protected void sendReward(){
|
||||
Thread.currentThread().setName("sendReward-Activity-"+id);
|
||||
protected void sendReward() {
|
||||
Thread.currentThread().setName("sendReward-Activity-" + id);
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if(sGlobalActivity.getOpenRanking()==0){
|
||||
if (sGlobalActivity.getOpenRanking() == 0) {
|
||||
return;
|
||||
}
|
||||
List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id);
|
||||
if(null==sActivityRankingReward) {
|
||||
if (null == sActivityRankingReward) {
|
||||
return;
|
||||
}
|
||||
int maxRank = 0;
|
||||
int maxRewardId = 0;
|
||||
Map<Integer, Integer> rank2miss = new HashMap<>();
|
||||
for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) {
|
||||
if(sActivityRankingReward1.getMaxRank()==-1){
|
||||
maxRank =-1;
|
||||
if (sActivityRankingReward1.getMaxRank() == -1) {
|
||||
maxRank = -1;
|
||||
maxRewardId = sActivityRankingReward1.getId();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(maxRank!=-1)
|
||||
{
|
||||
if (maxRank != -1) {
|
||||
maxRank = Math.max(maxRank, sActivityRankingReward1.getMaxRank());
|
||||
}
|
||||
|
||||
|
@ -184,15 +186,15 @@ class ExpectRankActivity extends AbstractActivity {
|
|||
//checkAndUpdate value
|
||||
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
|
||||
//sendmail
|
||||
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expertrank_activity_title", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expertrank_activity_txt", new Object[]{sGlobalActivity.getSesc(),ranking},new int[]{1,0},"#");
|
||||
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expertrank_activity_title", new Object[]{sGlobalActivity.getSesc()}, new int[]{1}, "#");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expertrank_activity_txt", new Object[]{sGlobalActivity.getSesc(), ranking}, new int[]{1, 0}, "#");
|
||||
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
rank++;
|
||||
}catch (Exception e) {
|
||||
LOGGER.error("id为{}的玩家,{}活动排行奖励没有发成功 e={}",uid,id,e);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("id为{}的玩家,{}活动排行奖励没有发成功 e={}", uid, id, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SChallengeStage;
|
||||
import config.SMonsterConfig;
|
||||
import config.SMonsterGroup;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -49,7 +51,7 @@ public class ChallengeLogic {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static Map<Integer, Integer> dropMap(SChallengeStage sChallengeConfig, int model, int type, int win, long[] result) {
|
||||
public static Map<Integer, Integer> dropMap(SChallengeStage sChallengeConfig, int model, int type, int win, long[] result,PlayerInfoProto.ChallengeResponse.Builder builder) {
|
||||
/*
|
||||
model //1为挑战 2为扫荡
|
||||
win // 1赢 0输
|
||||
|
@ -78,6 +80,7 @@ public class ChallengeLogic {
|
|||
}
|
||||
}
|
||||
LOGGER.info("zong reward");
|
||||
builder.setPercentReward(10000);
|
||||
}
|
||||
if (model == 1 && win == 1) {
|
||||
//打过
|
||||
|
@ -89,20 +92,40 @@ public class ChallengeLogic {
|
|||
}
|
||||
}
|
||||
LOGGER.info("tongguan reward");
|
||||
builder.setPercentReward(10000);
|
||||
builder.setLossBloodOrTimes(result[1]);
|
||||
LOGGER.info("win times 回合数:"+result[1]);
|
||||
} else if (model == 1 && win == 0) {
|
||||
//没打过
|
||||
int[][] reward1 = sChallengeConfig.getReward1();
|
||||
int ratio = 0;
|
||||
if (type == 1) {//无尽副本 血量
|
||||
long leaveHp = result[2] + result[3] + result[4]
|
||||
if (type == 2) {//无尽副本 血量
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(sChallengeConfig.getMonsterGroup());
|
||||
// 获取怪物组
|
||||
int[][] content = sMonsterGroup.getContents();
|
||||
double bossBlood = 0.0; //怪物初始化血量
|
||||
for (int i = 0; i < content.length; i++) {
|
||||
int[] ints = content[i];
|
||||
for (int j = 0; j < ints.length; j++) {
|
||||
if (ints[j] == 0){
|
||||
continue;
|
||||
}
|
||||
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(ints[j]);
|
||||
bossBlood+=monsterConfig.getHp();
|
||||
}
|
||||
}
|
||||
double leaveHp = result[2] + result[3] + result[4]
|
||||
+ result[5] + result[6];
|
||||
double lossBlood = bossBlood - leaveHp;
|
||||
for (int[] percent : reward1) {
|
||||
if (percent[0] > leaveHp) {
|
||||
if (percent[0] > lossBlood) {
|
||||
break;
|
||||
}
|
||||
ratio = percent[1];
|
||||
}
|
||||
} else if (type == 2) {//回合数
|
||||
LOGGER.info("输了 lossBlood:"+lossBlood);
|
||||
builder.setLossBloodOrTimes((long)lossBlood);
|
||||
} else if (type == 1) {//回合数
|
||||
long times = result[1];//回合数
|
||||
for (int[] percent : reward1) {
|
||||
if (percent[0] > times) {
|
||||
|
@ -110,6 +133,8 @@ public class ChallengeLogic {
|
|||
}
|
||||
ratio = percent[1];
|
||||
}
|
||||
builder.setLossBloodOrTimes(times);
|
||||
LOGGER.info("输了 回合数 times :"+times);
|
||||
}
|
||||
LOGGER.info("challengeHandler ====>id:{},ratio:{}", sChallengeConfig.getId(), ratio);
|
||||
for (int[] fix : sChallengeConfig.getPassReward()) {
|
||||
|
@ -120,6 +145,7 @@ public class ChallengeLogic {
|
|||
}
|
||||
}
|
||||
LOGGER.info("no pass reward percent");
|
||||
builder.setPercentReward(ratio);
|
||||
}
|
||||
return comDropMap;
|
||||
|
||||
|
@ -167,7 +193,7 @@ public class ChallengeLogic {
|
|||
return;
|
||||
}
|
||||
PlayerInfoProto.ChallengeResponse.Builder builder = PlayerInfoProto.ChallengeResponse.newBuilder();
|
||||
int type = proto.getType(); //1无尽 2宝物
|
||||
int type = proto.getType(); //1无尽 2宝物
|
||||
int model = proto.getModel(); //1为挑战 2为扫荡
|
||||
int id = proto.getId();
|
||||
SChallengeStage sChallengeConfig = STableManager.getConfig(SChallengeStage.class).get(id);
|
||||
|
@ -185,13 +211,13 @@ public class ChallengeLogic {
|
|||
if (model == 2) {
|
||||
//扫荡
|
||||
switch (type) {
|
||||
case 1:
|
||||
case 1: // 回合
|
||||
if (!limit(endlessNewReplicaLexel, id)) {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 2:// 血量
|
||||
if (!limit(treasureReplicaLexel, id)) {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
|
||||
return;
|
||||
|
@ -199,7 +225,7 @@ public class ChallengeLogic {
|
|||
break;
|
||||
}
|
||||
//扫荡 = 保底 +总奖励
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, null);
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, null,builder);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, comDropMap.entrySet().stream().map(n ->
|
||||
new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST_RETURN);
|
||||
builder.setDrop(drop);
|
||||
|
@ -230,23 +256,23 @@ public class ChallengeLogic {
|
|||
} else if (type == 2) {
|
||||
user.getPlayerInfoManager().setTreasureReplica(id);
|
||||
}
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(1);
|
||||
} else {
|
||||
if (type == 1){
|
||||
if((int) fightResult.getCheckResult()[1]>=20){
|
||||
//无尽副本回合数超过20 赢
|
||||
user.getPlayerInfoManager().setEndlessNewReplica(id);
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(1);
|
||||
}else{
|
||||
//没打过 //输了 保底+总奖励*奖励百分比
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(0);
|
||||
}
|
||||
}else if(type == 2){
|
||||
//没打过 //输了 保底+总奖励*奖励百分比
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(0);
|
||||
}
|
||||
}
|
||||
|
@ -262,6 +288,8 @@ public class ChallengeLogic {
|
|||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, comDropMap.entrySet().stream().map(n ->
|
||||
new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST_RETURN);
|
||||
builder.setDrop(drop);
|
||||
builder.setType(type);
|
||||
LOGGER.info("type :"+type);
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue