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); }
protected override bool IsObject(AmfObject obj) { var storageName = obj.GetString("storageName"); PerkVM.fixup(obj); return(storageName == _xml.Name); }
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>(); }
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); }
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; }
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>(); }
public string GetString(object key) { return(_obj.GetString(key)); }
protected virtual bool IsObject(AmfObject obj) { var storageName = (null != obj) ? obj.GetString("storageName") : ""; return(storageName == Name); }
public string GetString(object key) { return((null != _obj) ? _obj.GetString(key) : null); }
protected override bool IsObject(AmfObject obj) { return obj.GetString("statusAffectName") == _xml.Name; }
protected override bool IsObject(AmfObject obj) { return(obj.GetString("statusAffectName") == _xml.Name); }