Git Product home page Git Product logo

dbcviewer's People

Contributors

tomrus88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dbcviewer's Issues

IO End of stream

Sadly some issues with the latest version.
It occours if i try to open a db file (see example
background

WDB format changed (5.2+)

The WDBReader did not work anymore especially for questcache.wdb. The format and field locations mostly changed and the string section isn't terminated by null bytes anymore. There must be a hidden entry (with offsets or length parameters) in each record before the string block begins, which defines the length or start of each string (name, details, description).

request add search function

could you add search function in dbcviewer like MyDbcEditor can search some value in table
or add goto id

Map.db2 structure changed

Looks like BZ change the structure to Map.db2 and now it will require a new definition to be defined. Could you fix it?

DB2 (WDB5) sparse Saving

Hello there,

I've checked out your DBC Viewer and I must say it's done its job quite well by allowing you to manually edit and add rows, if necessary, to the Legion DB2s (WDB5).

However, there's one that has issues while saving happens: item-sparse.db2. This db2 has always been a special one and I noticed in your code you load it differently with:

public bool IsSparseTable { get; private set; }

You can edit it as normal, however as soon as you save it then for some reason it is not saved as a sparse storage DB2 would be. The way I confirmed this was by editing one test row in and then opening up a testing environment where it loads all the db2s and it resulted in me being given the following error:

(metaFlags & 0x1) != 0, "Item-sparse.db2 is not a sparse storage, use DB2Storage!"

Which leads me to believe there's an issue in regards to the metaflags on saving a DB2 as a sparse storage.

I've been looking into means to see if I can fix this, but I frankly can't. Perhaps you can @tomrus88 and if not then the issue's here for everyone to look at it, I suppose.

Thanks in advance.

Kind regards,
DJScias

Code change for definition name case mismatches

I had this issue last year, just sharing my changes. There are probably regular people that never realize why.

Also there are issues running from other programs. Like DascView which uses the windows associated app mechanism, effectively launches with working directory of system32, like "c:\Windows\System32" which is less than ideal for lots of reasons.

In MainForm.cs

        var definitions = m_definitions.Tables.Where(t => (t.Name.Equals(m_dbcName, StringComparison.OrdinalIgnoreCase)));
        //var definitions = m_definitions.Tables.Where(t => t.Name == m_dbcName);

        if (!definitions.Any())
        {
            definitions = m_definitions.Tables.Where(t => t.Name.Equals(Path.GetFileName(m_dbcFile), StringComparison.OrdinalIgnoreCase));
            //definitions = m_definitions.Tables.Where(t => t.Name == Path.GetFileName(m_dbcFile));
        }

In Program.cs

internal static class Program
{
	internal static string OrignalWorkingDirectory { get; set; }
	internal static string ApplicationDirectory { get; set; }
    
	/// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
	{
		OrignalWorkingDirectory = Directory.GetCurrentDirectory();
		ApplicationDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		// Allow callers to not need to specify our app directory as starting directory.
		// CascView for example will not set this and will cause DBCViewer to fail to find definitions.
		Directory.SetCurrentDirectory(ApplicationDirectory);

        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new MainForm());
    }
}

You can have this too. It allows a generic Lua output. You know where this file is I'm sure ;)

