修改部分int消耗的道具为long,修改关卡掉落的奖励为直接读取,不走group
parent
14e050d0ff
commit
bbb879369e
|
|
@ -245,6 +245,34 @@ public class StringUtil {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String parseLongArrayToString(long[][] source) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int length = source.length;
|
||||
int last = length-1;
|
||||
for(int i=0;i<length;i++){
|
||||
long[] item = source[i];
|
||||
int itemLast = item.length;
|
||||
if(i==last){
|
||||
for (int j = 0; j < itemLast; j++) {
|
||||
if (j == itemLast-1){
|
||||
sb.append(item[j]);
|
||||
}else {
|
||||
sb.append(item[j]).append("#");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (int j = 0; j < itemLast; j++) {
|
||||
if (j == itemLast-1){
|
||||
sb.append(item[j]).append("|");
|
||||
}else {
|
||||
sb.append(item[j]).append("#");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String getServiceKey(String serviceName, String host, String port) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ public class MapLogic {
|
|||
MapMissionManager.updateMapMission(user, EventType.updatePonintEvent, pointId, pointId);
|
||||
CommonProto.Drop.Builder dropBuilder = null;
|
||||
if (sOptionConfig.getReward().length > 0) {
|
||||
dropBuilder = ItemUtil.drop(user, sOptionConfig.getReward(), 1, 0, BIReason.MAP_EVENET_REWARD);
|
||||
dropBuilder = ItemUtil.dropByGroup(user, sOptionConfig.getReward(), 1, 0, BIReason.MAP_EVENET_REWARD);
|
||||
}
|
||||
List<CommonProto.EventBehaviorValues> eventBehaviorValuesList = new ArrayList<>();
|
||||
for (int i = 0; i < sOptionConfig.getBehaviorTypeValues().length; i++) {
|
||||
|
|
@ -1302,7 +1302,7 @@ public class MapLogic {
|
|||
if (mission.getMissionInfo() != null) {
|
||||
checkMissionReturn.newEventId = mission.getMissionInfo();
|
||||
}
|
||||
checkMissionReturn.drop = ItemUtil.drop(user, sMissionEventsConfig.getReward(), 1, 0, BIReason.MAP_MISSION_REWARD);
|
||||
checkMissionReturn.drop = ItemUtil.dropByGroup(user, sMissionEventsConfig.getReward(), 1, 0, BIReason.MAP_MISSION_REWARD);
|
||||
int useTime = getUseTime(user);
|
||||
mission.setTime(useTime);
|
||||
CrossInfo crossInfo = user.getMapManager().getCrossInfoMap().get(mapManager.getCurMapId());
|
||||
|
|
@ -1525,7 +1525,7 @@ public class MapLogic {
|
|||
|
||||
SChallengeMapConfig sChallengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(mapId);
|
||||
for (int i = 0; i < count; i++) {
|
||||
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sChallengeMapConfig.getSweepingAward(), 1, 0, BIReason.MAP_SWEEP_REWARD);
|
||||
CommonProto.Drop.Builder dropBuilder = ItemUtil.dropByGroup(user, sChallengeMapConfig.getSweepingAward(), 1, 0, BIReason.MAP_SWEEP_REWARD);
|
||||
mapSweepResponse.addDrop(dropBuilder);
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId(), count));
|
||||
|
|
@ -1579,7 +1579,7 @@ public class MapLogic {
|
|||
.setResult(fightResult.getResult());
|
||||
if (fightResult.getResult() == 1) {
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(mapManager.getSuddenlyBoss());
|
||||
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1.0f, 0, BIReason.SUDDENLY_REWARD);
|
||||
CommonProto.Drop.Builder dropBuilder = ItemUtil.dropByGroup(user, sMonsterGroup.getRewardgroup(), 1.0f, 0, BIReason.SUDDENLY_REWARD);
|
||||
builderResponse.setEnventDrop(dropBuilder);
|
||||
mapManager.findSuddenlyBoss(0, 0);
|
||||
}
|
||||
|
|
@ -2632,7 +2632,7 @@ public class MapLogic {
|
|||
if (!dailyPass.contains(id)) {
|
||||
throw new ErrorCodeException(ErrorCode.DAILY_ALREADY_PASS);
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.dropByGroup(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||
builder.setDrop(drop);
|
||||
consumeCount = true;
|
||||
} else if (type == 1) {
|
||||
|
|
@ -2685,7 +2685,7 @@ public class MapLogic {
|
|||
FightRecordLogic.getInstance().addRecordMap(user, fightData);
|
||||
|
||||
if (fightResult.getResult() > 0) {
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.dropByGroup(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||
builder.setDrop(drop);
|
||||
playerInfoManager.addDailyPass(id);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1438,17 +1438,17 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
boolean isBreak = false;
|
||||
int[][] consume;
|
||||
long[][] consume;
|
||||
int breakId = hero.getBreakId();
|
||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||
Map<Integer, Long> consumeMap = new HashMap<>();
|
||||
if (scHeroRankUpConfig != null && breakId != scHeroRankUpConfig.getId()) {
|
||||
isBreak = true;
|
||||
consume = scHeroRankUpConfig.getConsumeMaterial();
|
||||
// combinedAttribute(consume,consumeMap);
|
||||
for (int[] item : consume) {
|
||||
int propertyId = item[0];
|
||||
int propertyValue = item[1];
|
||||
consumeMap.put(propertyId, consumeMap.getOrDefault(propertyId, 0) + propertyValue);
|
||||
for (long[] item : consume) {
|
||||
int propertyId = (int)item[0];
|
||||
long propertyValue = item[1];
|
||||
consumeMap.put(propertyId, consumeMap.getOrDefault(propertyId, 0l) + propertyValue);
|
||||
}
|
||||
breakId = scHeroRankUpConfig.getId();
|
||||
} else {
|
||||
|
|
@ -1461,10 +1461,10 @@ public class HeroLogic {
|
|||
break;
|
||||
}
|
||||
consume = sHeroLevlConfig.getConsume();
|
||||
for (int[] item : consume) {
|
||||
int propertyId = item[0];
|
||||
int propertyValue = item[1];
|
||||
consumeMap.put(propertyId, consumeMap.getOrDefault(propertyId, 0) + propertyValue);
|
||||
for (long[] item : consume) {
|
||||
int propertyId = (int)item[0];
|
||||
long propertyValue = item[1];
|
||||
consumeMap.put(propertyId, consumeMap.getOrDefault(propertyId, 0l) + propertyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1481,12 +1481,12 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
//校验消耗
|
||||
boolean result = ItemUtil.itemCost(user, consumeMap, BIReason.UP_HERO_LEVEL_CONSUME, hero.getTemplateId());
|
||||
boolean result = ItemUtil.itemCostLong(user, consumeMap, BIReason.UP_HERO_LEVEL_CONSUME, hero.getTemplateId());
|
||||
if (!result) {
|
||||
int heroLevel = hero.getOriginalLevel();
|
||||
for (; oldLevel < targetLevel; oldLevel++) {
|
||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(oldLevel);
|
||||
if (!ItemUtil.itemCost(user, sHeroLevlConfig.getConsume(), BIReason.UP_HERO_LEVEL_CONSUME, hero.getTemplateId())) {
|
||||
if (!ItemUtil.itemCostLong(user, sHeroLevlConfig.getConsume(), BIReason.UP_HERO_LEVEL_CONSUME, hero.getTemplateId())) {
|
||||
break;
|
||||
}
|
||||
heroLevel++;
|
||||
|
|
@ -1651,8 +1651,8 @@ public class HeroLogic {
|
|||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
|
||||
int[][] consumeMaterial = scHeroRankUpConfig.getConsumeMaterial();
|
||||
boolean enoughCost = ItemUtil.itemCost(user, consumeMaterial, BIReason.UP_HEROSTAR_CONSUME, targetHero.getTemplateId());
|
||||
long[][] consumeMaterial = scHeroRankUpConfig.getConsumeMaterial();
|
||||
boolean enoughCost = ItemUtil.itemCostLong(user, consumeMaterial, BIReason.UP_HEROSTAR_CONSUME, targetHero.getTemplateId());
|
||||
if (!enoughCost) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
|
@ -1712,7 +1712,7 @@ public class HeroLogic {
|
|||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
|
||||
}
|
||||
String consume = StringUtil.parseArrayToString(consumeMaterial);
|
||||
String consume = StringUtil.parseLongArrayToString(consumeMaterial);
|
||||
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.hero_star.getType(), targetHero.getStar()));
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.HERO_STRENGTHEN.getType(), String.valueOf(targetHero.getTemplateId()), String.valueOf(oldStar), String.valueOf(targetHero.getStar()), consume, reportConsumeHero.toString());
|
||||
}
|
||||
|
|
@ -4763,9 +4763,9 @@ public class HeroLogic {
|
|||
*/
|
||||
public void dismantleHeroLevel(Hero hero, Map<Integer, Long> baseItemMap) {
|
||||
// 等级折算
|
||||
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel()).getSumConsume();
|
||||
for (int[] item : sumConsume) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
long[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel()).getSumConsume();
|
||||
for (long[] item : sumConsume) {
|
||||
baseItemMap.put((int)item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
int breakFloor = hero.getBreakId() == 0 ? 0 : STableManager.getConfig(SCHeroRankUpConfig.class).get(hero.getBreakId()).getPhase()[1];
|
||||
SHeroSacrifice breakSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(2, breakFloor);
|
||||
|
|
@ -4783,9 +4783,9 @@ public class HeroLogic {
|
|||
@Deprecated
|
||||
public void dismantleHeroLevelBack(Hero hero, Map<Integer, Long> baseItemMap) {
|
||||
// 等级折算
|
||||
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel()).getSumConsume();
|
||||
for (int[] item : sumConsume) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
long[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel()).getSumConsume();
|
||||
for (long[] item : sumConsume) {
|
||||
baseItemMap.put((int)item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
Map<Integer, SHeroReturn> sHeroReturnMap = SHeroReturn.sheroReturnMap.get(hero.getTemplateId());
|
||||
int breakFloor = hero.getBreakId() == 0 ? 0 : STableManager.getConfig(SCHeroRankUpConfig.class).get(hero.getBreakId()).getPhase()[1];
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ public class ItemUtil {
|
|||
/**
|
||||
* 掉落
|
||||
*/
|
||||
public static CommonProto.Drop.Builder drop(User user, int[] dropGroupIds,float dropRatio, int isMapping,int reason) throws Exception {
|
||||
public static CommonProto.Drop.Builder dropByGroup(User user, int[] dropGroupIds,float dropRatio, int isMapping,int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
ItemMap itemObj = new ItemMap();
|
||||
combineRewardDropGroup(user, dropGroupIds, dropRatio,itemObj);
|
||||
|
|
@ -238,10 +238,11 @@ public class ItemUtil {
|
|||
/**
|
||||
* 掉落 走特权
|
||||
*/
|
||||
public static CommonProto.Drop.Builder dropToPrivilege(User user, int[] dropGroupIds, int reason) throws Exception {
|
||||
public static CommonProto.Drop.Builder dropToPrivilege(User user, int[][] dropIds, int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
ItemMap itemObj = new ItemMap();
|
||||
combineRewardDropGroup(user, dropGroupIds, 1,itemObj);
|
||||
selectItemArr(dropIds,itemObj);
|
||||
// combineRewardDropGroup(user, dropIds, 1,itemObj);
|
||||
privilegeAddToMainLevelChallenge(user, itemObj);
|
||||
mapToAdd(user,itemObj,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
|
|
@ -1503,6 +1504,21 @@ public class ItemUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean itemCostLong(User user,long[][] costItems,int reason,int subReson) throws Exception {
|
||||
Map<Integer,Long> costMap = new HashMap<Integer,Long>();
|
||||
for(long[] item : costItems){
|
||||
int propertyId = (int)item[0];
|
||||
long propertyValue = item[1];
|
||||
costMap.put(propertyId, costMap.getOrDefault(propertyId, 0l) + propertyValue);
|
||||
}
|
||||
boolean result = checkCostLong(user, costMap);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItemLong(user, costMap,reason,subReson);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean checkCost(User user, Map<Integer, Integer> itemMap) throws Exception {
|
||||
HashMap<Integer, Long> longMap = new HashMap<>();
|
||||
itemMap.forEach((k,v)->longMap.put(k,v.longValue()));
|
||||
|
|
@ -1616,7 +1632,7 @@ public class ItemUtil {
|
|||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
if (!dropIds.toString().isEmpty()){
|
||||
int[] ints = StringUtil.parseFiledInt(dropIds.toString());
|
||||
drop = ItemUtil.drop(user, ints, 1, 0,reason);
|
||||
drop = ItemUtil.dropByGroup(user, ints, 1, 0,reason);
|
||||
}
|
||||
return drop;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
|||
|
||||
private int openStar;
|
||||
|
||||
private int[][] consumeMaterial;
|
||||
private long[][] consumeMaterial;
|
||||
|
||||
private int star;
|
||||
|
||||
private int show;
|
||||
|
||||
private int[][] sumConsume;
|
||||
private long[][] sumConsume;
|
||||
|
||||
private int judgeClass;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
|||
return openStar;
|
||||
}
|
||||
|
||||
public int[][] getConsumeMaterial() {
|
||||
public long[][] getConsumeMaterial() {
|
||||
return consumeMaterial;
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
|||
}
|
||||
|
||||
|
||||
public int[][] getSumConsume() {
|
||||
public long[][] getSumConsume() {
|
||||
return sumConsume;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ public class SHeroLevlConfig implements BaseConfig{
|
|||
|
||||
private float speedLevelPara;
|
||||
|
||||
private int[][] consume;
|
||||
private int[][] sumConsume;
|
||||
private long[][] consume;
|
||||
private long[][] sumConsume;
|
||||
|
||||
private int[][] rankupReturn;
|
||||
|
||||
|
|
@ -51,11 +51,11 @@ public class SHeroLevlConfig implements BaseConfig{
|
|||
return characterLevelPara;
|
||||
}
|
||||
|
||||
public int[][] getConsume() {
|
||||
public long[][] getConsume() {
|
||||
return consume;
|
||||
}
|
||||
|
||||
public int[][] getSumConsume() {
|
||||
public long[][] getSumConsume() {
|
||||
return sumConsume;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class SMainLevelConfig implements BaseConfig {
|
|||
|
||||
private int monsterGroup;
|
||||
|
||||
private int[] reward;
|
||||
private int[][]reward;
|
||||
|
||||
private int[] randomRewardMin;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ public class SMainLevelConfig implements BaseConfig {
|
|||
return monsterGroup;
|
||||
}
|
||||
|
||||
public int[] getReward() {
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue