Example #1
0
        public Character()
        {
            _class = CharacterEnums.CharacterClass.Explorer;
            _race = CharacterEnums.CharacterRace.Human;
            _gender = CharacterEnums.Genders.Female;
            _skinColor = CharacterEnums.SkinColors.Fair;
            _skinType = CharacterEnums.SkinType.Flesh;
            _hairColor = CharacterEnums.HairColors.Black;
            _eyeColor = CharacterEnums.EyeColors.Brown;
            _build = CharacterEnums.BodyBuild.Medium;

            _koCount = new Tuple<int, DateTime>(0, DateTime.Now);
            _actionState = CharacterActionState.None;
            _stanceState = CharacterStanceState.Standing;

            _primaryLanguage = CharacterEnums.Languages.Common;
            KnownLanguages = new HashSet<Languages>();
            KnownLanguages.Add(_primaryLanguage);

            FirstName = "";
            LastName = "";
            Description = "";
            Age = 17;   //Do we want an age? And are we going to advance it every in game year?  We'll need a birthdate for this.
            Weight = 180; //pounds or kilos?
            Height = 70;  //inches or centimeters?
            Location = "A1";
            InCombat = false;
            LastCombatTime = DateTime.MinValue.ToUniversalTime();
            IsNPC = false;
            Leveled = false;
            MainHand = "WIELD_RIGHT";
            NextLevelExperience = 300;
            Level = 1;
            Experience = 0;
            PointsToSpend = 0;

            Inventory = new Inventory();
            Equipment = new Equipment();
            Bonuses = new StatBonuses();

            Inventory.playerID = this.ID;
            Equipment.playerID = this.ID;

            Attributes = new Dictionary<string, Attribute>();

            Attributes.Add("Hitpoints", new Attribute(150, "Hitpoints", 150, 0.1, 1));
            Attributes.Add("Dexterity", new Attribute(10, "Dexterity", 5, 0, 1));
            Attributes.Add("Strength", new Attribute(10, "Strength", 5, 0, 1));
            Attributes.Add("Intelligence", new Attribute(10, "Intelligence", 5, 0, 1));
            Attributes.Add("Endurance", new Attribute(10, "Endurance", 5, 0, 1));
            Attributes.Add("Charisma", new Attribute(10, "Charisma", 5, 0, 1));

            SubAttributes = new Dictionary<string, double>();

            SubAttributes.Add("Agility", 1);
            SubAttributes.Add("Toughness", 1);
            SubAttributes.Add("Cunning", 1);
            SubAttributes.Add("Wisdom", 1);
            SubAttributes.Add("Leadership", 1);
        }
Example #2
0
        protected virtual void RenderParts(Entity p)
        {
            SkinType skinType = p.SkinType;
            ModelSet model    = skinType == SkinType.Type64x64Slim ? SetSlim :
                                (skinType == SkinType.Type64x64 ? Set64 : Set);

            DrawRotate(-p.HeadXRadians, 0, 0, model.Head, true);
            DrawPart(model.Torso);

            DrawRotate(p.anim.leftLegX, 0, p.anim.leftLegZ, model.LeftLeg, false);
            DrawRotate(p.anim.rightLegX, 0, p.anim.rightLegZ, model.RightLeg, false);
            Rotate = RotateOrder.XZY;
            DrawRotate(p.anim.leftArmX, 0, p.anim.leftArmZ, model.LeftArm, false);
            DrawRotate(p.anim.rightArmX, 0, p.anim.rightArmZ, model.RightArm, false);
            Rotate = RotateOrder.ZYX;
            UpdateVB();

            game.Graphics.AlphaTest = true;
            index = 0;
            if (skinType != SkinType.Type64x32)
            {
                DrawPart(model.TorsoLayer);
                DrawRotate(p.anim.leftLegX, 0, p.anim.leftLegZ, model.LeftLegLayer, false);
                DrawRotate(p.anim.rightLegX, 0, p.anim.rightLegZ, model.RightLegLayer, false);
                Rotate = RotateOrder.XZY;
                DrawRotate(p.anim.leftArmX, 0, p.anim.leftArmZ, model.LeftArmLayer, false);
                DrawRotate(p.anim.rightArmX, 0, p.anim.rightArmZ, model.RightArmLayer, false);
                Rotate = RotateOrder.ZYX;
            }
            DrawRotate(-p.HeadXRadians, 0, 0, model.Hat, true);
            UpdateVB();
        }
Example #3
0
        /// <summary>
        /// 将程序集中嵌入的指定皮肤释放到指定的路径下,成功即返回全路径,失败则返回空字符串string.Empty
        /// </summary>
        /// <param name="runPath"></param>
        /// <param name="skin"></param>
        /// <returns></returns>
        public static string ExtractToFile(string runPath, SkinType skin)
        {
            if (!Directory.Exists(runPath))
            {
                return(string.Empty);
            }
            if (!runPath.EndsWith("\\"))
            {
                runPath += "\\";
            }
            string skinFile = runPath + skin.ToString() + ".ssk";

            try
            {
                Assembly ass = Assembly.LoadFrom("Resources.dll");
                using (Stream s = ass.GetManifestResourceStream(@"KellControls.Resources.Resources.Skin." + skin.ToString() + ".ssk"))
                {
                    using (FileStream fs = new FileStream(skinFile, FileMode.Create, FileAccess.Write))
                    {
                        s.CopyTo(fs);
                        fs.Flush();
                    }
                }
                return(skinFile);
            }
            catch
            {
                if (File.Exists(skinFile))
                {
                    File.Delete(skinFile);
                }
                return(string.Empty);
            }
        }
Example #4
0
        internal static ISkin Generate(SkinType type)
        {
            switch (type)
            {
            case SkinType.Vanilla:
                return(new VanillaSkin());

            case SkinType.MIACApp:
                return(new MIACAppSkin());

            case SkinType.Bunny:
                return(new BunnySkin());

            case SkinType.Cat:
                return(new CatSkin());

            case SkinType.Cashflow:
                return(new CashFlowSkin());

            case SkinType.Proposal:
                return(new ProposalSkin());

            default:
                throw new InvalidOperationException("Cannot find this type of skin");
            }
        }
Example #5
0
        protected override void DrawModel(Player p)
        {
            int texId = p.PlayerTextureId <= 0 ? cache.HumanoidTexId : p.PlayerTextureId;

            graphics.BindTexture(texId);
            graphics.AlphaTest = false;

            SkinType skinType = p.SkinType;

            _64x64 = skinType != SkinType.Type64x32;
            DrawHeadRotate(0, 13 / 16f, 0, -p.PitchRadians, 0, 0, Head);

            DrawPart(Torso);
            DrawRotate(0, 6 / 16f, 0, p.anim.legXRot, 0, 0, LeftLeg);
            DrawRotate(0, 6 / 16f, 0, -p.anim.legXRot, 0, 0, RightLeg);
            Rotate = RotateOrder.XZY;
            DrawRotate(-3 / 16f, 11 / 16f, 0, p.anim.leftXRot, 0, p.anim.leftZRot, LeftArm);
            DrawRotate(3 / 16f, 11 / 16f, 0, p.anim.rightXRot, 0, p.anim.rightZRot, RightArm);
            Rotate = RotateOrder.ZYX;
            graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4);

            graphics.AlphaTest = true;
            index = 0;
            DrawHeadRotate(0, 13f / 16f, 0, -p.PitchRadians, 0, 0, Hat);
            graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4);
        }
Example #6
0
        // GET: SkinType/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SkinType skinType = db.SkinType.Find(id);
            var      question = from m in db.Question
                                select m;

            if (!String.IsNullOrEmpty(id))
            {
                question = question.Where(s => s.SkinId.Equals(id));
            }
            DetailModelView detailModelView = new DetailModelView();

            detailModelView.Question = question.ToList();
            detailModelView.SkinType = skinType;
            if (skinType == null)
            {
                return(HttpNotFound());
            }

            return(View(detailModelView));
        }
Example #7
0
        protected override void DrawModel(Player p)
        {
            int texId = p.PlayerTextureId <= 0 ? cache.HumanoidTexId : p.PlayerTextureId;

            graphics.BindTexture(texId);
            graphics.AlphaTest = false;

            SkinType skinType = p.SkinType;

            _64x64 = skinType != SkinType.Type64x32;
            ModelSet model = skinType == SkinType.Type64x64Slim ? SetSlim : Set;

            DrawHeadRotate(0, 24 / 16f, 0, -p.PitchRadians, 0, 0, model.Head);

            DrawPart(model.Torso);
            DrawRotate(0, 12 / 16f, 0, p.anim.legXRot, 0, 0, model.LeftLeg);
            DrawRotate(0, 12 / 16f, 0, -p.anim.legXRot, 0, 0, model.RightLeg);
            Rotate = RotateOrder.XZY;
            DrawRotate(-5 / 16f, 22 / 16f, 0, p.anim.leftXRot, 0, p.anim.leftZRot, model.LeftArm);
            DrawRotate(5 / 16f, 22 / 16f, 0, p.anim.rightXRot, 0, p.anim.rightZRot, model.RightArm);
            Rotate = RotateOrder.ZYX;
            graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4);

            graphics.AlphaTest = true;
            index = 0;
            DrawHeadRotate(0, 24f / 16f, 0, -p.PitchRadians, 0, 0, model.Hat);
            graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4);
        }
Example #8
0
        private static void SwitchSkin(int t)
        {
            byte[] value;
            switch (t)
            {
            case 0:
                using (BinaryWriter binaryWriter = new BinaryWriter(File.OpenWrite(FilePath))) {
                    binaryWriter.BaseStream.Position = BytePosition;
                    //value = int.Parse(InjectionCodes[0], System.Globalization.NumberStyles.HexNumber);
                    value = StringToByteArray(InjectionCodes[1]);
                    binaryWriter.Write(value);
                    binaryWriter.Flush();
                    binaryWriter.Close();
                }

                Skin = SkinType.Light;
                break;

            case 1:
                using (BinaryWriter binaryWriter = new BinaryWriter(File.OpenWrite(FilePath))) {
                    binaryWriter.BaseStream.Position = BytePosition;
                    //value = int.Parse(InjectionCodes[1], System.Globalization.NumberStyles.HexNumber);
                    value = StringToByteArray(InjectionCodes[0]);
                    binaryWriter.Write(value);
                    binaryWriter.Flush();
                    binaryWriter.Close();
                }

                Skin = SkinType.Dark;
                break;
            }
        }
    public void ChangeSkin(SkinType skinType)
    {
        switch (skinType)
        {
        case SkinType.Simple:
        {
            Debug.Log("Resources skin selected");
            UseTexturesFromResources();
            break;
        }
        case SkinType.Bundles:
        {
            Debug.Log("Bundles skin selected");
            if(Bundles.Initialized)
            {
                UseTexturesFromBundle();
            }
            else
            {
                Debug.Log("Cant load bundle. Check bundles directory location");
                UseTexturesFromResources();
            }

            break;
        }
        case SkinType.Generated:
        {
            Debug.Log("Generated textures skin selected");
            GenerateTextures();
            break;
        }
        default:
            throw new ArgumentOutOfRangeException();
        }
    }
        public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider)
        {
            if (!dbContext.SkinTypes.Any())
            {
                var skinTypesData = JsonConvert
                                    .DeserializeObject <List <SkinTypeDto> >(File.ReadAllText(GlobalConstants.SkinTypeSeederPath))
                                    .ToList();

                List <SkinType> skinTypes = new List <SkinType>();

                foreach (var currentSkinTypeData in skinTypesData)
                {
                    var skinType = new SkinType()
                    {
                        Name        = currentSkinTypeData.Name,
                        Description = currentSkinTypeData.Description,
                    };

                    skinTypes.Add(skinType);
                }

                await dbContext.SkinTypes.AddRangeAsync(skinTypes);

                await dbContext.SaveChangesAsync();
            }
        }
Example #11
0
 public Player(Game game) : base(game)
 {
     this.game = game;
     StepSize  = 0.5f;
     SkinType  = game.DefaultPlayerSkinType;
     SetModel("humanoid");
 }
Example #12
0
        public Character()
        {
            _class     = CharacterEnums.CharacterClass.Explorer;
            _race      = CharacterEnums.CharacterRace.Human;
            _gender    = CharacterEnums.Genders.Female;
            _skinColor = CharacterEnums.SkinColors.Fair;
            _skinType  = CharacterEnums.SkinType.Flesh;
            _hairColor = CharacterEnums.HairColors.Black;
            _eyeColor  = CharacterEnums.EyeColors.Brown;
            _build     = CharacterEnums.BodyBuild.Medium;

            _koCount     = new Tuple <int, DateTime>(0, DateTime.Now);
            _actionState = CharacterActionState.None;
            _stanceState = CharacterStanceState.Standing;

            _primaryLanguage = CharacterEnums.Languages.Common;
            KnownLanguages   = new HashSet <Languages>();
            KnownLanguages.Add(_primaryLanguage);

            FirstName           = "";
            LastName            = "";
            Description         = "";
            Age                 = 17;  //Do we want an age? And are we going to advance it every in game year?  We'll need a birthdate for this.
            Weight              = 180; //pounds or kilos?
            Height              = 70;  //inches or centimeters?
            Location            = "A1";
            InCombat            = false;
            LastCombatTime      = DateTime.MinValue.ToUniversalTime();
            IsNPC               = false;
            Leveled             = false;
            MainHand            = "WIELD_RIGHT";
            NextLevelExperience = 300;
            Level               = 1;
            Experience          = 0;
            PointsToSpend       = 0;

            Inventory = new Inventory();
            Equipment = new Equipment();
            Bonuses   = new StatBonuses();

            Inventory.playerID = this.ID;
            Equipment.playerID = this.ID;

            Attributes = new Dictionary <string, Attribute>();

            Attributes.Add("Hitpoints", new Attribute(150, "Hitpoints", 150, 0.1, 1));
            Attributes.Add("Dexterity", new Attribute(10, "Dexterity", 5, 0, 1));
            Attributes.Add("Strength", new Attribute(10, "Strength", 5, 0, 1));
            Attributes.Add("Intelligence", new Attribute(10, "Intelligence", 5, 0, 1));
            Attributes.Add("Endurance", new Attribute(10, "Endurance", 5, 0, 1));
            Attributes.Add("Charisma", new Attribute(10, "Charisma", 5, 0, 1));

            SubAttributes = new Dictionary <string, double>();

            SubAttributes.Add("Agility", 1);
            SubAttributes.Add("Toughness", 1);
            SubAttributes.Add("Cunning", 1);
            SubAttributes.Add("Wisdom", 1);
            SubAttributes.Add("Leadership", 1);
        }
Example #13
0
    public static void Apply(Skin skin, SkinType skinType)
    {
        bool flag = skinType == SkinType.Weapons;

        if (flag)
        {
            Dictionary <ushort, int> itemSkins = OptimizationVariables.MainPlayer.channel.owner.itemSkins;
            bool flag2 = itemSkins == null;
            if (!flag2)
            {
                ushort inventoryItemID = Provider.provider.economyService.getInventoryItemID(skin.ID);
                SkinOptions.SkinConfig.WeaponSkins.Clear();
                bool flag3 = itemSkins.TryGetValue(inventoryItemID, out int num);
                if (flag3)
                {
                    itemSkins[inventoryItemID] = skin.ID;
                }
                else
                {
                    itemSkins.Add(inventoryItemID, skin.ID);
                }
                OptimizationVariables.MainPlayer.equipment.applySkinVisual();
                OptimizationVariables.MainPlayer.equipment.applyMythicVisual();
                foreach (KeyValuePair <ushort, int> keyValuePair in itemSkins)
                {
                    SkinOptions.SkinConfig.WeaponSkins.Add(new WeaponSave(keyValuePair.Key, keyValuePair.Value));
                }
            }
        }
        else
        {
            SkinsUtilities.ApplyClothing(skin, skinType);
        }
    }
Example #14
0
        static void SwitchSkin(int t)
        {
            switch (t)
            {
            case 0:
                using (BinaryWriter binaryWriter = new BinaryWriter((Stream)File.OpenWrite(FilePath)))
                {
                    binaryWriter.BaseStream.Position = (long)BytePosition;
                    binaryWriter.Write(InjectionCodes[0]);
                    binaryWriter.Flush();
                    binaryWriter.Close();
                }
                Skin = SkinType.Light;
                break;

            case 1:
                using (BinaryWriter binaryWriter = new BinaryWriter((Stream)File.OpenWrite(FilePath)))
                {
                    binaryWriter.BaseStream.Position = (long)BytePosition;
                    binaryWriter.Write(InjectionCodes[1]);
                    binaryWriter.Flush();
                    binaryWriter.Close();
                }
                Skin = SkinType.Dark;
                break;
            }
        }
Example #15
0
        protected void CheckSkin()
        {
            DownloadedItem item;
            game.AsyncDownloader.TryGetItem( SkinIdentifier, out item );
            if( item != null && item.Data != null ) {
                Bitmap bmp = (Bitmap)item.Data;
                game.Graphics.DeleteTexture( ref PlayerTextureId );
                if( !FastBitmap.CheckFormat( bmp.PixelFormat ) )
                    game.Drawer2D.ConvertTo32Bpp( ref bmp );

                try {
                    SkinType = Utils.GetSkinType( bmp );
                    PlayerTextureId = game.Graphics.CreateTexture( bmp );
                    MobTextureId = -1;

                    // Custom mob textures.
                    if( Utils.IsUrlPrefix( SkinName ) && item.TimeAdded > lastModelChange )
                        MobTextureId = PlayerTextureId;
                    RenderHat = HasHat( bmp, SkinType );
                } catch( NotSupportedException ) {
                    ResetSkin( bmp );
                }
                bmp.Dispose();
            }
        }
Example #16
0
        static void SetSkin(SkinType skin)
        {
            switch (skin)
            {
            case SkinType.Light:
                using (BinaryWriter binaryWriter = new BinaryWriter((Stream)File.OpenWrite(FilePath)))
                {
                    binaryWriter.BaseStream.Position = (long)BytePosition;
                    binaryWriter.Write(bytes[0]);
                    binaryWriter.Flush();
                    binaryWriter.Close();
                }
                Skin = SkinType.Dark;
                break;

            case SkinType.Dark:
                using (BinaryWriter binaryWriter = new BinaryWriter((Stream)File.OpenWrite(FilePath)))
                {
                    binaryWriter.BaseStream.Position = (long)BytePosition;
                    binaryWriter.Write(bytes[1]);
                    binaryWriter.Flush();
                    binaryWriter.Close();
                }
                Skin = SkinType.Light;
                break;
            }
        }
Example #17
0
        private void Update()
        {
            MainRenderer.RendererEnable = false;

            int index    = transform.GetSiblingIndex();
            var noteData = !(Beatmap is null) && index < Beatmap.Notes.Count ? Beatmap.Notes[index] : null;

            if (noteData is null || noteData._SpeedOnDrop < 0f)
            {
                gameObject.SetActive(false);
                return;
            }
            SkinType type = noteData.Duration > FLOAT_GAP && MusicTime < noteData.Time + noteData.Duration ? SkinType.HoldLuminous : SkinType.NoteLuminous;

            Duration          = type == SkinType.NoteLuminous ? LuminousDuration_Tap : LuminousDuration_Hold;
            MainRenderer.Type = type;

            if (MusicPlaying && GetLumActive(noteData))
            {
                // Active
                Update_Movement(noteData, noteData.Duration <= FLOAT_GAP, type);
            }
            else
            {
                // Inactive
                gameObject.SetActive(false);
            }
        }
Example #18
0
        public static void LoadSkin(SkinType skinType)
        {
            if (defaultSkin == null)
            {
                CopyDefaultSkin();
            }
            if (compactSkin == null)
            {
                CopyCompactSkin();
            }
            if (transparentSkin == null)
            {
                CopyTransparentSkin();
            }

            switch (skinType)
            {
            case SkinType.Default:
                skin = defaultSkin;
                break;

            case SkinType.MechJeb1:
                skin = AssetBase.GetGUISkin("KSP window 2");
                break;

            case SkinType.Compact:
                skin = compactSkin;
                break;
            }
        }
Example #19
0
        public GameSettings()
        {
            ROWS = 6;
            COLUMNS = 7;
            SLOW_DROP_SPEED = 0.1f;
            NORMAL_DROP_SPEED = 1.5f;
            HIGH_DROP_SPEED = 3f;
            STONE_NUMBER = 21;
            RED_PLAYER = 1;
            YELLOW_PLAYER = 2;
            MEDIAPATH = "..\\..\\Content\\";
            TITLEPIC = "title.tga";
            GAMEPIC = "background_2.tga";
            STARTING_PLAYER = RED_PLAYER;
            AI_STRENGTH = DIFFICULTY.Easy;
            PLAYER_RED_NAME = "Player 1";
            PLAYER_YELLOW_NAME = "Player 2";

            IP = "music-pc";
            Port = 11000;

            ballPath = "";

            this.GfxSkin = SkinType.Classic;

            //SetGfxSkin(SkinType.Classic);
        }
Example #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="skin"></param>
 /// <returns></returns>
 public static ResourceDictionary GetSkin(SkinType skin)
 {
     return(new ResourceDictionary
     {
         Source = new Uri($"pack://application:,,,/PersianToolkit;component/Themes/Skin{skin.ToString()}.xaml")
     });
 }
Example #21
0
        public static void LoadSkin(SkinType skinType)
        {
            if (defaultSkin == null)
            {
                CopyDefaultSkin();
            }
            if (compactSkin == null)
            {
                CopyCompactSkin();
            }
            if (transparentSkin == null)
            {
                CopyTransparentSkin();
            }

            switch (skinType)
            {
            case SkinType.Default:
                skin = defaultSkin;
                break;

            case SkinType.Compact:
                skin = compactSkin;
                break;
            }
        }
        internal void UnselectOtherSkins(int lastSelected, SkinType skinType)
        {
            switch (skinType)
            {
            case SkinType.Wolfie:
                for (var i = 0; i < wolfieSkins.Length; i++)
                {
                    if (i == lastSelected)
                    {
                        continue;
                    }
                    wolfieSkins[i].GetComponent <CustomizationButtonScript>().SelectingUiChange(false);
                }
                break;

            case SkinType.Background:
                for (var i = 0; i < backgroundSkins.Length; i++)
                {
                    if (i == lastSelected)
                    {
                        continue;
                    }
                    backgroundSkins[i].GetComponent <CustomizationButtonScript>().SelectingUiChange(false);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(skinType), skinType, null);
            }
        }
        private static async Task <SkinType> AddSkinTypesToDbAsync(ApplicationDbContext db)
        {
            var firstSkinType = new SkinType()
            {
                Id = Guid.NewGuid().ToString(), Name = "Dry"
            };
            var secondSkinType = new SkinType()
            {
                Id = Guid.NewGuid().ToString(), Name = "Oily"
            };
            var thirdSkinType = new SkinType()
            {
                Id = Guid.NewGuid().ToString(), Name = "Sensitive"
            };

            await db.SkinTypes.AddAsync(firstSkinType);

            await db.SkinTypes.AddAsync(secondSkinType);

            await db.SkinTypes.AddAsync(thirdSkinType);

            await db.SaveChangesAsync();

            return(firstSkinType);
        }
