礼物和修仙属性修改

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) {
StringBuilder builder = new StringBuilder();
HashMap<Integer, Long> attrMap = new HashMap<>();
HeroManager heroManager = user.getHeroManager();
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) {
try {
// 拼接技能
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);
}
SChangingCard card = SChangingCard.map.get(info.getCardId());
skillBuilder.append(info.getIndex()).append("#").append(card.getSkill()[info.getStar()]).append("|");
}
// 技能
String skill = "";
if (builder.length() >= 1){
skill = builder.substring(0, builder.length()-1);
if (skillBuilder.length() >= 1){
skill = skillBuilder.substring(0, skillBuilder.length()-1);
}
// 玩家本身的主角属性
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel());
combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap);
// 主角礼物属性
Set<Integer> giftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
for (Integer id : giftEquipList) {
SEquipConfig config = SEquipConfig.equipConfigMap.get(id);
if (config == null){
continue;
}
combinedAttribute(config.getPlayerProperty(), attrMap);
}
// 属性
// 主角属性
HashMap<Integer, Long> attrMap = new HashMap<>();
calPlayerAttribute(attrMap, user);
String property = getPlayerProperty(attrMap);
CommonProto.FightUnitInfo skillInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId("0")
.setPosition(100)
.setStar(user.getPlayerInfoManager().getLevel())
.setStar(playerManager.getLevel())
.setProperty(property)
.setUnitSkillIds(skill)
.build();
@ -2803,31 +2784,20 @@ public class HeroLogic {
}
private void applyPlayerAndSkill(Map<Integer, Long> heroAllAttribute, User user){
// ... 主角和主角技能 ...
// ... 主角属性和主角技能 ...
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel());
if (playerLevelConfig != null){
combinedAttribute(playerLevelConfig.getPropList(), heroAllAttribute);
combinedAttribute(playerLevelConfig.getPlayerPropList(), heroAllAttribute);
}
// 变身卡加成 / 主角技能
// 主角技能
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();
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
for (Integer id : playerGiftEquipList) {
SEquipConfig config = configMap.get(id);
if (config == null){
continue;
}
combinedAttribute(config.getPlayerProperty(), heroAllAttribute);
}
// 主角属性加成
calPlayerAttribute(heroAllAttribute, 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){
// ... 礼物装备 ...
Set<Integer> heroGiftEquipList = hero.getHeroGiftEquipList();
Set<Integer> playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
HashSet<Integer> set = new HashSet<>();
set.addAll(heroGiftEquipList);
set.addAll(playerGiftEquipList);
HashMap<Integer, Long> giftAttrMap = new HashMap<>();
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);
if (config == null){
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){
// ... 修行和修仙 ...
// 修行等级属性加成
Map<Integer, SXiuXian> xiuXianMap = STableManager.getConfig(SXiuXian.class);
int practiceLevel = user.getHeroManager().getPracticeLevel();
for (SXiuXian v : xiuXianMap.values()) {
if (practiceLevel >= v.getId() && v.getTotalPros() != null) {
combinedAttribute(v.getTotalPros(), heroAllAttribute);
int[][] totalPros = v.getTotalPros();
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) {
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 {
// 身外化身加成
Map<Integer, SChangingCard> changingCardMap = STableManager.getConfig(SChangingCard.class);

View File

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

View File

@ -4,7 +4,6 @@ import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@Table(name ="XiuXian")
@ -20,6 +19,8 @@ public class SXiuXian implements BaseConfig {
private int[][] totalPros;
private int[][] playerProperty;
private String nameFontColor;
private int needStarNum;
@ -34,14 +35,15 @@ public class SXiuXian implements BaseConfig {
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
public void init() throws Exception {
sXiuXianMap = new HashMap<>();
Map<Integer, SXiuXian> config = STableManager.getConfig(SXiuXian.class);
for (Map.Entry<Integer, SXiuXian> integerSXiuXianEntry : config.entrySet()) {
map = STableManager.getConfig(SXiuXian.class);
for (Map.Entry<Integer, SXiuXian> integerSXiuXianEntry : map.entrySet()) {
SXiuXian value = integerSXiuXianEntry.getValue();
if (!sXiuXianMap.containsKey(value.getRealmId())) {
sXiuXianMap.put(value.getRealmId(), new HashMap<>(1));
@ -73,7 +75,11 @@ public class SXiuXian implements BaseConfig {
return totalPros;
}
public int getNeedStarNum() {
public int[][] getPlayerProperty() {
return playerProperty;
}
public int getNeedStarNum() {
return needStarNum;
}