少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-24 5b840b3e58aaa6c73e6c143d06ee1fa74869e650
3335 给通过物品id取物品的接口添加 默认 参数 includeAuction=false
2个文件已修改
44 ■■■■ 已修改文件
System/KnapSack/Logic/PackModel.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/SinglePack.cs 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PackModel.cs
@@ -653,12 +653,12 @@
            return itemModel;
        }
        public List<ItemModel> GetItemsById(PackType type, int id)
        public List<ItemModel> GetItemsById(PackType type, int id, bool includeAuction = false)
        {
            if (playerPackDict.ContainsKey(type))
            {
                var singlePack = playerPackDict[type];
                return singlePack.GetItemsById(id);
                return singlePack.GetItemsById(id, includeAuction);
            }
            else
            {
@@ -678,11 +678,16 @@
            }
        }
        public string GetItemGUIDByID(int itemId)
        public string GetItemGUIDByID(int itemId, bool includeAuction = false)
        {
            string guid = string.Empty;
            foreach (var key in itemGUIDDict.Keys)
            {
            {
                if (!includeAuction && itemGUIDDict[key].isAuction)
                {
                    continue;
                }
                if (itemGUIDDict[key].itemId == itemId)
                {
                    guid = key;
@@ -699,13 +704,13 @@
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public int GetItemCountByID(PackType type, int id)
        public int GetItemCountByID(PackType type, int id, bool includeAuction = false)
        {
            int count = 0;
            var singlePack = GetSinglePack(type);
            if (singlePack != null)
            {
                count = singlePack.GetCountById(id);
                count = singlePack.GetCountById(id, includeAuction);
            }
            return count;
System/KnapSack/Logic/SinglePack.cs
@@ -57,25 +57,35 @@
            return items;
        }
        public List<ItemModel> GetItemsById(int itemId)
        public List<ItemModel> GetItemsById(int itemId, bool includeAuction = false)
        {
            var list = new List<ItemModel>();
            foreach (var model in items.Values)
            foreach (var item in items.Values)
            {
                if (model.itemId == itemId)
                if (!includeAuction && item.isAuction)
                {
                    list.Add(model);
                    continue;
                }
                if (item.itemId == itemId)
                {
                    list.Add(item);
                }
            }
            return list;
        }
        public int GetCountById(int itemId)
        public int GetCountById(int itemId, bool includeAuction = false)
        {
            var count = 0;
            foreach (var item in items.Values)
            {
                if (!includeAuction && item.isAuction)
                {
                    continue;
                }
                if (item.itemId == itemId)
                {
                    count += item.count;
@@ -127,11 +137,16 @@
        /// <param name="needCount"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public List<int> GetItemIndexsAppointedCount(int itemId, int needCount)
        public List<int> GetItemIndexsAppointedCount(int itemId, int needCount, bool includeAuction = false)
        {
            var goalItems = new List<ItemModel>();
            foreach (var item in this.items.Values)
            {
                if (!includeAuction && item.isAuction)
                {
                    continue;
                }
                if (item.itemId == itemId)
                {
                    goalItems.Add(item);