策划需求:车迟斗法功能修改

back_recharge
duhui 2023-01-13 10:58:23 +08:00
parent ab293afbb2
commit 3ed9406b49
9 changed files with 59 additions and 99 deletions

View File

@ -51,10 +51,11 @@ public class CarDelayFunction implements FunctionManager {
// 获取车迟斗法当前boss的索引id
int indexId = GuildFightLogic.carDelayProgressIndication.getBossIndexId();
// 根据索引id取出当前的奖励配置
Map<Integer, TreeMap<Integer, String>> rewardByTypeAndRankMap = SWorldBossRewardConfig.rewardByBossIdMap.get(indexId);
TreeMap<Integer, String> personRewardConfigTreeMap = rewardByTypeAndRankMap.get(2);
TreeMap<Integer, String> guildRewardConfigTreeMap = rewardByTypeAndRankMap.get(1);
Map<Integer, TreeMap<Long, String>> rewardByTypeAndRankMap = SWorldBossRewardConfig.rewardByBossIdMap.get(indexId);
// 个人
TreeMap<Long, String> personRewardConfigTreeMap = rewardByTypeAndRankMap.get(2);
// 工会
TreeMap<Long, String> guildRewardConfigTreeMap = rewardByTypeAndRankMap.get(1);
AbstractRank personRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_RANK.getType());
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.CAR_DEALY_GUILD_RANK.getType());
@ -70,18 +71,15 @@ public class CarDelayFunction implements FunctionManager {
guildRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(guildRank.getRedisKey(), "", 0, -1);
}
int rank=0;
// 个人
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();
int uid = Integer.parseInt(value);
String rewardByRank = personRewardConfigTreeMap.floorEntry(rank).getValue();
String personContent = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_personreward_txt",new Object[]{rank},new int[]{0},"#");
for(ZSetOperations.TypedTuple<String> rankInfo : personRangeWithScores){
int uid = Integer.parseInt(rankInfo.getValue());
long score = rankInfo.getScore().longValue();
String rewardByRank = personRewardConfigTreeMap.floorEntry(score).getValue();
String personContent = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_personreward_txt",new Object[]{score},new int[]{0},"#");
MailLogic.getInstance().sendMail(uid,personTitle,personContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
if(times++%20==0){
MongoUtil.getLjsdMongoTemplate().lastUpdate();
@ -89,32 +87,20 @@ public class CarDelayFunction implements FunctionManager {
}
MongoUtil.getLjsdMongoTemplate().lastUpdate();
// Map<Integer, Integer> userLevelGuildMap = RedisUtil.getInstence().getMapValues(RedisKey.USER_LEVEL_GUILD_INFO, "", Integer.class, Integer.class);
// Map<Integer,Set<Integer>> usersByGuildId = new HashMap<>();
// userLevelGuildMap.forEach((userId,guildId)->{
// usersByGuildId.putIfAbsent(guildId,new HashSet<>());
// usersByGuildId.get(guildId).add(userId);
// });
rank=0;
// 工会
String guildTitle = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_title");
for(ZSetOperations.TypedTuple<String> item : guildRangeWithScores){
rank++;
String value = item.getValue();
int guildId = Integer.parseInt(value);
String rewardByRank = guildRewardConfigTreeMap.floorEntry(rank).getValue();
for(ZSetOperations.TypedTuple<String> rankInfo : guildRangeWithScores){
int guildId = Integer.parseInt(rankInfo.getValue());
GuildInfo guildInfo = GuilidManager.getGuildInfo(guildId);
if(guildInfo==null){
continue;
}
long score = rankInfo.getScore().longValue();
String rewardByRank = guildRewardConfigTreeMap.floorEntry(score).getValue();
guildInfo.clearCarFightSb();
GuilidManager.saveOrUpdateGuildInfo(guildInfo);
Collection<Set<Integer>> values = guildInfo.getMembers().values();
// if(userLevelGuildMap.containsKey(guildId)){
// values.add(usersByGuildId.get(guildId));
// }
String guildContent = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_familyreward_txt",new Object[]{rank},new int[0],"#");
for(Set<Integer> uids : values){
String guildContent = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_familyreward_txt",new Object[]{score},new int[0],"#");
for(Set<Integer> uids : guildInfo.getMembers().values()){
for(Integer uid:uids){
MailLogic.getInstance().sendMail(uid,guildTitle,guildContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
if(times++%20==0){

View File

@ -249,7 +249,6 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
}break;
default:
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
// 公会人数处理
@ -278,13 +277,15 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
* @return
*/
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);
String key = RedisKey.CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM;
String guildIdStr = String.valueOf(guildId);
HashSet<Integer> value = RedisUtil.getInstence().getMapValue(key, "", guildIdStr, HashSet.class);
if (value == null){
value = new HashSet();
value = new HashSet<>();
}
if (!value.contains(uid) && uid != 0){
value.add(uid);
RedisUtil.getInstence().putMapEntry(RedisKey.CAR_DEALY_GUILD_FIGHT_PEOPLE_NUM, "", String.valueOf(guildId),value);
RedisUtil.getInstence().putMapEntry(key, "", guildIdStr,value);
}
return value.size();
}

View File

@ -1,6 +1,5 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.logic.dao.HeroManager;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;

View File

@ -4,14 +4,16 @@ import com.google.protobuf.GeneratedMessage;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import org.springframework.stereotype.Component;
import rpc.protocols.ActivityProto;
import rpc.protocols.MessageTypeProto;
import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @Author hj

View File

@ -1,16 +1,12 @@
package com.ljsd.jieling.handler.activity;
import com.google.protobuf.GeneratedMessage;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.activity.event.GoldRefreshEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.TaSuiLingXiaoEvent;
import com.ljsd.jieling.logic.dao.*;
@ -21,7 +17,6 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.rank.RankLogic;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import com.ljsd.jieling.util.ItemUtil;
import config.SMonsterConfig;
@ -30,8 +25,8 @@ import config.SNewHeroConfig;
import manager.STableManager;
import org.springframework.stereotype.Component;
import rpc.protocols.ActivityProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import java.util.ArrayList;
import java.util.HashMap;

View File

@ -67,7 +67,7 @@ public class GetCarChallengeListHandler extends BaseHandler {
int matchNums = matchSection[0] + matchSection[1];
GuildInfo guildInfo = GuilidManager.getGuildInfo(guildId);
Set<Integer> members = new HashSet<>();
guildInfo.getMembers().values().forEach(integers ->members.addAll(integers));
guildInfo.getMembers().values().forEach(members::addAll);
List<ZsetTypedTupleWithRank> beforeList = new ArrayList<>(5);
List<ZsetTypedTupleWithRank> afterList = new ArrayList<>(5);
@ -241,24 +241,6 @@ public class GetCarChallengeListHandler extends BaseHandler {
}
// private static void process(int start,int end,Set<Integer> members,int matchNums, Set<ZsetTypedTupleWithRank> infos){
// while (start>=0 && infos.size()<matchNums){
// 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));
// }
// rank++;
// }
// end=start;
// start-=matchNums;
// if(end<=0){
// break;
// }
// }
// }
static class ZsetTypedTupleWithRank{
ZSetOperations.TypedTuple<String> item;
int rank;

View File

@ -242,7 +242,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
// 如果鸿蒙碑开启 返回鸿蒙系统中神将返回鸿蒙碑等级
if (heroManager.getHongmengTablet() > 0) {
// 存在共鸣或者使者
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
if (heroManager.getResonances().containsValue(id) || heroManager.getHongmengGuards().containsValue(id)) {
// 鸿蒙碑超过等级上限,返回鸿蒙碑等级
if (heroManager.getHongmengTablet() <= maxLevel) {
return heroManager.getHongmengTablet();
@ -251,12 +251,12 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
return scHero.getMaxRank() >= 10 ? heroManager.getHongmengTablet() : maxLevel;
}
}
if (heroManager.getResonances().values().contains(id)) {
if (heroManager.getResonances().containsValue(id)) {
// 模板
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.LEVEL);
if (hongMengAddAttribute != null) {
// 是否达到限制等级
return hongMengAddAttribute.value >= maxLevel ? maxLevel : hongMengAddAttribute.value;
return Math.min(hongMengAddAttribute.value, maxLevel);
}
}
return level;
@ -363,11 +363,11 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
public int getBreakIdByHongMeng(HeroManager heroManager) {
// 英雄在共鸣池中
if (heroManager.getHongmengTablet() > 0){
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
if (heroManager.getResonances().containsValue(id) || heroManager.getHongmengGuards().containsValue(id)) {
return HeroLogic.getInstance().calRobotBreakByLevel(templateId, getLevel(heroManager));
}
}else{
if (heroManager.getResonances().values().contains(id)) {
if (heroManager.getResonances().containsValue(id)) {
return HeroLogic.getInstance().calRobotBreakByLevel(templateId, getLevel(heroManager));
}
}

View File

@ -1265,9 +1265,9 @@ public class GuildFightLogic {
return;
}
carProgressTmp = 1;
calendar.set(calendar.HOUR_OF_DAY,battleTime[1][0]);
calendar.set(calendar.MINUTE,battleTime[1][1]);
calendar.set(calendar.SECOND,0);
calendar.set(Calendar.HOUR_OF_DAY,battleTime[1][0]);
calendar.set(Calendar.MINUTE,battleTime[1][1]);
calendar.set(Calendar.SECOND,0);
endTime = (int)(calendar.getTimeInMillis()/1000);
}else if(sourceCompare>=grapCompareStart && sourceCompare<grapCompaeEnd){
@ -1275,14 +1275,14 @@ public class GuildFightLogic {
return;
}
carProgressTmp = 3;
calendar.set(calendar.HOUR_OF_DAY,grabTime[1][0]);
calendar.set(calendar.MINUTE,grabTime[1][1]);
calendar.set(calendar.SECOND,0);
calendar.set(Calendar.HOUR_OF_DAY,grabTime[1][0]);
calendar.set(Calendar.MINUTE,grabTime[1][1]);
calendar.set(Calendar.SECOND,0);
endTime = (int)(calendar.getTimeInMillis()/1000);
}else if(sourceCompare>=battleCompaeEnd && sourceCompare<grapCompareStart){
carProgressTmp = 2;
} else if(timeControllerOfFunction==null){
}else if(timeControllerOfFunction==null){
carProgressTmp = -5;
}else{
carProgressTmp = -1;
@ -1294,25 +1294,24 @@ public class GuildFightLogic {
if(sourceCompare>grapCompaeEnd){
calendar.setTimeInMillis(calendar.getTimeInMillis() + 24*3600*1000L);
}
calendar.set(calendar.HOUR_OF_DAY,grabTime[0][0]);
calendar.set(calendar.MINUTE,grabTime[0][1]);
calendar.set(calendar.SECOND,0);
calendar.set(Calendar.HOUR_OF_DAY,grabTime[0][0]);
calendar.set(Calendar.MINUTE,grabTime[0][1]);
calendar.set(Calendar.SECOND,0);
grapStartTime = (int)(calendar.getTimeInMillis()/1000);
calendar.set(calendar.HOUR_OF_DAY,battleTime[0][0]);
calendar.set(calendar.MINUTE,battleTime[0][1]);
calendar.set(calendar.SECOND,0);
calendar.set(Calendar.HOUR_OF_DAY,battleTime[0][0]);
calendar.set(Calendar.MINUTE,battleTime[0][1]);
calendar.set(Calendar.SECOND,0);
battleStartTime = (int)(calendar.getTimeInMillis()/1000);
carProgress = carProgressTmp;
carDelayProgressIndication= Family.CarDelayProgressIndication.newBuilder().setBossIndexId(id).setProgress(carProgress).setEndTime(endTime).
carDelayProgressIndication = Family.CarDelayProgressIndication.newBuilder().setBossIndexId(id).setProgress(carProgress).setEndTime(endTime).
setBattleStartTime(battleStartTime).setGrabStartTime(grapStartTime).
build();
sendAllProgressUpdate();
// System.out.println(JsonFormat.printToString(carDelayProgressIndication) + "--");
}
}
public static void sendAllProgressUpdate(){

View File

@ -21,30 +21,22 @@ public class SWorldBossRewardConfig implements BaseConfig {
private int bossId;
private long score;
/**
*
* bossid
*/
public static Map<Integer,TreeMap<Integer,String>> rewardByTypeAndRankMap = new HashMap<>();
/**
* bossid
*/
public static Map<Integer,TreeMap<Integer, TreeMap<Integer,String>>> rewardByBossIdMap = new HashMap<>();
public static Map<Integer,TreeMap<Integer, TreeMap<Long,String>>> rewardByBossIdMap = new HashMap<>();
@Override
public void init() throws Exception {
Map<Integer, SWorldBossRewardConfig> config = STableManager.getConfig(SWorldBossRewardConfig.class);
Map<Integer, TreeMap<Integer,String>> rewardByTypeAndRankMapTmp = new HashMap<>();
Map<Integer,TreeMap<Integer, TreeMap<Integer,String>>> rewardByBossIdMapTmp = new HashMap<>();
Map<Integer,TreeMap<Integer, TreeMap<Long,String>>> rewardByBossIdMapTmp = new HashMap<>();
config.forEach((id,item)->{
rewardByTypeAndRankMapTmp.putIfAbsent(item.getType(),new TreeMap<>());
rewardByTypeAndRankMapTmp.get(item.getType()).put(item.getSection()[0], StringUtil.parseArrayToString(item.getReward()));
rewardByBossIdMapTmp.putIfAbsent(item.getBossId(),new TreeMap<>());
rewardByBossIdMapTmp.get(item.getBossId()).putIfAbsent(item.getType(),new TreeMap<>());
rewardByBossIdMapTmp.get(item.getBossId()).get(item.getType()).put(item.getSection()[0], StringUtil.parseArrayToString(item.getReward()));
rewardByBossIdMapTmp.get(item.getBossId()).get(item.getType()).put(item.getScore(), StringUtil.parseArrayToString(item.getReward()));
});
rewardByTypeAndRankMap = rewardByTypeAndRankMapTmp;
rewardByBossIdMap = rewardByBossIdMapTmp;
}
@ -67,4 +59,8 @@ public class SWorldBossRewardConfig implements BaseConfig {
public int getBossId() {
return bossId;
}
public long getScore() {
return score;
}
}