Exemple #1
0
 public DropResult(int dropLevel, Item baseItem, ItemQuality quality, SetItem setItem = null, UniqueItem uniqueItem = null, string paramText = null)
 {
     DropLevel  = dropLevel;
     BaseItem   = baseItem;
     Quality    = quality;
     SetItem    = setItem;
     UniqueItem = uniqueItem;
     ParamText  = paramText;
 }
Exemple #2
0
        /// <summary>
        /// Parse UniqueItems.txt
        /// </summary>
        /// <param name="log">Log callback</param>
        public void ParseDataFile(Action <string, LogLevel> log = null)
        {
            LogHelper.Log(log, "Parsing UniqueItems ...");
            if (DataController.Instance == null)
            {
                LogHelper.Log(log, "Initialize DataController first!", LogLevel.Error);
                return;
            }
            var data = DataController.Instance[DataFileEnum.UniqueItems];

            if (data == null)
            {
                LogHelper.Log(log, "Load UniqueItems.txt first!", LogLevel.Error);
                return;
            }

            _items   = new ListDict <string, List <UniqueItem> >(data.RowCount);
            _codeMap = new Dictionary <string, List <UniqueItem> >(ItemTypes.Instance.Count);
            for (int i = 0; i < data.RowCount; i++)
            {
                var name = data[i, "index"];
                if (string.IsNullOrEmpty(name))
                {
                    LogHelper.Log(log, $"Null or empty name for UniqueItems row {i}, skipped.", LogLevel.Warning);
                    continue;
                }
                if (data[i, "enabled"] != "1")
                {
                    continue;
                }
                UniqueItem item = new UniqueItem
                                  (
                    i,
                    name,
                    data[i, "code"],
                    data[i, "*type"],
                    DataHelper.ParseInt(data[i, "rarity"]),
                    DataHelper.ParseInt(data[i, "lvl"]),
                    DataHelper.ParseInt(data[i, "lvl req"]),
                    DataHelper.ParseBool(data[i, "ladder"])
                                  );
                if (!_items.ContainsKey(name))
                {
                    _items.Add(name, new List <UniqueItem>(1));
                }
                _items[name].Add(item);
                if (!_codeMap.ContainsKey(item.Code))
                {
                    _codeMap.Add(item.Code, new List <UniqueItem>(20));
                }
                _codeMap[item.Code].Add(item);
            }
            LogHelper.Log(log, $"Parsed {Count} unique item(s).");
        }