Jump to content

Metin2 Patcher with Electron


Recommended Posts

  • Management

M2 Download Center

This is the hidden content, please
( Internal )

 

252310GreenCheck.pngGitHub Repository: 

This is the hidden content, please

            The tutorial bellow is also available on the repository.

  

Metin2-Patcher-Electron

A simple metin2 patcher made in Electron with React and TypeScript. The file verification is made with SHA256.

073250X7dasOc.png

Getting Started

Install NodeJS: https://nodejs.org/en/download/

Install Yarn: https://yarnpkg.com/getting-started/install

Clone the repository:

git clone https://github.com/Karbust/Metin2-Patcher-Electron

Install the dependencies:

yarn install

Edit src/config.ts with your own values. Change resources/icon.png with your own logo (should be at least 256x256).

Available Commands

Command Purpose
yarn run start Starts the React App (aka Frontend) in development mode.
yarn run build Builds a production ready React bundle.
yarn run electron-start Starts the Electron App.
yarn run electron-pack Builds a production package of the app.
yarn run lint Check for linting errors.
yarn run lint-fix Fixing some linting errors.

About the Patcher

This project was made with the intend of learn more about Electron, something I wanted to do for a while.

If the folders don't exist, they'll be created. If the files don't exist they will be downloaded.

The patcher checks the local files and if their checksum mismatches the remote checksum, they will get downloaded.

This patcher runs the downloads asynchronously, this means it will download multiple files at the same time.

The entire project is made in React and Electron both with TypeScript. For CSS was used TailwindCSS.

Deploying

After editing everything you must use the command yarn run electron-pack to build the application.

It will build 2 files inside the release folder:

  • Metin2 Patcher Electron-X.X.X-win.zip
  • metin2_patcher_electron.exe

The first file is the full bundle zipped that can be extracted to the client folder (after removing the 2 unnecessary LINCENSE files). DON'T USE THIS IF YOU ALREADY HAVE THE CEF BROWSER ON THE CLIENT.

The second file is also zipped but will be extract to a temporary folder during runtime (takes about 3 seconds to fully open) and clean after itself when it closes. This is the way if you can't perform the first option.

Development Testing

In case there isn't the possibility to use a local webserver (like Apache with Xampp, or Wampp) it may be necessary update the CORS on your remote server.

For NGINX

Go to the configuration file for the patcher host and add this line:

add_header 'Access-Control-Allow-Origin' 'http://localhost:3000';

For Apache

Go to the configuration file for the patcher host and add this line:

Header set Access-Control-Allow-Origin "http://localhost:3000"

It may also be needed to activate the headers module:

a2enmod headers

Web Server

Using

This is the hidden content, please
, you shall place the client files inside a folder called files and run the script.

It will generate the JSON file with the names, sizes and checksum hash of the files.

Dir1

Dir2

 

Issues

If you have any issues, post here or open an issue on the repository: 

This is the hidden content, please

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 219
  • Eyes 5
  • Dislove 2
  • Angry 3
  • Not Good 2
  • Sad 1
  • Smile Tear 1
  • Confused 2
  • Scream 1
  • Lmao 1
  • Good 76
  • muscle 1
  • Love 10
  • Love 153

raw

raw

Link to comment
Share on other sites

  • Management
1 minute ago, I3ooI3oo said:

3, 2, 1

  Hide contents

leakmmo

  Hide contents

what a suprise you clicked here

  Hide contents

and here

  Reveal hidden contents

 

 

 

 

Running Man Happy Dance GIF by MOODMAN

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Dislove 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Management

Updated README with a better explanation on how to start on development environment.

Added the .env for the React app with some parameters.

This is the hidden content, please

  • Metin2 Dev 38
  • Eyes 1
  • Angry 1
  • Good 12
  • Love 3
  • Love 14

raw

raw

Link to comment
Share on other sites

  • Management

Updated README with a video tutorial (requested by @DemOnJR)

Fixed a typo on package.json (build.compression) not allowing to build the electron app.

This is the hidden content, please

 

  • Metin2 Dev 11
  • Eyes 1
  • Sad 1
  • Confused 1
  • Good 5
  • Love 7

raw

raw

Link to comment
Share on other sites

  • Premium
On 4/22/2021 at 12:31 AM, Karbust said:

Updated README with a video tutorial (requested by @DemOnJR)

Fixed a typo on package.json (build.compression) not allowing to build the electron app.

This is the hidden content, please

 

Thanks, i will use it for some tests.

  • Metin2 Dev 1

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

  • 2 weeks later...
  • Management

Update

Added multi-language support. Instructions can be found on the README.

This is the hidden content, please

Multi-language

It ships with support for two languages, English (default) and Portuguese. These can be used as examples to add more languages.

To add more languages, you must edit both src\i18n.ts and src_electron\i18n.ts.

Three things are needed, import the translation file (.json) that must go inside the folder localization\, and add the language on resources and supportedLngs.

Do not edit the placeholders ( {{ }} ) when creating a new language, otherwise it won't work as expected.

To add flags edit the file src\components\Buttons.ts. There are flags for every language that are supported by the official, just need to add the button.

Edited by Karbust
  • Metin2 Dev 17
  • Good 3
  • Love 14

raw

raw

Link to comment
Share on other sites

  • 6 months later...
  • Management

Update

Added support for NodeJS 17 (OpenSSL Issue).
Added a discord button (can be enabled/disabled on src\config.ts).
Fixed the error when building saying electron belongs to devDependencies.
Fixed the isDev issue not working on production build.

This is the hidden content, please

  • Metin2 Dev 12
  • Confused 1
  • Good 1
  • Love 3

raw

raw

Link to comment
Share on other sites

  • Management

Update

Sorry for another sudden update.

Added support for update locale.cfg when changing the language on the patcher. The default value is false which means the locale.cfg file will not be updated when changing the patcher's language.
To set it up edit src\config.ts.

This is the hidden content, please

Disclaimer: The locales may not be 100% correct since I don't have every metin2 client. If you find a mistake on the ones already defined let me know.

Edited by Karbust
Added the disclaimer
  • Metin2 Dev 8
  • Good 1
  • Love 2

raw

raw

Link to comment
Share on other sites

  • Active Member
1 hour ago, Karbust said:

Update

Sorry for another sudden update.

Added support for update locale.cfg when changing the language on the patcher. The default value is false which means the locale.cfg file will not be updated when changing the patcher's language.
To set it up edit src\config.ts.

This is the hidden content, please

Disclaimer: The locales may not be 100% correct since I don't have every metin2 client. If you find a mistake on the ones already defined let me know.

Good idea, bro! How did you come up with it? 😮 Nice patcher!

  • Metin2 Dev 2
  • Dislove 1
  • Lmao 2
  • Good 1
Link to comment
Share on other sites

  • Management

Update

Added a slider component that can be enabled or disabled (enabled by default) (instructions on how to use it are available on the repository).

fy5TRcz.png

 

Changed from CRA (Create-React-App aka react-scripts) to Vite, which allows for a faster development, build time and reduced package size. Also replaced the compression method from "maximum" to "normal", since there is no difference in sizes, but takes much less time to build.

sPkBkq6.png

This is the hidden content, please

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 27
  • Eyes 1
  • Think 1
  • Confused 1
  • Good 7
  • Love 1
  • Love 19

raw

raw

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • Premium

Hey,

I haved problem with installing. 

In fact, everything probably works correctly. I created files.json using a script and so on. The problem is, that:

1. Do not run download percent
2. Only a few files will be downloaded and then it will end.

How can I edit it? I probably made a mistake, but I don't know which one.

Now i have problem with stuck on 87%.. 😞

Edited by matyasvane
Link to comment
Share on other sites

  • 2 months later...
  • 9 months later...
  • 7 months later...
  • Management
13 hours ago, Gantur said:

Can you explain how to set it up for FTP?
How to make connection to Domain server "FTP" and create the .exe file

Those instructions are on the README and on the first post, edit the file config.ts with your variables and then run yarn run electron-pack to create the exe. The script to generate fhe files.json for the webserver is also on the first post and the README.

  • Good 1

raw

raw

Link to comment
Share on other sites

On 9/12/2023 at 10:32 AM, Karbust said:

Those instructions are on the README and on the first post, edit the file config.ts with your variables and then run yarn run electron-pack to create the exe. The script to generate fhe files.json for the webserver is also on the first post and the README.

Connection Error for me..
eaa4c246212a93b98182cf60a0006a66.png
 

5daa47ef10190a93dfa495103ea1a93d.png

Do I have to do a CORS update?
Or is there a chance without a Cors update?

Edited by Gantur
Core X - External 2 Internal
  • Metin2 Dev 1
Link to comment
Share on other sites

  • Management
9 hours ago, Gantur said:

Connection Error for me..
eaa4c246212a93b98182cf60a0006a66.png
 

5daa47ef10190a93dfa495103ea1a93d.png

Do I have to do a CORS update?
Or is there a chance without a Cors update?

On debug you have to update CORS, that's not needed when you build it.

Add a console.log above the following line: 

This is the hidden content, please

Also add the variable name on line (between the parentisis) 

This is the hidden content, please
 to be able to see what the error is.

After you do this, the error will be shown on the Chromium DevTools that the patcher opens on debug.

  • Metin2 Dev 5
  • Good 2
  • Love 1
  • Love 4

raw

raw

Link to comment
Share on other sites

  • 1 month later...
2 hours ago, FNCX said:

what's the point of running a browser that consumes memory a lot compared to other drawing guis for patcher lmao

Nowadays computers are much more powerful and so electron/CEF apps have become the norm. It's also easier to develop and maintain.

Slack, MS teams, discord, whats, spotify, battle.net client, Adobe Illustrator and many others are running inside embedded browsers.

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.