同步天书和礼物根据鸿蒙阵等级限制
parent
2d558cbaf2
commit
d6489ed691
|
|
@ -300,6 +300,8 @@ public class CumulationData {
|
|||
*/
|
||||
private int yuxuLv;
|
||||
|
||||
|
||||
|
||||
public Result updateData(MissionType missionType, Object...parm) throws Exception {
|
||||
return DataManagerDistributor.updateData(this, missionType,parm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -678,5 +678,26 @@ public class HeroManager extends MongoBase {
|
|||
this.xiuweiLevel = xiuweiLevel;
|
||||
updateString("xiuweiLevel", xiuweiLevel);
|
||||
}
|
||||
|
||||
public int getHongMengLevel(){
|
||||
if(this.getHongmengTablet() > 0){
|
||||
return this.getHongmengTablet();
|
||||
}
|
||||
//取守卫中最低等级
|
||||
Map<Integer,String> heros = this.getHongmengGuards();
|
||||
int level = 9999;
|
||||
for(String heroId : heros.values()){
|
||||
Hero hero = this.getHero(heroId);
|
||||
if(hero != null){
|
||||
if(level > hero.getOriginalLevel()){
|
||||
level = hero.getOriginalLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(level < 9999){
|
||||
return level;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -514,11 +514,12 @@ public class EquipLogic {
|
|||
String format = MessageFormat.format("礼物穿戴报错, 英雄礼物已穿戴,uid:{0},list:{1}, roleList:{2}", user.getId(), giftIds, heroGifts);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
// int boxNum = getHeroGiftBoxNum(user);
|
||||
// if (heroGifts.size() + set.size() > boxNum){
|
||||
// String format = MessageFormat.format("礼物穿戴报错, 英雄礼物超出格子数量,uid:{0},wear:{1}, allow:{2}", user.getId(), heroGifts.size() + set.size(), boxNum);
|
||||
// throw new ErrorCodeException(format);
|
||||
// }
|
||||
int hongmengLevel = heroManager.getHongMengLevel();
|
||||
int boxNum = SGiftConfig.getOpenBox(hongmengLevel);
|
||||
if (heroGifts.size() + set.size() > boxNum){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 英雄礼物超出格子数量,uid:{0},wear:{1}, allow:{2}", user.getId(), heroGifts.size() + set.size(), boxNum);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
int templateId = hero.getTemplateId();
|
||||
SCHero scHero = SCHero.getsCHero().get(templateId);
|
||||
if (scHero == null){
|
||||
|
|
|
|||
|
|
@ -6520,10 +6520,11 @@ public class HeroLogic {
|
|||
// 装备神印
|
||||
if (type == 1) {
|
||||
int[] value = SSpecialConfig.getIntegerArrayValue(SSpecialConfig.GodSignOpenStar);
|
||||
// 存放已解锁的位置id
|
||||
// 存放已解锁的位置id,改成根据鸿蒙阵等级解锁
|
||||
ArrayList<Integer> indexBox = new ArrayList<>();
|
||||
int hongMengLevel = heroManager.getHongMengLevel();
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
if (hero.getStar() >= value[i]) {
|
||||
if (hongMengLevel >= value[i]) {
|
||||
indexBox.add(i + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,37 +3,64 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Table(name ="GiftConfig")
|
||||
public class SGiftConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int id;
|
||||
|
||||
private int gift;
|
||||
private int gift;
|
||||
|
||||
private int box;
|
||||
private int harmony;
|
||||
|
||||
private int box;
|
||||
|
||||
public static Map<Integer, SGiftConfig> map = new HashMap<>();
|
||||
|
||||
@Override
|
||||
//按鸿蒙阵等级存储的列表
|
||||
public static Map<Integer, SGiftConfig> harmonymap = new HashMap<>();
|
||||
//按鸿蒙阵等级排好序的礼物格子列表
|
||||
public static List<Integer> list = new ArrayList<Integer>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
map = STableManager.getConfig(SGiftConfig.class);
|
||||
for(SGiftConfig config :map.values()){
|
||||
harmonymap.put(config.getHarmony(),config);
|
||||
}
|
||||
for(SGiftConfig config :harmonymap.values()){
|
||||
list.add(config.getHarmony());
|
||||
}
|
||||
Collections.sort(list);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getGift() {
|
||||
public int getGift() {
|
||||
return gift;
|
||||
}
|
||||
|
||||
public int getBox() {
|
||||
public int getBox() {
|
||||
return box;
|
||||
}
|
||||
|
||||
public int getHarmony() {
|
||||
return harmony;
|
||||
}
|
||||
|
||||
public static int getOpenBox(int harmonyLevel){
|
||||
for(int i = list.size() - 1;i>=0;i--){
|
||||
int level = list.get(i);
|
||||
if(harmonyLevel >= level){
|
||||
SGiftConfig config = harmonymap.get(level);
|
||||
if(config !=null){
|
||||
return config.getBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue