礼物和修仙属性修改

master_otnew
PC-202302260912\Administrator 2023-11-02 17:52:36 +08:00
parent 2953c3fbe6
commit 0f51ad7600
3 changed files with 118 additions and 69 deletions

View File

@ -2361,50 +2361,31 @@ public class HeroLogic {
* *
*/ */
public void getPlayerFightUnitInfo (User user, List<CommonProto.FightUnitInfo> pokemonList) { public void getPlayerFightUnitInfo (User user, List<CommonProto.FightUnitInfo> pokemonList) {
StringBuilder builder = new StringBuilder(); HeroManager heroManager = user.getHeroManager();
HashMap<Integer, Long> attrMap = new HashMap<>(); PlayerManager playerManager = user.getPlayerInfoManager();
List<TransformationInfo> list = user.getHeroManager().getTransformationList().values().stream().filter(v -> v.getStatus() == 1).collect(Collectors.toList()); // 主角技能
StringBuilder skillBuilder = new StringBuilder();
List<TransformationInfo> list = heroManager.getTransformationList().values().stream().filter(v -> v.getStatus() == 1).collect(Collectors.toList());
for (TransformationInfo info : list) { for (TransformationInfo info : list) {
try { SChangingCard card = SChangingCard.map.get(info.getCardId());
// 拼接技能 skillBuilder.append(info.getIndex()).append("#").append(card.getSkill()[info.getStar()]).append("|");
SChangingCard card = SChangingCard.map.get(info.getCardId());
builder.append(info.getIndex()).append("#").append(card.getSkill()[info.getStar()]).append("|");
// 获取属性
calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel());
}catch (Exception e){
LOGGER.error("获取主角技能报错:{}", e.getMessage(),e);
}
} }
// 技能
String skill = ""; String skill = "";
if (builder.length() >= 1){ if (skillBuilder.length() >= 1){
skill = builder.substring(0, builder.length()-1); skill = skillBuilder.substring(0, skillBuilder.length()-1);
} }
// 玩家本身的主角属性 // 主角属性
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel()); HashMap<Integer, Long> attrMap = new HashMap<>();
combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap); calPlayerAttribute(attrMap, user);
// 主角礼物属性
Set<Integer> giftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
for (Integer id : giftEquipList) {
SEquipConfig config = SEquipConfig.equipConfigMap.get(id);
if (config == null){
continue;
}
combinedAttribute(config.getPlayerProperty(), attrMap);
}
// 属性
String property = getPlayerProperty(attrMap); String property = getPlayerProperty(attrMap);
CommonProto.FightUnitInfo skillInfo = CommonProto.FightUnitInfo CommonProto.FightUnitInfo skillInfo = CommonProto.FightUnitInfo
.newBuilder() .newBuilder()
.setUnitId("0") .setUnitId("0")
.setPosition(100) .setPosition(100)
.setStar(user.getPlayerInfoManager().getLevel()) .setStar(playerManager.getLevel())
.setProperty(property) .setProperty(property)
.setUnitSkillIds(skill) .setUnitSkillIds(skill)
.build(); .build();
@ -2803,31 +2784,20 @@ public class HeroLogic {
} }
private void applyPlayerAndSkill(Map<Integer, Long> heroAllAttribute, User user){ private void applyPlayerAndSkill(Map<Integer, Long> heroAllAttribute, User user){
// ... 主角和主角技能 ... // ... 主角属性和主角技能 ...
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel()); SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel());
if (playerLevelConfig != null){ if (playerLevelConfig != null){
combinedAttribute(playerLevelConfig.getPropList(), heroAllAttribute); combinedAttribute(playerLevelConfig.getPropList(), heroAllAttribute);
combinedAttribute(playerLevelConfig.getPlayerPropList(), heroAllAttribute);
} }
// 变身卡加成 / 主角技能 // 主角技能
for (TransformationInfo info : user.getHeroManager().getTransformationList().values()) { for (TransformationInfo info : user.getHeroManager().getTransformationList().values()) {
// 主角属性
calPlayerAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel());
// 英雄属性 // 英雄属性
calPlayerCardAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel()); calPlayerCardToHeroAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel());
} }
// 礼物主角属性 // 主角属性加成
Set<Integer> playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); calPlayerAttribute(heroAllAttribute, user);
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
for (Integer id : playerGiftEquipList) {
SEquipConfig config = configMap.get(id);
if (config == null){
continue;
}
combinedAttribute(config.getPlayerProperty(), heroAllAttribute);
}
} }
// private void applyWorkShopTechnologyAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){ // private void applyWorkShopTechnologyAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){
@ -2975,19 +2945,39 @@ public class HeroLogic {
private void applyGiftEquipAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){ private void applyGiftEquipAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
// ... 礼物装备 ... // ... 礼物装备 ...
Set<Integer> heroGiftEquipList = hero.getHeroGiftEquipList(); HashMap<Integer, Long> giftAttrMap = new HashMap<>();
Set<Integer> playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
HashSet<Integer> set = new HashSet<>();
set.addAll(heroGiftEquipList);
set.addAll(playerGiftEquipList);
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap; Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
for (Integer id : set) { int heroGiftUp = 0;
// 主角属性计算,并计算对英雄礼物加成值
Set<Integer> playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
for (Integer id : playerGiftEquipList) {
SEquipConfig config = configMap.get(id); SEquipConfig config = configMap.get(id);
if (config == null){ if (config == null){
continue; continue;
} }
combinedAttribute(config.getProperty(), heroAllAttribute); heroGiftUp += config.getHeroGitUp();
if (config.getProperty() != null){
for (int[] ints : config.getProperty()) {
giftAttrMap.put(ints[0], giftAttrMap.getOrDefault(ints[0],0L)+ints[1]);
}
}
} }
// 英雄属性计算
Set<Integer> heroGiftEquipList = hero.getHeroGiftEquipList();
for (Integer id : heroGiftEquipList) {
SEquipConfig config = configMap.get(id);
if (config == null || config.getProperty() == null){
continue;
}
for (int[] ints : config.getProperty()) {
long value = Math.round(ints[1] * (1 + heroGiftUp / 10000d));
giftAttrMap.put(ints[0], giftAttrMap.getOrDefault(ints[0],0L)+value);
}
}
combinedAttribute(giftAttrMap, heroAllAttribute);
} }
/** /**
@ -3085,15 +3075,19 @@ public class HeroLogic {
} }
} }
/**
* ... ...
* @param heroAllAttribute
* @param user
*/
private void applyXiuxingAndXiuxianAttribute(Map<Integer, Long> heroAllAttribute, User user){ private void applyXiuxingAndXiuxianAttribute(Map<Integer, Long> heroAllAttribute, User user){
// ... 修行和修仙 ...
// 修行等级属性加成 // 修行等级属性加成
Map<Integer, SXiuXian> xiuXianMap = STableManager.getConfig(SXiuXian.class); Map<Integer, SXiuXian> xiuXianMap = STableManager.getConfig(SXiuXian.class);
int practiceLevel = user.getHeroManager().getPracticeLevel(); int practiceLevel = user.getHeroManager().getPracticeLevel();
for (SXiuXian v : xiuXianMap.values()) { for (SXiuXian v : xiuXianMap.values()) {
if (practiceLevel >= v.getId() && v.getTotalPros() != null) { int[][] totalPros = v.getTotalPros();
combinedAttribute(v.getTotalPros(), heroAllAttribute); if (practiceLevel >= v.getId() && totalPros != null) {
combinedAttribute(totalPros, heroAllAttribute);
} }
} }
@ -3854,7 +3848,46 @@ public class HeroLogic {
} }
/** /**
* *
*/
public void calPlayerAttribute(Map<Integer, Long> attrMap, User user) {
PlayerManager playerInfoManager = user.getPlayerInfoManager();
HeroManager heroManager = user.getHeroManager();
// 主角等级属性
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(playerInfoManager.getLevel());
if (playerLevelConfig != null){
combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap);
}
// 主角变身卡属性
for (TransformationInfo info : heroManager.getTransformationList().values()) {
calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel());
}
// 主角礼物属性
Set<Integer> playerGiftEquipList = playerInfoManager.getPlayerGiftEquipList();
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
for (Integer id : playerGiftEquipList) {
SEquipConfig config = configMap.get(id);
if (config != null){
combinedAttribute(config.getPlayerProperty(), attrMap);
}
}
// 修行
Map<Integer, SXiuXian> xiuXianMap = SXiuXian.map;
int practiceLevel = heroManager.getPracticeLevel();
for (SXiuXian xiuXian : xiuXianMap.values()) {
int[][] playerProperty = xiuXian.getPlayerProperty();
if (practiceLevel >= xiuXian.getId() && playerProperty != null) {
combinedAttribute(playerProperty, attrMap);
}
}
}
/**
*
*/ */
public void calPlayerAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) { public void calPlayerAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) {
try { try {
@ -3875,7 +3908,14 @@ public class HeroLogic {
} }
} }
public void calPlayerCardAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) { /**
*
* @param attrMap
* @param tmpId
* @param star
* @param level
*/
public void calPlayerCardToHeroAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) {
try { try {
// 身外化身加成 // 身外化身加成
Map<Integer, SChangingCard> changingCardMap = STableManager.getConfig(SChangingCard.class); Map<Integer, SChangingCard> changingCardMap = STableManager.getConfig(SChangingCard.class);

View File

@ -48,11 +48,14 @@ public class NewRechargeInfo extends MongoBase {
public List<AbstractWelfareBag> getTimeLimitBagList(){ public List<AbstractWelfareBag> getTimeLimitBagList(){
List<AbstractWelfareBag> list = new ArrayList<>(); List<AbstractWelfareBag> list = new ArrayList<>();
for(AbstractWelfareBag bag : timeLimitMap.values()){ for(AbstractWelfareBag bag : timeLimitMap.values()){
if(bag.isOpen() && bag.getEndTime() > 0){ if(bag != null && bag.isOpen() && bag.getEndTime() > 0){
list.add(bag); list.add(bag);
} }
} }
for(AbstractWelfareBag bag : receiveMap.values()){ for(AbstractWelfareBag bag : receiveMap.values()){
if (bag == null){
continue;
}
if(!(bag instanceof ReceiveWelfareBag)){ if(!(bag instanceof ReceiveWelfareBag)){
continue; continue;
} }
@ -61,7 +64,7 @@ public class NewRechargeInfo extends MongoBase {
} }
} }
for(AbstractWelfareBag bag : pushMap.values()){ for(AbstractWelfareBag bag : pushMap.values()){
if(bag.isOpen() && bag.getEndTime() > 0){ if(bag != null && bag.isOpen() && bag.getEndTime() > 0){
list.add(bag); list.add(bag);
} }
} }

View File

@ -4,7 +4,6 @@ import manager.STableManager;
import manager.Table; import manager.Table;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
@Table(name ="XiuXian") @Table(name ="XiuXian")
@ -20,6 +19,8 @@ public class SXiuXian implements BaseConfig {
private int[][] totalPros; private int[][] totalPros;
private int[][] playerProperty;
private String nameFontColor; private String nameFontColor;
private int needStarNum; private int needStarNum;
@ -34,14 +35,15 @@ public class SXiuXian implements BaseConfig {
private int playerSkillLvMax; private int playerSkillLvMax;
public static Map<Integer, SXiuXian> map = new HashMap<>();
// 目前只为主角修行等级属性使用 // 目前只为主角修行等级属性使用
public static Map<Integer, Map<Integer, SXiuXian>> sXiuXianMap; public static Map<Integer, Map<Integer, SXiuXian>> sXiuXianMap = new HashMap<>();
@Override @Override
public void init() throws Exception { public void init() throws Exception {
sXiuXianMap = new HashMap<>(); map = STableManager.getConfig(SXiuXian.class);
Map<Integer, SXiuXian> config = STableManager.getConfig(SXiuXian.class); for (Map.Entry<Integer, SXiuXian> integerSXiuXianEntry : map.entrySet()) {
for (Map.Entry<Integer, SXiuXian> integerSXiuXianEntry : config.entrySet()) {
SXiuXian value = integerSXiuXianEntry.getValue(); SXiuXian value = integerSXiuXianEntry.getValue();
if (!sXiuXianMap.containsKey(value.getRealmId())) { if (!sXiuXianMap.containsKey(value.getRealmId())) {
sXiuXianMap.put(value.getRealmId(), new HashMap<>(1)); sXiuXianMap.put(value.getRealmId(), new HashMap<>(1));
@ -73,7 +75,11 @@ public class SXiuXian implements BaseConfig {
return totalPros; return totalPros;
} }
public int getNeedStarNum() { public int[][] getPlayerProperty() {
return playerProperty;
}
public int getNeedStarNum() {
return needStarNum; return needStarNum;
} }