法宝升级修改

master_otnew
PC-202302260912\Administrator 2023-10-24 19:08:15 +08:00
parent 63d10823ee
commit ba91d21afd
10 changed files with 124 additions and 168 deletions

View File

@ -6,14 +6,13 @@ import com.ljsd.jieling.logic.dao.Baubles;
import com.ljsd.jieling.logic.dao.PropertyItem;
import com.mongodb.BasicDBObject;
import config.SItem;
import org.bson.json.JsonWriterSettings;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
@SuppressWarnings("SwitchStatementWithTooFewBranches")
@ReadingConverter
public class MongoPropertyConverter implements Converter<BasicDBObject, PropertyItem> {
private static final JsonWriterSettings jsonWriterSettings = new JsonWriterSettings();
// private static final JsonWriterSettings jsonWriterSettings = new JsonWriterSettings();
@Override
public PropertyItem convert(BasicDBObject source) {
if (!source.containsField("equipId")) {
@ -25,11 +24,11 @@ public class MongoPropertyConverter implements Converter<BasicDBObject, Property
case GlobalItemType.ESPECIAL_EQUIP:// 法宝
target = Baubles.class;
break;
default:
default:// 宝器,法相
target = PropertyItem.class;
break;
}
String realJson = source.toJson(jsonWriterSettings);
String realJson = JSON.toJSONString(source);
return JSON.parseObject(realJson, target);
}
}

View File

@ -125,7 +125,7 @@ public class RedisKey {
public static final String FAMILY_INFO = "FAMILY_INFO";
public static final String FAMILY_NAMES = "FAMILY_NAMES";
// public static final String FAMILY_NAMES = "FAMILY_NAMES";
public static final String FAMILY_LOGS = "FAMILY_LOGS";
public static final String GUILD_RELEASE = "guild-release";
@ -403,6 +403,7 @@ public class RedisKey {
public static final String First_Recharge = "First_Recharge";
// 命格抽卡次数每日
public static final String GEM_DRAW_COUNT_DAY = "GEM_DRAW_COUNT_DAY";
public static final String Redis_Timer = "Redis_Timer";
//进程排行 合区统一
public static Set<String> newAreaCacChe = new HashSet<>();

View File

@ -1,58 +0,0 @@
package com.ljsd.jieling.handler.equip;
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.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.MissionType;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.HeroInfoProto;
import rpc.protocols.MessageTypeProto;
import com.ljsd.jieling.util.ItemUtil;
import util.MathUtils;
import com.ljsd.jieling.util.MessageUtil;
import config.SEquipTalismanaLottery;
import config.SSpecialConfig;
import manager.STableManager;
import org.springframework.stereotype.Component;
@Component
public class ForceRandSoulEquipHandler extends BaseHandler<HeroInfoProto.SoulForceRandRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_REQUEST;
}
@Override
public void processWithProto(ISession iSession, HeroInfoProto.SoulForceRandRequest proto) throws Exception {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
boolean update = StoreLogic.getInstance().checkBuyGoodsAndUpdate(user, 7, 10019, 1);
if (!update){
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
}
int pos = SSpecialConfig.getIntegerValue(SSpecialConfig.MANDATORY_ASTROLOGICAL);
SEquipTalismanaLottery lotteryIn = STableManager.getConfig(SEquipTalismanaLottery.class).get(pos);
if (null == lotteryIn) {
throw new Exception("SEquipTalismanaLottery 配置不存在" + pos);
}
user.getEquipManager().setSoulEquipPool(pos);
int[] droplist = new int[1];
droplist[0]=(MathUtils.randomFromWeight(lotteryIn.getDrop()));
CommonProto.Drop.Builder drop = ItemUtil.drop(user, droplist,1,0,BIReason.RANDOM_SOULEQUIP);
HeroInfoProto.SoulForceRandResponse.Builder builder = HeroInfoProto.SoulForceRandResponse.newBuilder();
builder.setDrop(drop);
builder.setPos(pos);
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.FIND_STAR,1);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_RESPONSE_VALUE, builder.build(), true);
}
}

View File

