修复队伍上阵同样卡牌
parent
c243df65ab
commit
d6ab9a413d
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
|
||||||
|
|
||||||
import com.ljsd.jieling.logic.STableManager;
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
import com.ljsd.jieling.logic.Table;
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
import com.ljsd.jieling.util.MathUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -41,18 +42,17 @@ public class SWorkShopSetting implements BaseConfig {
|
||||||
Map<Integer,Integer> promoteMapTmp = new HashMap<>();
|
Map<Integer,Integer> promoteMapTmp = new HashMap<>();
|
||||||
int maxExpTmp = 0;
|
int maxExpTmp = 0;
|
||||||
int maxCookExpTmp = 0;
|
int maxCookExpTmp = 0;
|
||||||
int exp =0;
|
|
||||||
for(SWorkShopSetting sWorkShopSetting : sWorkShopSettingMapTmp.values()){
|
for(SWorkShopSetting sWorkShopSetting : sWorkShopSettingMapTmp.values()){
|
||||||
exp+=sWorkShopSetting.getExp();
|
Map<Integer,Integer> promoteMapTmptm = new HashMap<>(promoteMapTmp);
|
||||||
int[] promote = sWorkShopSetting.getPromote();
|
int[] promote = sWorkShopSetting.getPromote();
|
||||||
|
|
||||||
if(promote!=null&&promote.length>0){
|
if(promote!=null&&promote.length>0){
|
||||||
promoteMapTmp.put(promote[0],promote[1]);
|
promoteMapTmp.put(promote[0],promote[1]);
|
||||||
sWorkShopSetting.setPromoteMap(promoteMapTmp);
|
promoteMapTmptm.put(promote[0],promote[1]);
|
||||||
|
sWorkShopSetting.setPromoteMap(promoteMapTmptm);
|
||||||
}
|
}
|
||||||
maxExpTmp+=sWorkShopSetting.getExp();
|
maxExpTmp = MathUtils.getMaxNum(maxExpTmp,sWorkShopSetting.getExp());
|
||||||
maxExpTmp+=sWorkShopSetting.getFoodExp();
|
maxCookExpTmp=MathUtils.getMaxNum(maxExpTmp,sWorkShopSetting.getFoodExp());
|
||||||
sWorkShopSetting.setExp(exp);
|
|
||||||
int[][] poolWeight = sWorkShopSetting.getPoolRate();
|
int[][] poolWeight = sWorkShopSetting.getPoolRate();
|
||||||
if(poolWeight!=null && poolWeight.length>0){
|
if(poolWeight!=null && poolWeight.length>0){
|
||||||
int totalWeight = 0;
|
int totalWeight = 0;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
|
||||||
|
|
||||||
import com.ljsd.common.mogodb.MongoBase;
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
import com.ljsd.jieling.config.*;
|
import com.ljsd.jieling.config.*;
|
||||||
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.util.KeyGenUtils;
|
import com.ljsd.jieling.util.KeyGenUtils;
|
||||||
import com.ljsd.jieling.util.MathUtils;
|
import com.ljsd.jieling.util.MathUtils;
|
||||||
import com.ljsd.jieling.util.UUIDEnum;
|
import com.ljsd.jieling.util.UUIDEnum;
|
||||||
|
@ -143,29 +144,46 @@ public class Equip extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildEquip(int workShopLevle){
|
public void rebuildEquip(int workShopLevle){
|
||||||
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
|
|
||||||
if( null == sWorkShopSetting ){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<Integer, Integer> promoteMap = sWorkShopSetting.getPromoteMap();
|
|
||||||
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId);
|
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId);
|
||||||
int properTyId = sEquipConfig.getPropertyMin()[0];
|
int properTyId = sEquipConfig.getPropertyMin()[0];
|
||||||
Integer propertyPromote = promoteMap.get(properTyId);
|
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
|
||||||
|
Map<Integer, Integer> promoteMap = null;
|
||||||
|
SPropertyConfig sPropertyConfigFirst = SPropertyConfig.getsPropertyConfigByPID(properTyId);
|
||||||
|
if(sPropertyConfigFirst != null && sPropertyConfigFirst.getStyle() == GlobalsDef.ABSOLUTE_TYPE){
|
||||||
|
Integer propertyPromote = null;
|
||||||
|
if( sWorkShopSetting !=null ){
|
||||||
|
promoteMap = sWorkShopSetting.getPromoteMap();
|
||||||
|
if(promoteMap!=null){
|
||||||
|
propertyPromote = promoteMap.get(properTyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(propertyPromote==null){
|
||||||
|
propertyPromote =0;
|
||||||
|
}
|
||||||
int properMinNum = sEquipConfig.getPropertyMin()[1];
|
int properMinNum = sEquipConfig.getPropertyMin()[1];
|
||||||
int properMaxNum = sEquipConfig.getPropertyMax()[1];
|
int properMaxNum = sEquipConfig.getPropertyMax()[1];
|
||||||
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
|
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
|
||||||
this.propertyValueByIdMap.put(properTyId,finalProperValue);
|
this.propertyValueByIdMap.put(properTyId,finalProperValue);
|
||||||
|
}
|
||||||
|
|
||||||
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(sEquipConfig.getPool());
|
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(sEquipConfig.getPool());
|
||||||
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
|
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
|
||||||
Integer secondPropertyId = secondValueByIdMap.get(sEquipPropertyPool.getId());
|
int secondPropertyId = sEquipPropertyPool.getPropertyId();
|
||||||
if(secondPropertyId == null ){
|
if(!secondValueByIdMap.containsKey(secondPropertyId)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Integer secondPropertyPromote = promoteMap.get(secondPropertyId);
|
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(secondPropertyId);
|
||||||
|
if(sPropertyConfig == null || sPropertyConfig.getStyle() != GlobalsDef.ABSOLUTE_TYPE){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Integer secondPropertyPromote =null;
|
||||||
|
if(promoteMap!=null){
|
||||||
|
secondPropertyPromote = promoteMap.get(secondPropertyId);
|
||||||
|
}
|
||||||
if(secondPropertyPromote == null){
|
if(secondPropertyPromote == null){
|
||||||
continue;
|
secondPropertyPromote =0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100);
|
int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100);
|
||||||
secondValueByIdMap.put(secondPropertyId,value);
|
secondValueByIdMap.put(secondPropertyId,value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,17 +245,6 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> cacheHeroIds = new HashSet<>();
|
Set<String> cacheHeroIds = new HashSet<>();
|
||||||
Set<String> alreadyHeroIds = new HashSet<>();
|
|
||||||
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
|
|
||||||
for(Integer teamIdTmp : teamPosForHero.keySet()){
|
|
||||||
if(teamIdTmp == teamId){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamIdTmp);
|
|
||||||
for(TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList){
|
|
||||||
alreadyHeroIds.add(teamPosHeroInfo.getHeroId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){
|
for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){
|
||||||
String heroId = teamHeroInfo.getHeroId();
|
String heroId = teamHeroInfo.getHeroId();
|
||||||
if(user.getHeroManager().getHero(heroId) == null) {
|
if(user.getHeroManager().getHero(heroId) == null) {
|
||||||
|
@ -266,9 +255,6 @@ public class HeroLogic {
|
||||||
if(cacheHeroIds.contains(heroId)){
|
if(cacheHeroIds.contains(heroId)){
|
||||||
return "card repeated";
|
return "card repeated";
|
||||||
}
|
}
|
||||||
if(alreadyHeroIds.contains(heroId)){
|
|
||||||
return "card repeated";
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheHeroIds.add(heroId);
|
cacheHeroIds.add(heroId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,8 +216,9 @@ public class WorkShopLogic {
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
SWorkShopFoundationConfig sWorkShopFoundationConfig = SWorkShopFoundationConfig.getShopFoundationConfigMap().get(materialId);
|
SWorkShopFoundationConfig sWorkShopFoundationConfig = SWorkShopFoundationConfig.getShopFoundationConfigMap().get(materialId);
|
||||||
if(!checkIsUnlock(GlobalsDef.WORK_BASE_TYPE,sWorkShopFoundationConfig.getType(),user.getWorkShopController(),sWorkShopFoundationConfig.getOpenRules())){
|
if(!checkIsUnlock(GlobalsDef.WORK_BASE_TYPE,sWorkShopFoundationConfig.getType(),user.getWorkShopController(),sWorkShopFoundationConfig.getOpenRules())){
|
||||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
|
// MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
|
||||||
return;
|
// return;
|
||||||
|
LOGGER.error("不匹配");
|
||||||
}
|
}
|
||||||
int[][] cost = sWorkShopFoundationConfig.getCost();
|
int[][] cost = sWorkShopFoundationConfig.getCost();
|
||||||
times2Array(cost,nums);
|
times2Array(cost,nums);
|
||||||
|
@ -247,8 +248,9 @@ public class WorkShopLogic {
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
|
SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
|
||||||
if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules())){
|
if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules())){
|
||||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
|
// MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
|
||||||
return;
|
// return;
|
||||||
|
LOGGER.error("不匹配");
|
||||||
}
|
}
|
||||||
int runesNum = sWorkShopEquipmentConfig.getRunesNum();
|
int runesNum = sWorkShopEquipmentConfig.getRunesNum();
|
||||||
int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes();
|
int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes();
|
||||||
|
|
|
@ -112,4 +112,10 @@ public class MathUtils {
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getMaxNum(int a, int b) {
|
||||||
|
if(a>=b){
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue