Jump to content

[PY][FoxFS Archiver v2.5]Kill Client + DumpProto + Move Proto into Locale Dir + Crypt File List + Start Client


Recommended Posts

  • Premium

M2 Download Center

This is the hidden content, please
( Internal )

Hello peeps!

Got some more utilities that i use to automate boring stuff, so, maybe it can help u guys too
The script kills the client processes, generates dump_proto and moves it into locale_xx directory (optional), crypts a list of files(root, locale, icon, ...etc) and starts the client.
 

import os
import shutil
import bcolors
import time

class utilities:

    def __init__(self, packer_path, client_path, launcher_Name, dumpProto_path, locale_XX_path):
        self.packer_path = packer_path
        self.client_path = client_path
        self.launcher_Name = launcher_Name
        self.dumpProto_path = dumpProto_path
        self.locale_XX_path = locale_XX_path

    def fox_Pack(self, filesList):
        for i in filesList:
            print(f"\t* Will exec :> [{i}]")
            os.chdir(self.packer_path)
            os.system(f"tools\\Archiver.exe make_xml/{i}_create.xml")
            os.system(f"tools\\Archiver.exe xml/{i}_create.xml")
            time.sleep(0.5)
        # os.system(archiver_path)

    def killProcess(self):
        import psutil
        for proc in psutil.process_iter():
            # check whether the process name matches
            if proc.name() == self.launcher_Name:
                proc.kill()
        time.sleep(0.5)


    def createItemProto(self):
        os.chdir(self.dumpProto_path)
        os.system(f"{self.dumpProto_path}\\dump_proto.exe")
        if os.path.isfile(self.locale_XX_path + r"\item_proto_old"):
            os.remove(self.locale_XX_path + r"\item_proto_old")

        os.rename(self.locale_XX_path + "\\item_proto", self.locale_XX_path + "\\item_proto_old")
        shutil.copy2("item_proto", self.locale_XX_path)

    def startClient(self):
        os.chdir(self.client_path)
        os.startfile(self.client_path + "\\" + self.launcher_Name)

if __name__ == "__main__":
    start_time = time.time()
    print(f"{bcolors.OKMSG}{bcolors.OK}#-------[START]-------#\n{bcolors.ENDC}")

    utils = utilities(
    #packer Location 
    packer_path = r"C:\Users\itsas\Desktop\M2\versionControl\client\Packer",
    #client Location
    client_path = r"C:\Users\itsas\Desktop\M2\versionControl\client\Metin2",
    launcher_Name = "metin2_launcher.exe",
    #dumpProto RELEASE Location
    dumpProto_path = r"C:\Users\itsas\Desktop\M2\versionControl\DumpProto\Release",
    #locale\XX Location
    locale_XX_path = r"C:\Users\itsas\Desktop\M2\versionControl\client\Client\locale_general\ro")

    utils.killProcess()
    utils.createItemProto()
    #To pack multiple files, addd in the below list more, directory names
    utils.fox_Pack(["locale_general", "icon", "item"])
    utils.startClient()

    print(f"{bcolors.BLUE}--- {bcolors.WAITMSG}{bcolors.BLUE}{(time.time() - start_time)} seconds ---\n{bcolors.ENDC}")
    print(f"{bcolors.OKMSG}{bcolors.OK}#-------[STOP]-------#")

Prereq:
Python 3.9
Libraries: bcolors, shutil

  • Metin2 Dev 45
  • Eyes 1
  • Dislove 1
  • Think 2
  • Good 20
  • Love 5
  • Love 28
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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.