Jump to content

astroNOT

Member
  • Posts

    35
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Everything posted by astroNOT

  1. import os #no of channels channels = 4 #no of cores cores = 2 #Channels path chan_location = "/usr/home/main/srv1/chan/" #New ip to replace the old ip_value = "123.443.9.1" try: os.mkdir("%sbackup_config" % chan_location) except Exception: pass for i in range(1, channels + 1): # print(i) for core in range(1, cores + 1): with open(f"%sch{i}/core{core}/CONFIG" % chan_location, 'r') as cfg: count = 0 proxy_index = 0 list_of_lines = cfg.readlines() with open(f"%sbackup_config/config_channel{i}_core{core}" % chan_location, "w") as bk_file: bk_file.writelines(list_of_lines) for line in list_of_lines: count += 1 # print(line) if "proxy" in line.lower(): proxy_index = count - 1 # print(len(list_of_lines), 'list of lines len') print("proxy index ", proxy_index) list_of_lines[proxy_index] = "proxy_ip: %s\n" % ip_value with open(f"%sch{i}/core{core}/CONFIG" % chan_location, 'w') as cfg_w: cfg_w.writelines(list_of_lines) print(f"Succesfully updated config for Channel{i}, Core{core}")
  2. Indeed it removes the last char, in our chase the /n, aaand if its the last line in the file w/o a nl, then its doomed, updated the topic accordingly, thanks!
  3. Hello, When adding the bellow string to locale_game.txt APPLY_ANTI_RESIST_MAGIC Magic Pen: %d%% SA A key error is raised: 0613 21:44:08342 :: system.py(line:287) RunMainScript system.py(line:204) execfile prototype.py(line:3) <module> system.py(line:151) __hybrid_import system.py(line:116) _process_result localeInfo.py(line:210) <module> localeInfo.py(line:167) LoadLocaleFile Run - <type 'exceptions.KeyError'>:'S' 0613 21:44:08343 :: ============================================================================================================ 0613 21:44:08343 :: Abort!!!! Without the SA at the end, the bonus name is not properly displayed in game W/o the SA at the end, the bonus name is displayed as "UNKNOWN_NAME(93), the 93 is the index for the bonus in `enum EApplyTypes` from itemData.h Any ideas? LoadLocalFile py function: Thanks! EDIT: SOLVED: Because of this stupid line of code `tokens = line[:-1].split("\t")` you gotta have an extra char(space/new line) after 'SA' *only if its the last line in the file*
  4. M2 Download Center Download Here ( Internal ) The script updates item prices (buy/sell) for an item vnum: Considering item vnum is 110, it can update till 119 (or starting vnum 112 can go till 115, or 117, or w/e you desire) It can update for a single vnum (upgrade items, aswell), more in comments below Combined with can be pretty efficient from halo import Halo import bcolors class Append_new_prices: def __init__(self, value_dict, proto_location): self.proto_location = proto_location self.protoLst = [] self.value_dict = value_dict def get_proto_asList(self): with open(self.proto_location, 'r', encoding="utf8") as file: for line in file.readlines(): lineLst = line.split('\t') self.protoLst.append(lineLst) self.modified_protoLst = [] def update_protoLst(self): count = 0 for vnum, prices in self.value_dict.items(): try: upp_range = prices['uppLimit'] except KeyError: upp_range = 1 vnum_lst = self.get_item_VnumRange(vnum, upp_range) # while upp_range >= 0: for lineLst in self.protoLst: if "buy" not in prices.keys(): prices['buy'] = 0 if "sell" not in prices.keys(): prices['sell'] = 0 # print((lineLst[0]), " == ", vnum_lst) try: line_vnum = int(lineLst[0]) except ValueError: line_vnum = "VNUM NOT INT PFFFFF" if line_vnum in vnum_lst: lineLst[9] = prices['buy'] lineLst[10] = prices['sell'] self.protoLst[self.protoLst.index(lineLst)] = lineLst @staticmethod def get_item_VnumRange(vnum, range_lim): vnum_lst = [] plus_val = 0 # if range_lim == 0: # range_lim = 1 vnum = int(vnum) for i in range(0, range_lim + 1): vnum += plus_val vnum_lst.append(vnum) plus_val = 1 return vnum_lst def write_new_proto_fromList(self): with open(self.proto_location, 'w', encoding="utf8") as file: for line in self.protoLst: file.write('\t'.join(self.str_list(line))) def str_list(self, lst): new_lst = [] for i in lst: new_lst.append(str(i)) return new_lst if __name__ == "__main__": #First number (110) is the starting vnum, uppLimit is till when to stop adding prices, upplimit 9 means => 110, 111, 112, 113, 114...119 #It can have h/e many "item" objects as dictionary elements #!!!!!Count starts from 0! items = \ { "110": { "buy": 55, "sell": 43, "uppLimit": 1 }, # "120":{ # "buy":4000, # "sell":400000, # "uppLimit":9 # } } setPrices = Append_new_prices(value_dict=items, proto_location=r'C:\Users\itsas\Desktop\M2\versionControl\DumpProto\Release\item_proto.txt') with Halo(text='Loading', spinner='dots'): setPrices.get_proto_asList() setPrices.update_protoLst() setPrices.write_new_proto_fromList() print(f'{bcolors.OKMSG}{bcolors.OK} Done!') Prereq: Libs: Halo, bcoloros Python 3.9
  5. M2 Download Center Download Here ( 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
  6. Hello, Some boring clicking automated that I use, feel free to improve it, add waits, w/e, w/e import time, os from pywinauto import Desktop, Application import bcolors from pywinauto.keyboard import send_keys import psutil class mySession: app = Application(backend='uia') def __init__(self, vm_Name='', ssh_Name='', cliente_exe_Path='', winSCP_path='', vbox_exe_path=''): self.vm_Name = vm_Name self.ssh_Name = ssh_Name self.cliente_exe_Path = cliente_exe_Path pathList = cliente_exe_Path.split('\\') self.client_path = '/'.join(pathList[:-1]) self.exe_name = pathList[-1] self.vbox_exe_path = vbox_exe_path self.winSCP_path = winSCP_path def openVM(self, waitServer): self.killProcess("VirtualBox.exe") self.app.start(self.vbox_exe_path) self.app = Application(backend='uia').connect(title='Oracle VM VirtualBox Manager', timeout=10) # self.app.Dialog.print_control_identifiers() self.app.OracleVMVirtualBoxManager.child_window(title=self.vm_Name, control_type="ListItem").wrapper_object().click_input(button='left', double=True) # self.app = Application(backend='uia').connect(title=self.whoAmI('Starting')[0], timeout=10) time.sleep(waitServer) print(f"\t{bcolors.OK}{bcolors.OKMSG}VM is ready{bcolors.ENDC}") def openWinSCP(self): self.killProcess("WinSCP.exe") self.app.start(self.winSCP_path) self.app = Application(backend='uia').connect(title=self.whoAmI(keyword='wins')[0], timeout=40) time.sleep(1) if self.app.Dialog.child_window(title=self.ssh_Name + " ", control_type="TabItem").exists(): self.app.Dialog.child_window(title="Reconnect Session", control_type="Button").wrapper_object().click_input( button='left') else: self.app.Dialog.child_window(title="New Session", control_type="TabItem").wrapper_object().click_input(button='left') auth_win = self.app.Dialog.child_window(title=self.ssh_Name, control_type="TreeItem") auth_win.wait('visible', timeout=50) auth_win.wrapper_object().click_input(button='left', double=True) input_pass = self.app.Dialog.child_window(control_type="Edit") input_pass.wait('visible', timeout=50) input_pass.wrapper_object().type_keys("dev") self.app.Dialog.child_window(title="OK", control_type="Button").wrapper_object().click_input(button='left') time.sleep(2) print(f"\t{bcolors.OK}{bcolors.OKMSG}WinScp is ready{bcolors.ENDC}") def startClient(self, do_login=True): os.chdir(self.client_path) os.startfile(self.client_path + "\\" + self.exe_name) # self.app = Application(backend='uia').connect(title='Metin2', timeout=10) def whoAmI(self, keyword='', retryLimit=2, isFull=False): while retryLimit: windows = Desktop(backend="uia").windows() windowsList = [w.window_text() for w in windows] resultList = [] for i in windowsList: if keyword.lower() in i.lower(): resultList.append(i) if not len(resultList): time.sleep(0.5) self.whoAmI(keyword=keyword, retryLimit=retryLimit-1, isFull=isFull) else: # print('Matches: ', resultList) if not isFull: return resultList else: return windowsList def killProcess(self, proc_nmame, kill_=True): if kill_: for proc in psutil.process_iter(): # check whether the process name matches if proc.name() == proc_nmame: proc.kill() time.sleep(0.5) if __name__ == "__main__": print(f"{bcolors.OK}#########[START]#########{bcolors.ENDC}") #Here you have to give the name of ur Virtual Machine(vm_Name), winSCP ssh connetion name(ssh_Name), and ur client executable path controller = mySession(vm_Name="11.3_5.5_v4", ssh_Name="alpha_server", cliente_exe_Path=r"C:\Users\itsas\Desktop\M2\versionControl\client\Metin2\metin2_launcher.exe", vbox_exe_path='"C:\Program Files\Oracle\VirtualBox\VirtualBox.exe"', winSCP_path="C:\Program Files (x86)\WinSCP\WinSCP.exe") controller.openVM(waitServer=15) controller.openWinSCP() controller.startClient() print(f"{bcolors.OK}#########[END]#########{bcolors.ENDC}") Prereq: Python 3.9 Libs: pywinauto, psutil, bcolors Note: The script does kill existing processes of WinSCP and oracle VM, you can disable it, if u feel the need, search for killProcess method and set default param to False Edit: Parametrized paths for vbox, winSCP also
  7. Indeed it worked, with a slight catch.. What i had 2 to do is to add more height to all the parent elements, starting from the first parent, and following the nesting Thank you!
  8. Hello, I have this 1 button which is not clickable in the following position: Faulty position: [Hidden Content] But if i move it higher it works just fine, I not sure what to do, any ideas would be appreciated Working position: [Hidden Content] The actual ui dictionary:
  9. Hello, I'm keen to know, is there a way to increase a specific item texture specular (weapon/armor/etc) beyond the 100 that you can set in specular column? Or better yet to edit the texture to define what 100 specular should be. Point is, some items aren't as shiny as they should be at 100 specular PS. I assume the specular is tied to the texture. Thanks!
  10. Any chance u got the set for all characters?
  11. Hello peeps, I've got the following sutiation: When i add a specific map to index file, a core does not start (channel99 -> core99). When i try to Cannot connect to the server, an connection error is displayed by the client. I've added the map dir name at the eof, with a uniquie index Id Ex. 100 my_map_dir_name The map index has not yet been added to any of the CONFIG files Does anyone have any idea how can I debugg this situation? Can't seem to find any error in the cores/mysql client/auth syserr In syslog no helpful info also..(edited) ----FIX--- Sonitex — Today at 11:08 AM Last line in the map index file must be empty(edited) Pretty stupid "bug"
  12. Hello, I've added strong against metins/bosses, and now, I am trying to add em to item_attr. The goal is to make what is a bonus that I can add manually to an item, to be "addable" by add/change bonus items, if that makes sense? Now I do not know what that implies, any ideas/suggestions would be much apreciated! PS. I did try to add a new row in the table with APPLY_ATTBONUS_METIN, no luck tho. Thanks Tutorial by Owsap Server Source We can do the MySQL part now since we have finished with the server part. MySQL Now let's move on to the Client Source. Client Source Let's not forget our special tool, DumpProto. DumpProto Last but not least your client needs to read the new bonus type. Client Root And finally, your bonus needs a name. Client Locale ⚠ Following the order of the points and apply types are very important, make sure every modification is in order since an incorent order may read another bonus.
  13. Hello, I am running on freeBSD 11.3, gcc49, C++11, mysql 5.5 When compiling, at some point the compilation freezes and in VM machine, i keep getting this swapper error in termnial: swap_pager_getswapspace(3) failed swap_pager_getswapspace(7) failed swap_pager_getswapspace(9) failed swap_pager_getswapspace(3) failed . . . Any idea if this is related to the compilation freeze or? My main problem is the compilation freeze, TOP dosen't seem to show any memory shortage.. TOP output : [Hidden Content] I m not sure if this is how you see the disk space but df -h output looks worring, kinda full UPDATE: When the machine freezes the whole thing is gone, not just the compilation, can't even open a new ssh connection
  14. Following For this switch statement: if (GetType() == ITEM_ARMOR) { switch (GetSubType()) { case ARMOR_BODY: return ATTRIBUTE_SET_BODY; case ARMOR_WRIST: return ATTRIBUTE_SET_WRIST; case ARMOR_FOOTS: return ATTRIBUTE_SET_FOOTS; case ARMOR_NECK: return ATTRIBUTE_SET_NECK; case ARMOR_HEAD: return ATTRIBUTE_SET_HEAD; case ARMOR_SHIELD: return ATTRIBUTE_SET_SHIELD; case ARMOR_EAR: return ATTRIBUTE_SET_EAR; case COSTUME_BODY: return ATTRIBUTE_COSTUME_B; } } else if (GetType() == ITEM_COSTUME){ return ATTRIBUTE_COSTUME_B;} I get: item_attribute.cpp:52:13: error: duplicate case value case COSTUME_BODY: ^ item_attribute.cpp:31:13: error: previously used here case ARMOR_BODY: ^ Armor body is defined in item_length.cpp: enum EArmorSubTypes { ARMOR_BODY, COSTUME_BODY is also defined in item_length.cpp: enum ECostumeSubTypes { COSTUME_BODY, Any idea why does it see at as a duplicate?
  15. It does make sense, I'll still keep the post up if every participant till now agrees, who knows maybe the comments information will provide knowledge to more people, thanks for sharing it tho!
  16. Imma be honest, I didn't know if he was making fun of the situation or not
  17. Considering remote developement on freebsd is limited, and you might have to hard reset from a repo, you might find it annoying at times to keep modified dates in check, anyways, this is something I find useful, my knowledge might also be limtied but it is what it is!
  18. The point is to remove only the file you;'ve modified and compile only that file into a new object, but you could wait to compile errthing again, smart boi... aaand if ur decently clever u can make something that does everything from pull, rm, gmake, restart
  19. import sys import os from os import path def rmObj(objNames): # objNames = objNames.replace(' ', '') db_objDir = "locatie_DB_.obj_absoluta" #Absolut location for db dir objects, should look like /usr/src/gameSource/Server/db/src/.obj" game_objDir = locatie_GAME_.obj_absoluta" #Absolut location for game dir objects, should look like: /usr/src/gameSource/Server/game/src/.obj" obj_ExtensionLst = ['.o', '.d'] count = 0 for objName in objNames: objName = objName.replace(',', '').replace(' ', '') for extension in obj_ExtensionLst: db_ObjLocation = f"{db_objDir}/{objName}{extension}" game_ObjLocation = f"{game_objDir}/{objName}{extension}" if path.exists(db_ObjLocation): os.remove(f"{db_ObjLocation}") print(f"Removed {db_ObjLocation}") count += 1 if path.exists(game_ObjLocation): os.remove(f"{game_ObjLocation}") print(f"Removed {game_ObjLocation}") count += 1 if count == 0: print(f"No files found for given input in these locations: \n{db_objDir}, \n{game_objDir}") if __name__ == "__main__": rmObj(sys.argv[1:]) The script basically deletes .o/.d compiled objects from game/db Prereq: Python >3.4 pkg search python -> pkg install python_vsr_from_search_output Exec script: python3.X fileName.py obj_1, obj_2, ...etc
  20. The script moves the compiled game/db to a desired location, and back up the old ones, in a new directory, named by the user (as a commit message u might say) Could be useful if you don't use git/symlinks, I myself didn't think about symlinks for game/db, thanks to ikarus i do now haha. Prereq: python >3.4 pkg search python pkg install python_vsr_from_search_output I've commented in line what values to modify To call the script simply do python3.X fileName.py backup_Directory_Name import os import shutil from os import path class move_Binaries: targetDir = "/usr/home/bin(!!!REPLACE)" #Dir path from where the compiled game/db are read (Has to be absolute) outputBin = "/usr/src/gameSource/Server/output(!!!REPLACE)" #Dir path for where the gmake output is saved (compiled game/db) Has to be absolute backupDir = targetDir + "/backupBin" binariesList = ['game','db'] def __init__(self, backup_Name="NotGiven"): if backup_Name != "NotGiven": self.backup_Name = backup_Name else: self.backup_Name = backup_Name + '_' + self.getDateIdentifier() def move_to_backup(self): files = [f for f in os.listdir(self.targetDir) if os.path.isfile(f)] self.createDir(self.backupDir) dirCreated = self.createDir(self.backupDir, self.backup_Name) for f in files: for binName in self.binariesList: if binName in str(f): shutil.move(f"{self.targetDir}/{str(f)}", dirCreated + '/' + str(f)) print(f"Backed up binaries at: {dirCreated + '/' + str(f)}") def move_from_output(self): for binName in self.binariesList: try: shutil.move(f"{self.outputBin}/{binName}", self.targetDir + '/' + binName) print(f"Moved binaries from {self.outputBin} to {self.targetDir + '/' + binName}") except FileNotFoundError : print(f"No {binName} file in {self.outputBin} to move") def createDir(self, dirLocation, dirName=''): dirCreated = dirLocation + r'/' + dirName if path.exists(dirCreated): return dirCreated else: os.mkdir(dirCreated) return dirCreated def getDateIdentifier(self): from datetime import datetime # datetime object containing current date and time now = datetime.now() # dd/mm/YY H:M:S dt_string = now.strftime("%d_%m_%Y_%H_%M_%S") return dt_string if __name__ == "__main__": import sys move_BinariesInstance = move_Binaries(sys.argv[1]) move_BinariesInstance.move_to_backup() move_BinariesInstance.move_from_output()
  21. This is gr8, i mainly wanna use it for debugging purposes, only way I came up with do do any debugging, thanks!
  22. Hello, as per title, does any1 know a launcher binaries function that prints something in ingame chat, thanks!
×
×
  • 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.