命格脚本优化
parent
b8de907745
commit
9060e00553
|
@ -124,7 +124,7 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
* @param addItemMap
|
||||
* @return
|
||||
*/
|
||||
public boolean LifeStoneAllUp(ItemManager itemManager,TreeMap<Integer,SGemConfig>gemConfigMap, Map<Integer, Long>costItemMap, Map<Integer, Long>addItemMap){
|
||||
private boolean LifeStoneAllUp(ItemManager itemManager, TreeMap<Integer, SGemConfig> gemConfigMap, Map<Integer, Long> costItemMap, Map<Integer, Long> addItemMap) {
|
||||
long addCount = 0;//一个循环合成数量
|
||||
long costGoldNum = 0;//合成金币总消耗
|
||||
int costGoldId = gemConfigMap.get(1).getUpgradeCost()[0];//获取消耗材料id
|
||||
|
@ -159,7 +159,9 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
if (remainNum != 0) {
|
||||
costNum -= remainNum;
|
||||
}
|
||||
if (costNum>0){
|
||||
if (costNum <= 0) {
|
||||
continue;
|
||||
}
|
||||
//本次合成消耗
|
||||
long needCostGoldNum = costNum / stoneNum * costGold[1];
|
||||
long haveGoldNum = 0;
|
||||
|
@ -169,7 +171,13 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
///金币不足情况中断合成
|
||||
if (needCostGoldNum + costGoldNum > haveGoldNum) {
|
||||
long upNum = (haveGoldNum - costGoldNum) / costGold[1];
|
||||
costItemMap.put(gemConfig.getId(),upNum*stoneNum);
|
||||
long endCostNum = upNum * stoneNum;
|
||||
long haveCostNum = endCostNum - addCount;
|
||||
if (haveCostNum > 0) {
|
||||
costItemMap.put(gemConfig.getId(), haveCostNum);
|
||||
} else {
|
||||
addItemMap.put(gemConfig.getId(), -haveCostNum);
|
||||
}
|
||||
addItemMap.put(gemConfig.getNextGem(), upNum);
|
||||
costGoldNum += upNum * costGold[1];
|
||||
//刷新消耗金币数量
|
||||
|
@ -189,7 +197,7 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
}
|
||||
//保存累计消耗金币数量
|
||||
costItemMap.put(costGold[0], costGoldNum);
|
||||
}
|
||||
|
||||
if (curItem == null) {
|
||||
addItemMap.put(gemConfig.getId(), remainNum);
|
||||
}
|
||||
|
@ -206,7 +214,7 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
* @param selectGemLv
|
||||
* @return
|
||||
*/
|
||||
public boolean LifeStoneQuickUp(ItemManager itemManager,TreeMap<Integer,SGemConfig>gemConfigMap, Map<Integer, Long>costItemMap,int selectGemLv){
|
||||
private boolean LifeStoneQuickUp(ItemManager itemManager, TreeMap<Integer, SGemConfig> gemConfigMap, Map<Integer, Long> costItemMap, int selectGemLv) {
|
||||
long addCount = 0;//一个循环合成数量
|
||||
long costGoldNum = 0;//合成金币总消耗
|
||||
for (Map.Entry<Integer, SGemConfig> gemConfigEntry : gemConfigMap.entrySet()) {
|
||||
|
@ -233,8 +241,8 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
//剩余数量
|
||||
long remainNum = costNum % stoneNum;
|
||||
if (costNum > needNum) {
|
||||
costNum=needNum;
|
||||
remainNum = costNum - needNum;
|
||||
costNum = needNum;
|
||||
}
|
||||
addCount = costNum / stoneNum;
|
||||
//本次合成消耗金币
|
||||
|
@ -255,6 +263,7 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
}
|
||||
return addCount == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取升级到目标等级获取消耗指定命石需要数量
|
||||
* @param stoneType 命石类型
|
||||
|
|
Loading…
Reference in New Issue