Example #24
0
        internal void UpdateSkin(SkinType skin)
        {
            var skins0 = Resources.MergedDictionaries[0];

            skins0.MergedDictionaries.Clear();
            skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));
            skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skin));

            var skins1 = Resources.MergedDictionaries[1];

            skins1.MergedDictionaries.Clear();
            skins1.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
            });
            skins1.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
            });
            Current.MainWindow?.OnApplyTemplate();

            Resources.MergedDictionaries.Clear();
            Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri($"pack://application:,,,/HandyControl;component/Themes/Skin{skin.ToString()}.xaml")
            });
            Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
            });
        }
Example #25
0
        protected override void RenderParts(Entity p)
        {
            HumanoidModel human = (HumanoidModel)game.ModelCache.Models[0].Instance;

            vertices = human.vertices;
            // If user changes option while game is running
            if (classicArms != game.ClassicArmModel)
            {
                classicArms = game.ClassicArmModel;
                SetTranslationMatrix();
            }

            SkinType skinType = p.SkinType;
            ModelSet model    = skinType == SkinType.Type64x64Slim ? human.SetSlim :
                                (skinType == SkinType.Type64x64 ? human.Set64 : human.Set);

            game.Graphics.PushMatrix();
            game.Graphics.MultiplyMatrix(ref m);
            Rotate = RotateOrder.YZX;

            DrawArmPart(model.RightArm);
            UpdateVB();
            if (skinType != SkinType.Type64x32)
            {
                index = 0;
                game.Graphics.AlphaTest = true;
                DrawArmPart(model.RightArmLayer);
                UpdateVB();
                game.Graphics.AlphaTest = false;
            }

            Rotate = RotateOrder.ZYX;
            game.Graphics.PopMatrix();
        }
Example #26
0
        protected void CheckSkin()
        {
            DownloadedItem item;
            game.AsyncDownloader.TryGetItem( "skin_" + SkinName, out item );
            if( item != null && item.Data != null ) {
                Bitmap bmp = (Bitmap)item.Data;
                game.Graphics.DeleteTexture( ref PlayerTextureId );
                if( !FastBitmap.CheckFormat( bmp.PixelFormat ) )
                    game.Drawer2D.ConvertTo32Bpp( ref bmp );

                try {
                    SkinType = Utils.GetSkinType( bmp );
                    PlayerTextureId = game.Graphics.CreateTexture( bmp );
                    MobTextureId = -1;

                    // Custom mob textures.
                    if( Utils.IsUrlPrefix( item.Url ) && item.TimeAdded > lastModelChange ) {
                        MobTextureId = PlayerTextureId;
                    }
                    RenderHat = HasHat( bmp, SkinType );
                } catch( NotSupportedException ) {
                    string formatString = "Skin {0} has unsupported dimensions({1}, {2}), reverting to default.";
                    Utils.LogWarning( formatString, SkinName, bmp.Width, bmp.Height );
                    MobTextureId = -1;
                    PlayerTextureId = -1;
                    SkinType = game.DefaultPlayerSkinType;
                    RenderHat = false;
                }
                bmp.Dispose();
            }
        }
Example #27
0
        protected void CheckSkin()
        {
            DownloadedItem item;

            game.AsyncDownloader.TryGetItem(SkinIdentifier, out item);
            if (item != null && item.Data != null)
            {
                Bitmap bmp = (Bitmap)item.Data;
                game.Graphics.DeleteTexture(ref PlayerTextureId);
                if (!FastBitmap.CheckFormat(bmp.PixelFormat))
                {
                    game.Drawer2D.ConvertTo32Bpp(ref bmp);
                }

                try {
                    SkinType = Utils.GetSkinType(bmp);
                    if (Model is HumanoidModel || Model is ChibiModel)
                    {
                        ClearHat(bmp, SkinType);
                    }
                    PlayerTextureId = game.Graphics.CreateTexture(bmp);
                    MobTextureId    = -1;

                    // Custom mob textures.
                    if (Utils.IsUrlPrefix(SkinName, 0) && item.TimeAdded > lastModelChange)
                    {
                        MobTextureId = PlayerTextureId;
                    }
                } catch (NotSupportedException) {
                    ResetSkin(bmp);
                }
                bmp.Dispose();
            }
        }
Example #28
0
 public BodyPartData(System.IO.BinaryReader reader)
 {
     part     = (BodyPartPiece)reader.ReadByte();
     skinType = (SkinType)reader.ReadByte();
     flags    = (BodyPartFlags)reader.ReadByte();
     partType = (BodyPartType)reader.ReadByte();
 }
Example #29
0
        public static void SetSkin(string skinRoot, int portalId, SkinType skinType, string skinSrc)
        {
            var selectedCultureCode = LocaleController.Instance.GetCurrentLocale(portalId).Code;

            switch (skinRoot)
            {
            case "Skins":
                if (skinType == SkinType.Admin)
                {
                    if (portalId == Null.NullInteger)
                    {
                        HostController.Instance.Update("DefaultAdminSkin", skinSrc);
                    }
                    else
                    {
                        PortalController.UpdatePortalSetting(portalId, "DefaultAdminSkin", skinSrc, true, selectedCultureCode);
                    }
                }
                else
                {
                    if (portalId == Null.NullInteger)
                    {
                        HostController.Instance.Update("DefaultPortalSkin", skinSrc);
                    }
                    else
                    {
                        PortalController.UpdatePortalSetting(portalId, "DefaultPortalSkin", skinSrc, true, selectedCultureCode);
                    }
                }

                break;

            case "Containers":
                if (skinType == SkinType.Admin)
                {
                    if (portalId == Null.NullInteger)
                    {
                        HostController.Instance.Update("DefaultAdminContainer", skinSrc);
                    }
                    else
                    {
                        PortalController.UpdatePortalSetting(portalId, "DefaultAdminContainer", skinSrc, true, selectedCultureCode);
                    }
                }
                else
                {
                    if (portalId == Null.NullInteger)
                    {
                        HostController.Instance.Update("DefaultPortalContainer", skinSrc);
                    }
                    else
                    {
                        PortalController.UpdatePortalSetting(portalId, "DefaultPortalContainer", skinSrc, true, selectedCultureCode);
                    }
                }

                break;
            }
        }
Example #30
0
        public ActionResult DeleteConfirmed(string id)
        {
            SkinType skinType = db.SkinType.Find(id);

            db.SkinType.Remove(skinType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #31
0
        public void UpdateSkin(SkinType skin)
        {
            var skin0 = Resources.MergedDictionaries[0];

            skin0.MergedDictionaries.Clear();
            skin0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));
            Current.MainWindow?.OnApplyTemplate();
        }
        public async ValueTask SetSkinAsync(SkinType skin)
        {
            PlayerInfo.Skin = skin;

            using var writer = _game.StartRpc(NetId, RpcCalls.SetSkin);
            Rpc10SetSkin.Serialize(writer, skin);
            await _game.FinishRpcAsync(writer);
        }
Example #33
0
 public Player( Game game )
     : base(game)
 {
     this.game = game;
     StepSize = 0.5f;
     SkinType = game.DefaultPlayerSkinType;
     SetModel( "humanoid" );
 }
