Exemplo n.º 1
0
        private IList <CharacterAllyOrOrganization5e> GetAlliesAndOrganizations(int characterId)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CharacterId", characterId)
            };

            using (CustomDataAdapter adapter = new CustomDataAdapter("GetCharacterAlliesAndOrganizations5e", CommandType.StoredProcedure, parameters))
            {
                DataTable table = new DataTable();

                adapter.Fill(table);

                List <CharacterAllyOrOrganization5e> alliesAndOrganizations = new List <CharacterAllyOrOrganization5e>();

                foreach (DataRow row in table.Rows)
                {
                    CharacterAllyOrOrganization5e allyOrOrganization = DataRowHelper.CreateItemFromRow <CharacterAllyOrOrganization5e>(row);
                    allyOrOrganization.ImageKey = row["ImageKey"].ToNullableGuid();

                    alliesAndOrganizations.Add(allyOrOrganization);
                }

                return(alliesAndOrganizations);
            }
        }
Exemplo n.º 2
0
        private Character5e CreateCharacterObject(DataRow row)
        {
            int characterId = Convert.ToInt32(row["Id"]);

            Character5e character = DataRowHelper.CreateItemFromRow <Character5e>(row);

            character.Key                    = (Guid)row["Key"];
            character.SavingThrows           = CreateSavingThrowsObject(row);
            character.Skills                 = DataRowHelper.CreateItemFromRow <CharacterSkills5e>(row); //CreateSkillsObject(row);
            character.TemporaryHitPoints     = row["TemporaryHitPoints"].ToNullableInt();
            character.AttacksAndSpellcasts   = GetAttacksAndSpellcasts(characterId);
            character.Items                  = GetItems(characterId);
            character.Money                  = DataRowHelper.CreateItemFromRow <CharacterMoney5e>(row); //CreateMoneyObject(row);
            character.FeaturesAndTraits      = GetFeaturesAndTraits(characterId);
            character.Proficiencies          = GetProficiencies(characterId);
            character.AlliesAndOrganizations = GetAlliesAndOrganizations(characterId);
            character.SpellcastingAbility    = row["SpellcastingAbility"].ToNullableInt();
            character.SpellSaveDC            = row["SpellSaveDC"].ToNullableInt();
            character.SpellAttackBonus       = row["SpellAttackBonus"].ToNullableInt();
            character.Spells                 = GetSpells(characterId);
            character.SpellSlots             = DataRowHelper.CreateItemFromRow <CharacterSpellSlots5e>(row); //CreateSpellSlotsObject(row);
            character.AppearanceKey          = (Guid)row["AppearanceKey"];

            return(character);

            //return new Character5e
            //{
            //    Key = (Guid)row["Key"],
            //    Name = row["Name"] as String,
            //    Class = row["Class"] as String,
            //    Level = Convert.ToInt32(row["Name"]),
            //    Background = row["Background"] as String,
            //    PlayerName = row["PlayerName"] as String,
            //    Race = row["Race"] as String,
            //    Alignment = row["Alignment"] as String,
            //    Experience = Convert.ToInt32(row["Experience"]),
            //    Strength = Convert.ToInt32(row["Strength"]),
            //    Dexterity = Convert.ToInt32(row["Dexterity"]),
            //    Constitution = Convert.ToInt32(row["Constitution"]),
            //    Intelligence = Convert.ToInt32(row["Intelligence"]),
            //    Wisdom = Convert.ToInt32(row["Wisdom"]),
            //    Charisma = Convert.ToInt32(row["Charisma"]),
            //    Inspiration = Convert.ToInt32(row["Inspiration"]),
            //    ProficiencyBonus = Convert.ToInt32(row["ProficiencyBonus"]),
            //    SavingThrows = CreateSavingThrowsObject(row),
            //    Skills = CreateSkillsObject(row),
            //    ArmorClass = Convert.ToInt32(row["ArmorClass"]),
            //    Initiative = Convert.ToInt32(row["Initiative"]),
            //    Speed = Convert.ToInt32(row["Speed"]),
            //    HitPointMaximum = Convert.ToInt32(row["HitPointMaximum"]),
            //    CurrentHitPoints = Convert.ToInt32(row["CurrentHitPoints"]),
            //    TemporaryHitPoints = row["TemporaryHitPoints"].ToNullableInt(),
            //    TotalHitDice = row["TotalHitDice"] as String,
            //    HitDice = row["HitDice"] as String,
            //    SuccessDeathSaves = Convert.ToInt32(row["SuccessDeathSaves"]),
            //    FailedDeathSaves = Convert.ToInt32(row["FailedDeathSaves"]),
            //    AttacksAndSpellcasts = GetAttacksAndSpellcasts(characterId),
            //    //Items = row["Items"] as String,
            //    Money = CreateMoneyObject(row),
            //    PersonalityTraits = row["PersonalityTraits"] as String,
            //    Ideals = row["Ideals"] as String,
            //    Bonds = row["Bonds"] as String,
            //    Flaws = row["Flaws"] as String,
            //    //FeaturesAndTraits = row["FeaturesAndTraits"] as String,
            //    PassiveWisdom = Convert.ToInt32(row["PassiveWisdom"]),
            //    //Proficiencies = row["Proficiencies"] as String,
            //    //AlliesAndOrganizations = row["AlliesAndOrganizations"] as String,
            //    Age = Convert.ToInt32(row["Age"]),
            //    Height = row["Height"] as String,
            //    Weight = row["Weight"] as String,
            //    Eyes = row["Eyes"] as String,
            //    Skin = row["Skin"] as String,
            //    Hair = row["Hair"] as String,
            //    SpellcastingClass = row["SpellcastingClass"] as String,
            //    SpellcastingAbility = row["SpellcastingAbility"].ToNullableInt(),
            //    SpellSaveDC = row["SpellSaveDC"].ToNullableInt(),
            //    SpellAttackBonus = row["SpellAttackBonus"].ToNullableInt(),
            //    //Spells = row["Spells"] as String,
            //    SpellSlots = CreateSpellSlotsObject(row),
            //    AppearanceKey = (Guid)row["AppearanceKey"],
            //    Backstory = row["Backstory"] as String
            //};
        }