Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
e82caddb52
|
@ -102,8 +102,8 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
|
|||
calendar.set(Calendar.MINUTE,0);
|
||||
calendar.set(Calendar.SECOND,0);
|
||||
long timeInMillis = calendar.getTimeInMillis();
|
||||
sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000);
|
||||
sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000);
|
||||
sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L);
|
||||
sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L);
|
||||
} else {
|
||||
sGlobalSystemConfig.setSeasonOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonOpen(), TimeUtils.Stand_CeHua_Data_format));
|
||||
sGlobalSystemConfig.setSeasonEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonEnd(), TimeUtils.Stand_CeHua_Data_format));
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.config.clazzStaticCfg;
|
|||
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SEquipConfig;
|
||||
import config.SJewelConfig;
|
||||
import config.SRewardGroup;
|
||||
import config.SRewardItem;
|
||||
import manager.AbstractClassStaticConfig;
|
||||
|
@ -21,11 +22,15 @@ public class ItemStaticConfig extends AbstractClassStaticConfig {
|
|||
|
||||
private Map<Integer,Map<Integer,Integer>> euipTppes;
|
||||
|
||||
private Map<Integer,Map<Integer,Integer>> race2quality2soulid; //魂宝索引
|
||||
private Map<Integer,Map<Integer,Integer>> race2quality2id;//灵宝索引
|
||||
|
||||
@Override
|
||||
public void registConfigs(Set<String> registConfigs) {
|
||||
registConfigs.add(SRewardItem.class.getAnnotation(Table.class).name());
|
||||
registConfigs.add(SRewardGroup.class.getAnnotation(Table.class).name());
|
||||
registConfigs.add(SEquipConfig.class.getAnnotation(Table.class).name());
|
||||
registConfigs.add(SJewelConfig.class.getAnnotation(Table.class).name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,6 +53,30 @@ public class ItemStaticConfig extends AbstractClassStaticConfig {
|
|||
}catch (Exception e){
|
||||
LOGGER.error("exception");
|
||||
}
|
||||
|
||||
try {
|
||||
race2quality2soulid = new HashMap<>();
|
||||
race2quality2id = new HashMap<>();
|
||||
Map<Integer, SJewelConfig> config = STableManager.getConfig(SJewelConfig.class);
|
||||
config.forEach((k,v)->{
|
||||
int type = v.getLocation();
|
||||
int race = v.getRace();
|
||||
if(type==1){
|
||||
|
||||
Map<Integer, Integer> orDefault = race2quality2soulid.getOrDefault(race, new HashMap<>());
|
||||
orDefault.putIfAbsent(v.getLevel(),k);
|
||||
race2quality2soulid.putIfAbsent(race,orDefault);
|
||||
}else {
|
||||
Map<Integer, Integer> orDefault = race2quality2id.getOrDefault(race, new HashMap<>());
|
||||
orDefault.putIfAbsent(v.getLevel(),k);
|
||||
race2quality2id.putIfAbsent(race,orDefault);
|
||||
}
|
||||
|
||||
});
|
||||
}catch (Exception e){
|
||||
LOGGER.error("exception");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, Integer>> getEuipTppes() {
|
||||
|
@ -62,4 +91,27 @@ public class ItemStaticConfig extends AbstractClassStaticConfig {
|
|||
return integerIntegerMap.getOrDefault(star,0);
|
||||
}
|
||||
|
||||
public int getJewelIdByparam(int type,int race,int level) {
|
||||
if(type==1){
|
||||
Map<Integer, Integer> integerIntegerMap = race2quality2soulid.get(race);
|
||||
if(null == integerIntegerMap){
|
||||
return 0;
|
||||
}
|
||||
return integerIntegerMap.getOrDefault(level,0);
|
||||
}else{
|
||||
Map<Integer, Integer> integerIntegerMap = race2quality2id.get(race);
|
||||
if(null == integerIntegerMap){
|
||||
return 0;
|
||||
}
|
||||
return integerIntegerMap.getOrDefault(level,0);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, Integer>> getRace2quality2soulid() {
|
||||
return race2quality2soulid;
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, Integer>> getRace2quality2id() {
|
||||
return race2quality2id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public enum FunctionIdEnum {
|
|||
WorkShopRebuildEquip(104,null,MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
|
||||
Expedition(64,null),
|
||||
Achieve(65,null),
|
||||
DeathPath(72,null),
|
||||
Car_Delay(73,new CarDelayFunction()),
|
||||
;
|
||||
|
||||
|
|
|
@ -240,5 +240,7 @@ public interface BIReason {
|
|||
int GUILD_SKILL_LEVEL_UP_CONSUME = 1056;//工会技能升级消耗
|
||||
int FETE_CONSUME = 1057;//祭祀消耗
|
||||
|
||||
int COMPLEX_JEVEL_EQUIP_CONSUME = 1058; //合成宝器
|
||||
|
||||
|
||||
}
|
|
@ -187,7 +187,6 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
|||
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||
response.addAllEquipIds(equipadds);
|
||||
response.setDrop(drop);
|
||||
System.out.print(response.build().toString());
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
package com.ljsd.jieling.handler.equip;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.ItemStaticConfig;
|
||||
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.logic.dao.Jewel;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SJewelConfig;
|
||||
import manager.STableManager;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Description: 宝物合成
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/5/8 11:51
|
||||
*/
|
||||
public class ComplexJewelEquipRequestHandler extends BaseHandler<HeroInfoProto.ComplexJewelEquipRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.ComplexJewelEquipRequest proto) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
if (proto.getTargetleve() != 0) {//手动合成
|
||||
//check param and cnf
|
||||
if (proto.getNum() <= 0) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
|
||||
int needLeve = proto.getTargetleve() - 1;
|
||||
if (needLeve <= 0) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
int targetEquip = STableManager.getFigureConfig(ItemStaticConfig.class).getJewelIdByparam(proto.getType(),proto.getRance(), proto.getTargetleve());
|
||||
if (targetEquip == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
int needEquip = STableManager.getFigureConfig(ItemStaticConfig.class).getJewelIdByparam(proto.getType(),proto.getRance(), needLeve);
|
||||
if (needEquip == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
SJewelConfig sEquipStarsConfig = STableManager.getConfig(SJewelConfig.class).get(needEquip);
|
||||
if (null == sEquipStarsConfig) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
SJewelConfig sTargetEquipStarsConfig = STableManager.getConfig(SJewelConfig.class).get(targetEquip);
|
||||
if (null == sTargetEquipStarsConfig) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
|
||||
// Set<String> equipByIDs = ItemLogic.getJewelEquip(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace());
|
||||
TreeSet<String> equipByIDs = ItemLogic.getJewelEquipWithLeve(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace(),needLeve);
|
||||
|
||||
int needcount = sEquipStarsConfig.getRankupCount();
|
||||
if (equipByIDs.size() / needcount < proto.getNum()) {
|
||||
//数据不够
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
//check cost
|
||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||
for (int i = 0; i < proto.getNum(); i++) {
|
||||
int[][] sumConsume = sTargetEquipStarsConfig.getRankupResources();
|
||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||
}
|
||||
boolean enough = ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_JEVEL_EQUIP_CONSUME, 0);
|
||||
if (!enough) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
//drop
|
||||
int[][] dropItems = new int[1][];
|
||||
dropItems[0] = new int[2];
|
||||
dropItems[0][0] = sTargetEquipStarsConfig.getId();
|
||||
dropItems[0][1] = proto.getNum();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
|
||||
HeroInfoProto.ComplexJewelEquipResponse.Builder response = HeroInfoProto.ComplexJewelEquipResponse.newBuilder();
|
||||
|
||||
//remove old 宝器
|
||||
int i = 1;
|
||||
for (String id : equipByIDs) {
|
||||
if (i > proto.getNum() * needcount) {
|
||||
break;
|
||||
}
|
||||
response.addEquipIds(id);
|
||||
user.getEquipManager().remove(id);
|
||||
i++;
|
||||
}
|
||||
response.setDrop(drop);
|
||||
MessageUtil.sendIndicationMessage(user.getId(), response.build());
|
||||
|
||||
} else {
|
||||
|
||||
Map<Integer, Map<Integer, Integer>> race2quality2soulid = STableManager.getFigureConfig(ItemStaticConfig.class).getRace2quality2soulid();
|
||||
Map<Integer, Map<Integer, Integer>> race2quality2id = STableManager.getFigureConfig(ItemStaticConfig.class).getRace2quality2id();
|
||||
|
||||
Map<Integer, Integer> soulInnerMap = new TreeMap<>(race2quality2soulid.getOrDefault(proto.getRance(), new HashMap<>()));
|
||||
Map<Integer, Integer> innerMap = new TreeMap<>(race2quality2id.getOrDefault(proto.getRance(), new HashMap<>()));
|
||||
|
||||
Set<String> equipadds =new HashSet<>();
|
||||
List< CommonProto.Equip> equips = new LinkedList<>();
|
||||
combineEquip(user,soulInnerMap,equips,equipadds);
|
||||
combineEquip(user,innerMap,equips,equipadds);
|
||||
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder().addAllSoulEquip(equips);
|
||||
HeroInfoProto.ComplexJewelEquipResponse.Builder response = HeroInfoProto.ComplexJewelEquipResponse.newBuilder();
|
||||
response.addAllEquipIds(equipadds);
|
||||
response.setDrop(drop);
|
||||
MessageUtil.sendIndicationMessage(user.getId(), response.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void combineEquip(User user, Map<Integer, Integer> integerIntegerMap ,List<CommonProto.Equip> equips,Set<String> equipadds) throws Exception {
|
||||
|
||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||
Set<String> newids = new HashSet<>();
|
||||
Map<Integer, Integer> consumeMapTem = new HashMap<>();
|
||||
for (Map.Entry<Integer, Integer> entry : integerIntegerMap.entrySet()) {
|
||||
//star conf
|
||||
int targetstar = entry.getKey()+1;
|
||||
|
||||
if(!integerIntegerMap.containsKey(targetstar)){
|
||||
break;
|
||||
}
|
||||
|
||||
SJewelConfig sTargetEquipStarsConfig = STableManager.getConfig(SJewelConfig.class).get(integerIntegerMap.get(targetstar));
|
||||
if (null == sTargetEquipStarsConfig) {
|
||||
break;
|
||||
}
|
||||
SJewelConfig sEquipStarsConfig = STableManager.getConfig(SJewelConfig.class).get(entry.getValue());
|
||||
if (null == sEquipStarsConfig) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
TreeSet<String> equipByIDs = ItemLogic.getJewelEquipWithLeve(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace(),entry.getKey());
|
||||
int canConNum =equipByIDs.size()/sEquipStarsConfig.getRankupCount();
|
||||
if(canConNum<=0){
|
||||
continue;
|
||||
}
|
||||
//check cost
|
||||
boolean enough;
|
||||
int needcount=0;
|
||||
|
||||
for (int i = 0; i < canConNum; i++) {
|
||||
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMapTem);
|
||||
enough = ItemUtil.checkCost(user, consumeMapTem);
|
||||
if (!enough) {
|
||||
break;
|
||||
}
|
||||
|
||||
//生成装备 混合消耗
|
||||
Jewel equip = new Jewel(user.getId(),sTargetEquipStarsConfig.getId());
|
||||
user.getEquipManager().addEquip(user,equip);
|
||||
newids.add(equip.getId());//后面合成可能会被删除
|
||||
|
||||
needcount += sEquipStarsConfig.getRankupCount();
|
||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||
}
|
||||
|
||||
//消耗装备
|
||||
int i = 1;
|
||||
for (String id : equipByIDs.descendingSet()) {
|
||||
if (i > needcount) {
|
||||
break;
|
||||
}
|
||||
if(!newids.contains(id)){
|
||||
equipadds.add(id);
|
||||
}else {
|
||||
newids.remove(id);
|
||||
}
|
||||
user.getEquipManager().remove(id);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for (String id:newids) {
|
||||
equips.add(CBean2Proto.getEquipProto( user.getEquipManager().getEquipMap().get(id)));
|
||||
}
|
||||
ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -348,7 +348,7 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
long maxTime;
|
||||
VipInfo newVipInfo = new VipInfo();
|
||||
if(config.getContinueTime()!=null){
|
||||
if(config.getContinueTime()!=null&&config.getContinueTime().length>0){
|
||||
if(vipInfo.containsKey(privilageId)){
|
||||
if(config.getContinueTime()[1]==1&&TimeUtils.now()/1000<vipInfo.get(privilageId).getEffectTime()){
|
||||
if(config.getCondition().length==1&&config.getCondition()[0][0]==0){
|
||||
|
|
|
@ -16,7 +16,7 @@ public class DeathChallengeCount {
|
|||
return userReward;
|
||||
}
|
||||
|
||||
public void setUserReward(int uid,DeathReward reward) {
|
||||
public void putUserReward(int uid,DeathReward reward) {
|
||||
userReward.put(uid,reward);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -16,6 +20,7 @@ import com.ljsd.jieling.logic.fight.FightDispatcher;
|
|||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
|
@ -25,12 +30,14 @@ import com.ljsd.jieling.protocols.Family;
|
|||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGuildSetting;
|
||||
import config.SGuildWarConfig;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
@ -75,62 +82,109 @@ public class DeathPathLogic {
|
|||
* 检查是否在开启状态
|
||||
*/
|
||||
public void statusCheck(){
|
||||
Runnable runnable = this::doCheck;
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
|
||||
private void doCheck(){
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.DeathPath);
|
||||
if(timeControllerOfFunction==null){
|
||||
status = -1;
|
||||
return;
|
||||
}
|
||||
if(guildWarOpenTime==null){
|
||||
guildWarOpenTime = SGuildSetting.sGuildSetting.getGuildWarOpenTime();
|
||||
guildWarOpenTime = new int[8];
|
||||
int[] setting = SGuildSetting.sGuildSetting.getGuildWarOpenTime();
|
||||
if(setting[0]==2){
|
||||
for(int i = 1;i<setting.length;i++){
|
||||
guildWarOpenTime[setting[i]]= 1;
|
||||
if(setting[i]!=7){
|
||||
guildWarOpenTime[setting[i]+1]= -1;
|
||||
}else{
|
||||
guildWarOpenTime[1] = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(int i = 0 ; i<guildWarOpenTime.length;i++){
|
||||
guildWarOpenTime[i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(guildWarTime==null){
|
||||
guildWarTime = SGuildSetting.sGuildSetting.getGuildWarTime();
|
||||
}
|
||||
boolean result = false;
|
||||
if(guildWarOpenTime[0]==2){
|
||||
int dayOfWeek = TimeUtils.getDayOfWeek();
|
||||
for(int i = 1;i<guildWarOpenTime.length;i++){
|
||||
if(guildWarOpenTime[i]!=dayOfWeek){
|
||||
continue;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}else if(guildWarOpenTime[0]==1){
|
||||
result = true;
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
if(result) {
|
||||
Runnable runnable = this::isOpen;
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
// boolean result = false;
|
||||
// if(guildWarOpenTime[0]==2){
|
||||
// for(int i = 1;i<guildWarOpenTime.length;i++){
|
||||
// if(guildWarOpenTime[i]!=dayOfWeek){
|
||||
// continue;
|
||||
// }
|
||||
// result = true;
|
||||
// break;
|
||||
// }
|
||||
// }else if(guildWarOpenTime[0]==1){
|
||||
// result = true;
|
||||
// }else{
|
||||
// return;
|
||||
// }
|
||||
isOpen();
|
||||
|
||||
}
|
||||
private void isOpen(){
|
||||
int hourOfDay = TimeUtils.getHourOfDay();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
int tempTime = hourOfDay*100+minute;
|
||||
int currStatus = 0;
|
||||
for(int i = 0;i<guildWarTime.length-1;i++){
|
||||
int tempSmall = guildWarTime[i][0]*100+guildWarTime[i][1];
|
||||
int tempBig = guildWarTime[i+1][0]*100+guildWarTime[i+1][1];
|
||||
int dayOfWeek = TimeUtils.getDayOfWeek();
|
||||
int currStatus=0;
|
||||
int dayStats = guildWarOpenTime[dayOfWeek];
|
||||
//当前时间与表配置时间判断 获得 currStatus
|
||||
if(dayStats==-1){
|
||||
//领奖阶段
|
||||
currStatus = 2;
|
||||
}else if (dayStats==1){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int hourOfDay = TimeUtils.getHourOfDay();
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
int tempTime = hourOfDay*100+minute;
|
||||
if(guildWarTime.length!=2){
|
||||
return;
|
||||
}
|
||||
|
||||
int tempSmall = guildWarTime[0][0]*100+guildWarTime[0][1];
|
||||
|
||||
int tempBig = guildWarTime[1][0]*100+guildWarTime[1][1];
|
||||
|
||||
if(tempTime>=tempSmall&&tempTime<tempBig){
|
||||
currStatus = i+1;
|
||||
break;
|
||||
currStatus = 1;
|
||||
}else if(tempTime>=tempBig){
|
||||
currStatus = 2;
|
||||
}
|
||||
}
|
||||
// currStatus与服务器当前status比较,如果不同,认为状态修改
|
||||
if(currStatus!=status){
|
||||
status = currStatus;
|
||||
overTime = (int)(TimeUtils.getAppointTime(guildWarTime[status][0],guildWarTime[status][1])/1000);
|
||||
if(status==1){
|
||||
overTime = (int)(TimeUtils.getAppointTime(guildWarTime[status][0],guildWarTime[status][1])/1000);
|
||||
}
|
||||
if(status==1){
|
||||
if (taskExecutor == null) {
|
||||
taskExecutor = new DeathPathExecutor(tasks);
|
||||
taskExecutor.start();
|
||||
}
|
||||
}
|
||||
if(status==0){
|
||||
try {
|
||||
deleteDeathPathInfo();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println("状态修改-------");
|
||||
//阶段信息改变发送推送
|
||||
for(Map.Entry<Integer, ISession> sessionEntry:OnlineUserManager.sessionMap.entrySet()) {
|
||||
Family.DeathPathStatusChangeIndication indication = Family.DeathPathStatusChangeIndication.newBuilder().setStatus(status).build();
|
||||
MessageUtil.sendIndicationMessage(sessionEntry.getValue(),1, MessageTypeProto.MessageType.DEATH_PATH_STATUS_CHANGE_INDICATION.getNumber(),indication,true);
|
||||
}
|
||||
}
|
||||
System.out.println("status="+status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,10 +232,14 @@ public class DeathPathLogic {
|
|||
* @param messageType
|
||||
*/
|
||||
public void challenge(ISession session, int pathId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = session.getUid();
|
||||
String count = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_CHALLENGE_COUNT, String.valueOf(uid),String.class);
|
||||
if(!StringUtil.isEmpty(count)&&Integer.parseInt(count)>=SGuildSetting.sGuildSetting.getChallengeMaxTime()){
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
||||
}
|
||||
if(status!=1){
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
SGuildWarConfig config = STableManager.getConfig(SGuildWarConfig.class).get(pathId);
|
||||
|
@ -231,14 +289,15 @@ public class DeathPathLogic {
|
|||
}
|
||||
private void taskDoExecute(DeathPathTask task){
|
||||
|
||||
//公会总进攻次数
|
||||
//公会总进攻人数
|
||||
// task.setDamage(20000000);
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PAHT_TOTAL_CHALLENGE_COUNT, String.valueOf(task.getGuildId()), DeathChallengeCount.class);
|
||||
if (countInfo==null){
|
||||
countInfo = new DeathChallengeCount();
|
||||
countInfo.setUserReward(task.getUid(),null);
|
||||
countInfo.putUserReward(task.getUid(),new DeathReward());
|
||||
RedisUtil.getInstence().set(RedisKey.DEATH_PAHT_TOTAL_CHALLENGE_COUNT, String.valueOf(task.getGuildId()),countInfo);
|
||||
}else if(!countInfo.getUserReward().containsKey(task.getUid())) {
|
||||
countInfo.setUserReward(task.getUid(),null);
|
||||
countInfo.putUserReward(task.getUid(),new DeathReward());
|
||||
RedisUtil.getInstence().set(RedisKey.DEATH_PAHT_TOTAL_CHALLENGE_COUNT, String.valueOf(task.getGuildId()), countInfo);
|
||||
}
|
||||
//操作每个关的公会数据
|
||||
|
@ -273,7 +332,7 @@ public class DeathPathLogic {
|
|||
guildTotalRank.addRank(task.getGuildId(),"",task.getDamage());
|
||||
}else{
|
||||
guildTotalRank.addRank(currFirstGuildId,"",task.getDamage(),1);
|
||||
guildTotalRank.addRank(firstGuildId,"",task.getDamage(),-1);
|
||||
guildTotalRank.addRank(firstGuildId,"",0,-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,13 +387,13 @@ public class DeathPathLogic {
|
|||
//您所在的公会或您没有达到领奖条件
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if(countInfo.getUserReward().get(uid)!=null){
|
||||
if(countInfo.getUserReward().get(uid).getPosition()!=0){
|
||||
//您已领取过奖励
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
countInfo = new DeathChallengeCount();
|
||||
|
||||
countInfo.setUserReward(uid,new DeathReward(reward[0],reward[1],position));
|
||||
countInfo.putUserReward(uid,new DeathReward(reward[0],reward[1],position));
|
||||
RedisUtil.getInstence().set(RedisKey.DEATH_PAHT_TOTAL_CHALLENGE_COUNT, String.valueOf(guildId),countInfo);
|
||||
ItemUtil.drop(user,new int[][]{reward},BIReason.DEATH_PAHT_RANDOM_REWARD);
|
||||
Family.RewardInfo info = Family.RewardInfo.newBuilder().setUid(uid).setItemCount(reward[1]).setItemId(reward[0]).setPosition(position).build();
|
||||
|
@ -343,6 +402,49 @@ public class DeathPathLogic {
|
|||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//清除排行信息
|
||||
private void deleteDeathPathInfo() throws Exception {
|
||||
//todo 邮件自动发奖
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
AbstractRank personRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_PERSON_RANK.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> guildRankSet = guildRank.getRankByKey("", 0, -1);
|
||||
Set<ZSetOperations.TypedTuple<String>> personRankSet = personRank.getRankByKey("", 0, -1);
|
||||
if(guildRankSet.isEmpty()&&personRankSet.isEmpty()){
|
||||
return;
|
||||
}
|
||||
String[] removeGuildKey = new String[guildRankSet.size()];
|
||||
String[] removePersonKey = new String[personRankSet.size()];
|
||||
int index = 0;
|
||||
for(ZSetOperations.TypedTuple<String> item:guildRankSet){
|
||||
removeGuildKey[index] = RedisKey.getKey(RedisKey.DEATH_PAHT_TOTAL_CHALLENGE_COUNT, item.getValue(),false);
|
||||
index++;
|
||||
}
|
||||
index = 0;
|
||||
for(ZSetOperations.TypedTuple<String> item:personRankSet){
|
||||
removePersonKey[index] = RedisKey.getKey(RedisKey.DEATH_PATH_CHALLENGE_COUNT, item.getValue(),false);
|
||||
index++;
|
||||
}
|
||||
String mailTitle = SErrorCodeEerverConfig.getI18NMessage("guildwar_reward_title");
|
||||
String mailContent = SErrorCodeEerverConfig.getI18NMessage("guildwar_reward_txt");
|
||||
for(String key:removeGuildKey){
|
||||
DeathChallengeCount reward = redisUtil.getObject(key, DeathChallengeCount.class);
|
||||
if(reward!=null&&reward.getUserReward().size()!=0){
|
||||
Map<Integer, DeathReward> userReward = reward.getUserReward();
|
||||
for(Map.Entry<Integer, DeathReward> rewardEntry:userReward.entrySet()){
|
||||
if(rewardEntry.getValue().getPosition()==0){
|
||||
MailLogic.getInstance().sendMail(rewardEntry.getKey(),mailTitle,mailContent,"16#100",TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
redisUtil.del(removeGuildKey);
|
||||
redisUtil.del(removePersonKey);
|
||||
for(int i = 1; i <=10;i++){
|
||||
redisUtil.del(RedisKey.getKey(RankEnum.DEATH_PATH_EVERY_GUILD_RANK.getRedisKey(),String.valueOf(i),false));
|
||||
redisUtil.del(RedisKey.getKey(RankEnum.DEATH_PATH_EVERY_PERSON_RANK.getRedisKey(),String.valueOf(i),false));
|
||||
}
|
||||
redisUtil.del(RedisKey.getKey(guildRank.getRedisKey(),"",false));
|
||||
redisUtil.del(RedisKey.getKey(personRank.getRedisKey(),"",false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ public class DeathReward {
|
|||
this.position = position;
|
||||
}
|
||||
|
||||
public DeathReward() {
|
||||
}
|
||||
|
||||
public DeathReward(int itemId, int itemCount, int position) {
|
||||
this.itemId = itemId;
|
||||
this.itemCount = itemCount;
|
||||
|
|
|
@ -51,10 +51,7 @@ public class GuildLogic {
|
|||
};
|
||||
|
||||
public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder)throws Exception {
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if(guildId != 0){
|
||||
takeAllReward(user);
|
||||
}
|
||||
takeAllReward(user);
|
||||
|
||||
user.getGuildMyInfo().setFetetype(0);
|
||||
user.getGuildMyInfo().clearHadTakeReward();
|
||||
|
@ -78,7 +75,7 @@ public class GuildLogic {
|
|||
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if(guildId == 0){
|
||||
throw new ErrorCodeException(ErrorCode.FAMILY_NO);
|
||||
return;
|
||||
}
|
||||
|
||||
//check 最近一次公会id
|
||||
|
|
|
@ -43,7 +43,7 @@ public enum GameFightType {
|
|||
|
||||
GuildBossFight(FightType.GuildBossFight,new DefaultOfRedisCacheFightHandler(),RedisKey.GUILD_MONSTER_FIGHT),
|
||||
DailyChallenge(FightType.StoryFight,new DefaultWithoutHandFightHandler(),null),
|
||||
DeathPathChallenge(FightType.StoryFight,new DefaultWithoutHandFightHandler(),null),
|
||||
DeathPathChallenge(FightType.CarBossFight,new DefaultWithoutHandFightHandler(),null),
|
||||
|
||||
CarBossChallenge(FightType.CarBossFight,new DefaultWithoutHandFightHandler(),null),
|
||||
CarPersonChallenge(FightType.CarBossFight,new PVPFightHandler(),null),
|
||||
|
|
|
@ -28,6 +28,7 @@ import util.MathUtils;
|
|||
import util.StringUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ItemLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemLogic.class);
|
||||
|
@ -499,6 +500,34 @@ public class ItemLogic {
|
|||
return equiplist;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取 指定类型和属性的宝器
|
||||
*/
|
||||
public static TreeSet<String> getJewelEquip(User user, int type, int rance) {
|
||||
return user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
|
||||
StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId())
|
||||
).filter(stringPropertyItemEntry -> stringPropertyItemEntry.getValue() instanceof Jewel).filter(stringPropertyItemEntry -> {
|
||||
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(stringPropertyItemEntry.getValue().getEquipId());
|
||||
if (config == null) {
|
||||
return false;
|
||||
}
|
||||
return config.getLocation() == type && config.getRace() == rance;
|
||||
}).map(Map.Entry::getKey).collect(Collectors.toCollection(TreeSet::new));
|
||||
}
|
||||
|
||||
public static TreeSet<String> getJewelEquipWithLeve(User user, int type, int rance,int leve) {
|
||||
return user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
|
||||
StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId())
|
||||
).filter(stringPropertyItemEntry -> stringPropertyItemEntry.getValue() instanceof Jewel).filter(stringPropertyItemEntry -> {
|
||||
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(stringPropertyItemEntry.getValue().getEquipId());
|
||||
if (config == null) {
|
||||
return false;
|
||||
}
|
||||
return config.getLocation() == type && config.getRace() == rance&&config.getLevel()==leve;
|
||||
}).map(Map.Entry::getKey).collect(Collectors.toCollection(TreeSet::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* 宝器强化 精炼
|
||||
* @param iSession
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.ljsd.jieling.protocols.CommonProto;
|
|||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
|
@ -24,14 +24,14 @@ public class DeathPathTotalGuildRank extends AbstractRank{
|
|||
|
||||
@Override
|
||||
public int[] getDataByScore(Double score) {
|
||||
BigDecimal bigDecimal = new BigDecimal(score.toString()).subtract(new BigDecimal(score.intValue())).multiply(new BigDecimal(String.valueOf(Math.pow(10,8))));
|
||||
BigDecimal bigDecimal = new BigDecimal(score.toString()).subtract(new BigDecimal(score.intValue())).multiply(new BigDecimal(String.valueOf(Math.pow(10,15))));
|
||||
return new int[]{bigDecimal.intValue(),score.intValue()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
BigDecimal decimal = null;
|
||||
decimal = new BigDecimal(String.valueOf(data[0])).divide(new BigDecimal(String.valueOf(Math.pow(10,8))));
|
||||
decimal = new BigDecimal(String.valueOf(data[0])).divide(new BigDecimal(String.valueOf(Math.pow(10,15))));
|
||||
if(data.length>1){
|
||||
decimal = decimal.add(new BigDecimal(data[1]));
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ public class SGuildSetting implements BaseConfig {
|
|||
|
||||
private int[] giveLikeReward;
|
||||
|
||||
private int challengeMaxTime;
|
||||
|
||||
public static SGuildSetting sGuildSetting;
|
||||
|
||||
|
||||
|
@ -225,4 +227,8 @@ public class SGuildSetting implements BaseConfig {
|
|||
public int[][] getGuildWarTime() {
|
||||
return guildWarTime;
|
||||
}
|
||||
|
||||
public int getChallengeMaxTime() {
|
||||
return challengeMaxTime;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="JewelConfig")
|
||||
public class SJewelConfig implements BaseConfig {
|
||||
|
@ -22,6 +20,10 @@ public class SJewelConfig implements BaseConfig {
|
|||
|
||||
private int[] max;
|
||||
|
||||
private int rankupCount;
|
||||
|
||||
private int[][] rankupResources;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -57,5 +59,13 @@ public class SJewelConfig implements BaseConfig {
|
|||
return max;
|
||||
}
|
||||
|
||||
public int getRankupCount() {
|
||||
return rankupCount;
|
||||
}
|
||||
|
||||
public int[][] getRankupResources() {
|
||||
return rankupResources;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -175,10 +175,15 @@ public class ExcelUtils {
|
|||
continue;
|
||||
}
|
||||
Cell cell = row.getCell(j);
|
||||
Cell cell1 = row4.getCell(j);
|
||||
if (cell == null){
|
||||
Cell cell1 = row4.getCell(j);
|
||||
info = getStringBuilder(row2, info, j, cell1);
|
||||
}else{
|
||||
//添加默认值
|
||||
if (cell.toString().isEmpty()&&(cell1!=null)&&(!cell1.toString().isEmpty())){
|
||||
info = getStringBuilder(row2, info, j, cell1);
|
||||
continue;
|
||||
}
|
||||
if (getCellFormatValue(row1.getCell(j),null).toString().isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue