Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/17/20 in all areas

  1. Hi there devs, Its been a while since my last release and probably this will not change, but I had this guide in my head for like a year now. In my last ~2 years while I was working in the AE team various devs came and go, and this kind of guideline would have been a huge help and could prevent lots of errors. I have been in the dev scene for more than 10 years now and (as some of you may already noticed) one of my main interest has always been making more and more user friendly and complex UI objects/interfaces and along the road gathered tons of experience. You won't end up with another shiny system that you can use in your server this time by reading this article, but instead maybe I can prevent you from making windows that stays in the memory forever, opens infinite times, prevents other window's destruction, and many more. Who knows, maybe you will leave with some brand new never ever seen tricks that you can use in your future UIs. But first of all lets talk about some good2know stuff. UI layers Layers are root "windows", their purpose to hold all kind of interface windows while managing the z order of the windows (z order = depth level of the windows, which one is "above" the other). By default there are 5 layers (from bottom to top): "GAME": this is only used for the game window (game.py), and when you click on it the game will translate the click position to the map "UI_BOTTOM": this is used for shop titles "UI": this is the default layer, we would like to put most of our windows into this layer, like inventory, character window, messenger, pms, etc, so they can overlap each other "TOP_MOST": every window, that should always be in front of the player, so other windows would not overlap them from the lower layers, so for example the taskbar is placed in this layer "CURTAIN": this is for the curtain window, which is actually a black as a pit window, that is used to smooth the change from different introXX windows (like between login and charselect) This is the outest layer and goes before the other 4. So when the render happens, the 1st layer and its childs will be rendered first, then the 2nd layer, then the 3rd, etc, so by this we will get our comfy usual client layout. In the other hand, when we click, everything goes in reverse order, first the client will try to "pick" from the curtain layer's child windows (also in reverse order), then the top_most layer, etc. Ofc there is no layers beyond the game layer, so usually the "pick" will succeed there, and we will end up clicking on the map. UI windows Now lets talk a little bit about the parts of an UI window. It has a python object part and a c++ object part. When you create a basic Window (from the ui.py) basically 2 things happen: a python Window object is created first, then through the wndMgr.Register call a c++ CWindow object is created. These 2 objects are linked, in python the handle for the CWindow is saved in the self.hWnd variable, while in the CWindow the python object handle would be stored in the m_poHandler. What are these handles for? If you want to call a method on a window from python, you have to specify which window you want to perform that action on. Remember, the python part is just a "frontend" for the UI, the actual magic happens in the cpp part. Without python, its possible to create windows, but without the cpp part there is no windows at all. On the cpp part, we need the python object handle to perform callbacks, like notifying the python class when we press a key, or pressing our left mouse button. By default the newly created window will take a seat in one of the layers (if provided through the register method, otherwise it goes to the UI layer). In a healthy client we only put useful windows directly into a layer. For example you want to put your brand new won exchange window into the UI layer, but you don't want to put all parts of a window into the UI layer (for example putting the base window into the root layer then putting the buttons on it to the root layer too, then somehow using global coordinates to make it work). Instead, you want to "group" your objects, using the SetParent function. You may say that "yeah yeah who doesn't know this?", but do you know what actually happens in the background? The current window will be removed from its current parent's child list (which is almost never null, cus when you create it its in the UI layer, so the parent is the UI layer) and will be put into the end of the new parent window's child list. Why is it important, that it will be put into the end? Because it will determine the Z order of the childs of the window. For example if I create 2 ImageBox with the same size of image on the same position and then I set ImageBox1's parent before ImageBox2's parent, then I will only see ImageBox2, because that will be rendered after ImageBox1, because its position in the childList is lower than ImageBox2's. For normal window elements (like buttons) its very important, because after you set the parent of a window, you can't alter the z order (or rather the position in the childList) unless you use the SetParent again. No, you can't use SetTop, because its only for windows with "float" flags on it, which you only want to use on the base of your window (the root window that you put your stuff on it and use it as parent for most of the time). Window picking "Picking" is performed when we move the cursor. This is an important method, because this will determine the result of various events, for example the OnMouseOverIn, OnMouseOverOut, OnMouseRightButtonDown, etc. To fully understand it, you must keep in mind that every window is a square. Do you have a perfect circle image for a button? No you don't, its a square. Do you have the most abstract future window board design with full star wars going on the background? No, you DON'T. ITS A SQUARE. By default, a window is picked if: the mouse is over the window AND the window is visible (Shown) AND the window doesn't have "not_pick" flag set AND the window is "inside its parent's square" on the current mouse position, which means if the parent's position is 0,0 and it has a size of 10x10 and the window's position is 11, 0, the window is outside of its parent's square. This is really important to understand, lots of UI has fully bugged part because of ignoring this fact. I think every one of you already experienced it on some bad illumina design implementation, when you click on a picture, and your character will start to run around like a madman, because the game says that A-a-aaaaa! There is NO WINDOW ON THAT POSITION It is useful to use the not_pick flag whenever you can, for example on pure design elements, like lines and flowers and ofc the spaceships on the background. Lets say you have a size of 10x10 image that has a tooltip, and you have a window on it that has a size of 5x5. When the mouse is over the image, the tooltip will be shown, but if its over the 5x5 window, the tooltip won't appear, unless you set it to the 5x5 window too. But if you use the not_pick flag on the 5x5 window, the 5x5 window won't be picked and the tooltip would be shown even if the mouse is over the 5x5 window. Window deletion, reference counting, garbage collector, proxying The window deletion procedure starts on the python side, first the destructor of the python object will be called, then it will call the wndMgr.Destroy that deletes the c++ object. By default, we have to store our python object, or this time our python window, to make sour it doesn't vanish. Usually we do this via the interface module, like "self.wndRandomThing = myModule.RandomWindow()". But what is this? What is in the background? Python objects has reference count. Let me present it with the following example: a = ui.Window() # a new python object is created, and its reference count is 1 b = a # no new python object is created, but now b is refering to the same object as 'a', so that object has a refence count of 2 del b # b is no longer exists, so its no longer referencing to the newly created window object, so its reference count will be 1 del a # the newly created window object's reference count now 0, so it will be deleted, calling the __del__ method To be more accurate, del-ing something doesn't mean that it will be deleted immediately. If the reference count hits 0 the garbage collector (btw there is garbage collector in python if you didn't know) will delete it, and that moment the __del__ will be called. It sounds very handy isn't it? Yeeeeah its easyyyy the coder don't have to manage object deletion its sooo simple.... Yeah... But lets do the following: class stuff(object): def __del__(self): print "del" def doStuff(self): self.something = self.__del__ # here we could just simply do self.something = self too, doesnt matter a = stuff() a.doStuff() # and now you just cut your leg del a #you are expecting the "del" print, but that will never happen You may say " ? oh please who tf does something stupid like this? It SO OBVIOUS that its wrong whaaaaaaat????" But in reality, I could count on only one of my hand how many devs don't make this mistake. Even my codes from the past decade are bad according to this aspect, since I only realized this problem about a year ago, when I was working on the AE wiki. Even the yimir codes contain tons of this kind of errors, however there was definitely a smart man, who implemented the __mem_func__. Okay, I see that you still don't understand how is this possible to make this kind of mistake, so let me show you a real example: class myBoard(ui.Board): def __init__(self): super(myBoard, self).__init__() self.makeItRain() def __del__(self): super(myBoard, self).__del__() print "I want to break free. I want to breeaaaaaak freeeeeeeeeeee" def doNothing(self): pass def makeItRain(self): self.btn = ui.Button() self.btn.SetParent(self) self.btn.SetEvent(self.doNothing) #boom a = myBoard() del a # but where is the print? Thats not that obvious now right? What happens here? We create a myBoard object, which in the __init__ calls to the makeItRain func, which stores an ui.Button object, and sets the button to call for the myBoard class's doNothing function with the self object pointer in the OnLeftMouseButtonDown function, which means that the reference count will never be zero, because the btn referenced in the myBoard but myBoard is referenced in the btn but the btn is referenced in the.... so you know, its a spiral of death, that our best friend garbage collector can't resolve. Okay, but how to do it correctly? Lets talk about proxying. In python, proxies are weak references, which means that they don't increase reference count of an object, which is exactly what we need. #let me show this time the console output too class stuff(object): def __del__(self): print "del" >>> from weakref import proxy >>> a = stuff() #newly created object >>> b = proxy(a) #create weak reference to the new object (note that the weak reference object is also an object that stores the weak reference) >>> b #what is b? <weakproxy at 02DB0F60 to stuff at 02DBFB50> # b is a weakproxy object that refers to a which is a "stuff object" >>> del b # what if we delete b? # no "del" message, the stuff object is not deleted, because its reference count is still 1, because its stored in a >>> b = proxy(a) # lets recreate b >>> del a # now we delete the only one reference of the stuff object del # and here we go, we got the del message from __del__ >>> b # okay but whats up with b? <weakproxy at 02DB0F60 to NoneType at 7C2DFB7C> # because b is a weakproxy object, it won't be deleted out of nowhere, but it refers to a NoneType right now, because the stuff object is deleted (also note here that NoneType is also a python object :D) >>> if b: #what if I want to use b? ... print "a" ... Traceback (most recent call last): File "<stdin>", line 1, in <module> ReferenceError: weakly-referenced object no longer exists # in normal cases no need to trycatch this exception, because if we do everything right, we will never run into a deleted weakly-referenced object But how do we proxy something like self.doNothing? Actually, what is self.doNothing? self.doNothing has 3 parts: The first part is not that obvious, it has a base class pointer, which is points to myBoard. It has a class object pointer, that is basically "self". It refers to the current instance of myBoard. It has a function object pointer, called doNothing, which is located inside the myBoard class. And now we can understand ymir's ui.__mem_func__ class, which is exactly meant to be used for proxying class member functions: # allow me to reverse the order of the definitions inside the __mem_func__ so it will be more understandable class __mem_func__: def __init__(self, mfunc): #this happens when we write ui.__mem_func__(self.doSomething) if mfunc.im_func.func_code.co_argcount>1: # if the doSomething takes more than one argument (which is not the case right now, because it only needs the class obj pointer (which is the 'self' in the 'self.doSomething')) self.call=__mem_func__.__arg_call__(mfunc.im_class, mfunc.im_self, mfunc.im_func) #lets unfold the python object to the mentioned 3 parts else: self.call=__mem_func__.__noarg_call__(mfunc.im_class, mfunc.im_self, mfunc.im_func) #this will be called for the 'self.doSomething' def __call__(self, *arg): # this line runs whenever we call apply(storedfunc, args) or storedfunc() return self.call(*arg) class __noarg_call__: # this class is used whever the python object we want to proxy only takes one argument def __init__(self, cls, obj, func): self.cls=cls # this one I don't really get, we won't need the class object later also its not proxied, so its probably here to prevent delete the base class in rare cases self.obj=proxy(obj) # here we proxy the object pointer which is what really matters self.func=proxy(func) # and then we proxy the class func pointer def __call__(self, *arg): return self.func(self.obj) # here we just simply call the class function with the object pointer class __arg_call__: def __init__(self, cls, obj, func): self.cls=cls self.obj=proxy(obj) self.func=proxy(func) def __call__(self, *arg): return self.func(self.obj, *arg) # here we just simply call the class function with the object pointer and additional arguments Pros, cons, when to, when not to, why? Now you may ask that "Okay okay that sounds good, but why? What can this cause, how big the impact could be, is it worth to even bother with it?" First of all, you must understand that this is kinda equal to a memory leak. I would actually call these non-deleted windows as "leaking windows". Every time you warp, new and new instances will be generated from those objects, and ofc, one instance of a window means like about +50/100 instances, depending on the window complexity, how much childs it has. Usually these windows are at least remain in a Hide state, and hidden windows don't affect update and render time, but they will remain in the root layer, and may stack up depending on how much time the player warp. Still, the number of leaking root windows / warp is around 50-100, which is really not much for a linked list (the type of the childList). However, the memory consumption is much greater. One year ago AE had 10k leaking windows growth / warp. One base class (CWindow)'s size is 140 bytes, which means the memory growth is at least 1,3MB/warp and it does not contain the size of the python objects size for those windows, the linked_list headers and other necessary stuffs. After some hour of playing this can easily reach 100+MB of leaking memory. On worse cases the old windows are not even hidden, and on rewarp players may see multiple instances of the mentioned windows, like double inventory, double messenger window, etc. In this cases those windows can affect the render and update times too. Pros: your code will now work correctly regarding to this topic you may gain some performance boost you may find stuff in your client that even you don't know about you may find enough kebab for a whole week you can save kittens by removing leaking windows and proxying objects you can build my respect towards you and your code and you can even calculate the actual number using the following formula: totalRespect = proxysUsed * 2 + ui.__mem_func__sUsed - proxysMisused * 3.511769 - ui.__mem_func__sMisused * pi - 666 * ui.__mem_func__sNotUsed Cons: depending on how bad the situation is and how skilled you are, the time needed to find and fix everything could be vary, from few hours to several days if you are satisfied with your client as it is right now there is not that huge benefit regarding how much time it could take to fix all the windows Detecting leaking windows DON'T BLOCK THE BACKEND!! At first glance python code looks like you are invincible, you can do whatever you want, you are not responsible for the performance because python has a bottomless bucket full of update/render time and if the game freeze sometimes its definitely not your fault, the game is just BAD. Lets talk about OnUpdate and OnRender, whats the difference, when they are called, what to and what not to put in there. So as their name implies, they are called from the binary every time it performs an Update or Render action. In Update, the binary performs non-rendering actions, like updating the positions of walking characters, updating window positions, and every kind of calculation that is necessary for a render action, to make every kind of data up to date, reducing the cpu operations required for render as much as possible while keeping track of the time. In Render, the binary performs non-updating actions, calling only directx device rendering methods that builds up a picture of the current world, including the UI, using the current, up to date positions. If you try to count the number of stars in our galaxy to accurately simulate your star wars going on in the background of your inventory window, no matter where you do it, (render or update) you will start hurting the game. For example if you have an ui with tons of elements, generating all the elements under one tick can cause HUGE client lag. In my AE wiki, I only load one or two entity for the current page under an update tick, so it will still load quickly, but won't block the game. Notice that doing something like this is an UPDATE operation. Lets be nice and don't interrupt our rendering whit this kind of stuff. You should only use calls to render functions inside the OnRender, for example like in the ui.ListBox class, where we actually ask the binary to render a bar into our screen. Around 20% of time spent in an Update tick was consumed by the UI update (calling to a python object through the api is kinda slow by default) in the AE client one year ago. Removing the rendering and updating of the gui for testing purposes actually gave a huge boost to the client, so who knows, maybe one day someone will make a great client that runs smooth on low end pcs too. Answer the api calls if expected! Some calls from the binary like OnPressEscapeKey expects a return value. Of course if no return value is provided the binary won't crash, but can lead to weird problems and malfunctions. For example, the OnPressEscapeKey expects non-false (non-null) if the call was successful on the window, so it will stop the iteration from calling to lower level windows. So if you expect from the game to close only one window per esc push, you have to return True (or at least not False or nothing). There was a crash problem related to this in one of my friend's client recently. In his ui.EditLine class the OnPressEscapeKey looked something like this: def OnPressEscapeKey(self): if self.eventEscape(): return True return False In the original version it just return True unrelated to the eventEscape's return value. This looks fine at first glance, but if for some reason the self.eventEscape doesn't return anything and if (like the garbage collector decides to run or its disabled) the layer's or the parent's child lists changes in the binary because one or more windows are destroyed under the OnPressEscapeKey procedure and the iteration trough the child list is not interrupted, the binary will start to call invalid addresses thinking that they are existing windows, calling OnPressEscapeKey on them, resulting hardly backtraceable crashes. Closing words I can't highlight out enough times how much I like and enjoy creating new kind of UI stuff, (like animating windows that you may saw on my profile recently (click for the gif)) and because of this if you want to discuss a theory about new UI stuffs or mechanics of already existing UI stuffs feel free to do it in the comment section instead of writing me a pm to help others. Also this time (unlike for my other topics) I would like to keep this guideline up to date and maybe adding new paragraphs if I find out another common mistake/misunderstanding. DEATH TO ALL LEAKING WINDOW!!!!!4444four
    27 points
  2. M2 Download Center Download Here ( Internal ) A small fix for those who value details. The first picture presents the problem, while the next one presents the solution. Download: [Hidden Content]
    8 points
  3. Greetings from pizzaland, my dudes! ?? I'm "internationally known and locally respected" with the alias of MACRO; I'm a huge IT fan, I started as a young weirdo stealing old hardware from rubbish dumps at night, then testing the components and assembling the good ones, making "frankenstein-looking-like" home servers to keep my files safe on RAID and do my weirdo stuff (lots of testing and lots of blowing up), closed in my attic at night. I also offered IT support to my school friends for a little money, using those "reconditioned" components to fix their terminals, that made me save the amount of money I needed to buy me latest generation hardware for my pc as well as a used DELL PowerEdge server (I have a thing for DELL), that made me deeply enthusiast on real server managing stuff, I was fascinated about the virtualization and spent a lot of time playing around with VmWare in order to become familiar with all its potentialities: that made me go "MAMMA MIA!" I enjoyed Metin2 on my teens, it was a lovely back in time since there wasn't all that "bullshit" that we have today and people was kinda nicer; it was more about chilling around. I always was a full buff shaman because I'm a comfy one and my role is definetely the supporter. I remember starting one lame pserver on a "frankenstein-looking-like" machine (closed, just for me and a friend of mine) back in the days, with a .vdi image of the 2011 server files: the "franzi" ones; we played on it for like a year straight every night feeling like two gods in a desert planet: modding items, exploring the maps, duelling, spawning A TON of mobs just to make the thing crash and mainly chatting and enjoying our shiny modded characters: the comfy way you kno! I'm back as an adult now, I'm a 22yrs old financially stable weirdo living in it's own house; and I'm here because I truly would like to master my knowledge about the managing of both the server side and client side of Metin2 pserver because I'll like to pull out one of my never fulfilled desires: open my own pserver to the public, running on machines I have physical contact with. My vision about this is a fully clean experience with no bullshit. I'm not, as we say in Italy: "One that likes the baby food ready"; meaning that I'm not a person who avoids the fatigue and wants all the stuff "ready to eat", like a baby. If the effort is related to a personal archievement I'm in first line doing wathever I have to do with a big ass smile on my face! My knowledge in IT is completely self-taught, and it's propelled by pure passion, so there is literally nothing that doesn't amuse me when it comes to "make the thing work". For this reason I'm in no hurry with my project, as I said my schedule is to first master my knowledge, messing things up with some tests and deeply understand how this systems work. Again, as we say in Italy: "Those who do it themselves, do it like three people" (If you want something done, do it by yourself); nothing more true than this, especially when you are a meticulous autistic like me! This place is a well of knowledge and I'm glad to have the chance to dive into it! Many pizza-flavored greetings from Italy! See you around! (Wash you hands!) MACRO
    2 points
  4. Search for: if (!kTextFileLoader.SplitLineByTab(i, &kTokenVector)) continue; Add after: if (kTokenVector.size() != MONSTER_CARD_MAX_NUM) { Tracef("CPythonPlayer::LoadMonsterCard(%s) - Strange Token Count [Line:%d / TokenCount:%d]\n", c_szFileName, i, kTokenVector.size()); continue; } for (auto & token : kTokenVector) token.erase(std::remove_if(token.begin(), token.end(), isspace), token.end()); Search for: int pkGroup = std::stoi(kTokenVector[MONSTER_CARD_GROUP]); int pkIndex = std::stoi(kTokenVector[MONSTER_CARD_INDEX]); int pkVnum = std::stoi(kTokenVector[MONSTER_CARD_VNUM]); int pkType = std::stoi(kTokenVector[MONSTER_CARD_TYPE]); int pkMap1 = std::stoi(kTokenVector[MONSTER_CARD_MAP1]); pkMap2 = std::stoi(kTokenVector[MONSTER_CARD_MAP2]); pkMap3 = std::stoi(kTokenVector[MONSTER_CARD_MAP3]); Replace with: [Hidden Content] And change # to ## from .txt file or delete them.
    2 points
  5. Or better, don't use this shitty thing.
    2 points
  6. Nice one, but i'll stay with mine.
    2 points
  7. [Hidden Content] Let me know when you want to buy the system for full support.
    2 points
  8. Hi there, I'm sure you've found yourself into the situation where logs grow out of proportion and maybe fill your disk, especially if your metin2 server binary went into a loop of some kind. Or maybe your nginx or mysql logs grow so big that it takes 10 seconds just to open them. Of course you could just delete them and let them recreated, but a much cleaner solution is to let the syslog daemon keep your logs neatly ordered for you. For example, we can rotate the current log to a backup file (such as myserver.log.1) once it reaches a certain size, or we can do it every day, or every week; we can even use both criteria at the same time. Once the criteria is met for a second time, myserver.log will become myserver.log.1 and myserver.log.1 will become myserver.log.2, and so on. We can keep as many backups as we want too, and the oldest file will get deleted once rotation time comes. This ensures that the logs will never take more space on disk than the size limit we set, multiplied by the number of log files to keep. So let's say we want to rotate our metin2 server logs. First take a look at /etc/newsyslog.conf to see how it looks like. You can write directly to this file, but it would get overwritten when upgrading FreeBSD, so let's do this the proper way and create a new file called /etc/newsyslog.d/<application>.conf Each line corresponds to a log and each value is separated by a TAB: <location of the log file> <user:group> <mode> <logs to keep> <size limit> <time> <flags> <pid> Where user:group is the user owning the log file; mode the permissions set (such as 644); size limit is the size in kilobytes at which the log will be automatically rotated; time is a specially formatted string defining a time of the day, month or week for the logs to be rotated; flags define whether we want to compress the old logs and other options; and pid the path to the process id we have to signal. If this means nothing to you don't worry, I will give you a couple of ready made examples right now. Example A > Rotate game logs every time they grow to 4MB in size, keep 6 old logs, and compress them with gzip: ee /etc/newsyslog.d/metin2.conf /home/metin2/channel1/game1/syslog metin2:metin2 644 6 4096 * CZ /home/metin2/channel1/game1/pid.game /home/metin2/db/syslog metin2:metin2 644 6 4096 * CZ /home/metin2/db/pid.db (you can repeat this for each core) Example B > Rotate MySQL logs every monday at 4am, keep 3 old logs, and compress them with gzip: ee /etc/newsyslog.d/mysql.conf /var/db/mysql/myhostname.err mysql:mysql 644 3 @W1D4 * CZ /var/db/mysql/myhostname.pid Example C > Rotate NGINX logs every day at midnight, do not keep any old log: ee /etc/newsyslog.d/nginx.conf /var/log/nginx-access.log www:www 644 0 @T00 * C /var/run/nginx.pid /var/log/nginx-error.log www:www 644 0 @T00 * C /var/run/nginx.pid How do we know if we did it properly? Well, the system will send us a message if something is wrong, but only if we set a mail address for root mail to be forwarded to. By default FreeBSD sends error messages to the root account which we can read in the console using the "mail" command but since this is quite primitive let's have all mail sent to our e-mail: ee /etc/aliases Below this text: # Pretty much everything else in this file points to "root", so # you would do well in either reading root's mailbox or forwarding # root's email from here. Add this line, replacing the bracketed text with your email address: root:<your email here> Save and exit and then enter this command in the shell: newaliases Ready! Now you should receive system email in your own mailbox.
    2 points
  9. M2 Download Center Download Here ( Internal ) Download scan granny 2.9 video(before n after):
    2 points
  10. M2 Download Center Download Here ( Internal ) Two versions of this armor without caps. One version is with one shoulder and the other with two shoulders. In general, the shoulder is slightly modified compared to the original. Download: [Hidden Content]
    1 point
  11. M2 Download Center Download Here ( Internal ) Hey there, I have an Halloween gift for you all. i have been working for a few hours on official like element image on target window(See screenshots below). When you click on a mob if it is defined as elemental, it will open an element image in addition to the target window. Don't forget to hit the like button! (C) Metin2 guild wars - coded by [GA]Ruin - 27/10/2017 (I create custom metin2 systems in c++/python. if you want a custom system send me a pm and we can talk over skype). Let's begin! Server Side: Open service.h, add in the end: #define ELEMENT_TARGET Open char.cpp, search for else { p.dwVID = 0; p.bHPPercent = 0; } add below: #ifdef ELEMENT_TARGET const int ELEMENT_BASE = 11; DWORD curElementBase = ELEMENT_BASE; DWORD raceFlag; if (m_pkChrTarget && m_pkChrTarget->IsMonster() && (raceFlag = m_pkChrTarget->GetMobTable().dwRaceFlag) >= RACE_FLAG_ATT_ELEC) { for (int i = RACE_FLAG_ATT_ELEC; i <= RACE_FLAG_ATT_DARK; i *= 2) { curElementBase++; int diff = raceFlag - i; if (abs(diff) <= 1024) break; } p.bElement = curElementBase - ELEMENT_BASE; } else { p.bElement = 0; } #endif open packet.h, search for: } TPacketGCTarget; add above: #ifdef ELEMENT_TARGET BYTE bElement; #endif Client side: open locale_inc.h, add in the end: #define ELEMENT_TARGET open packet.h, search for } TPacketGCTarget; add above: #ifdef ELEMENT_TARGET BYTE bElement; #endif open PythonNetworkPhaseGame.cpp, look for: else if (pInstPlayer->CanViewTargetHP(*pInstTarget)) replace below with the following: #ifdef ELEMENT_TARGET PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetHPTargetBoard", Py_BuildValue("(iii)", TargetPacket.dwVID, TargetPacket.bHPPercent, TargetPacket.bElement)); #else PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetHPTargetBoard", Py_BuildValue("(ii)", TargetPacket.dwVID, TargetPacket.bHPPercent)); #endif open PythonApplicationModule.cpp, look for #ifdef ENABLE_ENERGY_SYSTEM add above: #ifdef ELEMENT_TARGET PyModule_AddIntConstant(poModule, "ENABLE_VIEW_ELEMENT", 1); #else PyModule_AddIntConstant(poModule, "ENABLE_VIEW_ELEMENT", 0); #endif open game.py, look for def SetHPTargetBoard(self, vid, hpPercentage): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.Show() replace with: if app.ENABLE_VIEW_ELEMENT: def SetHPTargetBoard(self, vid, hpPercentage,bElement): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.SetElementImage(bElement) self.targetBoard.Show() else: def SetHPTargetBoard(self, vid, hpPercentage): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.Show() open uitarget.py, look for import background add below: if app.ENABLE_VIEW_ELEMENT: ELEMENT_IMAGE_DIC = {1: "elect", 2: "fire", 3: "ice", 4: "wind", 5: "earth", 6 : "dark"} look for: self.isShowButton = False add below: if app.ENABLE_VIEW_ELEMENT: self.elementImage = None inside Destroy method, look for: self.__Initialize() add below: if app.ENABLE_VIEW_ELEMENT: self.elementImage = None inside ResetTargetBoard method, look for: self.hpGauge.Hide() add below: if app.ENABLE_VIEW_ELEMENT and self.elementImage: self.elementImage = None look for : def SetElementImage(self,elementId): add above: if app.ENABLE_VIEW_ELEMENT: def SetElementImage(self,elementId): try: if elementId > 0 and elementId in ELEMENT_IMAGE_DIC.keys(): self.elementImage = ui.ImageBox() self.elementImage.SetParent(self.name) self.elementImage.SetPosition(-60,-12) self.elementImage.LoadImage("d:/ymir work/ui/game/12zi/element/%s.sub" % (ELEMENT_IMAGE_DIC[elementId])) self.elementImage.Show() except: pass Compile server, client source and root pack and that's it! Enjoy! Happy halloween!
    1 point
  12. Hey, In different Games always Ninja's have the ability to hide example in Wow when Rogue hide the Monsters losing their aggro, but in Metin2 when you hide with the Skill Eunhyung the Monster still have aggro on you, this seems little wrong, Hided and Monster still can reach you? Maybe because you can use Poison / Bleeding / Fire that make this little bit difficult, but i think i come up with a solution. I think the only part that missing is when you clean the Target from the Monster to move again back but is not really necessary. * I Added also for GMs in /in command the function. In the Tutorial bellow, you can find the Function ForgetMyAttacker with my improvements.
    1 point
  13. M2 Download Center Download Here ( Internal ) Hi there. While cleaning out "my closet", I found this thing I developed between 2014-2015 - maybe(?) - for my, at that moment, server. Since it's now closed, and I won't use it, I'm sharing it with you guys. Note: Didn't do the scrollbar, wasn't needed for me, so yeah. Now, let's start with opening your locale_game.txt and adding these lines: QUESTCATEGORY_0 Main Quests QUESTCATEGORY_1 Sub Quests QUESTCATEGORY_2 Collect Quests QUESTCATEGORY_3 Levelup Quests QUESTCATEGORY_4 Scroll Quests QUESTCATEGORY_5 System Quests Alright, now find your characterwindow.py (uiscript?) and you can either comment Quest_Page children or simply remove them all. Moving on to your interfaceModule.py find this line self.BINARY_RecvQuest(index, name, "file", localeInfo.GetLetterImageName()) and replace it with self.wndCharacter.questCategory.RecvQuest(self.BINARY_RecvQuest, index, name) Ok, then we are at the most, let's say, difficult part of this. Open your uiCharacter.py and just as you did in your characterwindow.py, remove or simply comment any single line related to quests. You can just search for these vars: self.questShowingStartIndex self.questScrollBar self.questSlot self.questNameList self.questLastTimeList self.questLastCountList Once you did that, you just: # Find these lines self.soloEmotionSlot = self.GetChild("SoloEmotionSlot") self.dualEmotionSlot = self.GetChild("DualEmotionSlot") self.__SetEmotionSlot() # And add the following import uiQuestCategory self.questCategory = uiQuestCategory.QuestCategoryWindow(self.pageDict["QUEST"]) # Find this def OnUpdate(self): self.__UpdateQuestClock() # Replace it with def OnUpdate(self): self.questCategory.OnUpdate() And we're done with the client-side. I attached some extra elements needed (such as the main python file (uiQuestCategory.py) and some image resources). Remember to edit the path linked to these images in that file. For the server-side... Well, screw it, uploaded it too. Too lazy to write. It has only a new quest function (q.getcurrentquestname()) and a few things to add in your questlib.lua. Btw, not sure if you have it, but if not, just add this extra function in ui.Button() (ui.py - class Button). def SetTextAlignLeft(self, text, height = 4): if not self.ButtonText: textLine = TextLine() textLine.SetParent(self) textLine.SetPosition(27, self.GetHeight()/2) textLine.SetVerticalAlignCenter() textLine.SetHorizontalAlignLeft() textLine.Show() self.ButtonText = textLine #Äù½ºÆ® ¸®½ºÆ® UI¿¡ ¸ÂÃç À§Ä¡ ÀâÀ½ self.ButtonText.SetText(text) self.ButtonText.SetPosition(27, self.GetHeight()/2) self.ButtonText.SetVerticalAlignCenter() self.ButtonText.SetHorizontalAlignLeft() Forgot the source part, fml, here it is. Add it to your questlua_quest.cpp. int quest_get_current_quest_name(lua_State* L) { CQuestManager& q = CQuestManager::instance(); PC* pPC = q.GetCurrentPC(); lua_pushstring(L, pPC->GetCurrentQuestName().c_str()); return 1; } void RegisterQuestFunctionTable() { luaL_reg quest_functions[] = { { "getcurrentquestname", quest_get_current_quest_name}, { NULL, NULL } }; CQuestManager::instance().AddLuaFunctionTable("q", quest_functions); } Now, finally, have fun and bye!
    1 point
  14. Hey, I want to share a fix about the SKILL_MUYEONG, Official fixed this before some months ago, but nobody care in such details so we still have the same issue in our servers. The SKILL_MUYEONG is still attacking while you riding but doesn't make any damage. Preview with Fixed SKILL_MUYEONG while you riding: [Hidden Content]
    1 point
  15. This quest was made by when the only server that got it was karma2. Anyways it got leaked so i might release it full. It works on any game versions. Regens , group and quest in attachment. The only problem is , it`s in romanian language, but in 15 min u can translate it. MOB PROTO ( For shaman only damage) ITEM PROTO Snow.zip
    1 point
  16. M2 Download Center Download Here ( Internal ) Description: Today's New Year's eve, and I felt that I should help the people who can't compile the gamecore/db on FreeBSD, because of the library mess that's usually going on - most people compile DevIL, mysqlclient etc from the ports collection, as this takes a lot of time, hardware resources, and even knowledge for some. Given this situation, I've decided to compile from the official sources of all the required libraries, and tidy a bit up the all lib-includes files, by putting them all into the Extern folder (link below). This allows to brush away some stuff from the Server folder: (Yay, it's so clean and shiny ) [Hidden Content] I've also changed the makefiles according to the needs (link also below). This pre-done stuff should easy the process of compilation a lot for others, not to mention that it should work on all branches (I'm gonna test this next year lol ) Usage: Decompress your Server folder from your favourite branch, and upload it to a FreeBSD machine, which has gmake, makedepend and python installed. Nothing more is needed (except for gcc/g++ ofc). Upload the Extern.tgz archive into the same folder where you put the Server folder, and extract it. Patch the Makefiles in the Server folder with the ones from Makefiles.zip. Compile using gmake / gmake all / gmake game / gmake db from within the Server folder. Video (da n00b prooph part): Note: my English pronounciation isn't that great; I'll be adding subtitles asap. Downloads: Extern.tgz: [Hidden Content] Makefiles.zip: [Hidden Content] Happy New Year!
    1 point
  17. PROBLEM SOLVED! Thank you @Mali61 ! ♥
    1 point
  18. old open function: def ToggleDragonSoulWindow(self): if False == player.IsObserverMode(): if app.ENABLE_DRAGON_SOUL_SYSTEM: if False == self.wndDragonSoul.IsShow(): if self.DRAGON_SOUL_IS_QUALIFIED: self.wndDragonSoul.Show() else: try: self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_UNQUALIFIED) self.wndPopupDialog.Open() except: self.wndPopupDialog = uiCommon.PopupDialog() self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_UNQUALIFIED) self.wndPopupDialog.Open() else: self.wndDragonSoul.Close() new: def ToggleDragonSoulWindow(self): if False == playerm2g2.IsObserverMode(): if False == self.wndDragonSoul.IsShow(): if app.ENABLE_DS_PASSWORD: self.wndDragonSoul.Open() else: self.wndDragonSoul.Show() as you can see they removed qualified shit. so you can do it too and char_dragonsoul.cpp: //Find bool CHARACTER::DragonSoul_IsQualified() const { return FindAffect(AFFECT_DRAGON_SOUL_QUALIFIED) != NULL; } ///Change bool CHARACTER::DragonSoul_IsQualified() const { return true; }
    1 point
  19. @ElRenardo I search it, and found it finally: Here, give him a thanks. Thank you Tashigimaru
    1 point
  20. Wtf? Why would you need to do that? Just change the keys in your binary and your packer, build your binary, repack your data files and you are fine. No need to change every time you compile.
    1 point
  21. wtf enjoy with bugs guys!
    1 point
  22. Hey Tatsumaru, Thanks for the great work you do correcting graphical aspects of the game. I don't know if you already saw the female warrior holding a fishing rod. You certainly have a lot of work to do, but there's always more ! Thanks again !
    1 point
  23. Thank you last problem The yang is out From which file can i change the coordinates
    1 point
  24. 1 point
  25. M2 Download Center Download Here ( Internal ) Hello There. I publish here this system i hope that this help you a bit with this you can hide your costume if you dont like it (if I forgot something just say it ) (this system is not complete yet you can hide only your costume no hairstyle,sash,weapon) (This system is not mine! i just found the source function and made the python codes and quest)
    1 point
  26. Thank you for the update! Can it be that something is missing on the tutorial? My Client close after login and my syserr is empty..
    1 point
  27. There you go, uiCharacter.py and characterwindow.py for you to compare with yours. characterwindow.py uicharacter.py
    1 point
  28. M2 Download Center Download Here ( Internal )
    1 point
  29. Wow! Thank you Maso! ? I recently made plenty of python windows full of memleaks. Nice to know. ?
    0 points
  30. hello, i have a question. im new to binary editing and i wanted to know how i can change extension to root? thanks
    0 points
×
×
  • 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.