Ejemplo n.º 1
0
        public static void DbSqlMobSkills(DbDebugItem <string> debug, AbstractDb <string> db)
        {
            DbSqlWriter writer = new DbSqlWriter();

            writer.Init(debug);
            DbIOMobSkills.Writer(debug, db);

            if (debug.DestinationServer == ServerType.RAthena)
            {
                writer.AppendHeader(ResourceString.Get("RAthenaMobSkillDbSqlHeader"));
            }
            else if (debug.DestinationServer == ServerType.Hercules)
            {
                writer.AppendHeader(ResourceString.Get("HerculesMobSkillDbSqlHeader"), writer.TableName.Replace("_re", ""));
                writer.TableName = "mob_skill_db";
            }

            foreach (string line in writer.Read())
            {
                string[] elements = TextFileHelper.ExcludeBrackets(line.Trim('\t'));
                if (!_getMobSkill(writer.IsHercules, writer.TableName, writer.Builder, elements))
                {
                    writer.Line(writer.IsHercules ? line.ReplaceFirst("//", "-- ") : line.ReplaceFirst("//", "#"));
                }
            }

            writer.Write();
        }
Ejemplo n.º 2
0
        public static void DbSqlItems(DbDebugItem <int> debug, AbstractDb <int> db)
        {
            DbSqlWriter writer = new DbSqlWriter();

            writer.Init(debug);

            if (debug.DestinationServer == ServerType.RAthena)
            {
                DbIOItems.DbItemsWriter(debug, db);
                writer.AppendHeader(ResourceString.Get(writer.IsRenewal ? "RAthenaItemDbSqlHeaderRenewal" : "RAthenaItemDbSqlHeader"));

                foreach (string line in writer.Read())
                {
                    string[] elements = TextFileHelper.ExcludeBrackets(line.Trim('\t'));
                    if (!_getItems(writer.IsRenewal, writer.TableName, writer.Builder, elements))
                    {
                        writer.Line(line.ReplaceFirst("//", "#"));
                    }
                }
            }
            else
            {
                var table = db.Table;
                writer.AppendHeader(ResourceString.Get("HerculesItemDbSqlHeader"), writer.TableName.Replace("_re", ""));

                foreach (var tuple in table.FastItems.OrderBy(p => p.GetKey <int>()))
                {
                    _getItemsHercules(writer.TableName, writer.Builder, tuple);
                }
            }

            writer.Write();
        }
Ejemplo n.º 3
0
        public static void DbSqlMobs(DbDebugItem <int> debug, AbstractDb <int> db)
        {
            DbSqlWriter writer = new DbSqlWriter();

            writer.Init(debug);

            if (DbPathLocator.DetectPath(debug.DbSource).EndsWith(".conf"))
            {
                object value = db.Attached["EntireRewrite"];
                db.Attached["EntireRewrite"] = true;
                DbIOMethods.DbWriterComma(debug, db);
                db.Attached["EntireRewrite"] = value;
            }
            else
            {
                DbIOMethods.DbWriterComma(debug, db);
            }

            if (debug.DestinationServer == ServerType.RAthena)
            {
                writer.AppendHeader(ResourceString.Get("RAthenaMobDbSqlHeader"));
            }
            else if (debug.DestinationServer == ServerType.Hercules)
            {
                writer.AppendHeader(ResourceString.Get("HerculesMobDbSqlHeader"), writer.TableName.Replace("_re", ""));
                writer.TableName = "mob_db";
            }

            foreach (string line in writer.Read())
            {
                string[] elements = TextFileHelper.ExcludeBrackets(line.Trim('\t'));
                if (!_getMob(writer.IsHercules, writer.TableName, writer.Builder, elements))
                {
                    writer.Line(writer.IsHercules ? line.ReplaceFirst("//", "--" + (writer.NumberOfLinesProcessed > 1 ? " " : "")) : line.ReplaceFirst("//", "#"));
                }
                else
                {
                    writer.NumberOfLinesProcessed++;
                }
            }

            writer.Write();
        }