wc3edit.net

United Warcraft 3 map hacking!
It is currently February 24th, 2024, 12:40 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: May 22nd, 2023, 1:22 am 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
Map Name: invalid Defense v0.3.1

Map Link: https://www.hiveworkshop.com/threads/monster-defense-v0-3-1.346875/

Request: I would like to play this map in singleplayer with saves enabled. Currently, when hosting the map as the only player, this message is shown at the start: "Detected Single Player; Saving is diabled." ("diabled" is a typo in the map, not by me)

I tried to do this myself, but when I used rmpq extractor, and extracted Scripts/war3map.j, THERE IS ALMOST NOTHING IN THE SCRIPT FILE! Is it possible to have multiple script files, some hidden? Thank you!

Language: English

Attachment:
only_110_lines_of_code.jpg


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: May 22nd, 2023, 1:23 am 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
Not sure why map name shows as "invalid Defense". I typed M0nst3r Defense, and when I edit the post it shows M0nst3r Defense (without numbers)...


Top
 Profile  
 
PostPosted: May 22nd, 2023, 2:21 am 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
So I started manually extracting all the unrecognized .xxx files from the MPQ.

File00098.xxx (716K) has 20976 lines of unobfuscated Lua code. Not sure if it's possible to edit it and readd it to the MPQ without knowing its name though?


Top
 Profile  
 
PostPosted: May 28th, 2023, 10:38 am 
Offline
Cheater
User avatar

Joined: November 21st, 2016, 6:50 pm
Posts: 152
Unfortunately it's a Lua map. Author seems to have dumped only function calls in Jass script, but everything else is in war3map.lua which is hidden or MPQEditor can't find it.
You can try rebuilding map and searching for as many file names as possible altough it's never 100% accurate.
However, even if you do find it you obviously need to know how to read Lua code, you're also gonna need an IDE such as Visual Studio or Atom, I think Cheat Engine's debugger can also open it but I'd recommend using Notepad++ and LuaScript plugin along with Lua syntax highlighter (I think it's already bundled with default install).
Here is a Lua plugin for Notepad++
Quote:
https://github.com/dail8859/LuaScript

And only then you can finally play around with code and see if you can find anything that's related to map's singleplayer if you can read the code that is.

There's also this
Quote:
https://www.hiveworkshop.com/threads/blizzards-hidden-jass2lua-transpiler.337281/
but I don't think reverse converter exists.

Lately I see many maps that transcompiled Jass to Lua but there's also maps like this one that seem to be built in Lua from ground up.

Lastly, as you can see this takes incredible amount of work and knowledge just to make the map work in SP or add CP, cheating the map in any way is actually the easiest part of this whole problem.


Top
 Profile  
 
PostPosted: May 29th, 2023, 4:53 am 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
3nemy_ wrote:
Unfortunately it's a Lua map. Author seems to have dumped only function calls in Jass script, but everything else is in war3map.lua which is hidden or MPQEditor can't find it.
You can try rebuilding map and searching for as many file names as possible altough it's never 100% accurate.
However, even if you do find it you obviously need to know how to read Lua code, you're also gonna need an IDE such as Visual Studio or Atom, I think Cheat Engine's debugger can also open it but I'd recommend using Notepad++ and LuaScript plugin along with Lua syntax highlighter (I think it's already bundled with default install).
Here is a Lua plugin for Notepad++
Quote:
https://github.com/dail8859/LuaScript

And only then you can finally play around with code and see if you can find anything that's related to map's singleplayer if you can read the code that is.

There's also this
Quote:
https://www.hiveworkshop.com/threads/blizzards-hidden-jass2lua-transpiler.337281/
but I don't think reverse converter exists.

Lately I see many maps that transcompiled Jass to Lua but there's also maps like this one that seem to be built in Lua from ground up.

Lastly, as you can see this takes incredible amount of work and knowledge just to make the map work in SP or add CP, cheating the map in any way is actually the easiest part of this whole problem.


