Jump to content

Johnny69

Inactive Member
  • Posts

    83
  • Joined

  • Last visited

  • Days Won

    5
  • Feedback

    0%

Posts posted by Johnny69

  1. Good job.

     

    One sugestion: Use a BYTE for all filters or a 16 bits type (if it's not enough). You can easly set on every bit of the variable a flag value (0 = not set, 1 = set) and it's more optimized and easier to store in config.

     

    spacer.png

    • Love 1
  2. Are you sure your db port is in written in firewall and can be accesed by localhost only  ?

    Those headers you wroted does not exist in game->db connection so my guess is that somebody is sending random packets in your db.

     

    There is a fix in source code (CPeerBase::Accept) for the problem above but I recommend to add that port in firewall too.

  3. Why you reset the position in stack to 0 on game.py ?

    This will reset the chat message to 32 messages back (if the stack is full, first message you typed anyway) and a user actualy need his last message, not 32 messages ago message.

    • Love 1
  4. As I said in README file, align it wasn't done.

    I had a little free time today and I did the align too: (sorry for gif inspiration)

    https://metin2.download/picture/naEcD4QuxZVFb2AQM37Odaq5e07Lgds8/.gif

     

    If something is wrong with the code please send me a private message or reply in this topic and I will fix it.

     

    New link:

    This is the hidden content, please

     

    PS: Replace the whole code because it has small changes and they are necessarily.

    • Metin2 Dev 15
    • Good 1
    • Love 1
    • Love 7
  5. Ymir developers are kind of stupid (or at least the ones that work with metin2).

    I saw some code from the last months in root and binary and it's bad written, without logic.

    If is that wrong in client side imagine how it's like on server side.

     

    They only thing I think about those function splited is that they probably wanted to make the functions shorter ?

     

    • Lmao 1
    • Love 1
  6. 13 hours ago, xP3NG3Rx said:

    If you place a text below of the textline from its height, where will it shown?

    For example you have this text object:

    self.text1.SetPosition(30, 36) self.text1.SetText("This is a\ntext just to\nbe sure it\nworks.") self.text1.SetLineHeight(20)

    
    self.text1.SetPosition(30, 36)
    self.text1.SetText("This is a\ntext just to\nbe sure it\nworks.")
    self.text1.SetLineHeight(20)

    And another one like this way:

    self.text2.SetPosition(30, self.text1.GetPosition()[1]+5) self.text2.SetText("This one is good")

    
    self.text2.SetPosition(30, self.text1.GetPosition()[1]+5)
    self.text2.SetText("This one is good")

     

     

    I'm guesing you are talking about GetLocalPosition(). That function return rect left and top (left top corner).

    The right code it will look like this:

    		setYPosition = self.text1.GetLocalPosition()[1]
    		setYPosition += self.text1.GetLineHeight() * self.text1.GetTextLineCount()
        
    		self.text2.SetPosition(20, setYPosition)

    Or you can use GetTextSize() function like this:

    		self.text2.SetPosition(20, self.text1.GetLocalPosition()[1] + self.text1.GetTextSize()[1])

     

  7. If you split only by "\n" and not "\\n" you won't need to add that check for editline.

    Also I know default open file function from python 2.7 escape \n automaticaly but you can fix the \n in two ways: (I'm talking about locale_game / locale_interface)

    1. replace all "\\n" in line with "\n"

    2. open the file with codecs.open and encoding "string_escape"

     

    One ideea though for your code: split the code where the text is initialized and after this save only the positions where \n was in a vector, after that in Render function you can use the position vector to rearange the text y position. Something like this (https://metin2.download/picture/f9LxxwZljyoXvU1nuSq3rwgoHx7xQYov/.png)

     

    PS: I don't know how official did it but they seem stupid ?

     

    Good job ?

    • Metin2 Dev 1
    • Not Good 1
    • Good 2
    • Love 2
  8. 31 minutes ago, masodikbela said:

    This is not a problem, because if GameWindow is not leaking (and also the button class itself is not leaking) the button will be deleted after the deletion of GameWindow, so there is no need to do xy = None or del xy in the __del__ method. Its generally not necessary at all, the reference number won't increase by setting parent of a window, it increases when you save them into a variable of a class or into a global var.

    Here is an example from the python command line:

    >>> class stuff1(object): ... def __del__(self): ... print "del1" ... >>> class stuff2(object): ... def __del__(self): ... print "del2" ... def __init__(self): ... self.something = stuff1() ... >>> a = stuff2() >>> del a del2 del1 >>>

    
    >>> class stuff1(object):
    ...     def __del__(self):
    ...             print "del1"
    ...
    >>> class stuff2(object):
    ...     def __del__(self):
    ...             print "del2"
    ...     def __init__(self):
    ...             self.something = stuff1()
    ...
    >>> a = stuff2()
    >>> del a
    del2
    del1
    >>>

     

     

    Yeah, you are right. I saw that shit that I said with the buttons at some server and I thought they are created in game.py.

    It was something like: "import test" in game.py

    and test.py with this content like this:

    spacer.png

     

  9. Very usefull if you don't want memory leak (at least from python side).

    Also you can mention that objects created with no parent need to be deleted manually. (I saw some people creating buttons and stuff directly from game.py and never setting a parent or deleting them).

    Good job. ?

  10. Try it like this:

        long long playerOfflineYang = 0;
        long long playerOfflineWon = 0;
    
    	// Add LIMIT 1
        SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT collected_yang, collected_won"));
        SQLResult * pRes = pkMsg->Get();
    
        if (pRes->uiNumRows > 0){
            MYSQL_ROW row = mysql_fetch_row(pRes->pSQLResult);
            if(row)
    		{
    			str_to_number(playerOfflineYang, row[0]);
    			str_to_number(playerOfflineWon, row[1]);
            }
        }

     

  11. Oh, I don't think opening a file on actions like damage or get gold is very good for the game.

    You better use a direct query if you don't know how to cache the data.

    I think a direct query will be way less time consuming and better for the server.

×
×
  • 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.