Example #34
0
        /// <summary>
        /// Deep copy constructor
        /// </summary>
        /// <param name="copy"></param>
        public Character(Character copy)   //copy constructor
        {
            _class       = copy._class;
            _race        = copy._race;
            _gender      = copy._gender;
            _skinColor   = copy._skinColor;
            _skinType    = copy._skinType;
            _hairColor   = copy._hairColor;
            _eyeColor    = copy._eyeColor;
            _build       = copy._build;
            _koCount     = new Tuple <int, DateTime>(0, DateTime.Now);
            _actionState = CharacterActionState.None;
            _stanceState = CharacterStanceState.Standing;

            _primaryLanguage = copy._primaryLanguage;
            KnownLanguages   = new HashSet <Languages>();
            foreach (CharacterEnums.Languages lang in copy.KnownLanguages)
            {
                KnownLanguages.Add(lang);
            }

            FirstName           = copy.FirstName;
            LastName            = copy.LastName;
            Description         = copy.Description;
            Age                 = copy.Age;    //Do we want an age? And are we going to advance it every in game year?  Players could be 400+ years old rather quick.
            Weight              = copy.Weight; //pounds or kilos?
            Height              = copy.Height; //inches or centimeters?
            Location            = "A1";
            InCombat            = false;
            LastCombatTime      = DateTime.MinValue.ToUniversalTime();
            IsNPC               = false;
            Leveled             = false;
            NextLevelExperience = 300;
            Level               = 1;
            Experience          = 0;
            PointsToSpend       = 0;
            MainHand            = "WIELD_RIGHT";


            Attributes = new Dictionary <string, Attribute>();

            foreach (KeyValuePair <string, Attribute> attrib in copy.Attributes)
            {
                Attributes.Add(attrib.Key, attrib.Value);
            }

            SubAttributes = new Dictionary <string, double>();

            foreach (KeyValuePair <string, double> subAttrib in copy.SubAttributes)
            {
                SubAttributes.Add(subAttrib.Key, subAttrib.Value);
            }

            Inventory = new Inventory();


            this.Save();
        }
Example #35
0
        void ResetSkin(Bitmap bmp)
        {
            string formatString = "Skin {0} has unsupported dimensions({1}, {2}), reverting to default.";

            Utils.LogDebug(formatString, SkinName, bmp.Width, bmp.Height);
            MobTextureId = -1;
            TextureId    = -1;
            SkinType     = game.DefaultPlayerSkinType;
        }
Example #36
0
 public Player(Game game) : base(game)
 {
     this.game = game;
     StepSize  = 0.5f;
     SkinType  = game.DefaultPlayerSkinType;
     anim      = new AnimatedComponent(game, this);
     shadow    = new ShadowComponent(game, this);
     SetModel("humanoid");
 }
Example #37
0
 public Player( Game game )
     : base(game)
 {
     this.game = game;
     StepSize = 0.5f;
     SkinType = game.DefaultPlayerSkinType;
     anim = new AnimatedComponent( game, this );
     shadow = new ShadowComponent( game, this );
     SetModel( "humanoid" );
 }
Example #38
0
 /// <summary>
 /// Represents a single skin.
 /// </summary>
 /// <param name="id">The skin id.</param>
 /// <param name="name">The name of the skin.</param>
 /// <param name="type">The skin type.</param>
 /// <param name="flags">Additional skin flags.</param>
 /// <param name="restrictions">Restrictions that apply to the skin.</param>
 /// <param name="icon">The full icon URL.</param>
 /// <param name="description">Optional skin description.</param>
 /// <param name="details">Additional skin details.</param>
 public Skin(int id, string name, SkinType type, IEnumerable<SkinFlag> flags, IEnumerable<Restriction> restrictions, string icon, string description, SkinDetail details)
 {
     Id = id;
     Name = name;
     Type = type;
     Flags = flags;
     Restrictions = restrictions;
     Icon = icon;
     Description = description;
     Details = details;
 }
Example #39
0
        /// <summary>
        /// Changes the skin.
        /// </summary>
        /// <param name="st">The st.</param>
        public static void ChangeSkin(SkinType st)
        {
            System.Reflection.Assembly thisDll = System.Reflection.Assembly.GetExecutingAssembly();
            if (se == null)
            {
                se = new Sunisoft.IrisSkin.SkinEngine(Application.OpenForms[0], thisDll.GetManifestResourceStream("Fm.Src.Common.SkinProcessor.Skins." + st.ToString() + ".ssk"));
                se.Active = true;
                for (int i = 0; i < Application.OpenForms.Count; i++)
                {
                    se.AddForm(Application.OpenForms[i]);
                }

            }
            else
            {
                se.SkinStream = thisDll.GetManifestResourceStream("FT.Commons.SkinProcessor.Skins." + st.ToString() + ".ssk");
                se.Active = true;
            }
        }
Example #40
0
        public static void LoadSkin(SkinType skinType)
        {
            switch (skinType)
            {
                case SkinType.Default:
                    if (defaultSkin == null) CopyDefaultSkin();
                    skin = defaultSkin;
                    break;

                case SkinType.MechJeb1:
                    skin = AssetBase.GetGUISkin("KSP window 2");
                    break;
            }
        }
        /// <summary>
        /// Constructs a new instance of UISkinBrowser.
        /// </summary>
        /// <param name="Screen">A UIScreen instance that this UISkinBrowser belongs to.</param>
        /// <param name="Ctrl">A UIControl instance that this UISkinBrowser should be created from.</param>
        /// <param name="SkinType">The type of skin initially displayed by this UISkinBrowser. 0 = light, 1 = medium, 2 = dark.</param>
        public UISkinBrowser(UIScreen Screen, UIControl Ctrl, int SkinType, AvatarSex Sex)
            : base(Ctrl, Screen)
        {
            Position = Position + Screen.Position;

            m_SelectedSkintype = (Elements.SkinType)SkinType;
            m_Sex = Sex;

            m_SkinBrowserArrowLeft = new UIButton("SkinBrowserArrowLeft",
                FileManager.GetTexture((ulong)FileIDs.UIFileIDs.person_edit_skinbrowserarrowleft),
                Position + new Vector2(5, Size.Y - 70), Screen);
            m_SkinBrowserArrowLeft.OnButtonClicked += M_SkinBrowserArrowLeft_OnButtonClicked;
            m_SkinBrowserArrowRight = new UIButton("SkinBrowserArrowRight",
                FileManager.GetTexture((ulong)FileIDs.UIFileIDs.person_edit_skinbrowserarrowright),
                Position + new Vector2(Size.X - 45, Size.Y - 70), Screen);
            m_SkinBrowserArrowRight.OnButtonClicked += M_SkinBrowserArrowRight_OnButtonClicked;
        }
 protected static bool SkinChanged( string SkinRoot, int portalId, SkinType SkinType, string PostedSkinSrc )
 {
     //SkinController objSkins = new SkinController();
     SkinInfo objSkinInfo;
     string strSkinSrc = Null.NullString;
     objSkinInfo = SkinController.GetSkin( SkinRoot, portalId, SkinType.Admin );
     if( objSkinInfo != null )
     {
         strSkinSrc = objSkinInfo.SkinSrc;
     }
     if( strSkinSrc == null )
     {
         strSkinSrc = "";
     }
     return strSkinSrc != PostedSkinSrc;
 }
Example #43
0
        static unsafe void ClearHat( Bitmap bmp, SkinType skinType )
        {
            using( FastBitmap fastBmp = new FastBitmap( bmp, true, false ) ) {
                int sizeX = (bmp.Width / 64) * 32;
                int yScale = skinType == SkinType.Type64x32 ? 32 : 64;
                int sizeY = (bmp.Height / yScale) * 16;

                // determine if we actually need filtering
                for( int y = 0; y < sizeY; y++ ) {
                    int* row = fastBmp.GetRowPtr( y );
                    row += sizeX;
                    for( int x = 0; x < sizeX; x++ ) {
                        byte alpha = (byte)(row[x] >> 24);
                        if( alpha != 255 ) return;
                    }
                }

                // only perform filtering when the entire hat is opaque
                int fullWhite = FastColour.White.ToArgb();
                int fullBlack = FastColour.Black.ToArgb();
                for( int y = 0; y < sizeY; y++ ) {
                    int* row = fastBmp.GetRowPtr( y );
                    row += sizeX;
                    for( int x = 0; x < sizeX; x++ ) {
                        int pixel = row[x];
                        if( pixel == fullWhite || pixel == fullBlack ) row[x] = 0;
                    }
                }
            }
        }
