Jump to content

Search the Community

Showing results for tags 'python' in content posted in Programming / Scripts.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Community
    • Announcements
    • Feedback
  • Metin2
    • General
    • Questions and Answers
    • Guides & HowTo
    • Design
    • Private Servers
    • Services
    • Videos
  • Releases
    • General
    • Tools
    • Programming / Scripts
    • Quests
    • Binaries & Clients/Serverfiles
    • 3D Models
    • 2D Graphics
    • Operating Systems
  • Safe Zone
    • Offtopic
    • Games Talk
    • Music/Videos/Art


There are no results to display.

There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 46 results

  1. Hi, I want to release shop with the new currency. Client: inventorywindow.py (locale/uiscript): You must replace this: "y" : SCREEN_HEIGHT - 37 - 565, "y" : SCREEN_HEIGHT - 37 - 589, 2x replace this: "height" : 565, "height" : 589, And replace this: ## Print { "name":"Money_Slot", "type":"button", "x":8, "y":28, "horizontal_align":"center", "vertical_align":"bottom", "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "children" : ( { "name":"Money_Icon", "type":"image", "x":-18, "y":2, "image":"d:/ymir work/ui/game/windows/money_icon.sub", }, { "name" : "Money", "type" : "text", "x" : 3, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "123456789", }, ), }, ## Print { "name":"Money_Slot", "type":"button", "x":8, "y":28+24, "horizontal_align":"center", "vertical_align":"bottom", "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "children" : ( { "name":"Money_Icon", "type":"image", "x":-18, "y":2, "image":"d:/ymir work/ui/game/windows/money_icon.sub", }, { "name" : "Money", "type" : "text", "x" : 3, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "123456789", }, ), }, ## Print { "name":"Premium_Slot", "type":"button", "x":8, "y":28, "horizontal_align":"center", "vertical_align":"bottom", "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "children" : ( { "name":"Premium_Icon", "type":"image", "x":-18, "y":2, "image":"d:/ymir work/ui/game/windows/money_icon.sub", }, { "name" : "Premium", "type" : "text", "x" : 3, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "123456789", }, ), }, game.py (root): In table "servercommandlist" you must add this lines: "GetInputStart" : self.GetInputStart, "GetInputStop" : self.GetInputStop, "GetInput" : self.GetInput, "SetQuestIndex" : self.QuestIndexShop, "SetIsNpc" : self.SetIsNpc, "SetPrice" : self.SetIsPrice, "NieMamPP" : self.NieMamPP, "setPP" : self.__setAchievementPoints, And add this lines under "servercommandlist" table: def NieMamPP(self): import uiShop self.wndShop = uiShop.ShopDialog() self.wndShop.NieMamPP() def __setAchievementPoints(self, points): constInfo.ACHIEVEMENT_POINTS = int(points) self.interface.wndInventory.UpdatePremiumInSlot() def SetIsPrice(self, value): self.interface.dlgShop.SetShopPrice(value) def SetIsNpc(self): constInfo.IsItemShop = 1 def QuestIndexShop(self, value): constInfo.IS_QUEST = int(value) def GetInputStart(self): constInfo.INPUT_IGNORE = 1 def GetInputStop(self): constInfo.INPUT_IGNORE = 0 def GetInput(self): net.SendQuestInputStringPacket(str(constInfo.INPUT_DATA)) constinfo.py (root): You must add this lines in the middle of the file: ACHIEVEMENT_POINTS = 0 IS_QUEST = 0 IsItemShop = 0 INPUT_IGNORE = 0 INPUT_DATA = "" uitooltip.py (root): You must replace this function: def SetShopItem(self, slotIndex): itemVnum = shop.GetItemID(slotIndex) if 0 == itemVnum: return price = shop.GetItemPrice(slotIndex) self.ClearToolTip() self.isShopItem = TRUE item.SelectItem(itemVnum) metinSlot = [] for i in xrange(player.METIN_SOCKET_MAX_NUM): metinSlot.append(shop.GetItemMetinSocket(slotIndex, i)) attrSlot = [] for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(shop.GetItemAttribute(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) self.AppendPrice(price) def SetShopItem(self, slotIndex, addprice = 0, waltype = 0): itemVnum = shop.GetItemID(slotIndex) if 0 == itemVnum: return price = shop.GetItemPrice(slotIndex) self.ClearToolTip() self.isShopItem = TRUE item.SelectItem(itemVnum) metinSlot = [] for i in xrange(player.METIN_SOCKET_MAX_NUM): metinSlot.append(shop.GetItemMetinSocket(slotIndex, i)) attrSlot = [] for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(shop.GetItemAttribute(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) if waltype == 0: self.AppendPrice(price) else: self.AppendSpace(5) self.AppendTextLine("Cena: %s TR" % (locale.NumberToMoneyString(addprice)[:-5]), self.SPECIAL_TITLE_COLOR) uiinventory.py (root): Under: def RefreshStatus(self): money = player.GetElk() self.wndMoney.SetText(locale.NumberToMoneyString(money)) Add: def UpdatePremiumInSlot(self): import constInfo value = str(constInfo.ACHIEVEMENT_POINTS) self.wndPremium.SetText(locale.NumberToMoneyString(value)[:-5] + " TR") Under: self.wndMoneySlot = 0 Add: self.wndPremium = 0 self.wndPremiumSlot = 0 Under: self.wndMoneySlot = self.GetChild("Money_Slot") Add: self.wndPremium = self.GetChild("Premium") self.wndPremiumSlot = self.GetChild("Premium_Slot") And replace this function: def SelectEmptySlot(self, selectedSlotPos): if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1: return selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos) if mouseModule.mouseController.isAttached(): attachedSlotType = mouseModule.mouseController.GetAttachedType() attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemCount = mouseModule.mouseController.GetAttachedItemCount() attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex() if player.SLOT_TYPE_INVENTORY == attachedSlotType: itemCount = player.GetItemCount(attachedSlotPos) attachedCount = mouseModule.mouseController.GetAttachedItemCount() self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount) if item.IsRefineScroll(attachedItemIndex): self.wndItem.SetUseMode(FALSE) elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType: mouseModule.mouseController.RunCallBack("INVENTORY") elif player.SLOT_TYPE_SHOP == attachedSlotType: if constInfo.IsItemShop == 0: net.SendShopBuyPacket(attachedSlotPos) else: import uiShop self.wndShop = uiShop.ShopDialog() self.wndShop.BuyFromIS(attachedSlotPos) elif player.SLOT_TYPE_SAFEBOX == attachedSlotType: if player.ITEM_MONEY == attachedItemIndex: net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount()) snd.PlaySound("sound/ui/money.wav") else: net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos) elif player.SLOT_TYPE_MALL == attachedSlotType: net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos) mouseModule.mouseController.DeattachObject() uishop.py (root): This file is too much editing, I give you the finished file. http://wklej.to/YR452 Server: Add shop, and then add items in this shop. In my system, a standard shop has id 15. Remember not to give the shop directly at NPC! Quest: http://wklej.to/T5Ild The price we give here: cmdchat("SetPrice 200|50|100|200|150|250|100|100|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0") Slots are separated by "|". The items we give here: local items = { [1]={71124, 1, 200}, [2]={71125, 1, 200}, [3]={71126, 1, 200}, [4]={71127, 1, 200}, [5]={71128, 1, 200}, } [slot_id]={item_id, item_count, item_price}, This guide and information contained in it things are by Teodor. Sorry for my english, I come from Polish. Greetings! Screen:
  2. As we work with maps we accumulate a large number of unused textures which end up making the client / pack downloads for our server bigger. For this reason I made this little python 2.7 script. It will read all the textureset files and the texture paths on it and copy to textureset_release/ only the textures that are actually being used by your maps, as listed in Settings.txt The folder where the script looks for Settings.txt files recursively is "maps/", change it at the start of the code if yours is different. Likewise, it will look for "textureset/" and "terrainmaps/", and create "textureset_release/". No files will be deleted. Disclaimer: The code is very ugly, I actually have no idea of python, I made this script looking at docs and based on my knowledge of other languages. If you actually know python I suggest you don't look at it to avoid hurting your eyes. import os import re import string import shutil import sys ct = 0 usedimg = [] usedsets = [] list = [] mapfolder = 'maps/' class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) def __exit__(self, etype, value, traceback): os.chdir(self.savedPath) def cleanValue(val): val = val.replace('\\', '/') val = val.strip(' \t\n"') val = val.lower() return val def copyFile(src, dest): try: shutil.copy(src, dest) # eg. src and dest are the same file except shutil.Error as e: print('Error: %s' % e) # eg. source or destination doesn't exist except IOError as e: print('Error: %s' % e.strerror) # Read the tab-separated value of a parameter "param" in all files named "fname" (can be an extension) in folder "folder" def SaveParams(param,fname,folder,list): for path, subdirs, files in os.walk(folder): for filename in files: if filename.lower() == fname.lower() or (fname.startswith('.') and filename.endswith (fname)): f = os.path.join(path, filename) with open(f, "rt") as current: for line in current: lcline = line.lower() lcparam = param.lower() if lcparam in lcline: # strip tabs and split values value = line.rstrip('\t\n') # get parameter value list.append(value) # Read a value with the order number "order" within a parameter block "block" in all files named "fname" (can be an extension) in folder "folder" which are also in list "compare" def SaveParamsFromBlock(block,order,fname,folder,list,compare): for path, subdirs, files in os.walk(folder): for filename in files: if filename in compare and (filename.lower() == fname.lower() or (fname.startswith('.') and filename.endswith (fname))): countblock = -1 f = os.path.join(path, filename) with open(f, "rt") as current: for line in current: lcline = line.lower() lcblock = block.lower() if countblock == order: list.append(line) countblock = -1 elif lcline.startswith(lcblock): countblock = 0 elif countblock >= 0: countblock = countblock + 1 # move to the client data folder with cd('..\client\data'): try: os.makedirs('terrainmaps_release') except: shutil.rmtree('terrainmaps_release') os.makedirs('terrainmaps_release') print "This script copies to terrainmaps_release only the textures which are actually listed in textureset files." print "The folder is emptied on each run. make_archive.py uses this folder as source for making the terrainmaps pack." print "This script is written to be run from the tools repo copy and assumes the client repo copy to be in the same base directory as tools" print "" select = raw_input("Press any key to start, e to exit") if str(select) == "e": sys.exit() # Get all the texturesets used in our maps SaveParams('TextureSet','Setting.txt','maps',usedsets) # Extract the filename part of the used TextureSet paths and write it back to the list for idx,val in enumerate(usedsets): val = cleanValue(val) parts = re.split('/', val.lower()) # check its actually a terrainmaps path usedsets[idx] = parts[-1] # Fetch a list of the textures used in the sets used SaveParamsFromBlock('Start Texture',0,'.txt','textureset',usedimg,usedsets) # Copy the textures used in textureset_release for idx,val in enumerate(usedimg): # check its actually a terrainmaps path if "terrainmaps" in val: val = cleanValue(val) val = val[len('d:/ymir work/terrainmaps/'):] usedimg[idx] = val.lower() srcPath = 'terrainmaps/' + usedimg[idx] destPath = 'terrainmaps_release/' + usedimg[idx] print "Copy " + srcPath + " to " + destPath if not os.path.isdir(os.path.dirname(destPath)): os.makedirs(os.path.dirname(destPath)) copyFile(srcPath, destPath) ct = ct + 1 print "Total " + str(ct) + " textures copied in terrainmaps_release" raw_input("Press any key to exit") As a bonus another python 2.7 script used to create the property/list file with all your prb, pre. Assumes a property/ folder at the location where you run it. import os import math count = 0 extensions = ('prb','prt','prd','pre','pra') with open("property/list", "w") as a: for path, subdirs, files in os.walk(r'property'): for filename in files: f = os.path.join(path, filename) if filename != "list" and filename !="reserve": extension = filename.split ('.')[-1] if (extension in extensions): a.write(str(f) + '\n') else: Print ("Strange file: " + f) count = count + 1 print 'Total: ' + str(count) + ' files listed on property/list!' raw_input("Press any key to exit") And finally another script to copy all your msa and motlist.txt files to a server/data folder that you can upload later to your server. It will only copy when files are different or not existing at the destination. It assumes a ../client/data/npc (and so on) and ../server/data/monster etc. structure, feel free to edit the paths in the scripts to your needs. import os import shutil from itertools import chain import filecmp pathList = [] count = 0 def copyFile(src, dest): try: shutil.copy(src, dest) return True # eg. src and dest are the same file except shutil.Error as e: print('Error: %s' % e) # eg. source or destination doesn't exist except IOError as e: print('Error: %s' % e.strerror) print "This script moves all the .msa and motlist.txt files from pc monster and npc client folders to the appropiate server folders, creating them if necessary." paths = ('../client/data/monster/', '../client/data/monster2/', '../client/data/npc/', '../client/data/npc2/', '../client/data/pc/', '../client/data/pc2/') for path, dirs, files in chain.from_iterable(os.walk(path) for path in paths): for filename in files: if filename.endswith('.msa') or filename.endswith('.txt'): realpath = path.replace('\\', '/') cfolder = os.path.split(realpath)[1] gfolder = 'monster' if ('/pc/' in realpath): gfolder = 'pc/' + realpath.split('/')[4] elif ('/pc2/' in realpath): gfolder = 'pc2/' + realpath.split('/')[4] else: # Check for duplicated non-pc folders existingpath = next((s for s in pathList if ('/' + cfolder) in s), None) if existingpath and existingpath.endswith(cfolder): if realpath != existingpath: print("Warning: duplicate folders " + realpath + " and " + existingpath + "!") pathList.remove(existingpath) break elif path not in pathList: pathList.append(realpath) else: pathList.append(realpath) spath = realpath + '/' + filename dpath = '../server/data/' + gfolder + '/' + cfolder # Create destination folder if not existing if not os.path.isdir(dpath): os.makedirs(dpath) dpath = dpath + '/' + filename # Copy file if destination is not existing or different if not os.path.exists(dpath) or not filecmp.cmp(spath,dpath): if copyFile(spath, dpath): print "Copied " + spath + " to " + dpath count = count + 1 print "Finished copying " + str(count) + " files!" raw_input("Press any key to exit") How to use: install python 2.7 anywhere on your hd (C:\Python27 for example), add this path to the system path, and save this code in a file named something.py, then run it by doubleclick Remember to change directory to wherever you have your client files.
  3. Hello everyone. It's a good day to share an old code with you. First of all you need to know: I don't help to install it. Don't even take the contact with me about it. The whole code is written by me, and reversed from official binaries. At the beginning do a backup for your files(srcs+pys) and READ CAREFULLY the readme. W/o brain.exe please close this tab, or your browser, thank you for your understanding. Preview: Download.exe Enjoy & #h4v3fun, pngr
  4. Hi there everyone, I'd like to share a small function which will give you a random name whilst creating a new character. This will only include the function and a list of names, so you will have to set the event on your own. Preview: The function which will most likely be put in introCreate.py import os import app #import the above lines if you don't have them already def __randomizeName(self): dir = os.path.dirname(os.path.abspath("introCreate.py")) list = open("%s\\names.list" % dir, "r").read().split("\n") rng = app.GetRandom(0, len(list)-1) randomName = list[rng] self.heroName.SetText("%s" % randomName) ## change variable 'heroName' with your editline's name Also place the attached file to this thread in the main directory of the client. (i.e: where the launcher is) names.list contains 150 names, if you ever need more names let me know so I can up the number or you can add more yourself, but do note you need to put each name as a new line so you won't mess up the function. That's all for now, hope you all have a great day! Cheers. names.list
  5. Auto refine option when you upgrade the item with SCROLL or on NPC. I did all checks like example : When you have just one scroll in inventory, refine window will be close. When the item is already maximum upgrade. (+8 to +9 just in case will be succes) and more .. Preview: https://gyazo.com/63959d63b9acc7d4337e16de061ea747 Download : https://mega.nz/#!SZpDWBKB!EbBTPAThBjFZBuFCdvttRz5Yia4oYrAj5m4r0pNFe6U
  6. GitHub repository: https://github.com/Vegas007/Metin2-Extended-Modules-For-Script-Window
  7. Hi devs, I'd like to share a script I developed the other night whilst working on a project, this script is meant to improve the quality of life of Metin2 as often players find it hard to accurately tell the cooldown of skills and end up spamming their keyboards like many of us have. Preview: Without any further ado, let's dig right into coding this bad boy. We start with locale: Now we shall move onto root part: version 1.0 version 2.0 If you encounter any bugs or you have suggestions please let me know! Changes:
  8. masodikbela


    Hi there Devs, I would like to share my "little" system. If you aren't interested in the introduction/preview etc. and you just want to download it and put in to your server, just scroll down until the "[How-To] Set up" subtitle. The story Firstly let me tell this system's story. I've got an idea one year before, that it would be good if the players would be able to put their items into a "global" system where they could see the other player's items, and they could buy it for DC or gold (that time I worked with the latest vanilla core (not with the source)). Then in the following 8 days I made it (it took about 80-90 working hours). Originally the system was created for one of my friend's server. but this server has never started, and nobody used this system. After some mounts I've decided to publish it on the Hungarian forum, because it won't worth to work on it for long hours if nobody uses it and its just collecting dust on my computer. Then I've published it on the 2nd of December, 2014. After some time I've decided to translate it into English and I've got a new idea for a new feature. This feature was: the trade system (I will explain its working later). This idea inspired by one of the players (from a server where this system was able to use). He told me that it would be better if they could set the gold price via an item (what's value is very high). Then with more than 180 working hours (totally) behind my back I'm here. Overview [How-To] Set up Customizing the tradehouse Questions and Answers Notes changelog: 19th of August, 2015: I publicated the tradehouse here. my toDo list: add logging for the system (the released version don't log the actions in the tradehouse) Thanks for reading the topic, if you have any problem/remark feel free to ask it here or write me a PM. Have a good day!
  9. Special thanks for design and help: [url=https://metin2dev.org/board/index.php?/profile/12872-legolasofficial/]LegolasOfficial[/url] Download: https://mega.nz/#!pBUj0IoC!tYUbK3liAC5fSxxWQ1sWjUKypNFphPergj4lDZxk6RQ
  10. Hello, To extend NPC Shop to 80 Items follow these steps. ServerSide Open "common/length.h" and search: SHOP_HOST_ITEM_MAX_NUM = 40 Replace with: SHOP_HOST_ITEM_MAX_NUM = 80 In the same file search: SHOP_PRICELIST_MAX_NUM = 40 Replace with: SHOP_PRICELIST_MAX_NUM = 80 Now open "game/shop.cpp" and search: m_pGrid = M2_NEW CGrid(5, 9) Replace with: m_pGrid = M2_NEW CGrid(10, 9) Now open "game/shop_manager.cpp" and search: CGrid grid = CGrid(5, 9) Replace with: CGrid grid = CGrid(10, 9) Now compile Db File & Game File and ServerSide's steps complete. ClientSide NOTE: If you want Only NPC Shop's with 80 Items follow this guide, else if you want NPC Shop & Private Shop follow the Update Istruction. Extract "pack/uiscript" from your Client and open "shopdialog.py". Now reaplace all content with: Shopdialog.py ~ 80 Items Now create "shopdialog2.py" and insert this content: ShopDialog2 ~ 80 Items for Shop Ok, at this point you can compress your UiScript with the new file "shopdialog2.py". Extract "pack/root" from your Client and open "interfacemodule.py" Search this: self.dlgShop = uiShop.ShopDialog() self.dlgShop.LoadDialog() self.dlgShop.Hide() After add: self.dlgShop2 = uiShop.ShopDialog2() self.dlgShop2.LoadDialog() self.dlgShop2.Hide() Same file, search this: def OpenShopDialog(self, vid): self.wndInventory.Show() self.wndInventory.SetTop() self.dlgShop.Open(vid) self.dlgShop.SetTop() After add: def OpenShopDialog2(self, vid): self.wndInventory.Show() self.wndInventory.SetTop() self.dlgShop2.Open(vid) self.dlgShop2.SetTop() Now open "game.py" and Search: def StartShop(self, vid): self.interface.OpenShopDialog(vid) Replace with: def StartShop(self, vid): if chr.IsNPC(vid): self.interface.OpenShopDialog(vid) else: self.interface.OpenShopDialog2(vid) Now open "uishop.py" and Search: def Close(self): self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.tooltipItem.HideToolTip() self.Hide() Replace with: def Close(self): self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.Hide() Same file, search: def OnUpdate(self): USE_SHOP_LIMIT_RANGE = 1000 (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs(y - self.yShopStart) > USE_SHOP_LIMIT_RANGE: self.Close() After add: UiShop.py ~ ShopDialog2 Now you can compress "root" file. #Update [24-02-15] Fixed Client Bug. Changes in "shop_manager.cpp" added. #Update [26-02-15] Added PrivateShop with 80 Items. NPC & PrivateShop with 80 Items ClientSide: Open "UserInterface/Packet.h" in you Binary Client Source and Search: SHOP_HOST_ITEM_MAX_NUM = 40 Replace with: SHOP_HOST_ITEM_MAX_NUM = 80 Now you can compile your Binary Source. Open your Client File and extract "pack/uiscript". Open "shopdialog.py" and replace all contentwith: Shopdialog.py ~ 80 Items Now open "privateshopbuilder.py" and replace all content with: PrivateShopBuilder ~ 80 Items Now you can compress your UiScript. Screen Private Shop: Et Voilà, we ended. Good work, Bye.
  11. Hello, today I will give you this login interface, which is very similar to WoM2. It's coded by me, good luck Original interface(WoM2): My interface: Photo1: Photo2: Download: https://1drv.ms/u/s!AhOzstvwiFbCbOvOhJG_R8ohLeg Link alternativ: https://www118.zippyshare.com/v/FxNbjoDa/file.html
  12. Hello, today I will give you this login interface, which is very similar to WoM2. It's coded by me, good luck Original interface(WoM2): My interface: Photo1: Photo2: Download: 1. https://1drv.ms/u/s!AhOzstvwiFbCa_hZFTG57aD_mTU 2. https://www111.zippyshare.com/v/rIWjrge8/file.html btw: configuration in root/intrologin.py: SERVER_IP = "" CH1_PORT = 21000 CH2_PORT = 22000 CH3_PORT = 23000 CH4_PORT = 24000 PORT_AUTH = 31009 NUME_SERVER = "Andy"
  13. Perhaps it will be useful for some people for various systems. Have fun. # onPressKeyDict[app.DIK_F5] = lambda : self.Print() # For test function @root/game.py def Print(self): import app, chat list = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" # Set list maxStr = 10 # Set the maximum number of characters k = "" for v in xrange(maxStr): k = k + list[app.GetRandom(0, len(list) - 1)] chat.AppendChat(chat.CHAT_TYPE_INFO, "Result word: %s" % str(k))
  14. Abel(Tiger)

    python [Py] Root 02.02.2018

    I think they forgot to cythonize =)) I don't recommend to use that code, is ugly ... https://mega.nz/#!Ixl0nLZa!61VOx87EA9zBUiNAHD-poUZnaIx3VZr6RVgqUT3LZu4
  15. Hello Dev Community! Today I will share You my litlle project what I made, because i saw many things of this problem - it means bonus page, bonus window or as You call it. This is my first thread on metin2dev forum. I do this 2 years ago nad post on known polish forum - mpcforum.pl. This can be a long topic, sorry in advance but I think it's worth. Original thread on mpcforum: http://www.mpcforum.pl/topic/1038647-okno-bonus-by-sanki/ I will share it there, because I think it's good idea for servers. So let's go! Screen: I know... it is in polish language, but You can translate it very fast and simply... Google translator can help You Notice the tabs, spaces, etc. THIS IS THE FIRST BAD thing what You can do wrong. 1. For first... unpack root and uiscript, go to root folder and open game.py, in imports add this: import uiBonus under: import uiCharacter 2. Next search in this file: onPressKeyDict[app.DIK_Z] and add under(this function is for opening and closing this bonus window): onPressKeyDict[app.DIK_X] = lambda: self.interface.ToggleBonusWindow() in this file it's end. You can close this file. 3. Now go to interfacemodule.py also in root files (in this file will be add very much so You have to be carefoul and check to add all good) and add import like in game.py: import uiBonus 4. Now in this file search: def __init__(self): and under this: self.wndInventory = None add this: self.wndBonus = None 5. Now search this function: def __MakeWindows(self): and under: wndInventory = uiInventory.InventoryWindow() add this: wndBonus = uiBonus.BonusWindow() 6. In this same function but a few lines below after this: self.wndCharacter = wndCharacter add this: self.wndBonus = wndBonus 7. Ok. Good. Now search this function: def Close(self): and after this: if self.wndInventory: self.wndInventory.Destroy() add this: if self.wndBonus: self.wndBonus.Destroy() 7.1 Now again in the same function, a few lines below, we are looking for: del self.wndInventory add this: del self.wndBonus 8. Now search another function: def ShowAllWindows(self): and under this: self.wndInventory.Show() add this: self.wndBonus.Show() 9. Now next function or search this: def HideAllWindows(self): under: if self.wndInventory: self.wndInventory.Hide() add: if self.wndBonus: self.wndBonus.Hide() 10. Uff... not far...but now be carefoul! Search function : def ToggleInventoryWindow(self): and UNDER this function, NOT IN THIS function add new: def ToggleBonusWindow(self): if FALSE == player.IsObserverMode(): if FALSE == self.wndBonus.IsShow(): self.wndBonus.Show() self.wndBonus.SetTop() else: self.wndBonus.Hide() 11. Ok. Next search: def __HideWindows(self): and in this after line: self.wndInventory, add: self.wndBonus, OK. In this way, we end add window to python files. Now only remain for us to add and pack to root files: uibonus.py and add and pack to uiscript files: bonus.py link for this files: http://speedy.sh/Yn8Jb/zakladka-bonus.rar scan: http://img23.imageshack.us/img23/1237/l6n5.png IF AFTER ADD, SOMETHING DON'T WONT WORKING( turn off client etc.) check client SYSERR! PS. If problem is in this window bonus, errors will be in the middle of the polish. A reference to the file where to look. Only one problem for older clients(2010) and oldest, is checking locals "IsARABIC", but the solution is easy... There You must only comment three lines(add # in beginning of the line) 38, 39 and 40 in uiBonus.py file. It must be like this: If I somewhere write something wrong, misspell, translate, spoilers etc or incorrect description(everything write what i learned alone) I ask for precise, explanation, etc. I don't translate this files because I don't have time for it... :< If anybody translate files to english(show text in window ingame and errors) will be that good and send me this files or give link in thread I will add it to topic. PS.2. There is a little small bug( resis sura and ninja are reversed), only numbers in uibonus.py( now it is like this: odpninja... bonusid = 61 ... odpsura... bonusid = 60... ) reverse bonusid and it will be good( odpninja... bonusid = 60 ... odpsura.... bonusid = 61 ... ). I think, everyone know what i mean Prohibition of copying on other forums, etc. For personal use only. Kind Regards, Sanki
  16. xP3NG3Rx

    python [Fix] Ghost GUI

    Hello. I was looking inside the official python files and I found a little fix for this: Let me explain a bit the problem. If you leave open the inventory/dragon soul inventory/expanded taskbar or the affected objects and then you are using quest for teleportation, the windows what you left open will be closed because of the quest and when the quest executed those windows what you left open before would be opened again, but the warp is killing this procedure and that happens what you can see in the video, the windows are there but you cannot see them. Btw you can close them with escape key. The fix is coming from webzen: Simple, just execute a .Hide() function before the Destroy function has been called on that object what is stuck on the main window after teleport and that's it. For example: interfaceModule.py -> Interface class -> Close function: if self.wndInventory: self.wndInventory.Hide()#fix self.wndInventory.Destroy() if self.wndDragonSoul: self.wndDragonSoul.Hide()#fix self.wndDragonSoul.Destroy()
  17. martysama0134

    python Sequence Generator

    I made a sequence generator script. You can find it in here: https://github.com/martysama0134/how-to-mt2-general/tree/master/sequence-generator This python script automatically generates the sequence table for `EterLib\NetStream.cpp` (in `s_bSequenceTable`) and `game\src\sequence.cpp` (in `gc_abSequence`). (the keys get changed every time you run the script) A sequence table is just a simple random generated array with 16x2048 bytes between 0x0 and 0xfe. Replacing the sequence table makes older/unwanted launchers unable to access the server.
  18. martysama0134

    python Xtea Keys Generator

    Some years ago I created a (python2) script to generate xtea keys randomly, here it is: xtea-keys-generator.rar You can also find it in here: https://github.com/martysama0134/how-to-mt2-general/tree/master/xtea-keys-generator It generates the code for EterNexus, for EterPack.cpp, and also the hex string you see inside the compiled launcher.
  19. Find in locale/xx/ui/loadingwindow.py: { "name" : "FullGage", "type" : "expanded_image", "x" : 40, "y" : 25, "image" : uiScriptLocale.LOCALE_UISCRIPT_PATH + "loading/gauge_full.dds", }, Add this; { "name" : "LoadingName_Text", "type" : "text", "x" : 190, "y" : -8, "text" : "", "vertical_align" : "center", }, Add in constInfo.py; loadingname = "" Find in root/introloading.py: self.loadingGage=self.GetChild("FullGage") Add this; self.loadingName_txt=self.GetChild("LoadingName_Text") Find: def __SetProgress(self, p): Change like this; def GetChName(self, p): import constInfo text = constInfo.loadingname uzunluk = len(text) asd = uzunluk*p/100 return text[0:asd] def __SetProgress(self, p): if self.loadingGage: self.loadingGage.SetPercentage(2+98*p/100, 100) name = self.GetChName(2+98*p/100) self.loadingName_txt.SetText(name) Last one if you use the official pack introselect(unpacked 2015 & 2018 packs), use this: If you use the fake official introselect or old introselet, use this:
  20. Yo guys, here you have a script that i made to fix the annoying fact that epack32 craps out when you use for some reason uppercase extensions, this can happen with gr2's for example. Here you have a video showing how to use it properly, this is for an earlier version but you should get how it works. I'm also writing a py library that acts as manager for the query/msm/protos etc, the quality of the code is been improving since this script, stay tuned for the future. ## Author North - Fleon # Usage: python scriptname.py import os,fnmatch,shutil,re lenght = 3 # Set here the size of the extension, default 3 extension = None; class FileManager(): @staticmethod def Main(): print("\n\n#### Extension to lowercase V.01 ####\n\n") print("Renames recursively from a caps extension to lower.") print("USAGE: Place your content and script into C:\workdir") print("The script will recursively change the extension to lower.") input(">>>> Press ENTER to continue...") # In case you are using a python version that is equal or lower than 2.7 please use raw_input instead of input above. FileManager.GetExtension() FileManager.GetLogFile() FileManager.RenameFile() def GetExtension(): global extension global lenght while not extension or len(extension) > lenght: print("Tell me wich extension would you like to lower") print("/!\ The extension must not be left empty.") extension = str(input(">>>> Now type an extension: (Example: txt) \n")) return(extension) def GetLogFile(): path = os.getcwd() global extension Extension = "*." + str(extension) with open("rename_log", "w") as File_txt: for root, dirnames, filenames in os.walk(path): for gr2 in fnmatch.filter(filenames, Extension): write_txt = (os.path.join(root, gr2) +"\n") File_txt.write(write_txt) def RenameFile(): global extension with open("rename_log", "r") as file_directory: for element in file_directory: element = element[:-1] ren_element = element.replace(str.upper(extension), str.lower(extension)) os.rename(element, ren_element) print(">>>> This file has been renamed: " + element) total_elements = sum(1 for line in open('rename_log')) print("Total renamed files: {0}".format(str(total_elements))) FileManager.Main()
  21. Hello Metin2dev users, I want to relase this because it can be useful for someone who's starting to understand what kind of logic there is behind the ui managment This is a really simple thing, but it can be optimized to get you the idea of what you can do with small parts of code. As exercise do the followings: + Add the metin2 official effect for the brave cape + Add a keyboard shortcut to the button + Set a time of 4s in the c++ function for anti command spam + Enhance the overall looking? + What ever you'd like to add Video of the button: Link DL: https://mega.nz/#!MRg1zDra!h0eEHRpbxU5M_IycdhvRbYlaNs5i993JqcCgFTI5Q1M If i missed something in the file just tell me, ill adjust the file. I don't know and i don't care if this is already relased, it's so simple that no one is gonna be offended. Let me know your feedback for this kind of exercise-typeof-relases
  22. https://i.imgur.com/TBOcLui.gifv uiCommon.py class ItemQuestionDialog(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.__CreateDialog() self.tooltipItem = uiToolTip.ItemToolTip() self.toolTip = uiToolTip.ToolTip() self.window_type = 0 self.count = 0 self.dropType = 0 self.dropCount = 0 self.dropNumber = 0 def __del__(self): ui.ScriptWindow.__del__(self) def __CreateDialog(self): pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "QuestionDialog.py") self.board = self.GetChild("board") self.textLine = self.GetChild("message") self.acceptButton = self.GetChild("accept") self.cancelButton = self.GetChild("cancel") self.titleBar = ui.TitleBar() self.titleBar.SetParent(self.board) self.titleBar.MakeTitleBar(244, "yellow") self.titleBar.SetPosition(8, 7) self.titleBar.Show() self.titleName = ui.TextLine() self.titleName.SetParent(self.titleBar) self.titleName.SetPosition(0, 4) self.titleName.SetWindowHorizontalAlignCenter() self.titleName.SetHorizontalAlignCenter() self.titleName.Show() self.slotList = [] for i in xrange(3): slot = ui.ImageBox() slot.LoadImage("d:/ymir work/ui/public/slot_base.sub") slot.SetParent(self) slot.SetWindowHorizontalAlignCenter() self.slotList.append(slot) def Open(self, vnum, slot = None, price = None): item.SelectItem(vnum) xSlotCount, ySlotCount = item.GetItemSize() try: if self.window_type == "inv": metinSlot = [player.GetItemMetinSocket(player.INVENTORY, slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)] elif self.window_type == "shop": metinSlot = [shop.GetItemMetinSocket(slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)] except: pass if vnum in (50300, 70037): self.titleName.SetText("%s %s" % (skill.GetSkillName(metinSlot[0]), item.GetItemName())) elif vnum == 70104: self.titleName.SetText("%s %s" % (nonplayer.GetMonsterName(metinSlot[0]), item.GetItemName())) else: self.titleName.SetText(item.GetItemName()) newHeight = 0 if price: newHeight = 20 itemPrice = ui.TextLine() itemPrice.SetPosition(0, 77 + 32*ySlotCount) itemPrice.SetWindowHorizontalAlignCenter() itemPrice.SetHorizontalAlignCenter() itemPrice.SetVerticalAlignCenter() itemPrice.SetParent(self.board) if str(price).isdigit(): itemPrice.SetText(localeInfo.NumberToMoneyString(price)) else: itemPrice.SetText(price) itemPrice.Show() self.itemPrice = itemPrice slotGrid = ui.SlotWindow() slotGrid.SetParent(self) slotGrid.SetPosition(-16, 62) slotGrid.SetWindowHorizontalAlignCenter() slotGrid.AppendSlot(0, 0, 0, 32*xSlotCount, 32*ySlotCount) slotGrid.AddFlag("not_pick") slotGrid.Show() self.slotGrid = slotGrid if self.count > 1 and vnum != 1: self.slotGrid.SetItemSlot(0, vnum, self.count) else: self.slotGrid.SetItemSlot(0, vnum) self.SetSize(260, 110 + 32*ySlotCount + newHeight) self.board.SetSize(260, 110 + 32*ySlotCount + newHeight) self.textLine.SetPosition(0, 44) for i in xrange(min(3, ySlotCount)): self.slotList[i].SetPosition(0, 30 + ySlotCount*32 - i*32) if vnum != 1: self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(arg) self.slotList[i].OnMouseOverOut = lambda arg = self.tooltipItem: self.OverOutItem(arg) else: self.slotList[i].OnMouseOverIn = lambda arg = localeInfo.MONETARY_UNIT0: self.OverInToolTip(arg) self.slotList[i].OnMouseOverOut = lambda: self.OverOutToolTip() self.slotList[i].Show() self.GetChild("accept").SetPosition(-40, 74 + 32*ySlotCount + newHeight) self.GetChild("cancel").SetPosition(40, 74 + 32*ySlotCount + newHeight) self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) self.SetCenterPosition() self.SetTop() self.Show() def SetCloseEvent(self, event): self.titleBar.SetCloseEvent(event) def SetMessage(self, text): self.textLine.SetText(text) def OverInToolTip(self, arg): self.toolTip.ClearToolTip() self.toolTip.AppendTextLine(arg, 0xffffff00) self.toolTip.Show() def OverOutToolTip(self): self.toolTip.Hide() def OverInItem(self, slot): if self.window_type == "shop": self.tooltipItem.SetShopItem(slot) elif self.window_type == "inv": self.tooltipItem.SetInventoryItem(slot) def OverOutItem(self, tooltipItem): if None != tooltipItem: self.tooltipItem.HideToolTip() self.tooltipItem.ClearToolTip() def Close(self): self.ClearDictionary() self.slotList = [] self.titleBar = None self.titleName = None self.itemPrice = None self.slotGrid = None self.toolTip = None self.tooltipItem = None self.Hide() constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) def SetWidth(self, width): height = self.GetHeight() self.SetSize(width, height) self.board.SetSize(width, height) self.SetCenterPosition() self.UpdateRect() def SAFE_SetAcceptEvent(self, event): self.acceptButton.SAFE_SetEvent(event) def SAFE_SetCancelEvent(self, event): self.cancelButton.SAFE_SetEvent(event) def SetAcceptEvent(self, event): self.acceptButton.SetEvent(event) def SetCancelEvent(self, event): self.cancelButton.SetEvent(event) def SetText(self, text): self.textLine.SetText(text) def SetAcceptText(self, text): self.acceptButton.SetText(text) def SetCancelText(self, text): self.cancelButton.SetText(text) def OnPressEscapeKey(self): self.Close() return True add imports import constInfo import skill import nonplayer This is just a class, now you just have to call it itemQuestionDialog = uiCommon.ItemQuestionDialog() itemQuestionDialog.window_type = "inv" #for inventory itemQuestionDialog.window_type = "shop" #for shops itemQuestionDialog.count = ... drop MONEY itemQuestionDialog.Open(1, "", attachedMoney) drop ITEM itemQuestionDialog.Open(itemVNum, slotNumber) buy&sell ITEM itemQuestionDialog.Open(itemVNum, slotNumber, price)
  23. #FIRST YEAH Hi Guys, Just a Simple "python Security script". Just include the file in your root for example and import in prototype.py. Its really not a big deal. Somebody asked for it. And you have to have Python 2.7 Code: import subprocess import app import threading import os import time Evil_ProcessList = ["notepad++.exe"] Evil_FileNameList = [".sdsd",".asd",".asds"] class SuperUnsecureAndNotEnoughProtectionOfferingScript(object): def __init__(self): self.LoadSuperUnsecureSystem() def __del__(self): pass def LoadSuperUnsecureSystem(self): while 1: self.CheckForEvilFiles() self.CheckForEvilProcesses() def KillProcess(self, processname): try: os.system("taskkill /f /im %s" % processname) except: app.Exit() def DeleteFile(self, filename): try: os.remove(filename) except IOError: app.Exit() def CheckForEvilFiles(self): for file in os.listdir(os.getcwd()): for filename in Evil_FileNameList: if file.endswith(filename): self.DeleteFile(file) def CheckForEvilProcesses(self): for evil in Evil_ProcessList: if evil in subprocess.Popen("tasklist", stdout=subprocess.PIPE, shell=False).communicate()[0]: self.KillProcess(evil) if __name__ == '__main__': threading.Thread(target=SuperUnsecureAndNotEnoughProtectionOfferingScript, args=()).start()
  24. daradevil124

    python Metin2 Block Banword

    Open: root.eix & epk && uichat.py Find: Kod: if net.IsChatInsultIn(text): Change: Kod: if net.IsInsultIn(text): It extracts all known banwords from the file "insult.txt" in the "Locale_en" folder.