private Tuple <XmlNode, XmlNamespaceManager> LoadMappingMetadata(string inputFile)
        {
            var xmlDoc = new XmlDocument();

            //xmlDoc.Load(Host.ResolvePath(inputFile));
            xmlDoc.Load(inputFile);

            var schemaConstantsList = new SchemaConstants[]
            {
                MetadataConstants.V3_SCHEMA_CONSTANTS,
                MetadataConstants.V2_SCHEMA_CONSTANTS,
                MetadataConstants.V1_SCHEMA_CONSTANTS,
            };

            foreach (var schemaConstants in schemaConstantsList)
            {
                var nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
                nsmgr.AddNamespace("ef", schemaConstants.MslNamespace);
                nsmgr.AddNamespace("edmx", schemaConstants.EdmxNamespace);
                var mappingNode = xmlDoc.DocumentElement.SelectSingleNode("./*/edmx:Mappings", nsmgr);

                if (mappingNode != null)
                {
                    return(Tuple.Create(mappingNode, nsmgr));
                }
            }

            throw new Exception(CodeGenerationTools.GetResourceString("Template_UnsupportedSchema"));
        }
Beispiel #2
0
        public static short ComputeStatForLevel(SchemaConstants.Rarity base_rarity, short? base_stat, short? max_stat, byte target_level)
        {
            short bv = base_stat.GetValueOrDefault(0);
            short mv = max_stat.GetValueOrDefault(0);

            byte fully_upgraded_max_level = MaxLevel(Evolve(base_rarity, SchemaConstants.EvolutionLevel.PlusPlus));
            return ComputeStatForLevel2(bv, 1, mv, fully_upgraded_max_level, target_level);
        }
Beispiel #3
0
 public static EquipStats ComputeStatsForLevel(SchemaConstants.Rarity base_rarity, EquipStats base_stats, EquipStats max_stats, byte target_level)
 {
     return new EquipStats
     {
         Acc = ComputeStatForLevel(base_rarity, base_stats.Acc, max_stats.Acc, target_level),
         Atk = ComputeStatForLevel(base_rarity, base_stats.Atk, max_stats.Atk, target_level),
         Def = ComputeStatForLevel(base_rarity, base_stats.Def, max_stats.Def, target_level),
         Res = ComputeStatForLevel(base_rarity, base_stats.Res, max_stats.Res, target_level),
         Eva = ComputeStatForLevel(base_rarity, base_stats.Eva, max_stats.Eva, target_level),
         Mag = ComputeStatForLevel(base_rarity, base_stats.Mag, max_stats.Mag, target_level),
         Mnd = ComputeStatForLevel(base_rarity, base_stats.Mnd, max_stats.Mnd, target_level)
     };
 }
Beispiel #4
0
 public static byte MaxLevel(SchemaConstants.Rarity rarity)
 {
     if (rarity == SchemaConstants.Rarity.One)
         return 3;
     return (byte)(5 * ((int)rarity - 1));
 }
Beispiel #5
0
 public static SchemaConstants.Rarity EvolveAsMuchAsPossible(SchemaConstants.Rarity base_rarity, SchemaConstants.Rarity cur_rarity, int max_times)
 {
     int times_already_upgraded = (int)cur_rarity - (int)base_rarity;
     int new_total_upgrades = Math.Min(times_already_upgraded + max_times, 2);
     return Evolve(base_rarity, new_total_upgrades);
 }
Beispiel #6
0
 public static SchemaConstants.Rarity Evolve(SchemaConstants.Rarity rarity, SchemaConstants.EvolutionLevel evo)
 {
     return Evolve(rarity, (int)evo);
 }
Beispiel #7
0
 public static SchemaConstants.Rarity Evolve(SchemaConstants.Rarity rarity, int num_times)
 {
     System.Diagnostics.Debug.Assert(num_times <= 2);
     int new_rarity = (int)rarity + num_times;
     return (SchemaConstants.Rarity)new_rarity;
 }
        public double ElementalMultiplier(SchemaConstants.ElementID element)
        {
            SchemaConstants.ElementID storedElement;

            if (EquipmentElementalInformation.ElementalEquipment.TryGetValue(EquipmentId, out storedElement) && storedElement == element)
            {
                return 1.2;
            }
            return 1.0;
        }