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

            writer.Init(debug);
            DbWriterMethods.DbUniqueWriter(debug, db);

            if (debug.DestinationServer == ServerType.RAthena)
            {
                writer.AppendHeader(RAthenaMobSkillDbSqlHeader);
            }
            else if (debug.DestinationServer == ServerType.Hercules)
            {
                writer.AppendHeader(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();
        }
Exemplo n.º 2
0
        public static void DbSqlItems <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db)
        {
            DbSqlWriter writer = new DbSqlWriter();

            writer.Init(debug);

            if (debug.DestinationServer == ServerType.RAthena)
            {
                DbWriterMethods.DbItemsCommaWriter(debug, db);
                writer.AppendHeader(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(HerculesItemDbSqlHeader, writer.TableName.Replace("_re", ""));

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

            writer.Write();
        }