Esempio n. 1
0
        protected override bool IsObject(AmfObject obj)
        {
            var id = obj.GetString("id");

            // Save format fixup, only needed when editing older saves
            if (id == null && obj.Contains("perkName"))
            {
                obj["id"]       = obj["perkName"];
                obj["perkName"] = null;
                obj["perkDesc"] = null;
                id = obj.GetString("id");
            }

            // Fixes saves which have NaNs for some perk values, which crashes CoC
            if (double.IsNaN(obj.GetDouble("value1")))
            {
                obj["value1"] = 0;
            }
            if (double.IsNaN(obj.GetDouble("value2")))
            {
                obj["value2"] = 0;
            }
            if (double.IsNaN(obj.GetDouble("value3")))
            {
                obj["value3"] = 0;
            }
            if (double.IsNaN(obj.GetDouble("value4")))
            {
                obj["value4"] = 0;
            }

            return(id == _xml.Name);
        }
Esempio n. 2
0
        protected override bool IsObject(AmfObject obj)
        {
            var storageName = obj.GetString("storageName");

            PerkVM.fixup(obj);
            return(storageName == _xml.Name);
        }
Esempio n. 3
0
        public FlagVM(GameVM game, AmfObject flags, XmlEnum data, int index)
        {
            _flagArray = flags;
            _game = game;
            _index = index;
            _label = data != null ? data.Name : "";
            _comment = data != null ? data.Description : "";
            if (!String.IsNullOrEmpty(_comment)) _label = _label + "\u202F*";

            var value = flags[_index];
            if (value is AmfObject) _valueTrait = ((AmfObject)value).Trait;
            _valueLabel = flags.GetString(_index);

            GameVMProperties = new HashSet<string>();
        }
Esempio n. 4
0
        public void CleanupInventory()
        {
            //shift all the items around in the inventory
            const int maxSlots = 10;
            AmfObject inv      = GetObj("inventory");
            AmfObject nInv     = new AmfObject(AmfTypes.Array);

            for (int i = 0; i < maxSlots; ++i)
            {
                AmfObject item = (AmfObject)inv[i];
                if (item == null)
                {
                    continue;
                }
                if (item.GetString("classInstance") != XmlItem.Empty.ID)
                {
                    nInv.Push(item);
                }
            }
            SetValue("inventory", nInv);
        }
Esempio n. 5
0
        protected override bool IsObject(AmfObject obj)
        {
            var id = obj.GetString("id");

            // Save format fixup, only needed when editing older saves
            if (id == null && obj.Contains("perkName"))
            {
                obj["id"] = obj["perkName"];
                obj["perkName"] = null;
                obj["perkDesc"] = null;
                id = obj.GetString("id");
            }

            // Fixes saves which have NaNs for some perk values, which crashes CoC
            if (double.IsNaN(obj.GetDouble("value1"))) obj["value1"] = 0;
            if (double.IsNaN(obj.GetDouble("value2"))) obj["value2"] = 0;
            if (double.IsNaN(obj.GetDouble("value3"))) obj["value3"] = 0;
            if (double.IsNaN(obj.GetDouble("value4"))) obj["value4"] = 0;

            return id == _xml.Name;
        }
Esempio n. 6
0
        public FlagVM(GameVM game, AmfObject flags, XmlEnum data, int index)
        {
            _flagArray = flags;
            _game      = game;
            _index     = index;
            _label     = data != null ? data.Name : "";
            _comment   = data != null ? data.Description : "";
            if (!String.IsNullOrEmpty(_comment))
            {
                _label = _label + "\u202F*";
            }

            var value = flags[_index];

            if (value is AmfObject)
            {
                _valueTrait = ((AmfObject)value).Trait;
            }
            _valueLabel = flags.GetString(_index);

            GameVMProperties = new HashSet <string>();
        }
Esempio n. 7
0
 public string GetString(object key)
 {
     return(_obj.GetString(key));
 }
Esempio n. 8
0
        protected virtual bool IsObject(AmfObject obj)
        {
            var storageName = (null != obj) ? obj.GetString("storageName") : "";

            return(storageName == Name);
        }
Esempio n. 9
0
 public string GetString(object key)
 {
     return((null != _obj) ? _obj.GetString(key) : null);
 }
Esempio n. 10
0
 protected override bool IsObject(AmfObject obj)
 {
     return obj.GetString("statusAffectName") == _xml.Name;
 }
Esempio n. 11
0
 protected override bool IsObject(AmfObject obj)
 {
     return(obj.GetString("statusAffectName") == _xml.Name);
 }