Exemplo n.º 1
0
        private Hero CreateHero(XmlNode heroConfig)
        {
            var hero = new Hero();

            hero.Identifier          = heroConfig.Attribute("Name");
            hero.RecruitmentFoodCost = heroConfig.Attribute <int>("RecruitmentFoodCost");
            hero.AITargetType        = heroConfig.Attribute <AITargetType>("AITargetType");
            hero.AttackType          = heroConfig.Attribute <AttackType>("AttackType");
            hero.Archetype           = _localizationProvider.Get(heroConfig.Attribute("Archetype"));
            hero.UnlockLevelCount    = heroConfig.Attribute <int>("UnlockLevelCount");
            hero.Faction             = heroConfig.Attribute <Faction>("Faction");
            hero.IntroDialogs        = heroConfig.Select("IntroDialogs/Dialog", CreateDialog);
            hero.EquipmentSlots      = heroConfig.Select("EquipmentSlots/EquipmentSlot", CreateEquipmentSlot);
            return(hero);
        }
Exemplo n.º 2
0
        public override MethodResult <User> Handle(string email, string password)
        {
            var user = UserRepository.GetUserByEmailWithCriticalDataIncluded(email);

            if (user == null)
            {
                // use localization provider to get content for the provided KEY
                return(Fail(new GeneralErrorInfo("Invalid credentials", LocalizationProvider.Get("INVALID_CREDENTIALS")?.Value ?? "")));
            }

            if (!Hashing.VerifySha256(user.Password, password, user.PasswordSalt))
            {
                return(Fail(new GeneralErrorInfo("Invalid credentials", LocalizationProvider.Get("INVALID_CREDENTIALS")?.Value ?? "")));
            }

            return(user);
        }