Example #44
0
 void ResetSkin( Bitmap bmp )
 {
     string formatString = "Skin {0} has unsupported dimensions({1}, {2}), reverting to default.";
     Utils.LogDebug( formatString, SkinName, bmp.Width, bmp.Height );
     MobTextureId = -1;
     PlayerTextureId = -1;
     SkinType = game.DefaultPlayerSkinType;
     RenderHat = false;
 }
Example #45
0
        public void SetGfxSkin(GameSettings.SkinType skinType)
        {
            if (skinType == SkinType.Classic)
            {
                if (GfxSkin == SkinType.Different)
                {
                    this.SkinChanged = true;
                }

                standPath = MEDIAPATH + "classic\\stand_classic.x";
                stoneRedPath = MEDIAPATH + "classic\\stone_red_classic.x";
                stoneYellowPath = MEDIAPATH + "classic\\stone_yellow_classic.x";
                GfxSkin = SkinType.Classic;
            }

            if (skinType == SkinType.Different)
            {
                if (GfxSkin == SkinType.Classic)
                {
                    this.SkinChanged = true;
                }

                standPath = MEDIAPATH + "new\\ball.x";
                standPath = MEDIAPATH + "new\\stand_different.x";
                stoneRedPath = MEDIAPATH + "new\\stone_red_different.x";
                stoneYellowPath = MEDIAPATH + "new\\stone_yellow_different.x";
                GfxSkin = SkinType.Different;
            }
        }
Example #46
0
        /// <summary>
        /// Changes this avatar's outfit.
        /// </summary>
        public void ChangeOutfit(Outfit Oft, SkinType Type)
        {
            Binding[] Bindings;

            AccessoryMesh = null;
            AccessoryTexture = null;

            if (Oft.HandgroupID.FileID != 0)
            {
                HandGroup Hag = FileManager.GetHandgroup(Oft.HandgroupID.UniqueID);
                Appearance LeftHandApr, RightHandApr;

                switch (Type)
                {
                    case SkinType.Light:
                        LeftHandApr = FileManager.GetAppearance(Hag.Light.Left.Idle.AppearanceID.UniqueID);
                        RightHandApr = FileManager.GetAppearance(Hag.Light.Right.Idle.AppearanceID.UniqueID);
                        break;
                    case SkinType.Medium:
                        LeftHandApr = FileManager.GetAppearance(Hag.Medium.Left.Idle.AppearanceID.UniqueID);
                        RightHandApr = FileManager.GetAppearance(Hag.Medium.Right.Idle.AppearanceID.UniqueID);
                        break;
                    case SkinType.Dark:
                        LeftHandApr = FileManager.GetAppearance(Hag.Dark.Left.Idle.AppearanceID.UniqueID);
                        RightHandApr = FileManager.GetAppearance(Hag.Dark.Right.Idle.AppearanceID.UniqueID);
                        break;
                    default:
                        LeftHandApr = FileManager.GetAppearance(Hag.Light.Left.Idle.AppearanceID.UniqueID);
                        RightHandApr = FileManager.GetAppearance(Hag.Light.Right.Idle.AppearanceID.UniqueID);
                        break;
                }

                Bindings = FileManager.GetBindings(LeftHandApr.BindingIDs);

                foreach (Binding Bnd in Bindings)
                {
                    switch (Bnd.Bone)
                    {
                        case "L_HAND":
                            LeftHandMesh = FileManager.GetMesh(Bnd.MeshID.UniqueID);
                            LeftHandTexture = FileManager.GetTexture(Bnd.TextureID.UniqueID);
                            break;
                    }
                }

                Bindings = FileManager.GetBindings(RightHandApr.BindingIDs);

                foreach (Binding Bnd in Bindings)
                {
                    switch (Bnd.Bone)
                    {
                        case "R_HAND":
                            RightHandMesh = FileManager.GetMesh(Bnd.MeshID.UniqueID);
                            RightHandTexture = FileManager.GetTexture(Bnd.TextureID.UniqueID);
                            break;
                    }
                }
            }

            Appearance Apr;

            switch (Type)
            {
                case SkinType.Light:
                    Apr = FileManager.GetAppearance(Oft.LightAppearance.UniqueID);
                    break;
                case SkinType.Medium:
                    Apr = FileManager.GetAppearance(Oft.MediumAppearance.UniqueID);
                    break;
                case SkinType.Dark:
                    Apr = FileManager.GetAppearance(Oft.DarkAppearance.UniqueID);
                    break;
                default:
                    Apr = FileManager.GetAppearance(Oft.LightAppearance.UniqueID);
                    break;
            }

            Bindings = FileManager.GetBindings(Apr.BindingIDs);

            if(Oft.Region == OutfitRegion.Head)
                HeadMesh = null; //IMPORTANT: Reset the head mesh before loading a new one.

            foreach (Binding Bnd in Bindings)
            {
                switch (Bnd.Bone)
                {
                    case "PELVIS":
                        BodyMesh = FileManager.GetMesh(Bnd.MeshID.UniqueID);
                        BodyTexture = FileManager.GetTexture(Bnd.TextureID.UniqueID);
                        break;
                    case "HEAD":
                        if (HeadMesh == null)
                        {
                            HeadMesh = FileManager.GetMesh(Bnd.MeshID.UniqueID);
                            HeadTexture = FileManager.GetTexture(Bnd.TextureID.UniqueID);
                        }
                        else
                        {
                            AccessoryMesh = FileManager.GetMesh(Bnd.MeshID.UniqueID);
                            AccessoryTexture = FileManager.GetTexture(Bnd.TextureID.UniqueID);
                        }
                        break;
                }
            }
        }
        public static void SetSkin( string skinRoot, int portalId, SkinType skinType, string skinSrc )
        {
            // remove skin assignment
            DataProvider.Instance().DeleteSkin(skinRoot, portalId, (int)skinType);

            // add new skin assignment if specified
            if (!String.IsNullOrEmpty(skinSrc))
            {
                DataProvider.Instance().AddSkin(skinRoot, portalId, (int)skinType, skinSrc);
            }
        }
Example #48
0
 /// <summary>
 /// Sets the head for this Sim.
 /// </summary>
 /// <param name="Head">The Appearance of the head to set.</param>
 public void Head(Outfit Head, SkinType Type)
 {
     m_Avatar.SetHead(Head, Type);
 }
Example #49
0
 public static void SetSkin(string skinRoot, int portalId, SkinType skinType, string skinSrc)
 {
     var selectedCultureCode = LocaleController.Instance.GetCurrentLocale(portalId).Code;
     switch (skinRoot)
     {
         case "Skins":
             if (skinType == SkinType.Admin)
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultAdminSkin", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultAdminSkin", skinSrc, selectedCultureCode);
                 }
             }
             else
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultPortalSkin", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultPortalSkin", skinSrc, selectedCultureCode);
                 }
             }
             break;
         case "Containers":
             if (skinType == SkinType.Admin)
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultAdminContainer", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultAdminContainer", skinSrc, selectedCultureCode);
                 }
             }
             else
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultPortalContainer", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultPortalContainer", skinSrc, selectedCultureCode);
                 }
             }
             break;
     }
 }
Example #50
0
 public static void LoadSkin(SkinType skinType)
 {
     GUI.skin = null;
     switch (skinType)
     {
     case SkinType.Default:
         if (defaultSkin == null) CopyDefaultSkin();
         GUI.skin = defaultSkin;
         break;
     case SkinType.KSP:
         GUI.skin = AssetBase.GetGUISkin("KSP window 2");
         break;
     case SkinType.Compact:
         if (compactSkin == null) CopyCompactSkin();
         GUI.skin = compactSkin;
         break;
     }
 }
