public GameVM(AmfFile file, GameVM previousVM) : base(file) { SetCharacterOptions(); setCharacter("PC"); SaveFile = new AmfObjectVM(file); var flagsObject = FlagsObject; _flags = new GeneralObjectVM(flagsObject); if (null != previousVM) { _searchText = previousVM._searchText; } // Flags foreach (var xmlFlag in XmlData.Current.Flags) { if (!_allFlags.ContainsKey(xmlFlag.Name)) { _allFlags[xmlFlag.Name] = new FlagVM(this, ref flagsObject, xmlFlag); } } foreach (var flag in flagsObject) { string flagName = flag.ToString(); if (!_allFlags.ContainsKey(flagName)) { XmlEnum data = new XmlEnum(); data.Name = flagName; _allFlags[flagName] = new FlagVM(this, ref flagsObject, data); } } Flags = new UpdatableCollection <FlagVM>(_allFlags.Values.ToList().Where(x => x.Match(SearchText))); }
public void UpdateItemGroups() { //create our groups var groups = new List <ItemGroupVM>(); var enumNames = Enum.GetNames(typeof(ItemCategories)); Array.Sort <String>(enumNames); //check enum support foreach (string ename in enumNames) { var etype = Enum.Parse(typeof(ItemCategories), ename); int eint = (int)etype; if (((int)_categories & eint) == eint) { //create the group for this supported type ItemGroupVM vm = new ItemGroupVM(ename, this); if (vm.Items.Count > 0) { groups.Add(vm); } } } AllGroups = new UpdatableCollection <ItemGroupVM>(groups); OnPropertyChanged("AllGroups"); }
public CharacterVM(GameVM game, AmfObject obj) : base(obj) { Game = game; Breasts = new BreastArrayVM(game, GetObj("breastRows")); Vaginas = new VaginaArrayVM(game, GetObj("vaginas")); Cocks = new CockArrayVM(game, GetObj("cocks")); Ass = new VaginaVM(game, GetObj("ass")); List <String> types = new List <String>(); foreach (XmlItemType type in XmlData.Current.ItemTypes) { types.Add(type.Name); } var containers = new List <ItemContainerVM>(); _inventory = new ItemContainerVM(this, "Inventory", types); containers.Add(_inventory); UpdateInventory(); // Complete slots creation ItemContainers = new UpdatableCollection <ItemContainerVM>(containers); }
public ItemGroupVM(string name, ItemSlotVM slot) { Name = name; var items = new List <ItemVM>(); var searchText = ""; if (VM.Instance.Game != null) { searchText = VM.Instance.Game.ItemSearchText; } foreach (XmlItem xml in XmlData.Current.Items) { if (searchText.Length >= MIN_ITEM_TEXT_SEARCH_LENGTH && !xml.Name.ToLower().Contains(searchText) && !xml.ID.ToLower().Contains(searchText)) { continue; } if (xml.Type == name) { items.Add(new ItemVM(slot, xml)); } } //sort items if (items.Count > 1) { items.Sort(); } Items = new UpdatableCollection <ItemVM>(items); }
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 CharacterVM(GameVM game, AmfObject obj) : base(obj) { Game = game; Breasts = new BreastArrayVM(game, GetObj("breastRows")); Vaginas = new VaginaArrayVM(game, GetObj("vaginas")); Cocks = new CockArrayVM(game, GetObj("cocks")); Ass = new VaginaVM(game, GetObj("ass")); var containers = new List <ItemContainerVM>(); _inventory = new ItemContainerVM(this, "Inventory", ItemCategories.All); containers.Add(_inventory); UpdateInventory(); // Complete slots creation ItemContainers = new UpdatableCollection <ItemContainerVM>(containers); }
public ItemSlotVM(CharacterVM character, AmfObject obj, ItemCategories categories) : base(obj) { Categories = categories; _character = character; //find the xml definition for this slot type var id = GetString("classInstance"); _xml = XmlItem.Empty; foreach (XmlItem item in XmlData.Current.Items) { if (item.ID == id) { _xml = item; break; } } //create our groups var groups = new List <ItemGroupVM>(); var enumNames = Enum.GetNames(typeof(ItemCategories)); Array.Sort <String>(enumNames); //check enum support foreach (string ename in enumNames) { var etype = Enum.Parse(typeof(ItemCategories), ename); int eint = (int)etype; if (((int)categories & eint) == eint) { //create the group for this supported type ItemGroupVM vm = new ItemGroupVM(ename, this); if (vm.Items.Count > 0) { groups.Add(vm); } } } AllGroups = new UpdatableCollection <ItemGroupVM>(groups); }
public ItemGroupVM(string name, ItemSlotVM slot) { Name = name; var items = new List <ItemVM>(); var searchText = ""; if (VM.Instance.Game != null) { searchText = VM.Instance.Game.ItemSearchText; } //we made this easier now foreach (XmlItemGroup type in XmlData.Current.ItemGroups) { if (type.Name == name) { //only add items from this item set into the group foreach (XmlItem xml in type.Items) { //skip items that do not match the search string if (searchText.Length >= MIN_ITEM_TEXT_SEARCH_LENGTH && !xml.Name.ToLower().Contains(searchText) && !xml.ID.ToLower().Contains(searchText)) { continue; } //add the item to the item group items.Add(new ItemVM(slot, xml)); } } } //sort items if (items.Count > 1) { items.Sort(); } Items = new UpdatableCollection <ItemVM>(items); }
public void UpdateItemGroups() { //create our groups var groups = new List <ItemGroupVM>(); //var enumNames = Enum.GetNames(typeof(ItemCategories)); var typeNames = Types; typeNames.Sort(); //check enum support foreach (string typeName in typeNames) { ItemGroupVM vm = new ItemGroupVM(typeName, this); if (vm.Items.Count > 0) { groups.Add(vm); } } AllGroups = new UpdatableCollection <ItemGroupVM>(groups); OnPropertyChanged("AllGroups"); }
public ItemGroupVM(string name, ItemSlotVM slot) { Name = name; var items = new List <ItemVM>(); foreach (XmlItem xml in XmlData.Current.Items) { //xmlitem.Type if (xml.Type == name) { items.Add(new ItemVM(slot, xml)); } } //sort items if (items.Count > 1) { items.Sort(); } Items = new UpdatableCollection <ItemVM>(items); }
public StatusGroupVM(CreatureVM creature, string name, StatusEffectVM[] statusEffects) { Creature = creature; Name = name; StatusEffects = new UpdatableCollection <StatusEffectVM>(statusEffects.Where(x => x.Match(Creature.Game.SearchText))); }
public PerkGroupVM(CreatureVM creature, string name, PerkVM[] perks) { Creature = creature; Name = name; Perks = new UpdatableCollection <PerkVM>(perks.Where(x => x.Match(Creature.Game.SearchText))); }
public GameVM(AmfFile file, GameVM previousVM) : base(file) { SetCharacterOptions(); setCharacter("PC"); var flagsObject = FlagsObject; _flags = new GeneralObjectVM(flagsObject); if (null != previousVM) { _perkSearchText = previousVM._perkSearchText; _keyItemSearchText = previousVM._keyItemSearchText; _rawDataSearchText = previousVM._rawDataSearchText; } // Perks var charPerks = Character.PerksArray; var xmlPerks = XmlData.Current.PerkGroups.SelectMany(x => x.Perks).ToArray(); var unknownPerkGroup = XmlData.Current.PerkGroups.Last(); ImportMissingNamedVectors(charPerks, xmlPerks, "storageName", x => x.GetString("tooltip"), unknownPerkGroup.Perks); Character.PerkGroups = new List <PerkGroupVM>(); foreach (var xmlGroup in XmlData.Current.PerkGroups) { var perksVM = xmlGroup.Perks.OrderBy(x => x.Name).Select(x => new PerkVM(this, charPerks, x)).ToArray(); _allPerks.AddRange(perksVM); var groupVM = new PerkGroupVM(this, xmlGroup.Name, perksVM); Character.PerkGroups.Add(groupVM); } //Character.Perks = new UpdatableCollection<PerkVM>(_allPerks.Where(x => x.Match(PerkSearchText))); // KeyItems var keyItems = Character.KeyItemsArray; var xmlKeys = XmlData.Current.KeyItems; ImportMissingNamedVectors(keyItems, xmlKeys, "storageName", x => x.GetString("tooltip")); _allKeyItems = XmlData.Current.KeyItems.OrderBy(x => x.Name).Select(x => new KeyItemVM(this, keyItems, x)).ToArray(); Character.KeyItems = new UpdatableCollection <KeyItemVM>(_allKeyItems.Where(x => x.Match(KeyItemSearchText))); // Statuses var statuses = Character.StatusEffectsArray; var xmlStatuses = XmlData.Current.Statuses; ImportMissingNamedVectors(statuses, xmlStatuses, "storageName", x => x.GetString("tooltip")); _allStatuses = XmlData.Current.Statuses.OrderBy(x => x.Name).Select(x => new StatusEffectVM(this, statuses, x)).ToArray(); Character.StatusEffects = new UpdatableCollection <StatusEffectVM>(_allStatuses.Where(x => x.Match(RawDataSearchText))); // Flags foreach (var xmlFlag in XmlData.Current.Flags) { if (!_allFlags.ContainsKey(xmlFlag.Name)) { _allFlags[xmlFlag.Name] = new FlagVM(this, ref flagsObject, xmlFlag); } } foreach (var flag in flagsObject) { string flagName = flag.ToString(); if (!_allFlags.ContainsKey(flagName)) { XmlEnum data = new XmlEnum(); data.Name = flagName; _allFlags[flagName] = new FlagVM(this, ref flagsObject, data); } } Flags = new UpdatableCollection <FlagVM>(_allFlags.Values.ToList().Where(x => x.Match(RawDataSearchText))); }
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 KeyItemGroupVM(CreatureVM creature, string name, KeyItemVM[] keyItems) { Creature = creature; Name = name; KeyItems = new UpdatableCollection <KeyItemVM>(keyItems.Where(x => x.Match(Creature.Game.SearchText))); }
public PerkGroupVM(CharacterVM character, string name, PerkVM[] perks) { Character = character; Name = name; Perks = new UpdatableCollection <PerkVM>(perks.Where(x => x.Match(Character.Game.SearchText))); }
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 PerkGroupVM(GameVM game, string name, PerkVM[] perks) { _game = game; Name = name; Perks = new UpdatableCollection<PerkVM>(perks.Where(x => x.Match(_game.PerkSearchText))); }
public PerkGroupVM(GameVM game, string name, PerkVM[] perks) { _game = game; Name = name; Perks = new UpdatableCollection <PerkVM>(perks.Where(x => x.Match(_game.PerkSearchText))); }
public GameVM(AmfFile file, GameVM previousVM) : base(file) { SetCharacterOptions(); CharacterSelection = "PC"; var shittyShips = GetObj("shittyShips") ?? new AmfObject(AmfTypes.Array); Ships = new ShipArrayVM(this, shittyShips); var flagsObject = FlagsObject; _flags = new GeneralObjectVM(flagsObject); // Flags var flagNames = AllFlags.Keys.ToList(); foreach (var flagName in flagNames) { XmlEnum data = new XmlEnum(); data.Name = flagName; AllFlags[flagName] = new FlagVM(this, ref flagsObject, data); } foreach (var xmlFlag in XmlData.Current.Flags) { if (!AllFlags.ContainsKey(xmlFlag.Name)) { AllFlags[xmlFlag.Name] = new FlagVM(this, ref flagsObject, xmlFlag); } } foreach (var flag in flagsObject) { string flagName = flag.ToString(); if (!AllFlags.ContainsKey(flagName)) { XmlEnum data = new XmlEnum(); data.Name = flagName; AllFlags[flagName] = new FlagVM(this, ref flagsObject, data); } } if (null != previousVM) { foreach (var flag in previousVM.AllFlags) { string flagName = flag.Key.ToString(); if (!AllFlags.ContainsKey(flagName)) { XmlEnum data = new XmlEnum(); data.Name = flagName; AllFlags[flagName] = new FlagVM(this, ref flagsObject, data); } } } Flags = new UpdatableCollection <FlagVM>(AllFlags.Values.ToList().Where(x => x.Match(SearchText))); OnPropertyChanged("Flags"); // Codex var codexEntries = AllCodexEntries.Keys.ToList(); foreach (var codexName in codexEntries) { XmlCodexEntry data = new XmlCodexEntry(); data.Name = codexName; AllCodexEntries[codexName] = new CodexEntryVM(this, data); } foreach (var xmlCodex in XmlData.Current.CodexEntries) { if (!AllCodexEntries.ContainsKey(xmlCodex.Name)) { AllCodexEntries[xmlCodex.Name] = new CodexEntryVM(this, xmlCodex); } } foreach (var codexEntry in CodexUnlockedEntriesObj) { string codexName = codexEntry.Value.ToString(); if (!AllCodexEntries.ContainsKey(codexName)) { XmlCodexEntry data = new XmlCodexEntry(codexName); AllCodexEntries[codexName] = new CodexEntryVM(this, data); } } foreach (var codexEntry in CodexViewedEntriesObj) { string codexName = codexEntry.Value.ToString(); if (!AllCodexEntries.ContainsKey(codexName)) { XmlCodexEntry data = new XmlCodexEntry(codexName); AllCodexEntries[codexName] = new CodexEntryVM(this, data); } } if (null != previousVM) { foreach (var codexEntry in previousVM.AllCodexEntries) { string codexName = codexEntry.Value.ToString(); if (!AllCodexEntries.ContainsKey(codexName)) { XmlCodexEntry data = new XmlCodexEntry(codexName); AllCodexEntries[codexName] = new CodexEntryVM(this, data); } } } CodexEntries = new UpdatableCollection <CodexEntryVM>(AllCodexEntries.Values.ToList().Where(x => x.Match(SearchText))); OnPropertyChanged("CodexEntries"); }
public StatusGroupVM(CharacterVM character, string name, StatusEffectVM[] statusEffects) { Character = character; Name = name; StatusEffects = new UpdatableCollection <StatusEffectVM>(statusEffects.Where(x => x.Match(Character.Game.RawDataSearchText))); }
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 KeyItemGroupVM(CharacterVM character, string name, KeyItemVM[] keyItems) { Character = character; Name = name; KeyItems = new UpdatableCollection <KeyItemVM>(keyItems.Where(x => x.Match(Character.Game.KeyItemSearchText))); }
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))); }