Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
88ee5cb6ae
|
@ -196,7 +196,7 @@ public class MongoUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, new LinkedList<>(ids), 2);
|
}, new LinkedList<>(ids), 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ public interface GlobalItemType {
|
||||||
int ALL_DROP = 1; //全部掉落
|
int ALL_DROP = 1; //全部掉落
|
||||||
int WEIGHT_DROP = 2; //随机掉落
|
int WEIGHT_DROP = 2; //随机掉落
|
||||||
int SUCCESSIVELY_RANDOM = 3; // 依次随机
|
int SUCCESSIVELY_RANDOM = 3; // 依次随机
|
||||||
|
int SELETEONE = 4; //n 选1
|
||||||
|
|
||||||
// 物品类型
|
// 物品类型
|
||||||
int GEM = 3; // 钻石Id(充值获得)
|
int GEM = 3; // 钻石Id(充值获得)
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class UseAndPriceItemHandler extends BaseHandler<PlayerInfoProto.UseAndPr
|
||||||
}else if(type==4){//分解宝器
|
}else if(type==4){//分解宝器
|
||||||
ItemLogic.getInstance().decomposeJewel(iSession,equipIdsList);
|
ItemLogic.getInstance().decomposeJewel(iSession,equipIdsList);
|
||||||
|
|
||||||
|
}else if(type==6){
|
||||||
|
ItemLogic.getInstance().useItem(iSession,itemList,useAndPriceItemRequest.getItemId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ public class RechargeInfo extends MongoBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDyGoodsCanBuyTimes(Integer type) {
|
public void addDyGoodsCanBuyTimes(Integer type) {
|
||||||
this.dyGoodsCanBuyTimes.put(type,this.dyGoodsCanBuyTimes.get(type)+1 );
|
this.dyGoodsCanBuyTimes.put(type,this.dyGoodsCanBuyTimes.getOrDefault(type,0)+1 );
|
||||||
updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
|
updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,9 @@ public class ItemLogic {
|
||||||
LOGGER.info("useItem ==>uid={},itemNum={},openBoxLimits={}",uid,item.getItemNum(),openBoxLimits);
|
LOGGER.info("useItem ==>uid={},itemNum={},openBoxLimits={}",uid,item.getItemNum(),openBoxLimits);
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_USE_ONE_MAX);
|
throw new ErrorCodeException(ErrorCode.ITEM_USE_ONE_MAX);
|
||||||
}
|
}
|
||||||
|
if (sItem.getUseType() ==2){ //n 选1
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
if (sItem.getUseType() ==0){
|
if (sItem.getUseType() ==0){
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_USE_NOT);
|
throw new ErrorCodeException(ErrorCode.ITEM_USE_NOT);
|
||||||
}
|
}
|
||||||
|
@ -153,6 +156,68 @@ public class ItemLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用选择宝箱道具
|
||||||
|
*/
|
||||||
|
public void useItem(ISession iSession,List<CommonProto.Item> itemList,int itemId) throws Exception {
|
||||||
|
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
if (itemList.size() == 0 ){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
int openBoxLimits = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getOpenBoxLimits();
|
||||||
|
for (CommonProto.Item item :itemList){
|
||||||
|
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||||
|
if (item.getItemNum() > openBoxLimits){
|
||||||
|
LOGGER.info("useItem ==>uid={},itemNum={},openBoxLimits={}",uid,item.getItemNum(),openBoxLimits);
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_USE_ONE_MAX);
|
||||||
|
}
|
||||||
|
if (sItem.getUseType() !=2){ //n 选1
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder cost = new StringBuilder();
|
||||||
|
|
||||||
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
Map<Integer, Integer> cardMap = new HashMap<>();
|
||||||
|
Map<Integer,Integer> equipMap = new HashMap<>();
|
||||||
|
Map<Integer,Integer> randomMap = new HashMap<>();
|
||||||
|
|
||||||
|
int num=0;
|
||||||
|
for (CommonProto.Item item :itemList){
|
||||||
|
if (cost.length() == 0){
|
||||||
|
cost = new StringBuilder(item.getItemId() + "#" + item.getItemNum());
|
||||||
|
}else{
|
||||||
|
cost.append("|").append(item.getItemId()).append("#").append(item.getItemNum());
|
||||||
|
}
|
||||||
|
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||||
|
num+=item.getItemNum();
|
||||||
|
ItemUtil.combineReward(user,true,sItem.getRewardGroup(), 1f,itemMap,cardMap,equipMap,randomMap,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
|
||||||
|
|
||||||
|
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.USER_ITEM,0);
|
||||||
|
if (!result){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!itemMap.containsKey(itemId)&&!cardMap.containsKey(itemId)&&!equipMap.containsKey(itemId)&&!randomMap.containsKey(itemId)){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//drop
|
||||||
|
int[][] dropItems = new int[1][];
|
||||||
|
dropItems[0] = new int[2];
|
||||||
|
dropItems[0][0] = itemId;
|
||||||
|
dropItems[0][1] = num;
|
||||||
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.USER_ITEM);
|
||||||
|
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分解装备
|
* 分解装备
|
||||||
* @param iSession
|
* @param iSession
|
||||||
|
|
|
@ -142,7 +142,8 @@ public class CBean2Proto {
|
||||||
|
|
||||||
|
|
||||||
public static CommonProto.Equip getEquipProto(PropertyItem equip){
|
public static CommonProto.Equip getEquipProto(PropertyItem equip){
|
||||||
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
//前端读表
|
||||||
|
// Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
||||||
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
||||||
CommonProto.Equip.Builder equipProto =CommonProto.Equip.newBuilder()
|
CommonProto.Equip.Builder equipProto =CommonProto.Equip.newBuilder()
|
||||||
.setEquipId(equip.getEquipId())
|
.setEquipId(equip.getEquipId())
|
||||||
|
@ -151,8 +152,7 @@ public class CBean2Proto {
|
||||||
.setIsLocked(equip.getIsLocked());
|
.setIsLocked(equip.getIsLocked());
|
||||||
if(equip instanceof Equip){
|
if(equip instanceof Equip){
|
||||||
Equip tempEquip =(Equip)equip;
|
Equip tempEquip =(Equip)equip;
|
||||||
equipProto.setMainAttribute(parseFromMap(propertyValueByIdMap).get(0))
|
equipProto .addAllSecondAttribute(parseFromMap(secondValueByIdMap))
|
||||||
.addAllSecondAttribute(parseFromMap(secondValueByIdMap))
|
|
||||||
.setRebuildLevel(tempEquip.getRebuildLevel())
|
.setRebuildLevel(tempEquip.getRebuildLevel())
|
||||||
.setSkillId(tempEquip.getSkill());
|
.setSkillId(tempEquip.getSkill());
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,8 @@ public class ItemUtil {
|
||||||
addEquip(user, equipMap, dropBuilder,reason);
|
addEquip(user, equipMap, dropBuilder,reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void combineRewardDropGroup(User user, int[] dropGroupIds, float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap) {
|
private static void combineRewardDropGroup(User user, int[] dropGroupIds, float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap) {
|
||||||
for (int dropGroupId : dropGroupIds) {
|
for (int dropGroupId : dropGroupIds) {
|
||||||
if(MapLogic.getInstance().getDifficultyReward().containsKey(dropGroupId)){
|
if(MapLogic.getInstance().getDifficultyReward().containsKey(dropGroupId)){
|
||||||
|
@ -373,6 +375,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sRewardGroup.getIsUpset()) {
|
switch (sRewardGroup.getIsUpset()) {
|
||||||
|
case GlobalItemType.SELETEONE:
|
||||||
case GlobalItemType.ALL_DROP:
|
case GlobalItemType.ALL_DROP:
|
||||||
getMap(user,StringUtil.parseFiledInt(rewardStr),itemMap,cardMap,equipMap,randomMap,dropRatio);
|
getMap(user,StringUtil.parseFiledInt(rewardStr),itemMap,cardMap,equipMap,randomMap,dropRatio);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class SItem implements BaseConfig {
|
||||||
private int itemBaseType; //道具类型(该道具在哪个背包显示)
|
private int itemBaseType; //道具类型(该道具在哪个背包显示)
|
||||||
private int quantity;
|
private int quantity;
|
||||||
private int useType; //使用类型0不使用 1掉落组 2N选1
|
private int useType; //使用类型0不使用 1掉落组 2N选1
|
||||||
private int rewardGroup;
|
private int[] rewardGroup;
|
||||||
private int usePerCount;
|
private int usePerCount;
|
||||||
private boolean isopen;
|
private boolean isopen;
|
||||||
private int isSave;
|
private int isSave;
|
||||||
|
@ -61,7 +61,7 @@ public class SItem implements BaseConfig {
|
||||||
return useType;
|
return useType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRewardGroup() {
|
public int[] getRewardGroup() {
|
||||||
return rewardGroup;
|
return rewardGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue