修改物品类型

back_recharge
gaojie 2019-01-25 10:24:28 +08:00
parent 7f2209d1ff
commit af7e96dfa3
2 changed files with 20 additions and 6 deletions

View File

@ -8,8 +8,9 @@ public interface GlobalItemType {
// 物品类型 // 物品类型
int GEM = 3; // 钻石Id(充值获得) int GEM = 3; // 钻石Id(充值获得)
int ITEM = 10; //道具 int ITEM = 0; //道具
int CARD = 11; // 卡牌 int CARD = 1; // 卡牌
int EQUIP = 12; //装备 int CARD_FRAGMENT = 2; // 卡牌碎片
int EQUIP = 3; //装备
} }

View File

@ -139,7 +139,8 @@ public class ItemUtil {
private static void getMap(int itemId ,int itemNum, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,float dropRatio) { private static void getMap(int itemId ,int itemNum, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,float dropRatio) {
SItem sItem = SItem.getsItemMap().get(itemId); SItem sItem = SItem.getsItemMap().get(itemId);
switch (sItem.getItemType()) { int itemType =getItemType(sItem.getItemType());
switch (itemType) {
case GlobalItemType.ITEM: case GlobalItemType.ITEM:
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap); putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap);
break; break;
@ -154,6 +155,17 @@ public class ItemUtil {
} }
} }
private static int getItemType(int itemType) {
switch (itemType) {
case GlobalItemType.CARD_FRAGMENT:
itemType = GlobalItemType.ITEM;
break;
default:
break;
}
return itemType;
}
private static void putcountMap(int itemId,int itemNum, Map<Integer, Integer> map) { private static void putcountMap(int itemId,int itemNum, Map<Integer, Integer> map) {
map.merge(itemId, itemNum, (a, b) -> b + a); map.merge(itemId, itemNum, (a, b) -> b + a);
} }
@ -330,7 +342,8 @@ public class ItemUtil {
int itemId = costItem[0]; int itemId = costItem[0];
int itemNum = costItem[1]; int itemNum = costItem[1];
SItem sItem = SItem.getsItemMap().get(itemId); SItem sItem = SItem.getsItemMap().get(itemId);
switch (sItem.getItemType()) { int itemType = getItemType(sItem.getItemType());
switch (itemType) {
case GlobalItemType.GEM: case GlobalItemType.GEM:
putcountMap(itemId,itemNum,moneyMap); putcountMap(itemId,itemNum,moneyMap);
break; break;