예제 #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);
        }
예제 #2
0
        protected override bool IsObject(AmfObject obj)
        {
            var storageName = obj.GetString("storageName");

            PerkVM.fixup(obj);
            return(storageName == _xml.Name);
        }
예제 #3
0
파일: FlagVM.cs 프로젝트: Belgrath/CoCEd
        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>();
        }
예제 #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);
        }
예제 #5
0
파일: PerkVM.cs 프로젝트: Belgrath/CoCEd
        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;
        }
예제 #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>();
        }
예제 #7
0
파일: VM.cs 프로젝트: zeek20freak/TiTsEd
 public string GetString(object key)
 {
     return(_obj.GetString(key));
 }
예제 #8
0
        protected virtual bool IsObject(AmfObject obj)
        {
            var storageName = (null != obj) ? obj.GetString("storageName") : "";

            return(storageName == Name);
        }
예제 #9
0
파일: VM.cs 프로젝트: reddraggon2001/TiTsEd
 public string GetString(object key)
 {
     return((null != _obj) ? _obj.GetString(key) : null);
 }
예제 #10
0
파일: StatusVM.cs 프로젝트: tmedwards/CoCEd
 protected override bool IsObject(AmfObject obj)
 {
     return obj.GetString("statusAffectName") == _xml.Name;
 }
예제 #11
0
파일: StatusVM.cs 프로젝트: klorpa/CoCEd
 protected override bool IsObject(AmfObject obj)
 {
     return(obj.GetString("statusAffectName") == _xml.Name);
 }