Example #1
0
        public void RemodelCosmetic(CharacterRecord record, ushort cosmeticId)
        {
            var skinId = HeadRecord.GetSkin(record.CosmeticId);

            record.Look.RemoveSkin(skinId);
            record.Look.AddSkin(HeadRecord.GetSkin(cosmeticId));
            record.CosmeticId = cosmeticId;
        }
        public void RemodelBreed(CharacterRecord record, sbyte breedId, ushort cosmecticId)
        {
            var currentBreed = BreedRecord.GetBreed(record.BreedId);

            var newBreed = BreedRecord.GetBreed(breedId);

            var level = ExperienceRecord.GetCharacterLevel(record.Exp);

            var shortcuts = record.Shortcuts.OfType <CharacterSpellShortcut>();

            List <ushort> spells = currentBreed.GetSpellsForLevel(200, new List <CharacterSpell>()).ToList();

            spells.AddRange(this.BreedSpecialSpells);


            foreach (var spell in spells)
            {
                record.Spells.RemoveAll(x => x.SpellId == spell);
                var shortcut = shortcuts.FirstOrDefault(x => x.SpellId == spell);
                record.Shortcuts.Remove(shortcut);
            }

            foreach (var spell in newBreed.GetSpellsForLevel(level, new List <CharacterSpell>()))
            {
                record.Spells.Add(new CharacterSpell(spell, 1));
            }

            var look    = record.Sex ? ContextActorLook.Parse(currentBreed.FemaleLook) : ContextActorLook.Parse(currentBreed.MaleLook);
            var newLook = record.Sex ? ContextActorLook.Parse(newBreed.FemaleLook) : ContextActorLook.Parse(newBreed.MaleLook);

            record.SpellPoints += (ushort)(level - 1);

            foreach (var skin in look.Skins)
            {
                record.Look.RemoveSkin(skin);
            }

            foreach (var skin in newLook.Skins)
            {
                record.Look.AddSkin(skin);
            }

            record.Look.SetScale(newLook.Scale);

            ushort headSkin = HeadRecord.GetSkin(record.CosmeticId);

            record.Look.RemoveSkin(headSkin);

            record.Look.AddSkin(HeadRecord.GetSkin(cosmecticId));

            record.BreedId = breedId;
        }
Example #3
0
        public static ContextActorLook GetBreedLook(int breedid, bool sex, int cosmeticid, IEnumerable <int> colors)
        {
            var breed = GetBreed(breedid);
            ContextActorLook result = sex ? ContextActorLook.Parse(breed.FemaleLook) : ContextActorLook.Parse(breed.MaleLook);

            result.AddSkin(HeadRecord.GetSkin(cosmeticid));

            int[] simpleColors = VerifiyColors(colors, sex, breed);

            result.SetColors(ContextActorLook.GetConvertedColors(simpleColors));

            return(result);
        }
Example #4
0
        private static void WriteHead(StreamWriter file, HeadRecord rec)
        {
            // TODO SUBM info
            // TODO file notes
            // TODO destination path?
            // TODO date/time

            file.WriteLine("0 HEAD");
            file.WriteLine("1 GEDC");
            file.WriteLine("2 VERS 5.5.1");
            file.WriteLine("2 FORM LINEAGE-LINKED");
            file.WriteLine("1 CHAR UTF-8");
            file.WriteLine("1 SOUR SharpGEDWriter"); // TODO not registered
            file.WriteLine("2 VERS V0.2-Alpha");

            WriteCommon.writeSubNotes(file, rec);

            file.WriteLine("1 SUBM @S0@");

            file.WriteLine("0 @S0@ SUBM");
        }
Example #5
0
        private static void dump(Forest f, bool showErrors)
        {
            if (f.Errors.Count > 0)
            {
                foreach (var unkRec in f.Errors)
                {
                    if (unkRec.Error == UnkRec.ErrorCode.EmptyFile)
                    {
                        Console.WriteLine("Empty file");
                        return;
                    }
                }
            }

            if (f.AllRecords.Count == 0)
            {
                Console.WriteLine("*****Failed to parse");
                return;
            }

            Dictionary <string, int> tagCounts = new Dictionary <string, int>();

            foreach (var record in f.AllRecords)
            {
                incr(tagCounts, record.Tag);
            }

            Dictionary <string, int> indiEventCounts = new Dictionary <string, int>();
            int indiEventLoc = 0;
            Dictionary <string, int> indiAttribCounts = new Dictionary <string, int>();
            int attribLoc = 0;
            Dictionary <string, int> famEventCounts = new Dictionary <string, int>();
            int famEventLoc = 0;

            foreach (var person in f.AllPeople)
            {
                IndiRecord ged = person.Indi;
                foreach (var familyEvent in ged.Events)
                {
                    string tag = familyEvent.Tag;
                    incr(indiEventCounts, tag);
                    if (!string.IsNullOrEmpty(familyEvent.Place))
                    {
                        indiEventLoc++;
                    }
                }
                foreach (var familyEvent in ged.Attribs)
                {
                    string tag = familyEvent.Tag;
                    incr(indiAttribCounts, tag);
                    if (!string.IsNullOrEmpty(familyEvent.Place))
                    {
                        attribLoc++;
                    }
                }
            }

            foreach (var union in f.AllUnions)
            {
                FamRecord ged = union.FamRec;
                foreach (var familyEvent in ged.FamEvents)
                {
                    string tag = familyEvent.Tag;
                    incr(famEventCounts, tag);
                    if (!string.IsNullOrEmpty(familyEvent.Place))
                    {
                        famEventLoc++;
                    }
                }
            }

            HeadRecord head = f.Header;

            if (head == null)
            {
                Console.WriteLine("No head");
            }
            else
            {
                Console.WriteLine("  {0}-{1}:{2} ({3})", head.GedVersion, head.Product, head.ProductVersion, head.GedDate.ToString("yyyyMMdd"));
            }
            Console.Write("\t");
            foreach (var tag in tagCounts.Keys)
            {
                if (!string.IsNullOrEmpty(tag))
                {
                    Console.Write("{0}:{1};", tag, tagCounts[tag]);
                }
            }
            Console.WriteLine();
            Console.WriteLine("\t\t----------");
            Console.Write("\t");
            foreach (var tag in indiEventCounts.Keys)
            {
                Console.Write("{0}:{1};", tag, indiEventCounts[tag]);
            }
            if (indiEventLoc > 0)
            {
                Console.Write("Locations:{0}", indiEventLoc);
            }
            Console.WriteLine();
            Console.WriteLine("\t\t----------");
            //foreach (var tag in indiAttribCounts.Keys)
            //{
            //    Console.WriteLine("\t\t{0}:{1}", tag, indiAttribCounts[tag]);
            //}
            //if (attribLoc > 0)
            //    Console.WriteLine("\t\tLocations:{0}", attribLoc);
            //Console.WriteLine("\t\t----------");
            Console.WriteLine("\t\t----------");
            Console.Write("\t");
            foreach (var tag in famEventCounts.Keys)
            {
                Console.Write("{0}:{1};", tag, famEventCounts[tag]);
            }
            if (famEventLoc > 0)
            {
                Console.Write("Locations:{0}", famEventLoc);
            }
            Console.WriteLine();
            if (f.NumberOfTrees > 1)
            {
                Console.WriteLine("Number of trees:{0}", f.NumberOfTrees);
            }
        }
Example #6
0
 public static ushort GetSkinFromCosmeticId(int cosmecticId)
 {
     return(HeadRecord.GetSkin(cosmecticId));
 }