public CockVM(GameVM game, AmfObject obj) : base(obj) { Piercing = new PiercingVM(obj, "", "Desc", PiercingLocation.C**k); _game = game; }
public ItemSlotVM(GameVM game, AmfObject obj, ItemCategories categories) : base(obj) { Categories = categories; _game = game; _allGroups = XmlData.Current.ItemGroups.Where(group => Categories.HasFlag(group.Category)).Select(x => new ItemGroupVM(_game, x, this)).ToArray(); AllGroups = new UpdatableCollection <ItemGroupVM>(_allGroups.Where(x => x.Items.Count != 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>(); }
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 Load(string path, SerializationFormat expectedFormat, bool createBackup) { FileManager.TryRegisterExternalFile(path); var file = new AmfFile(path); var dataVersion = file.GetString("version"); if (file.Error != null) { var box = new ExceptionBox() { Title = "Could not read file.", Message = "CoCEd could not read this file correctly. Maybe it was corrupted or generated by an old version of Flash. Continuing may make CoCEd unstable or cause it to corrupt the file. It is strongly advised that you cancel this operation.", Path = file.FilePath, ExceptionMessage = file.Error.Mesg, IsWarning = true, }; var result = box.ShowDialog(ExceptionBoxButtons.Continue, ExceptionBoxButtons.Cancel); Logger.Error(file.Error.Mesg); if (result != ExceptionBoxResult.Continue) { return; } } else if (String.IsNullOrEmpty(dataVersion)) { var box = new ExceptionBox() { Title = "File version too old.", Message = "CoCEd may not be able to read this file correctly as it was generated by an older version of CoC. Continuing may make CoCEd unstable or cause it to corrupt the file. It is strongly advised that you cancel this operation.", IsWarning = true, }; var result = box.ShowDialog(ExceptionBoxButtons.Continue, ExceptionBoxButtons.Cancel); Logger.Error(String.Format("{0} CoC data version: {1}.", box.Title, dataVersion)); if (result != ExceptionBoxResult.Continue) { return; } } // Some day I would like to be able to test `dataVersion` to ensure that it's not too old // of a version, however, as long as CoC developers keep pushing crappy version strings // (e.g. 0.8.4.8d), that can't happen. Ideally, I'd like to see them switch to SemVer. // // This probably doesn't really apply to Vanilla anymore, since its finished and unlikely // to even receive patches at this point. // Sanity checks: see if the save can be re-saved as-is OR if any of the top-level property names are invalid as identifiers. if (!file.CanBeSaved(SerializationFormat.Slot) || HasBadPropertyNames(file)) { var box = new ExceptionBox() { Title = "File could not be read correctly.", Message = "CoCEd could not read this file correctly, it is likely corrupted. Cancelling this operation.", IsWarning = true, }; box.ShowDialog(ExceptionBoxButtons.OK); Logger.Error(String.Format("{0} CoC data version: {1}.", box.Title, dataVersion)); return; } // Sanity check: ensure the actual format matches the expected format (just a warning to the user about mixing up the formats). if (file.Format != expectedFormat) { var box = new ExceptionBox() { Title = "File format different from expected format.", Message = "The file is actually a " + (file.Format == SerializationFormat.Slot ? "\"Slot\"" : "\"Save to File\"") + " format save, but it was loaded as though it were a " + (expectedFormat == SerializationFormat.Slot ? "\"Slot\"" : "\"Save to File\"") + " format save.\n\nThe two formats are not compatible, so care should be taken to ensure you do not confuse the two, since CoC can only load each format in a specific way. Attempting to load a \"Slot\" save as though it were a \"Save to File\" save, or vice versa, will cause CoC to think the save is corrupt, at best, or see the save deleted, at worse. Do not mix them up.", IsWarning = true, }; box.ShowDialog(ExceptionBoxButtons.OK); } if (createBackup) { FileManager.CreateBackup(path); } _currentFile = file; // Is this save from Vanilla, Revamp, or Xianxia? ModType modType; //if (_currentFile.Contains("soulforce")) //{ // modType = ModType.Xianxia; // XmlData.Select(XmlData.Files.Xianxia); //} //else if (_currentFile.Contains("hunger")) { modType = ModType.Revamp; XmlData.Select(XmlData.Files.Revamp); } else { modType = ModType.Vanilla; XmlData.Select(XmlData.Files.Vanilla); } Data = XmlData.Current; Game = new GameVM(_currentFile, Game, modType); OnPropertyChanged("Data"); OnPropertyChanged("Game"); OnPropertyChanged("HasData"); UpdateAppTitle(); VM.Instance.NotifySaveRequiredChanged(false); if (FileOpened != null) { FileOpened(null, null); } }
public ItemGroupVM(GameVM game, XmlItemGroup group, ItemSlotVM slot) { _game = game; Name = group.Name; Items = new UpdatableCollection <ItemVM>(group.Items.Where(x => Match(x, _game.ItemSearchText)).OrderBy(x => x.Name).Select(x => new ItemVM(slot, x))); }
public PerkVM(GameVM game, AmfObject perksArray, XmlNamedVector4 xml) : base(game, perksArray, xml) { }
public GameVM(AmfFile file, GameVM previousVM, bool isRevampMod = false) : base(file) { if (previousVM != null) { _itemSearchText = previousVM._itemSearchText; _perkSearchText = previousVM._perkSearchText; _rawDataSearchText = previousVM._rawDataSearchText; _keyItemSearchText = previousVM._keyItemSearchText; } // Is this save from vanilla CoC or the CoC-Revamp-Mod? IsRevampMod = isRevampMod; // Unique children Ass = new AssVM(file.GetObj("ass")); LipPiercing = new PiercingVM(file, "lip", PiercingLocation.Lip); NosePiercing = new PiercingVM(file, "nose", PiercingLocation.Nose); EarsPiercing = new PiercingVM(file, "ears", PiercingLocation.Ears); EyebrowPiercing = new PiercingVM(file, "eyebrow", PiercingLocation.Eyebrow); NipplesPiercing = new PiercingVM(file, "nipples", PiercingLocation.Nipples); TonguePiercing = new PiercingVM(file, "tongue", PiercingLocation.Tongue); // Collections Cocks = new CockArrayVM(this, file.GetObj("cocks")); Vaginas = new VaginaArrayVM(file.GetObj("vaginas")); Breasts = new BreastArrayVM(this, file.GetObj("breastRows")); Vaginas.CollectionChanged += OnGenitalCollectionChanged; Breasts.CollectionChanged += OnGenitalCollectionChanged; Cocks.CollectionChanged += OnGenitalCollectionChanged; // Flags int numFlags = XmlData.Current.Flags.Max(x => x.ID) + 25; // was 200; I'm unsure if there's really a need for a buffer at all anymore var xmlFlagByID = new XmlEnum[numFlags]; foreach(var xml in XmlData.Current.Flags) xmlFlagByID[xml.ID] = xml; var flagsArray = GetObj("flags"); if (flagsArray == null) { // For very old versions of CoC _obj["flags"] = flagsArray = new AmfObject(AmfTypes.Array); for (int i = 0; i < 3000; ++i) flagsArray.Push(0); } _allFlags = new FlagVM[numFlags]; for (int i = 0; i < _allFlags.Length; ++i) _allFlags[i] = new FlagVM(this, flagsArray, xmlFlagByID[i], i); Flags = new UpdatableCollection<FlagVM>(_allFlags.Where(x => x.Index > 0 && x.Match(_rawDataSearchText))); // Statuses var cocStatuses = file.GetObj("statusAffects"); var xmlStatuses = XmlData.Current.Statuses; ImportMissingNamedVectors(cocStatuses, xmlStatuses, "statusAffectName"); _allStatuses = XmlData.Current.Statuses.OrderBy(x => x.Name).Select(x => new StatusVM(this, cocStatuses, x)).ToArray(); Statuses = new UpdatableCollection<StatusVM>(_allStatuses.Where(x => x.Match(_rawDataSearchText))); // KeyItems var cocKeys = file.GetObj("keyItems"); var xmlKeys = XmlData.Current.KeyItems; ImportMissingNamedVectors(cocKeys, xmlKeys, "keyName"); _allKeyitems = XmlData.Current.KeyItems.OrderBy(x => x.Name).Select(x => new KeyItemVM(this, cocKeys, x)).ToArray(); KeyItems = new UpdatableCollection<KeyItemVM>(_allKeyitems.Where(x => x.Match(_keyItemSearchText))); // Perks var cocPerks = _obj.GetObj("perks"); var xmlPerks = XmlData.Current.PerkGroups.SelectMany(x => x.Perks).ToArray(); var unknownPerkGroup = XmlData.Current.PerkGroups.Last(); ImportMissingNamedVectors(cocPerks, xmlPerks, "id", null, unknownPerkGroup.Perks); PerkGroups = new List<PerkGroupVM>(); foreach (var xmlGroup in XmlData.Current.PerkGroups) { var perksVM = xmlGroup.Perks.OrderBy(x => x.Name).Select(x => new PerkVM(this, cocPerks, x)).ToArray(); _allPerks.AddRange(perksVM); var groupVM = new PerkGroupVM(this, xmlGroup.Name, perksVM); PerkGroups.Add(groupVM); } // Item containers var containers = new List<ItemContainerVM>(); _inventory = new ItemContainerVM(this, "Inventory", ItemCategories.All); containers.Add(_inventory); UpdateInventory(); _chest = new ItemContainerVM(this, IsRevampMod ? "Chest(s)" : "Chest", ItemCategories.All); containers.Add(_chest); UpdateChest(); _weaponRack = new ItemContainerVM(this, "Weapon rack", ItemCategories.Weapon | ItemCategories.Unknown); containers.Add(_weaponRack); UpdateWeaponRack(); _armorRack = new ItemContainerVM(this, "Armor rack", ItemCategories.Armor | ItemCategories.ArmorCursed | ItemCategories.Unknown); containers.Add(_armorRack); UpdateArmorRack(); if (IsRevampMod) { _shieldRack = new ItemContainerVM(this, "Shield rack", ItemCategories.Shield | ItemCategories.Unknown); containers.Add(_shieldRack); UpdateShieldRack(); _dresser = new ItemContainerVM(this, "Dresser", ItemCategories.Undergarment | ItemCategories.Unknown); containers.Add(_dresser); UpdateDresser(); _jewelryBox = new ItemContainerVM(this, "Jewelry box", ItemCategories.Jewelry | ItemCategories.Unknown); containers.Add(_jewelryBox); UpdateJewelryBox(); } // Import missing items var unknownItemGroup = XmlData.Current.ItemGroups.Last(); foreach (var slot in containers.SelectMany(x => x.Slots)) { // Add this item to the DB if it does not exist var type = slot.Type; if (String.IsNullOrEmpty(type)) continue; if (XmlData.Current.ItemGroups.SelectMany(x => x.Items).Any(x => x.ID == type)) continue; var xml = new XmlItem { ID = type, Name = type }; unknownItemGroup.Items.Add(xml); } foreach (var slot in containers.SelectMany(x => x.Slots)) slot.UpdateGroups(); // Update item groups after new items have been added // Complete slots creation ItemContainers = new UpdatableCollection<ItemContainerVM>(containers.Where(x => x.Slots.Count != 0)); }
public KeyItemVM(GameVM game, AmfObject keyItems, XmlNamedVector4 xml) : base(game, keyItems, xml) { }
public ClawsVM(GameVM game, AmfObject obj) : base(game, obj) { }
public BodyPartVM(GameVM game, AmfObject obj) : base(obj) => _game = game;
public ItemContainerVM(GameVM game, string name, ItemCategories categories) { Name = name; _game = game; Categories = categories; }
public StatusVM(GameVM game, AmfObject allStatuses, XmlNamedVector4 xml) : base(game, allStatuses, xml) { }
public PerkGroupVM(GameVM game, string name, PerkVM[] perks) { _game = game; Name = name; Perks = new UpdatableCollection<PerkVM>(perks.Where(x => x.Match(_game.PerkSearchText))); }
public TailVM(GameVM game, AmfObject obj) : base(game, obj) { }
public LowerBodyVM(GameVM game, AmfObject obj) : base(game, obj) { }
public ItemSlotVM(GameVM game, AmfObject obj, ItemCategories categories) : base(obj) { Categories = categories; _game = game; _allGroups = XmlData.Current.ItemGroups.Where(group => Categories.HasFlag(group.Category)).Select(x => new ItemGroupVM(_game, x, this)).ToArray(); AllGroups = new UpdatableCollection<ItemGroupVM>(_allGroups.Where(x => x.Items.Count != 0)); }
public ItemGroupVM(GameVM game, XmlItemGroup group, ItemSlotVM slot) { _game = game; Name = group.Name; Items = new UpdatableCollection<ItemVM>(group.Items.Where(x => Match(x, _game.ItemSearchText)).OrderBy(x => x.Name).Select(x => new ItemVM(slot, x))); }
public BreastArrayVM(GameVM game, AmfObject obj) : base(obj, x => new BreastsVM(game, x)) { }
public FaceVM(GameVM game, AmfObject obj) : base(game, obj) { }
public BreastsVM(GameVM game, AmfObject obj) : base(obj) { _game = game; }
public CockArrayVM(GameVM game, AmfObject obj) : base(obj, x => new CockVM(game, x)) { }
protected NamedVector4VM(GameVM game, AmfObject items, XmlNamedVector4 xml) { _xml = xml; _game = game; _items = items; }
public PerkGroupVM(GameVM game, string name, PerkVM[] perks) { _game = game; Name = name; Perks = new UpdatableCollection <PerkVM>(perks.Where(x => x.Match(_game.PerkSearchText))); }