Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
3069ff56e1
|
@ -11,12 +11,7 @@ import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ItemManager extends MongoBase {
|
public class ItemManager extends MongoBase {
|
||||||
private static Set<Integer> notDelete = new HashSet<>();
|
|
||||||
static {
|
|
||||||
notDelete.add(Global.STAMINA);
|
|
||||||
notDelete.add(Global.HEROSTORY_TICKET);
|
|
||||||
notDelete.add(Global.GENERALSTORY_TICKET);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
|
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -43,9 +38,6 @@ public class ItemManager extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(Integer key) {
|
public void removeItem(Integer key) {
|
||||||
if(notDelete.contains(key)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Item item = itemMap.get(key);
|
Item item = itemMap.get(key);
|
||||||
if (item!=null){
|
if (item!=null){
|
||||||
itemMap.remove(key);
|
itemMap.remove(key);
|
||||||
|
|
|
@ -23,6 +23,13 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
public class ItemUtil {
|
public class ItemUtil {
|
||||||
private static Map<Integer,String> dropRewardMap = new ConcurrentHashMap<>();
|
private static Map<Integer,String> dropRewardMap = new ConcurrentHashMap<>();
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
||||||
|
private static Set<Integer> notDelete = new HashSet<>();
|
||||||
|
static {
|
||||||
|
notDelete.add(Global.STAMINA);
|
||||||
|
notDelete.add(Global.HEROSTORY_TICKET);
|
||||||
|
notDelete.add(Global.GENERALSTORY_TICKET);
|
||||||
|
}
|
||||||
|
|
||||||
//指定道具掉落(如:邮件,初始化物品)
|
//指定道具掉落(如:邮件,初始化物品)
|
||||||
public static CommonProto.Drop.Builder drop(User user, int[][] itemArr,int reason) throws Exception {
|
public static CommonProto.Drop.Builder drop(User user, int[][] itemArr,int reason) throws Exception {
|
||||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||||
|
@ -538,7 +545,7 @@ public class ItemUtil {
|
||||||
if (null == myItem) {
|
if (null == myItem) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (myItem.getItemNum() <= needCount) {
|
if (myItem.getItemNum() <= needCount && !notDelete.contains(userItem.getKey())) {
|
||||||
itemManager.removeItem(userItem.getKey());
|
itemManager.removeItem(userItem.getKey());
|
||||||
} else {
|
} else {
|
||||||
myItem.setItemNum(myItem.getItemNum() - needCount);
|
myItem.setItemNum(myItem.getItemNum() - needCount);
|
||||||
|
|
Loading…
Reference in New Issue