Exemplo n.º 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;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Parse SetItems.txt
        /// </summary>
        /// <param name="log">Log callback</param>
        public void ParseDataFile(Action <string, LogLevel> log = null)
        {
            LogHelper.Log(log, "Parsing SetItems ...");
            if (DataController.Instance == null)
            {
                LogHelper.Log(log, "Initialize DataController first!", LogLevel.Error);
                return;
            }
            var data = DataController.Instance[DataFileEnum.SetItems];

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

            _items   = new ListDict <string, SetItem>(data.RowCount);
            _codeMap = new Dictionary <string, List <SetItem> >(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 SetItems row {i}, skipped.", LogLevel.Warning);
                    continue;
                }
                if (_items.ContainsKey(name))
                {
                    LogHelper.Log(log, $"Name [{name}] already exists, SetItems row {i} skipped.", LogLevel.Warning);
                    continue;
                }
                SetItem item = new SetItem
                               (
                    i,
                    name,
                    data[i, "set"],
                    data[i, "item"],
                    data[i, "*item"],
                    DataHelper.ParseInt(data[i, "rarity"]),
                    DataHelper.ParseInt(data[i, "lvl"]),
                    DataHelper.ParseInt(data[i, "lvl req"])
                               );
                _items.Add(name, item);
                if (!_codeMap.ContainsKey(item.Code))
                {
                    _codeMap.Add(item.Code, new List <SetItem>(20));
                }
                _codeMap[item.Code].Add(item);
            }
            LogHelper.Log(log, $"Parsed {Count} set item(s).");
        }