Jump to content

[Vs2013] Metin2 Packmaker


tierrilopes

Recommended Posts

Exemplo de comando para compactar:

 

 

 

FolderName "root"

PackName "../root"

 

List SecurityExtNameList

{

"txt"

"msk"

"msa"

"msm"

"mss"

"mse"

"msf"

"spt"

"py"

 

}

 

List CompressExtNameList

{

"txt"

"spt"

"atr"

"dds"

"raw"

"wtr"

"mde"

"tga"

}

 

List CSHybridEncryptExeNameList

{

"dds"

"raw"

"gr2"

"msm"

"atr"

}

 

List FileList

{

"root/emotion.py"

"root/serverinfo.py"

}

 

 

 

Link to comment
  • 2 weeks later...

Encontrei este código enquanto navegava na metin2dev:

 

 

 

 

import glob, os , shutil, sys

from os import path , system

executefile = "execute.cmd"

logfolder = "logs"

packfile = "D:\Client 40250\pack/"

packedfolder = "packed/"

text = ".txt"

ivfilename = ""

type = ""

comptype = ""

file_list = []

def yes_no(question, default="yes"):

valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}

if default is None:

prompt = " [y/n] "

elif default == "yes":

prompt = " [Y/n] "

elif default == "no":

prompt = " [y/N] "

else:

raise ValueError("invalid default answer: '%s'" % default)

 

 

sys.stdout.write(question + prompt)

choice = raw_input().lower()

if default is not None and choice == '':

return valid[default]

if choice in valid:

return valid[choice]

else:

sys.stdout.write("Please respond with 'yes' or 'no' ", "(or 'y' or 'n').\n")

 

def get_size(dirname):

total_size = 0

for dirpath, dirnames, filenames in os.walk(dirname):

for f in filenames:

fp = os.path.join(dirpath, f)

total_size += os.path.getsize(fp)

return total_size

 

def createpack(filename, dirname):

if get_size(dirname) == 0:

print("This is an empty folder [%s]"% (dirname))

exit()

print("Please Chose the type of pack you want to create\n")

print("1:CompressExtNameList --> type 1")

print("2:SecurityExtNameList --> type 2")

print("3:panamaextnamelist --> type 3")

print("4:cshybridencryptexenamelist --> type 4\n")

type = raw_input("Your Choice:")

type = int(type)

if type < 0 or type > 4:

print ("Please Type one number Bettwen 1 - 5")

if type == 1:

comptype = "CompressExtNameList";

if type == 2:

comptype = "SecurityExtNameList";

if type == 3:

comptype = "panamaextnamelist";

if type == 4:

comptype = "cshybridencryptexenamelist";

makeit = filename + text

check(makeit,1,"no")

x = open(makeit, 'w')

x.write("FolderName\t\"%s\"\nPackName\t\"%s\"\n"% (packedfolder, filename))

if type == 3:

pack = os.path.join(packfile,filename)

check(pack,0,"yes")

x.write("IV\t\"%s\"\n"% (pack))

x.write("\nList\t%s\n{\n" % (comptype))

chkdict = {}

setdef = chkdict.setdefault

for root, dirs, files in os.walk(dirname):

for file in files:

ext = path.splitext(file)[1]

if not ext in chkdict:

x.write("\t\"%s\"\n" % setdef(ext,ext))

del chkdict

x.write("}\n")

x.write("\nList\tFilelist\n{\n")

for root, dirs, files in os.walk(dirname):

for filesname in files :

filepath = os.path.join(root,filesname)

if os.stat(filepath).st_size==0:

continue

x.write("\t\"%s\"\n" %(filepath))

x.write("}\n")

 

def extract_writer(type, iv):

global ivfilename , file_list

check("",0,"no")

if not os.listdir(packfile):

print("Error: %s folder is empty \nsystem will close the script now"%(packfile))

system("pause")# this is an optinal command if you want to see what is going on

return

listofpacks()

pack = raw_input("Pack Number:")

pack = int(pack)

file = file_list[pack]

index = file + ".eix"

y = check(index,0,"no")

if y == True:

file2 = os.path.join(packfile,file)

if iv == True:

ivfilename = file2

x = open(executefile, 'a') #open extract.cmd

x.write("PackMaker.exe --%s %s %s\t> logs/%s_log.txt\t 2> logs/%s_error.txt\n" % (type,file2, ivfilename, file, file))

print("PackMaker.exe --%s %s %s\n" % (type,file2, ivfilename)) #show you on screen what are the file

else:

return

x.close()

executePackMakerfiles(executefile)

 

def check(filename,remove,IVa="no"):

if filename == "" and remove == 0:

if os.path.isfile(executefile):

os.remove(executefile)

if not os.path.isdir(logfolder):

os.system("mkdir %s" % (logfolder))

if not os.path.isdir(packfile):

os.system("mkdir pack")

return True

elif os.path.splitext(filename)[1] == ".eix":

filename = os.path.join(packfile,filename)

if os.path.isfile(filename):

return True

print("[%s] Is missing"%(filename))

return False

if filename != "":

if os.path.isfile(filename) or os.path.isdir(filename):

if remove == 1:

os.remove(filename)

if IVa == "yes":

os.system("PackMaker.exe --createiv %s"%(filename))

 

#run extract.cmd to execute the commands

def executePackMakerfiles(filename):

answer = yes_no("Do you Want to run %s?" %(filename),"yes")

if True == answer:

if filename == executefile:

os.system(executefile)

else:

os.system("PackMaker.exe %s" %(filename))

else:

system("pause")# this is an optinal command if you want to see what is going on

main()

 

def listofpacks():

global file_list

i = 0

file_count = len(glob.glob("%s*.epk"%(packfile)))

for file in glob.glob("%s*.epk"%(packfile)): #search for any file with the (.epk) extention

file = path.basename(file)

file = path.splitext(file)[0] #removeing extention [xxx.epk ---> xxx (without (.epk))]

file_list.append(file)

#

while i < file_count:

filo = file_list

filo = ("%d:%s" % (i,filo))

print filo

i += 1

 

def cls():

os.system("cls")

 

def main():

print ("Hello This is Make Pack pythn tool")

print ("type the number of the command you want to execute")

print ("1:Create-iv\n2:Open-iv\n3:Extract\n4:Extract With Iv\n5:Make Pack\n6:Exit")

choice = raw_input("Your Choice:")

choice = int(choice)

if choice < 1 or choice > 6:

print ("Please Type one number Bettwen 1 - 6")

if choice >= 1 and choice <= 4:

if choice == 1:

executetype = "createiv"

iv = bool(False)

elif choice == 2:

executetype = "openiv"

iv = bool(False)

elif choice == 3:

executetype = "extract"

iv = bool(False)

elif choice == 4:

executetype = "extract"

iv = bool(True)

cls()

extract_writer(executetype, iv)

if choice == 5:

packname = raw_input("Pack Name:")

path = raw_input("Path:")

createpack(packname,path)

packname2 = packname + text

executePackMakerfiles(packname2)

system("pause")# this is an optinal command if you want to see what is going on

main()

if choice == 6:

exit()

main()

 

 

 

Pastebin: http://pastebin.com/m4dgJH4J

 

Testei e está a funcionar

 

Créditos: flygun

Link to comment
  • 4 years later...
  • 7 months later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...