Example #1
0
        private async void OnSaveClicked(object sender, RoutedEventArgs e)
        {
            IViewService viewService = Services.Get <IViewService>();
            IFileService fileService = Services.Get <IFileService>();

            await fileService.Save(
                async (advancedMode) =>
            {
                AppearanceFile.SaveModes mode = AppearanceFile.SaveModes.All;

                if (advancedMode)
                {
                    mode = await viewService.ShowDialog <AppearanceModeSelectorDialog, AppearanceFile.SaveModes>("Save Appearance...");
                }

                AppearanceFile file = new AppearanceFile();

                if (mode == AppearanceFile.SaveModes.None)
                {
                    return(null);
                }

                file.Read(this.Actor, mode);

                return(file);
            },
                AppearanceFile.FileType);
        }
Example #2
0
 private void RefreshService_OnRefreshComplete(IBaseMemoryOffset baseOffset)
 {
     if (this.refreshCacheFile != null)
     {
         this.refreshCacheFile.Write(this.Appearance, this.Equipment, AppearanceFile.SaveModes.All);
         this.refreshCacheFile = null;
     }
 }
Example #3
0
        private void RefreshService_OnRefreshStarting(IBaseMemoryOffset baseOffset)
        {
            if (this.baseOffset != baseOffset)
            {
                return;
            }

            this.refreshCacheFile = new AppearanceFile();
            this.refreshCacheFile.Read(this.Appearance, this.Equipment, AppearanceFile.SaveModes.All);
        }
Example #4
0
        public static AppearanceFile ToFile(this INpcBase npc)
        {
            AppearanceFile file = new AppearanceFile();

            file.SaveMode           = AppearanceFile.SaveModes.All;
            file.ModelType          = npc.ModelType;
            file.Race               = npc.Race.Race;
            file.Tribe              = npc.Tribe.Tribe;
            file.Gender             = (Appearance.Genders)npc.Gender;
            file.Age                = (Appearance.Ages)npc.BodyType;
            file.Height             = (byte)npc.Height;
            file.Head               = (byte)npc.Face;
            file.Hair               = (byte)npc.HairStyle;
            file.EnableHighlights   = npc.HairHighlightColor > 1;
            file.Skintone           = (byte)npc.SkinColor;
            file.REyeColor          = (byte)npc.EyeColor;
            file.LEyeColor          = (byte)npc.EyeHeterochromia;
            file.HairTone           = (byte)npc.HairColor;
            file.Highlights         = (byte)npc.HairHighlightColor;
            file.FacialFeatures     = (Appearance.FacialFeature)npc.FacialFeature;
            file.LimbalEyes         = 0;     // TODO: Can npc's have limbal rings?
            file.Eyebrows           = (byte)npc.Eyebrows;
            file.Eyes               = (byte)npc.EyeShape;
            file.Nose               = (byte)npc.Nose;
            file.Jaw                = (byte)npc.Jaw;
            file.Mouth              = (byte)npc.Mouth;
            file.LipsToneFurPattern = (byte)npc.LipColor;
            file.EarMuscleTailSize  = (byte)npc.ExtraFeature1;
            file.TailEarsType       = (byte)npc.ExtraFeature2OrBust;
            file.Bust               = (byte)npc.ExtraFeature2OrBust;
            file.FacePaint          = (byte)npc.FacePaint;
            file.FacePaintColor     = (byte)npc.FacePaintColor;

            file.MainHand = WeaponFromItem(npc.NpcEquip.MainHand, npc.NpcEquip.DyeMainHand);
            file.OffHand  = WeaponFromItem(npc.NpcEquip.OffHand, npc.NpcEquip.DyeOffHand);

            file.HeadGear  = GearFromItem(npc.NpcEquip.Head, npc.NpcEquip.DyeHead);
            file.Body      = GearFromItem(npc.NpcEquip.Body, npc.NpcEquip.DyeBody);
            file.Hands     = GearFromItem(npc.NpcEquip.Hands, npc.NpcEquip.DyeHands);
            file.Legs      = GearFromItem(npc.NpcEquip.Legs, npc.NpcEquip.DyeLegs);
            file.Feet      = GearFromItem(npc.NpcEquip.Feet, npc.NpcEquip.DyeFeet);
            file.Ears      = GearFromItem(npc.NpcEquip.Ears, npc.NpcEquip.DyeEars);
            file.Neck      = GearFromItem(npc.NpcEquip.Neck, npc.NpcEquip.DyeNeck);
            file.Wrists    = GearFromItem(npc.NpcEquip.Wrists, npc.NpcEquip.DyeWrists);
            file.LeftRing  = GearFromItem(npc.NpcEquip.LeftRing, npc.NpcEquip.DyeLeftRing);
            file.RightRing = GearFromItem(npc.NpcEquip.RightRing, npc.NpcEquip.DyeRightRing);

            return(file);
        }
Example #5
0
        private async void OnSaveClicked(object sender, RoutedEventArgs e)
        {
            IViewService viewService = Services.Get <IViewService>();

            AppearanceFile.SaveModes mode = await viewService.ShowDialog <AppearanceModeSelectorDialog, AppearanceFile.SaveModes>("Save Appearance...");

            if (mode == AppearanceFile.SaveModes.None)
            {
                return;
            }

            IFileService   fileService = Services.Get <IFileService>();
            AppearanceFile file        = new AppearanceFile();

            file.Read(this.actor, mode);
            await fileService.Save(file);
        }
Example #6
0
 private async void ApplyNpc(INpcBase npc)
 {
     AppearanceFile apFile = npc.ToFile();
     await apFile.Apply(this.Actor, AppearanceFile.SaveModes.All);
 }