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

The value of "offset" is out of range #79

Open
Markov-Andrey opened this issue Sep 12, 2024 · 7 comments
Open

The value of "offset" is out of range #79

Markov-Andrey opened this issue Sep 12, 2024 · 7 comments

Comments

@Markov-Andrey
Copy link

Hello!

Based on WC3MapTranslator, I have created a parser that converts all content of a map file to JSON and back. My issue is that when testing with different maps, I receive similar errors. This occurs in various formats (sometimes .w3u parses correctly, sometimes not, and other formats as well).

However, the error always appears. What could be causing this?

(My ultimate goal is to configure the program for my project.)

The current version of Reforged is being used.

Example console log errors:
PS C:\Program Files\OSPanel\domains\WC3MapTranslator> node decode.js
File w3\war3map.doo successfully converted to output\doodads.json!
File w3\war3map.imp successfully converted to output\imports.json!
Error processing file w3\war3map.w3a: The value of "offset" is out of range. It must be >= 0 and <= 36986. Received 36990
Error processing file w3\war3map.w3b: The value of "offset" is out of range. It must be >= 0 and <= 258. Received 260
File w3\war3map.w3c successfully converted to output\cameras.json!
File w3\war3map.w3d successfully converted to output\doodads.json!
File w3\war3map.w3e successfully converted to output\terrain.json!
Error processing file w3\war3map.w3h: The value of "offset" is out of range. It must be >= 0 and <= 976. Received 980
File w3\war3map.w3i successfully converted to output\info.json!
Error processing file w3\war3map.w3q: The value of "offset" is out of range. It must be >= 0 and <= 6173. Received 6175
File w3\war3map.w3r successfully converted to output\regions.json!
Error processing file w3\war3map.w3t: The value of "offset" is out of range. It must be >= 0 and <= 728. Received 729
Error processing file w3\war3map.w3u: The value of "offset" is out of range. It must be >= 0 and <= 16611. Received 16613
File w3\war3map.wts successfully converted to output\strings.json!
File w3\war3mapUnits.doo successfully converted to output\unitsDoo.json!

@pqhuy98
Copy link

pqhuy98 commented Nov 1, 2024

+1 I got same issue

@pokelocos
Copy link

This issue seems to correspond to the response provided in this other thread:

#67

@pqhuy98
Copy link

pqhuy98 commented Nov 12, 2024

I was able to work-around the issue by finding a patched version of WC3MapTranslator from another project "patchwork-mapconverter", and copy them into my repo: https://github.com/pqhuy98/Warcraft3/tree/master/gold-rush/scripts/sandbox/wc3maptranslator

@pokelocos
Copy link

I was able to work-around the issue by finding a patched version of WC3MapTranslator from another project "patchwork-mapconverter", and copy them into my repo: https://github.com/pqhuy98/Warcraft3/tree/master/gold-rush/scripts/sandbox/wc3maptranslator

I saw your project, but I don't understand what I need to do to accomplish what I want. In the end, what I need is to be able to transform the files "war3map.w3e", "war3map.doo", and "war3mapUnits.doo" into JSON. I would greatly appreciate any help I could receive. Thank you very much!

@pqhuy98
Copy link

pqhuy98 commented Nov 15, 2024

You can copy the files in the folder I shared into your codebase. Then instead of importing the translator classes this package, you can directly import those classes in the files you just copied.

@ChiefOfGxBxL
Copy link
Owner

Hi @Markov-Andrey, are you able to provide the map or files you are using when encountering this error? It appears the issue described in #67 is relevant here. WC3MapTranslator only currently supports the most recent file versions out-of-the-box, so if you're translating older map files you may encounter those offset errors due to the software expecting newer fields that won't be present in older files.

Thanks, @pokelocos and @pqhuy98, for helping too!

@Markov-Andrey
Copy link
Author

Markov-Andrey commented Nov 29, 2024

@ChiefOfGxBxL, hi!

With the release of Reforged 2.0, everything has been thrown into disarray. I haven't checked the current state of things because I've been steering my development in a different direction. I was recommended another library, and using it, I managed to transform map files (https://github.com/WC3-Patchwork/Patchwork-MapConverter).

I’ve been working on an engine designed to transfer data between maps and carefully merge data between them. The essence of my work is that a parent project-map transfers all its data to child project-maps, merging the data whenever possible. It also attaches new maps to itself and integrates all non-standard data and imports.

Unfortunately, I couldn't grasp the structure of the parsed data—it’s too complex to understand. I initially thought I’d be able to reassign RAW codes that overlap between two sets of custom maps, but I got lost in the processed data. I assumed the data was neatly organized, but the reality turned out to be much harsher. Developing such a system quickly and on my own isn't feasible.

On the other hand, using Laravel (PHP), I managed to implement data transfer (copying) of selected files from the parent to child projects—although this part was straightforward. I also implemented a cleanup process for WTS files, removing technical tags added during development in the World Editor. Additionally, I developed functionality for overriding core variables in the .j file. At some point, I may also learn how to delete individual map triggers from .j files. Furthermore, I created functionality to import shared data to child maps as well as individual files. Finally, I use PHP to connect to Ladik's MPQ Editor and automatically package everything into a .W3X archive.

The main issue with the system lies in connecting new projects to the current one. When transferring data, matching RAW codes for units and decorations get overwritten by my project’s data... which is a big problem. This remains the system's biggest bottleneck.

To publish my system on Hive, I’d need to rewrite it in C++ or something similar to make it work as an .exe rather than a web server. (I specialize in web development because that’s my main job.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants