Exemplo 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);
        }
Exemplo n.º 2
0
 public static void fixup(AmfObject obj)
 {
     PerkVM.initialize(obj, false);
     // Fixes saves which have NaNs for some perk values
     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;
     }
 }
Exemplo n.º 3
0
 public double GetDouble(object key)
 {
     return(_obj.GetDouble(key));
 }
Exemplo n.º 4
0
 public double GetDouble(object key, double?defaultValue = 0)
 {
     return(_obj.GetDouble(key, defaultValue));
 }
Exemplo 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;
        }