Example #51
0
        static unsafe bool HasHat( Bitmap bmp, SkinType skinType )
        {
            using( FastBitmap fastBmp = new FastBitmap( bmp, true ) ) {
                int sizeX = (bmp.Width / 64) * 32;
                int yScale = skinType == SkinType.Type64x32 ? 32 : 64;
                int sizeY = (bmp.Height / yScale) * 16;
                int fullWhite = FastColour.White.ToArgb();
                int fullBlack = FastColour.Black.ToArgb();

                for( int y = 0; y < sizeY; y++ ) {
                    int* row = fastBmp.GetRowPtr( y );
                    row += sizeX;
                    for( int x = 0; x < sizeX; x++ ) {
                        int pixel = row[x];
                        if( !(pixel == fullWhite || pixel == fullBlack) ) {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
Example #52
0
        public void Load(string id)
        {
            MongoUtils.MongoData.ConnectToDatabase();
            MongoDatabase characterDB = MongoUtils.MongoData.GetDatabase("Characters");
            MongoCollection characterCollection = characterDB.GetCollection<BsonDocument>("PlayerCharacter");
            IMongoQuery query = Query.EQ("_id", ObjectId.Parse(id));
            BsonDocument found = characterCollection.FindOneAs<BsonDocument>(query);

            ID = found["_id"].AsObjectId.ToString();
            FirstName = found["FirstName"].AsString.CamelCaseWord();
            LastName = found["LastName"].AsString.CamelCaseWord();
            _class = (CharacterClass)Enum.Parse(typeof(CharacterClass), found["Class"].AsString.CamelCaseWord());
            _race = (CharacterRace)Enum.Parse(typeof(CharacterRace), found["Race"].AsString.CamelCaseWord());
            _gender = (Genders)Enum.Parse(typeof(Genders), found["Gender"].AsString.CamelCaseWord());
            _skinType = (SkinType)Enum.Parse(typeof(SkinType), found["SkinType"].AsString.CamelCaseWord());
            _skinColor = (SkinColors)Enum.Parse(typeof(SkinColors), found["SkinColor"].AsString.CamelCaseWord());
            _skinType = (SkinType)Enum.Parse(typeof(SkinType), found["SkinType"].AsString.CamelCaseWord());
            _hairColor = (HairColors)Enum.Parse(typeof(HairColors), found["HairColor"].AsString.CamelCaseWord());
            _eyeColor = (EyeColors)Enum.Parse(typeof(EyeColors), found["EyeColor"].AsString.CamelCaseWord());
            Height = found["Height"].AsDouble;
            Weight = found["Weight"].AsDouble;
            _stanceState = (CharacterStanceState)Enum.Parse(typeof(CharacterStanceState), found["StanceState"].AsString.CamelCaseWord());
            _actionState = (CharacterActionState)Enum.Parse(typeof(CharacterActionState), found["ActionState"].AsString.CamelCaseWord());
            Description = found["Description"].AsString;
            Location = found["Location"].AsString;
            Password = found["Password"].AsString;
            IsNPC = found["IsNPC"].AsBoolean;
            Experience = found["Experience"].AsInt64;
            NextLevelExperience = found["NextLevelExperience"].AsInt64;
            Level = found["Level"].AsInt32;
            Leveled = found["Leveled"].AsBoolean;
            PointsToSpend = found["PointsToSpend"].AsInt32;
            MainHand = found["MainHand"].AsString != "" ? found["MainHand"].AsString : null;
            Title = found.Contains("Title") ? found["Title"].AsString : "";
            KillerID = found.Contains("KillerID") ? found["KillerID"].AsString : "";

            BsonArray playerAttributes = found["Attributes"].AsBsonArray;
            BsonArray inventoryList = found["Inventory"].AsBsonArray;
            BsonArray equipmentList = found["Equipment"].AsBsonArray;
            BsonArray bonusesList = found["Bonuses"].AsBsonArray;

            if (playerAttributes != null) {
                foreach (BsonDocument attrib in playerAttributes) {

                    if (!this.Attributes.ContainsKey(attrib["Name"].ToString())) {
                        Attribute tempAttrib = new Attribute();
                        tempAttrib.Name = attrib["Name"].ToString();
                        tempAttrib.Value = attrib["Value"].AsDouble;
                        tempAttrib.Max = attrib["Max"].AsDouble ;
                        tempAttrib.RegenRate = attrib["RegenRate"].AsDouble;
                        tempAttrib.Rank = attrib["Rank"].AsInt32;

                        this.Attributes.Add(tempAttrib.Name, tempAttrib);
                    }
                    else {
                        this.Attributes[attrib["Name"].ToString()].Max = attrib["Max"].AsDouble;
                        this.Attributes[attrib["Name"].ToString()].Value = attrib["Value"].AsDouble;
                        this.Attributes[attrib["Name"].ToString()].RegenRate = attrib["RegenRate"].AsDouble;
                        this.Attributes[attrib["Name"].ToString()].Rank = attrib["Rank"].AsInt32;
                    }
                }
            }

            if (inventoryList.Count > 0) {
                foreach (BsonDocument item in inventoryList) {
                    Items.Iitem fullItem = Items.Items.GetByID(item["_id"].AsObjectId.ToString());
                    if (!Inventory.inventory.Contains(fullItem)) {
                        Inventory.AddItemToInventory(fullItem);
                    }
                }
            }

            if (equipmentList.Count > 0) {
                foreach (BsonDocument item in equipmentList) {
                    Items.Iitem fullItem = Items.Items.GetByID(item["_id"].AsObjectId.ToString());
                    if (!Equipment.equipped.ContainsKey(fullItem.WornOn)) {
                        Equipment.EquipItem(fullItem, this.Inventory);
                    }
                }
            }

            if (bonusesList.Count > 0) {
                Bonuses.LoadFromBson(bonusesList);
            }
        }
Example #53
0
 /// <summary>
 /// Change the outfit for this Sim.
 /// </summary>
 /// <param name="Oft">The outfit to change into.</param>
 /// <param name="Skin">The sim's skin type.</param>
 public void ChangeOutfit(Outfit Oft, SkinType Skin)
 {
     m_Avatar.ChangeOutfit(Oft, Skin);
 }
Example #54
0
        /// <summary>
        /// Sets this avatar's head outfit.
        /// </summary>
        public void SetHead(Outfit HeadOutfit, SkinType Type)
        {
            Appearance Apr;

            switch (Type)
            {
                case SkinType.Light:
                    Apr = FileManager.GetAppearance(HeadOutfit.LightAppearance.UniqueID);
                    break;
                case SkinType.Medium:
                    Apr = FileManager.GetAppearance(HeadOutfit.MediumAppearance.UniqueID);
                    break;
                case SkinType.Dark:
                    Apr = FileManager.GetAppearance(HeadOutfit.DarkAppearance.UniqueID);
                    break;
                default:
                    Apr = FileManager.GetAppearance(HeadOutfit.LightAppearance.UniqueID);
                    break;
            }

            AccessoryMesh = null;
            AccessoryTexture = null;

            //I think that heads are always 0...
            Binding Bnd = FileManager.GetBinding(Apr.BindingIDs[0].UniqueID);

            HeadMesh = FileManager.GetMesh(Bnd.MeshID.UniqueID);
            HeadTexture = FileManager.GetTexture(Bnd.TextureID.UniqueID);

            if(Apr.BindingIDs.Count > 1) //This head has accessories.
                Bnd = FileManager.GetBinding(Apr.BindingIDs[1].UniqueID);
        }
 public static SkinInfo GetSkin(string SkinRoot, int PortalId, SkinType SkinType)
 {
     SkinInfo objSkin = null;
     foreach (SkinInfo skin in GetSkins(PortalId))
     {
         if (skin.SkinRoot == SkinRoot & skin.SkinType == SkinType)
         {
             objSkin = skin;
             break;
         }
     }
     return objSkin;
 }
Example #56
0
        private void OnCmdChangedSkin(SkinType skinType)
        {
            if (skinType == SkinType.Blue)
            {
                Application.Current.Resources.MergedDictionaries.RemoveAt(2);
                Application.Current.Resources.MergedDictionaries.RemoveAt(1);

                ResourceDictionary res = (ResourceDictionary)Application.LoadComponent(new Uri("/Nova.SmartLCT.Skin;Component/BlueMode/BlueMood.UI.xaml", UriKind.RelativeOrAbsolute));
                Application.Current.Resources.MergedDictionaries.Add(res);

                res = (ResourceDictionary)Application.LoadComponent(new Uri("/Nova.SmartLCT.Skin;Component/BlueMode/BlueMood.Color.xaml", UriKind.RelativeOrAbsolute));
                Application.Current.Resources.MergedDictionaries.Add(res);

            }

            else if (skinType == SkinType.Red)
            {
                Application.Current.Resources.MergedDictionaries.RemoveAt(2);
                Application.Current.Resources.MergedDictionaries.RemoveAt(1);

                ResourceDictionary res = (ResourceDictionary)Application.LoadComponent(new Uri("/Nova.SmartLCT.Skin;Component/RedMode/RedMood.UI.xaml", UriKind.RelativeOrAbsolute));
                Application.Current.Resources.MergedDictionaries.Add(res);

                res = (ResourceDictionary)Application.LoadComponent(new Uri("/Nova.SmartLCT.Skin;Component/RedMode/RedMood.Color.xaml", UriKind.RelativeOrAbsolute));
                Application.Current.Resources.MergedDictionaries.Add(res);

            }
        }
Example #57
0
        /// <summary>
        /// Deep copy constructor
        /// </summary>
        /// <param name="copy"></param>
        public Character(Character copy)
        {
            //copy constructor
            _class = copy._class;
            _race = copy._race;
            _gender = copy._gender;
            _skinColor = copy._skinColor;
            _skinType = copy._skinType;
            _hairColor = copy._hairColor;
            _eyeColor = copy._eyeColor;
            _build = copy._build;
            _koCount = new Tuple<int, DateTime>(0, DateTime.Now);
            _actionState = CharacterActionState.None;
            _stanceState = CharacterStanceState.Standing;

            _primaryLanguage = copy._primaryLanguage;
            KnownLanguages = new HashSet<Languages>();
            foreach (CharacterEnums.Languages lang in copy.KnownLanguages) {
                KnownLanguages.Add(lang);
            }

            FirstName = copy.FirstName;
            LastName = copy.LastName;
            Description = copy.Description;
            Age = copy.Age;   //Do we want an age? And are we going to advance it every in game year?  Players could be 400+ years old rather quick.
            Weight = copy.Weight; //pounds or kilos?
            Height = copy.Height;  //inches or centimeters?
            Location = "A1";
            InCombat = false;
            LastCombatTime = DateTime.MinValue.ToUniversalTime();
            IsNPC = false;
            Leveled = false;
            NextLevelExperience = 300;
            Level = 1;
            Experience = 0;
            PointsToSpend = 0;
            MainHand = "WIELD_RIGHT";

            Attributes = new Dictionary<string, Attribute>();

            foreach (KeyValuePair<string, Attribute> attrib in copy.Attributes){
                Attributes.Add(attrib.Key, attrib.Value);
            }

            SubAttributes = new Dictionary<string, double>();

            foreach (KeyValuePair<string, double> subAttrib in copy.SubAttributes) {
                SubAttributes.Add(subAttrib.Key, subAttrib.Value);
            }

            Inventory = new Inventory();

            this.Save();
        }
 /// <summary>
 /// SkinChanged changes the skin
 /// </summary>
 /// <history>
 /// 	[cnurse]	10/19/2004	documented
 /// </history>
 private static bool SkinChanged( string SkinRoot, int PortalId, SkinType SkinType, string PostedSkinSrc )
 {
     string strSkinSrc = "";
     SkinInfo objSkinInfo = SkinController.GetSkin( SkinRoot, PortalId, SkinType.Admin );
     if( objSkinInfo != null )
     {
         strSkinSrc = objSkinInfo.SkinSrc;
     }
     if( strSkinSrc == null )
     {
         strSkinSrc = "";
     }
     return strSkinSrc != PostedSkinSrc;
 }
Example #59
0
 public static void SetSkin(string skinRoot, int portalId, SkinType skinType, string skinSrc)
 {
     switch (skinRoot)
     {
         case "Skins":
             if (skinType == SkinType.Admin)
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultAdminSkin", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultAdminSkin", skinSrc);
                 }
             }
             else
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultPortalSkin", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultPortalSkin", skinSrc);
                 }
             }
             break;
         case "Containers":
             if (skinType == SkinType.Admin)
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultAdminContainer", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultAdminContainer", skinSrc);
                 }
             }
             else
             {
                 if (portalId == Null.NullInteger)
                 {
                     HostController.Instance.Update("DefaultPortalContainer", skinSrc);
                 }
                 else
                 {
                     PortalController.UpdatePortalSetting(portalId, "DefaultPortalContainer", skinSrc);
                 }
             }
             break;
     }
 }