using PluginInterface;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.Composition;
 using System.Data;
 using System.IO;
 using System.Text;
 using System.Text.RegularExpressions;

 namespace ExportFileDataAsLuaTable
 {
    [Export(typeof(IPlugin))]
    public class FileDataLuaExporter : IPlugin
    {
        [Import("PluginFinished")]
        public Action<int> Finished { get; set; }
        [Import("ClearDataTable")]
        public Action ClearDataTable { get; set; }

        public void Run(DataTable table)
        {
            if (table.TableName == "SoundKit.db2")
            {
                using (var sw1 = new StreamWriter("SoundKitData.lua"))
                {
                    sw1.WriteLine("local SOUNDDATA = {");

                    foreach (DataRow row in table.Rows)
                    {
                        sw1.WriteLine("[{0}] = \"{1}\"", row[16], row[0]);
                    }

                    sw1.WriteLine("}");
                }

                return;
            }

			if (table.TableName == "ManifestInterfaceData.db2")
			{
				using (var sw = new StreamWriter("ManifestInterfaceData.txt"))
				{
					foreach (DataRow row in table.Rows)
					{
						sw.WriteLine("{0}{1}", row[1], row[2]);
					}
				}
			}

			var fileName = Path.GetFileNameWithoutExtension(table.TableName) + ".lua";
			using (var sw = new StreamWriter(fileName))
			{
				RunGeneric(table, sw);
			}
        }

		string FilterToLuaText(string s)
		{
			if (s.IndexOf('\n') != -1 || s.IndexOf('\r') != -1)
				s = Regex.Replace(s, @"\r\n?|\n", "\\n");

			if (s.IndexOf('\"') != -1)	// assume caller will use double quotes if enclosing
				s = Regex.Replace(s, "\\\"", "\\\"");

			return s;
		}

		public void RunGeneric(DataTable table, StreamWriter sw)
		{
			var tableName = Path.GetFileNameWithoutExtension(table.TableName);

			sw.WriteLine("-- " + tableName);
			sw.WriteLine("");

			sw.WriteLine(@"db_tablecols = db_tablecols or {}; db_tablecols['" + tableName + "'] = {");
			foreach (DataColumn col in table.Columns)
			{
				sw.Write("\"" + FilterToLuaText(col.Caption) + "\", ");
			}
			sw.WriteLine("}");
			sw.WriteLine("");

			sw.WriteLine(@"db_tables = db_tables or {}; db_tables['" + tableName + "'] = {");
            foreach (DataRow row in table.Rows)
            {
				sw.Write("{");
				foreach (var item in row.ItemArray)
				{
					var s = item as String;
					if ((object)s != null)
						s = "\"" + FilterToLuaText(s) + "\", ";
					else if ((object)item != null)
						s = item.ToString() + ", ";
					else
						s = " , ";
					sw.Write(s);
				}
				sw.WriteLine("},");
            }
			sw.WriteLine("}");
			sw.WriteLine("");
        }

dbclayout.xml update

Updated version of GemProperties.dbc fields:

  <GemProperties build="12340">
    <index>
      <primary>ID</primary>
    </index>
    <field type="int" name="ID" />
    <field type="int" name="iRefID_SpellItemEnchantment" />
    <field type="int" name="maxcount_inv" />
    <field type="int" name="maxcount_item " />
    <field type="int" name="type" />
  </GemProperties>

Achievement_Criteria.dbc fields:

  <Achievement_Criteria build="12340">
    <index>
      <primary>ID</primary>
    </index>
    <field type="int" name="ID" />
    <field type="int" name="referredAchievement" />
    <field type="int" name="requiredType" />
    <field type="int" name="asset_id" />
    <field type="int" name="quantity" />
    <field type="int" name="start_event" />
    <field type="int" name="start_asset" />
    <field type="int" name="fail_event" />
    <field type="int" name="fail_asset" />
    <field type="string" name="Description01" />
    <field type="string" name="Description02" />
    <field type="string" name="Description03" />
    <field type="string" name="Description04" />
    <field type="string" name="Description05" />
    <field type="string" name="Description06" />
    <field type="string" name="Description07" />
    <field type="string" name="Description08" />
    <field type="string" name="Description09" />
    <field type="string" name="Description10" />
    <field type="string" name="Description11" />
    <field type="string" name="Description12" />
    <field type="string" name="Description13" />
    <field type="string" name="Description14" />
    <field type="string" name="Description15" />
    <field type="string" name="Description16" />
    <field type="string" name="name_flags" />
    <field type="int" name="flags" />
    <field type="int" name="timedType" />
    <field type="int" name="timerStartEvent" />
    <field type="int" name="timeLimit" />
    <field type="string" name="showOrder" />
  </Achievement_Criteria>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.