@ -1690,16 +1690,16 @@ public class ActivityLogic implements IEventHandler{
*/
private CommonProto.Drop.Builder getDrawReward(User user,int activityId,int num,int[][] reward) throws Exception {
if (num == 1){
return getDrawRewardOne(user,activityId,num,reward);
return getDrawRewardOne(user, activityId, reward);
}else {
return getDrawRewardTen(user,activityId,num,reward);
return getDrawRewardTen(user, activityId, reward);
}
}
/**
*
*/
private CommonProto.Drop.Builder getDrawRewardOne(User user,int activityId,int num,int[][] reward) throws Exception {
private CommonProto.Drop.Builder getDrawRewardOne(User user, int activityId, int[][] reward) throws Exception {
// 活动信息
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(activityId);
// up奖励id
@ -1750,7 +1750,7 @@ public class ActivityLogic implements IEventHandler{
/**
*
*/
private CommonProto.Drop.Builder getDrawRewardTen(User user,int activityId,int num,int[][] reward) throws Exception {
private CommonProto.Drop.Builder getDrawRewardTen(User user, int activityId, int[][] reward) throws Exception {
// 活动信息
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(activityId);
// up奖励id
@ -1799,9 +1799,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param user
* @return
* @throws Exception
*/
public ActivityProto.qiMenDunJiaDrawResponse qiMenDunJiaDraw(User user,int activityId,int num) throws Exception {
// 道具消耗
@ -1829,8 +1826,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param user
* @return
*/
private void qiMenConsume(User user,int count) throws Exception {
// 获取抽奖消耗配置
@ -1910,22 +1905,17 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param session
* @throws Exception
*/
public void zeroResetSpecialMonsterActivity(ISession session) throws Exception {
AbstractActivity activity = ActivityTypeEnum.getActicityById(14501);
if (activity != null){
activity.takeAllReward(session);
}
}
// public void zeroResetSpecialMonsterActivity(ISession session) throws Exception {
// AbstractActivity activity = ActivityTypeEnum.getActicityById(14501);
// if (activity != null){
// activity.takeAllReward(session);
// }
// }
/**
* id
*
* @param user
* @param type
* @return
*/
public int getActivityByTypeToFirst(User user, int type){
List<SGlobalActivity> activities = SGlobalActivity.getsGlobalActivityMapByType(type);
@ -1944,9 +1934,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
*
* @param user
* @return
*/
public Set<Integer> getDesireOpenHeroList(User user) {
// 开服时间戳
@ -1977,10 +1964,7 @@ public class ActivityLogic implements IEventHandler{
}
/**
*
*
* @param user
* @return
*
*/
public Set<Integer> getDesireOpenFabaoList(User user) {
// 开服时间戳
@ -1995,8 +1979,9 @@ public class ActivityLogic implements IEventHandler{
Map<Integer, SCHero> heroMap = SCHero.getsCHero();
// 满足条件的放入set
for (SCHero hero : heroMap.values()) {
if (time >= hero.getJoinWishDay()*TimeUtils.DAY && hero.getEquipTalismana() != null && hero.getEquipTalismana().length > 1){
set.add(hero.getEquipTalismana()[1]);
int[] equipTalismana = hero.getEquipTalismana();
if (time >= hero.getJoinWishDay() * TimeUtils.DAY && equipTalismana != null && equipTalismana.length > 1){
set.add(equipTalismana[1]);
}
}
// set 返回给客户端最新的set

View File

@ -12,6 +12,9 @@ public class Baubles extends PropertyItem{
private Set<String> blessList = new HashSet<>();//庇佑
public Baubles() {
}
public Baubles(int uid, int equipId) {
super(uid, equipId);
}

View File

@ -13,6 +13,9 @@ public class PropertyItem extends MongoBase {
private int buildLevel;// 精炼/星级
private String heroId;// 绑定英雄id
public PropertyItem() {
}
public PropertyItem(int uid, int equipId) {
this.setRootCollection(User._COLLECTION_NAME);
this.setId(KeyGenUtils.produceIdByModule(UUIDEnum.property_equip, uid));

View File

@ -681,6 +681,7 @@ public class EquipLogic {
EquipManager equipManager = user.getEquipManager();
String baublesId = proto.getBaublesId();
int upLv = proto.getUpLv();
List<String> costBaublesList = proto.getCostBaublesList();
Baubles baubles = equipManager.getBaubles(baublesId);
if (baubles == null){
@ -695,15 +696,40 @@ public class EquipLogic {
throw new ErrorCodeException(ErrorCode.LEVE_MAX, "法宝已到达最大等级:"+tgLv);
}
ArrayList<int[][]> costList = new ArrayList<>();
HashMap<Integer, Integer> costItemMap = new HashMap<>();
int count = 0;
for (int i = 0; i < upLv; i++) {
SEquipTalismana talismana = talismanaMap.get(nowLv + i);
costList.add(talismana.getRankupBasicMaterial());
int[][] material = talismana.getRankupBasicMaterial();
for (int[] ints : material) {
int itemId = ints[0];
int itemNum = ints[1];
if (itemId == 0){
count+=itemNum;
}else {
costItemMap.put(itemId, costItemMap.getOrDefault(itemId, 0) + itemNum);
}
}
}
boolean cost = ItemUtil.itemCost(user, costList, BIReason.BAUBLES_STRENGETHEN, 0);
if (costBaublesList.size() != count){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
for (String id : costBaublesList) {
Baubles baubles1 = equipManager.getBaubles(id);
if (baubles1 == null || baubles1.getEquipId() != baubles.getEquipId() || !StringUtil.isEmpty(baubles1.getMasterId()) || !baubles1.getBlessList().isEmpty()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"法宝无法消耗,请检查佩戴状态");
}
}
boolean cost = ItemUtil.itemCost(user, costItemMap, BIReason.BAUBLES_STRENGETHEN, 0);
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
for (String id : costBaublesList) {
equipManager.removeEquip(id);
}
baubles.setLevel(tgLv);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.BaublesStrengthenResponse_VALUE, null, true);
@ -776,7 +802,7 @@ public class EquipLogic {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "法宝安装的庇佑数量以达到上限");
}
int openLevel = SSpecialConfig.getIntegerValue("Huyou_OpenLevel");
if (blessBaubles.getLevel() < openLevel){
if (blessBaubles.getLevel() < openLevel || baubles.getLevel() < openLevel){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "法宝未到达要求等级");
}

View File

@ -37,7 +37,6 @@ import java.util.stream.Collectors;
* Description:
* Author: zsx
* CreateDate: 2020/1/7 11:46
*
*TODO fix
*/
public class ExpeditionLogic {

View File

@ -6386,9 +6386,6 @@ public class HeroLogic {
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//法宝技能继承真实技能 todo 玉虚法宝重写
int[] equipTalismana = tempHero.getEquipTalismana();
return skillList;
}
@ -6398,55 +6395,55 @@ public class HeroLogic {
* @param yuxuHero
* @return
*/
public List<Integer> getCrossYuxuHeroSkillList(com.ljsd.jieling.thrift.idl.ArenaOfHero hero, Hero yuxuHero) {
List<Integer> skillList = new ArrayList<>();
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
//英雄技能取统一的玉虚配置英雄
List<Integer> skillListByStar = tempHero.getSkillListByStar(yuxuHero.getStar());
if (skillListByStar != null) {
skillList.addAll(skillListByStar);
}
// 大于10星觉醒技
if (yuxuHero.getStar() > HERO_MAX_STAR) {
skillList.addAll(tempHero.getAwakSkills(1, yuxuHero.getBreakId()));
skillList.addAll(tempHero.getAwakSkills(2, yuxuHero.getStarBreakId()));
} else {
skillList.addAll(tempHero.getPassiveSkills(1, yuxuHero.getBreakId()));
skillList.addAll(tempHero.getPassiveSkills(2, yuxuHero.getStarBreakId()));
}
// 角色初始被动
int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
if (skillLogicConfig != null){
for (int skill : skillLogicConfig) {
skillList.add(skill);
}
}
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
//魂印取统一配置
Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
soulEquipByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//神印取统一配置
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//法宝技能继承真实技能
int[] equipTalismana = tempHero.getEquipTalismana();
if (equipTalismana.length >= 2 && hero.getStar() >= equipTalismana[0]) {
int especialEquipLevel = hero.getEspecialEquipLevel();
int especialEquipId = equipTalismana[1];
Map<Integer, SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
sEquipTalismana.forEach((k, v) -> {
if (k <= especialEquipLevel && v.getOpenSkillRules() != null) {
Arrays.stream(v.getOpenSkillRules()).forEach(skillList::add);
}
});
}
return skillList;
}
// public List<Integer> getCrossYuxuHeroSkillList(com.ljsd.jieling.thrift.idl.ArenaOfHero hero, Hero yuxuHero) {
// List<Integer> skillList = new ArrayList<>();
// SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
// //英雄技能取统一的玉虚配置英雄
// List<Integer> skillListByStar = tempHero.getSkillListByStar(yuxuHero.getStar());
// if (skillListByStar != null) {
// skillList.addAll(skillListByStar);
// }
// // 大于10星觉醒技
// if (yuxuHero.getStar() > HERO_MAX_STAR) {
// skillList.addAll(tempHero.getAwakSkills(1, yuxuHero.getBreakId()));
// skillList.addAll(tempHero.getAwakSkills(2, yuxuHero.getStarBreakId()));
// } else {
// skillList.addAll(tempHero.getPassiveSkills(1, yuxuHero.getBreakId()));
// skillList.addAll(tempHero.getPassiveSkills(2, yuxuHero.getStarBreakId()));
// }
//
// // 角色初始被动
// int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
// if (skillLogicConfig != null){
// for (int skill : skillLogicConfig) {
// skillList.add(skill);
// }
// }
//
// Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
//
// //魂印取统一配置
// Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
// soulEquipByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//
// //神印取统一配置
// Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
// godSealByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//
// //法宝技能继承真实技能
// int[] equipTalismana = tempHero.getEquipTalismana();
// if (equipTalismana.length >= 2 && hero.getStar() >= equipTalismana[0]) {
// int especialEquipLevel = hero.getEspecialEquipLevel();
// int especialEquipId = equipTalismana[1];
// Map<Integer, SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
// sEquipTalismana.forEach((k, v) -> {
// if (k <= especialEquipLevel && v.getOpenSkillRules() != null) {
// Arrays.stream(v.getOpenSkillRules()).forEach(skillList::add);
// }
// });
// }
// return skillList;
// }
/**
* , ,
@ -6454,23 +6451,23 @@ public class HeroLogic {
* @param yuxuHero
* @return
*/
public StringBuilder getCrossYuxuHeroSkills(com.ljsd.jieling.thrift.idl.ArenaOfHero hero, Hero yuxuHero) {
List<Integer> heroSkillList = this.getCrossYuxuHeroSkillList(hero,yuxuHero);
coverSkill(heroSkillList);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < heroSkillList.size(); i++) {
Integer skill = heroSkillList.get(i);
if (i < 2) {
sb.append(skill).append(DIVISION);
continue;
}
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if (config != null && config.getEffectiveRange() == 1) {
sb.append(skill).append(DIVISION);
}
}
return sb;
}
// public StringBuilder getCrossYuxuHeroSkills(com.ljsd.jieling.thrift.idl.ArenaOfHero hero, Hero yuxuHero) {
// List<Integer> heroSkillList = this.getCrossYuxuHeroSkillList(hero,yuxuHero);
// coverSkill(heroSkillList);
// StringBuilder sb = new StringBuilder();
// for (int i = 0; i < heroSkillList.size(); i++) {
// Integer skill = heroSkillList.get(i);
// if (i < 2) {
// sb.append(skill).append(DIVISION);
// continue;
// }
// SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
// if (config != null && config.getEffectiveRange() == 1) {
// sb.append(skill).append(DIVISION);
// }
// }
// return sb;
// }
/**
*

View File

@ -44,7 +44,7 @@ public class RankLogic {
* 0
* 1
*/
private static List<Object> force_curr_rank = new ArrayList<>(2);
private static final List<Object> force_curr_rank = new ArrayList<>(2);
/**
*
@ -81,7 +81,7 @@ public class RankLogic {
*/
private PlayerInfoProto.RankResponse getRankInfo(User user,int start,int end) throws Exception{
// 上次存储时间+一小时
if (force_curr_rank.size() <= 0){
if (force_curr_rank.isEmpty()){
force_curr_rank.add(0L);
force_curr_rank.add(1L);
}
@ -105,6 +105,7 @@ public class RankLogic {
/**
* id
* todo
*/
public List<List<Integer>> getRandomUserByRank(User user,int counts) throws Exception {
List<List<Integer>> result = new ArrayList<>();