Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes, work from a folder, new README #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# convert_tool
This is a ROSE client data convertion tool that will take a extracted IROSE client (112_112na) and convert the data into sql and lua files to support the osirose-new server project

# before building - DO NOT FORGET!
CMD> git submodule update --init --recursive

The rest is just convert_tools.sln -> build

# How to use
1. Create folder inside client named convert_tool
2. Copy build files under src/bin/debug into the folder above
3. Run convert_tool.exe
4. Copy srv_data/scripts into server files
5. Load item_db.sql + skill_db.sql into your database

You're good to go!
1 change: 1 addition & 0 deletions src/ItemData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

//#define OUTPUT_STB_DATA_COMMENT
using System;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using Revise.Files.STB;
Expand Down
1 change: 1 addition & 0 deletions src/MobData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

//#define OUTPUT_STB_DATA_COMMENT
using System;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down
21 changes: 13 additions & 8 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@

namespace convert_tool
{
internal class Program
static class Globals
{
public const string stbroot = "../3DDATA/stb/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this a command line parameter? And default it to "./". This way, people can run it from anywhere and we have some sound default.

}

internal class Program
{
private struct ItemInfo
{
Expand All @@ -47,7 +52,7 @@ public void set(string dataFile, string stringFile)

private static void Main(string[] args)
{
const string stbRoot = "./3DDATA/stb/";

const string zoneStb = "list_zone.stb";

var itemDataFiles = new ItemInfo[14];
Expand Down Expand Up @@ -89,28 +94,28 @@ private static void Main(string[] args)
foreach (var itemDataFile in itemDataFiles)
{
var itemData = new ItemData();
itemData.Load((ItemData.ItemType) (++typeIdx), stbRoot + itemDataFile.DataFile, stbRoot + itemDataFile.StringFile);
itemData.Load((ItemData.ItemType) (++typeIdx), Globals.stbroot + itemDataFile.DataFile, Globals.stbroot + itemDataFile.StringFile);
}

const string skillStb = "list_skill.stb";
const string skillStl = "list_skill_s.stl";
var skillFile = new SkillData();
skillFile.Load(stbRoot + skillStb, stbRoot + skillStl);
skillFile.Load(Globals.stbroot + skillStb, Globals.stbroot + skillStl);

const string npcStb = "list_npc.stb";
const string npcStl = "list_npc_s.stl";
var mobFile = new MobData();
mobFile.Load(stbRoot + npcStb, stbRoot + npcStl);
mobFile.Load(Globals.stbroot + npcStb, Globals.stbroot + npcStl);

var dataFile = new DataFile();
dataFile.Load(stbRoot + zoneStb);
dataFile.Load(Globals.stbroot + zoneStb);
for (var i = 1; i < dataFile.RowCount; i++)
{
if (!dataFile[i][2].Contains(".zon")) continue;
if (!("../"+dataFile[i][2]).Contains(".zon")) continue;

Console.Write("Attempting to load \"" + dataFile[i][1] + "\" - ");
var zone = new ZoneData();
zone.Load(dataFile[i][2], i);
zone.Load("../" + dataFile[i][2], i);
}

Console.Write("Done extracting. Press any key to exit...\n");
Expand Down
1 change: 1 addition & 0 deletions src/SkillData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

//#define OUTPUT_STB_DATA_COMMENT
using System;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using Revise.Files.STB;
Expand Down
23 changes: 12 additions & 11 deletions src/ZoneData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#endregion

using System;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -103,18 +104,18 @@ public void Load(string filePath = null, int mapId = 0)

private static void ExtractSpawnPoints(int mapId, ZoneFile zoneFile, List<string> spawnList)
{
const string zoneStb = "./3DDATA/stb/list_zone.stb";
const string zoneStb = Globals.stbroot + "list_zone.stb";

var zoneDataFile = new DataFile();
zoneDataFile.Load(zoneStb);

var curMapRow = zoneDataFile[mapId];

var reviveMap = curMapRow[32];
bool isParsable = int.TryParse(curMapRow[32], out var reviveMap);
double.TryParse(curMapRow[33], out var reviveX);
double.TryParse(curMapRow[34], out var reviveY);

if (reviveMap.Length > 0)
if (isParsable)
{
spawnList.Add("revive_point(" + reviveMap.ToString("G", CultureInfo.InvariantCulture) + ", " + (reviveX * 1000.0f).ToString("G", CultureInfo.InvariantCulture) + ", " + (reviveY * 10000.0f).ToString("G", CultureInfo.InvariantCulture) + ");\n");
}
Expand Down Expand Up @@ -177,7 +178,7 @@ private static void ExtractNpcs(List<string> npcList, int mapId, MapDataFile ifo
foreach (var npc in ifo.NPCs)
{
var eventDataFile = new DataFile();
eventDataFile.Load("./3DDATA/stb/list_event.stb");
eventDataFile.Load(Globals.stbroot + "list_event.stb");
int dialogId = 0;
for (int i = 0; i < eventDataFile.RowCount; i++)
{
Expand All @@ -201,10 +202,10 @@ private static void ExtractNpcs(List<string> npcList, int mapId, MapDataFile ifo

private static void ExtractWarpGates(List<string> warpList, int mapId, MapDataFile ifo)
{
const string warpStb = "./3DDATA/stb/warp.stb";
const string zoneStb = "./3DDATA/stb/list_zone.stb";
const string warpGateModel = "./3DDATA/special/warp_gate01/warp.zms";
const string decoSpecialList = "./3DDATA/special/list_deco_special.zsc";
const string warpStb = Globals.stbroot + "warp.stb";
const string zoneStb = Globals.stbroot + "list_zone.stb";
const string warpGateModel = Globals.stbroot + "../special/warp_gate01/warp.zms";
const string decoSpecialList = Globals.stbroot +"../special/list_deco_special.zsc";
Comment on lines +207 to +208
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I don't like this as this would resolve to "../3DDATA/stb/../special/warp_gate01/warp.zms" and "../3DDATA/stb/../special/list_deco_special.zsc".

Also this tool is being deprecated in favor for https://github.com/dev-osrose/rose_data_converter


var zoneDataFile = new DataFile();
zoneDataFile.Load(zoneStb);
Expand All @@ -223,10 +224,10 @@ private static void ExtractWarpGates(List<string> warpList, int mapId, MapDataFi
foreach (var warpGate in ifo.WarpPoints)
{
var destMapId = int.Parse(warpDataFile[warpGate.WarpID][2]);
if (zoneDataFile[destMapId][2].ToString().Contains(".zon"))
if (("../" + zoneDataFile[destMapId][2].ToString()).Contains(".zon"))
{
ZoneFile zoneFile = new ZoneFile();
zoneFile.Load(zoneDataFile[destMapId][2].ToString()); // Load the zon file
zoneFile.Load("../" + zoneDataFile[destMapId][2].ToString()); // Load the zon file

foreach (var spawnPoint in zoneFile.SpawnPoints)
{
Expand Down Expand Up @@ -258,7 +259,7 @@ private static void ExtractWarpGates(List<string> warpList, int mapId, MapDataFi
var boundingBox = BoundingBox.FromPoints(vectorPositions);

warpList.Add("warp_gate(\"\", "
+ warpDataFile[warpGate.WarpID][2].ToString("G", CultureInfo.InvariantCulture) + ", "
+ warpDataFile[warpGate.WarpID][2] + ", "
+ (destCoords.X).ToString("G", CultureInfo.InvariantCulture) + ", "
+ (destCoords.Y).ToString("G", CultureInfo.InvariantCulture) + ", "
+ (destCoords.Z).ToString("G", CultureInfo.InvariantCulture) + ", "
Expand Down