Thanks very much for the response! I haven't worked with Lua before but I doubt it'd be a problem. But yea, the issue is finding war3map.lua :(

Are there any viable bruteforce options that exist? I tried an older version of Ladik's MPQ Editor that allegedly has a 'name breaker' but couldn't get it to work. Also, the feature which listens for used files within the MPQ archive while the game is running unfortunately only seems to work on pre-Reforged -- and this map doesn't work with pre-Reforged (I guess because of the Lua stuff).

~~

My goal isn't to cheat, but just to be able to play in SP. The map involves strategy to survive, and I'd rather do so via solo trial and error, rather than having to wait for randos to join.
I guess I can do so anyway, just without the save feature, but that just makes it a bit annoying that the only way to progress is when there is someone else in-game (you unlock additional races as you progress).

Also, I get that at this point this is more effort than it's worth -- but this process in itself is fun too :P


Top
 Profile  
 
PostPosted: May 29th, 2023, 5:14 pm 
Offline
Cheater
User avatar

Joined: November 21st, 2016, 6:50 pm
Posts: 152
After some time of analyzing and critical thinking I realized the answer was right in front of me the whole time and it just went over my head.
You see, war3map.j is technically a "fake" file meaning there's nothing important in it, it's just some default WE strings that get stored in .j script after you save the map in WE.

As for war3map.lua, I don't know which tools author used to protect the map and MPQ because even though most filenames are missing lua script is entirely intact and not obfuscated whatsoever, my only guess is perhaps because none of the known map optimizers are able to scramble Lua yet.
In any case I deduced lua script file was File00000321.xxx due to its size, the other bigger file 002.xxx is loading screen.

Also it's worth to mention this map was in fact written in TypeScript and then transpiled to Lua
Quote:
https://typescripttolua.github.io/
Quote:
https://github.com/cipherxof/wc3-ts-template


With all that out of the way I started looking for save system and stumbled upon this.

Image

__TS__New is I believe some kind of object that seems to start before every trigger and PlayerSaveManager is trigger itself, subscribe should be equivalent to TriggerAddAction in Jass, I don't know what TriggerAddCondition would be.
Anyway, you don't need to know any of this in this case because all you have to do is change this line's flag and that will enable saving in SP.
Code:
self.saveLoad.disableSaving = true to false


After this, all you need to do is import lua script back to MPQ but since latest MPQ Editor can only open the map in Read Only, you need to use older version, I had luck with 3.6.0.854 version.
Unfortunately since we don't have a full listfile we can't flush the archive to reduce map file size so it will be slightly larger but that's the least of our concerns.
I have also made a small listfile that will search for correct path to war3map.lua so you don't have to look through the list of unknown filenames to find it.


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: June 2nd, 2023, 12:10 pm 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
3nemy_ wrote:
After some time of analyzing and critical thinking I realized the answer was right in front of me the whole time and it just went over my head.
You see, war3map.j is technically a "fake" file meaning there's nothing important in it, it's just some default WE strings that get stored in .j script after you save the map in WE.

As for war3map.lua, I don't know which tools author used to protect the map and MPQ because even though most filenames are missing lua script is entirely intact and not obfuscated whatsoever, my only guess is perhaps because none of the known map optimizers are able to scramble Lua yet.
In any case I deduced lua script file was File00000321.xxx due to its size, the other bigger file 002.xxx is loading screen.

Also it's worth to mention this map was in fact written in TypeScript and then transpiled to Lua
Quote:
https://typescripttolua.github.io/
Quote:
https://github.com/cipherxof/wc3-ts-template


With all that out of the way I started looking for save system and stumbled upon this.

Image

__TS__New is I believe some kind of object that seems to start before every trigger and PlayerSaveManager is trigger itself, subscribe should be equivalent to TriggerAddAction in Jass, I don't know what TriggerAddCondition would be.
Anyway, you don't need to know any of this in this case because all you have to do is change this line's flag and that will enable saving in SP.
Code:
self.saveLoad.disableSaving = true to false


After this, all you need to do is import lua script back to MPQ but since latest MPQ Editor can only open the map in Read Only, you need to use older version, I had luck with 3.6.0.854 version.
Unfortunately since we don't have a full listfile we can't flush the archive to reduce map file size so it will be slightly larger but that's the least of our concerns.
I have also made a small listfile that will search for correct path to war3map.lua so you don't have to look through the list of unknown filenames to find it.


Thanks for coming back to post! In my earlier messages I did mention that I found the Lua file (and though I hadn't mentioned it, I found the part of the code dealing with the single-player restriction), but was asking if it is possible to edit it and re-add it to the MPQ without knowing its name in the listfile? Your message above indicates that it seems to be possible, but how please?

You said:
> After this, all you need to do is import lua script back to MPQ but since latest MPQ Editor can only open the map in Read Only, you need to use older version, I had luck with 3.6.0.854 version.

Does this mean that I can simply use that version of MPQ Editor, and edit the .xxx file even though it is not in the listfile? I didn't realize that it's possible to edit without having the file name in the listfile first.


Top
 Profile  
 
PostPosted: June 2nd, 2023, 1:44 pm 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
House wrote:
3nemy_ wrote:
After some time of analyzing and critical thinking I realized the answer was right in front of me the whole time and it just went over my head.
You see, war3map.j is technically a "fake" file meaning there's nothing important in it, it's just some default WE strings that get stored in .j script after you save the map in WE.

As for war3map.lua, I don't know which tools author used to protect the map and MPQ because even though most filenames are missing lua script is entirely intact and not obfuscated whatsoever, my only guess is perhaps because none of the known map optimizers are able to scramble Lua yet.
In any case I deduced lua script file was File00000321.xxx due to its size, the other bigger file 002.xxx is loading screen.

Also it's worth to mention this map was in fact written in TypeScript and then transpiled to Lua
Quote:
https://typescripttolua.github.io/
Quote:
https://github.com/cipherxof/wc3-ts-template


With all that out of the way I started looking for save system and stumbled upon this.

Image

__TS__New is I believe some kind of object that seems to start before every trigger and PlayerSaveManager is trigger itself, subscribe should be equivalent to TriggerAddAction in Jass, I don't know what TriggerAddCondition would be.
Anyway, you don't need to know any of this in this case because all you have to do is change this line's flag and that will enable saving in SP.
Code:
self.saveLoad.disableSaving = true to false


After this, all you need to do is import lua script back to MPQ but since latest MPQ Editor can only open the map in Read Only, you need to use older version, I had luck with 3.6.0.854 version.
Unfortunately since we don't have a full listfile we can't flush the archive to reduce map file size so it will be slightly larger but that's the least of our concerns.
I have also made a small listfile that will search for correct path to war3map.lua so you don't have to look through the list of unknown filenames to find it.


Thanks for coming back to post! In my earlier messages I did mention that I found the Lua file (and though I hadn't mentioned it, I found the part of the code dealing with the single-player restriction), but was asking if it is possible to edit it and re-add it to the MPQ without knowing its name in the listfile? Your message above indicates that it seems to be possible, but how please?

You said:
> After this, all you need to do is import lua script back to MPQ but since latest MPQ Editor can only open the map in Read Only, you need to use older version, I had luck with 3.6.0.854 version.

Does this mean that I can simply use that version of MPQ Editor, and edit the .xxx file even though it is not in the listfile? I didn't realize that it's possible to edit without having the file name in the listfile first.

Ok I used an older version of MPQ Editor which can open in not "Read Only", and I was able to edit the .xxx file even though it is not part of the listfile.

Thanks so much for the help!


Top
 Profile  
 
PostPosted: June 2nd, 2023, 6:39 pm 
Offline
Cheater
User avatar

Joined: November 21st, 2016, 6:50 pm
Posts: 152
I uploaded small listfile for lua script and map with SP enabled, I assume you overlooked it since you didn't download it.
As for the rest of my post, it's simply a step by step guide in case you were interested in how I figured it out so you can do it yourself in future for other such maps.


Top
 Profile  
 
PostPosted: June 2nd, 2023, 11:23 pm 
Offline
Newcomer

Joined: May 29th, 2020, 3:12 am
Posts: 7
Actually I left namebreaker running yesterday and turns out it's literally just "war3map.lua" lol

I thought I had that in my listfile oops xD

But hey! Learnt some things through that oversight

Thanks for everything!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)