Exemplo n.º 1
0
 public void Update()
 {
     if (this.fID == Guid.Empty)
     {
         this.fID = Guid.NewGuid();
     }
     foreach (Creature fCreature in this.fCreatures)
     {
         if (fCreature == null)
         {
             continue;
         }
         if (fCreature.Category == null)
         {
             fCreature.Category = "";
         }
         if (fCreature.Senses == null)
         {
             fCreature.Senses = "";
         }
         if (fCreature.Movement == null)
         {
             fCreature.Movement = "";
         }
         if (fCreature.Auras == null)
         {
             fCreature.Auras = new List <Aura>();
         }
         foreach (Aura aura in fCreature.Auras)
         {
             if (aura.Keywords != null)
             {
                 continue;
             }
             aura.Keywords = "";
         }
         if (fCreature.CreaturePowers == null)
         {
             fCreature.CreaturePowers = new List <CreaturePower>();
         }
         if (fCreature.DamageModifiers == null)
         {
             fCreature.DamageModifiers = new List <DamageModifier>();
         }
         foreach (CreaturePower creaturePower in fCreature.CreaturePowers)
         {
             if (creaturePower.Condition == null)
             {
                 creaturePower.Condition = "";
             }
             creaturePower.ExtractAttackDetails();
         }
         CreatureHelper.UpdateRegen(fCreature);
         foreach (CreaturePower creaturePower1 in fCreature.CreaturePowers)
         {
             CreatureHelper.UpdatePowerRange(fCreature, creaturePower1);
         }
         if (fCreature.Tactics == null)
         {
             fCreature.Tactics = "";
         }
         if (fCreature.URL == null)
         {
             fCreature.URL = "";
         }
         if (fCreature.Image == null)
         {
             continue;
         }
         Program.SetResolution(fCreature.Image);
     }
     foreach (CreatureTemplate fTemplate in this.fTemplates)
     {
         if (fTemplate == null)
         {
             continue;
         }
         if (fTemplate.Senses == null)
         {
             fTemplate.Senses = "";
         }
         if (fTemplate.Movement == null)
         {
             fTemplate.Movement = "";
         }
         if (fTemplate.Auras == null)
         {
             fTemplate.Auras = new List <Aura>();
         }
         foreach (Aura aura1 in fTemplate.Auras)
         {
             if (aura1.Keywords != null)
             {
                 continue;
             }
             aura1.Keywords = "";
         }
         if (fTemplate.CreaturePowers == null)
         {
             fTemplate.CreaturePowers = new List <CreaturePower>();
         }
         if (fTemplate.DamageModifierTemplates == null)
         {
             fTemplate.DamageModifierTemplates = new List <DamageModifierTemplate>();
         }
         foreach (CreaturePower creaturePower2 in fTemplate.CreaturePowers)
         {
             if (creaturePower2.Condition == null)
             {
                 creaturePower2.Condition = "";
             }
             creaturePower2.ExtractAttackDetails();
         }
         if (fTemplate.Tactics != null)
         {
             continue;
         }
         fTemplate.Tactics = "";
     }
     if (this.fThemes == null)
     {
         this.fThemes = new List <MonsterTheme>();
     }
     foreach (MonsterTheme fTheme in this.fThemes)
     {
         if (fTheme == null)
         {
             continue;
         }
         foreach (ThemePowerData power in fTheme.Powers)
         {
             power.Power.ExtractAttackDetails();
         }
     }
     if (this.fTraps == null)
     {
         this.fTraps = new List <Trap>();
     }
     foreach (Trap fTrap in this.fTraps)
     {
         if (fTrap.Description == null)
         {
             fTrap.Description = "";
         }
         if (fTrap.Attacks == null)
         {
             fTrap.Attacks = new List <TrapAttack>();
         }
         if (fTrap.Attack != null)
         {
             fTrap.Attacks.Add(fTrap.Attack);
             fTrap.Initiative = (fTrap.Attack.HasInitiative ? fTrap.Attack.Initiative : -2147483648);
             fTrap.Trigger    = fTrap.Attack.Trigger;
             fTrap.Attack     = null;
         }
         foreach (TrapAttack attack in fTrap.Attacks)
         {
             if (attack.ID == Guid.Empty)
             {
                 attack.ID = Guid.NewGuid();
             }
             if (attack.Name == null)
             {
                 attack.Name = "Attack";
             }
             if (attack.Keywords == null)
             {
                 attack.Keywords = "";
             }
             if (attack.Notes != null)
             {
                 continue;
             }
             attack.Notes = "";
         }
         if (fTrap.Trigger == null)
         {
             fTrap.Trigger = "";
         }
         foreach (TrapSkillData skill in fTrap.Skills)
         {
             if (skill.ID != Guid.Empty)
             {
                 continue;
             }
             skill.ID = Guid.NewGuid();
         }
     }
     if (this.fSkillChallenges == null)
     {
         this.fSkillChallenges = new List <SkillChallenge>();
     }
     foreach (SkillChallenge fSkillChallenge in this.fSkillChallenges)
     {
         if (fSkillChallenge.Notes == null)
         {
             fSkillChallenge.Notes = "";
         }
         foreach (SkillChallengeData skillChallengeResult in fSkillChallenge.Skills)
         {
             if (skillChallengeResult.Results != null)
             {
                 continue;
             }
             skillChallengeResult.Results = new SkillChallengeResult();
         }
     }
     if (this.fMagicItems == null)
     {
         this.fMagicItems = new List <MagicItem>();
     }
     if (this.fArtifacts == null)
     {
         this.fArtifacts = new List <Artifact>();
     }
     foreach (Tile fTile in this.fTiles)
     {
         Program.SetResolution(fTile.Image);
         if (fTile.Keywords != null)
         {
             continue;
         }
         fTile.Keywords = "";
     }
     if (this.fTerrainPowers == null)
     {
         this.fTerrainPowers = new List <TerrainPower>();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the library to the latest format.
        /// </summary>
        public void Update()
        {
            if (fID == Guid.Empty)
            {
                fID = Guid.NewGuid();
            }

            foreach (Creature c in fCreatures)
            {
                if (c == null)
                {
                    continue;
                }

                if (c.Category == null)
                {
                    c.Category = "";
                }

                if (c.Senses == null)
                {
                    c.Senses = "";
                }

                if (c.Movement == null)
                {
                    c.Movement = "";
                }

                if (c.Auras == null)
                {
                    c.Auras = new List <Aura>();
                }

                foreach (Aura aura in c.Auras)
                {
                    if (aura.Keywords == null)
                    {
                        aura.Keywords = "";
                    }
                }

                if (c.CreaturePowers == null)
                {
                    c.CreaturePowers = new List <CreaturePower>();
                }

                if (c.DamageModifiers == null)
                {
                    c.DamageModifiers = new List <DamageModifier>();
                }

                foreach (CreaturePower cp in c.CreaturePowers)
                {
                    if (cp.Condition == null)
                    {
                        cp.Condition = "";
                    }

                    cp.ExtractAttackDetails();
                }

                CreatureHelper.UpdateRegen(c);
                foreach (CreaturePower power in c.CreaturePowers)
                {
                    CreatureHelper.UpdatePowerRange(c, power);
                }

                if (c.Tactics == null)
                {
                    c.Tactics = "";
                }

                if (c.Image != null)
                {
                    Program.SetResolution(c.Image);
                }
            }

            foreach (CreatureTemplate ct in fTemplates)
            {
                if (ct == null)
                {
                    continue;
                }

                if (ct.Senses == null)
                {
                    ct.Senses = "";
                }

                if (ct.Movement == null)
                {
                    ct.Movement = "";
                }

                if (ct.Auras == null)
                {
                    ct.Auras = new List <Aura>();
                }

                foreach (Aura aura in ct.Auras)
                {
                    if (aura.Keywords == null)
                    {
                        aura.Keywords = "";
                    }
                }

                if (ct.CreaturePowers == null)
                {
                    ct.CreaturePowers = new List <CreaturePower>();
                }

                if (ct.DamageModifierTemplates == null)
                {
                    ct.DamageModifierTemplates = new List <DamageModifierTemplate>();
                }

                foreach (CreaturePower cp in ct.CreaturePowers)
                {
                    if (cp.Condition == null)
                    {
                        cp.Condition = "";
                    }

                    cp.ExtractAttackDetails();
                }

                if (ct.Tactics == null)
                {
                    ct.Tactics = "";
                }
            }

            if (fThemes == null)
            {
                fThemes = new List <MonsterTheme>();
            }

            foreach (MonsterTheme mt in fThemes)
            {
                if (mt == null)
                {
                    continue;
                }

                foreach (ThemePowerData tpd in mt.Powers)
                {
                    tpd.Power.ExtractAttackDetails();
                }
            }

            if (fTraps == null)
            {
                fTraps = new List <Trap>();
            }

            foreach (Trap t in fTraps)
            {
                if (t.Description == null)
                {
                    t.Description = "";
                }

                if (t.Attacks == null)
                {
                    t.Attacks = new List <TrapAttack>();
                }
                if (t.Attack != null)
                {
                    t.Attacks.Add(t.Attack);
                    t.Initiative = t.Attack.HasInitiative ? t.Attack.Initiative : int.MinValue;
                    t.Trigger    = t.Attack.Trigger;
                    t.Attack     = null;
                }
                foreach (TrapAttack ta in t.Attacks)
                {
                    if (ta.ID == Guid.Empty)
                    {
                        ta.ID = Guid.NewGuid();
                    }

                    if (ta.Name == null)
                    {
                        ta.Name = "Attack";
                    }

                    if (ta.Keywords == null)
                    {
                        ta.Keywords = "";
                    }

                    if (ta.Notes == null)
                    {
                        ta.Notes = "";
                    }
                }

                if (t.Trigger == null)
                {
                    t.Trigger = "";
                }

                foreach (TrapSkillData tsd in t.Skills)
                {
                    if (tsd.ID == Guid.Empty)
                    {
                        tsd.ID = Guid.NewGuid();
                    }
                }
            }

            if (fSkillChallenges == null)
            {
                fSkillChallenges = new List <SkillChallenge>();
            }

            foreach (SkillChallenge sc in fSkillChallenges)
            {
                if (sc.Notes == null)
                {
                    sc.Notes = "";
                }

                foreach (SkillChallengeData scd in sc.Skills)
                {
                    if (scd.Results == null)
                    {
                        scd.Results = new SkillChallengeResult();
                    }
                }
            }

            if (fMagicItems == null)
            {
                fMagicItems = new List <MagicItem>();
            }

            if (fArtifacts == null)
            {
                fArtifacts = new List <Artifact>();
            }

            foreach (Tile t in fTiles)
            {
                Program.SetResolution(t.Image);

                if (t.Keywords == null)
                {
                    t.Keywords = "";
                }
            }

            if (fTerrainPowers == null)
            {
                fTerrainPowers = new List <TerrainPower>();
            }
        }