Ejemplo n.º 1
0
    public BaseItem(Dictionary <string, string> itemDictionary)
    {
        string[] delimiter = new string[] { " " };

        _name        = itemDictionary["Name"];
        _description = itemDictionary["Description"];
        _useText     = itemDictionary["UseText"];
        _ID          = int.Parse(itemDictionary["ID"]);
        _value       = int.Parse(itemDictionary["Value"]);
        _type        = (ItemTypes)System.Enum.Parse(typeof(BaseItem.ItemTypes), itemDictionary["Type"].ToString());
        _icon        = int.Parse(itemDictionary["Icon"]);

        string[] tempStats = itemDictionary["Stats"].Split(delimiter, StringSplitOptions.None);
        for (int i = 0; i < tempStats.Length; i++)
        {
            _stats.Add(BaseStat.Parse(tempStats[i]));
        }

        string[] tempModifiers = itemDictionary["Modifier"].Split(delimiter, StringSplitOptions.None);
        for (int i = 0; i < tempModifiers.Length; i++)
        {
            _modifiers.Add(int.Parse(tempModifiers[i]));
        }
    }