Example #60
0
		public Character(CharacterRace race, CharacterClass characterClass, Genders gender, Languages language, SkinColors skinColor, SkinType skinType, HairColors hairColor, EyeColors eyeColor, BodyBuild build) {
			Class = characterClass;
			Race = race;
			Gender = gender;
            SkinColor = skinColor;
            SkinType = skinType;
            HairColor = hairColor;
            EyeColor = eyeColor;
            Build = build;

			_koCount = new Tuple<int, DateTime>(0, DateTime.Now);
			_actionState = CharacterActionState.None;
			_stanceState = CharacterStanceState.Standing;
            
            _primaryLanguage = language;
            KnownLanguages = new HashSet<Languages>();
            KnownLanguages.Add(_primaryLanguage);

			FirstName = "";
			LastName = "";
			Description = "";
			Age = 17;   //Do we want an age? And are we going to advance it every in game year?
			Weight = 180.0d; //pounds or kilos?
			Height = 70.0d;  //inches or centimeters?
			Location = "A1000";
			InCombat = false;
			LastCombatTime = DateTime.MinValue.ToUniversalTime();
            IsNPC = false;
            Leveled = false;
            MainHand = "WIELD_RIGHT";
            NextLevelExperience = 300;
            Level = 1;
            Experience = 0;
            PointsToSpend = 0;

            Inventory = new Inventory();
			Equipment = new Equipment();
			Bonuses = new Dictionary<BonusTypes, Bonus>();
            StatBonus = new StatBonuses();
			StatBonus.Bonuses = Bonuses;

			Inventory.playerID = Id;
			Equipment.playerID = Id;

			Attributes = new List<Attribute>();

			Attributes.Add(new Attribute(150, "Hitpoints", 150, 0.1, 1));
			Attributes.Add(new Attribute(10, "Dexterity", 5, 0, 1));
			Attributes.Add(new Attribute(10, "Strength", 5, 0, 1));
			Attributes.Add(new Attribute(10, "Intelligence", 5, 0, 1));
			Attributes.Add( new Attribute(10, "Endurance", 5, 0, 1));
			Attributes.Add(new Attribute(10, "Charisma", 5, 0, 1));

			SubAttributes = new Dictionary<string, double>();

			SubAttributes.Add("Agility", 1);
			SubAttributes.Add("Toughness", 1);
			SubAttributes.Add("Cunning", 1);
			SubAttributes.Add("Wisdom", 1);
			SubAttributes.Add("Leadership", 1);
		}