Jump to content

Vanilla

Developer
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    58
  • Feedback

    0%

Posts posted by Vanilla

  1. It's nice to see people contributing but the circumstances around this are rather sad ?

    Either way I just changed a bit on the code. In this case you'd use smart pointers. If you don't have the most recent std you might wanna swap unique_ptr with auto_ptr in my example.

    Also there's no sense in formatting a string with.. well, no format. You can just go ahead and directly use the already finished string.

    And there's one thing: You might wanna get into trouble when running in test server since literally everyone is a gm during this. It'll block you from trading etc... So I made a check for test_server.

    And lastly I highly recommend not using queries for this. We already have a gm privilege management. Why don't we use the different stages of GM and restrict those? Like e. g. lower GM rank may not be allowed to trade while higher staff can do. This would eliminate a lot of queries since.. yeah, you're going to put unnecessary load if you're running a query every time one of these functions trigger. Might as well either cache the result in the player instance and fetch it once it's already stored ooooor you can, like I said above, just go ahead and use the existing privilege management.

    Oh and one tiny thing: The query states utf8mb4 which is indeed quite nice... but it doesn't make sense to specify this and then create a table with latin1. I changed that, too.



    Open Service.h

    //add:

    #define ENABLE_GAMEMASTER_RESTRICTION

    open exchange.cpp

    // Search:

    if (victim->IsBlockMode(BLOCK_EXCHANGE))

    // add:

    #ifdef ENABLE_GAMEMASTER_RESTRICTION

    if (!IsGM())

    {

    if (!test_server && victim->GetGMLevel() != GM_PLAYER)

    {

    ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't trade with a Game Master"));

    return false;

    }

    }

    if (!test_server && IsGM())

    {
    std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT * FROM gamemaster_restriction"));

    SQLResult * pRes = pMsg->Get();

    if (pRes->uiNumRows)

    {

    MYSQL_ROW row;

    while ((row = mysql_fetch_row(pRes->pSQLResult)))

    {

    DWORD datos = 0;

    str_to_number(datos, row[0]);

    if (GetPlayerID()==datos)

    {

    ChatPacket(CHAT_TYPE_INFO, "You don't have permission to do this");

    return false;

    }

    }

    }

    }

    #endif

    open char_item.cpp

    //search:

    bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

    //add:

    #ifdef ENABLE_GAMEMASTER_RESTRICTION

    if (!test_server && IsGM())

    {
    std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT * FROM gamemaster_restriction"));

    SQLResult * pRes = pMsg->Get();

    if (pRes->uiNumRows)

    {

    MYSQL_ROW row;

    while ((row = mysql_fetch_row(pRes->pSQLResult)))

    {

    DWORD datos = 0;

    str_to_number(datos, row[0]);

    if (GetPlayerID()==datos)

    {

    ChatPacket(CHAT_TYPE_INFO, "You don't have permission to do this");

    return false;

    }

    }

    }

    }

    #endif

    open cmd_general.cpp

    //Search:

    ACMD(do_click_safebox)

    // add:

    #ifdef ENABLE_GAMEMASTER_RESTRICTION

    if (!test_server && ch->IsGM())

    {
    std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT * FROM gamemaster_restriction"));

    SQLResult * pRes = pMsg->Get();

    if (pRes->uiNumRows)

    {

    MYSQL_ROW row;

    while ((row = mysql_fetch_row(pRes->pSQLResult)))

    {

    DWORD datos = 0;

    str_to_number(datos, row[0]);

    if (ch->GetPlayerID()==datos)

    {

    ch->ChatPacket(CHAT_TYPE_INFO, "You don't have permission to do this");

    return;

    }

    }

    }

    }

    #endif

    add player sql.

    SET NAMES utf8mb4;

    SET FOREIGN_KEY_CHECKS = 0;

    -- ----------------------------

    -- Table structure for gamemaster_restriction

    -- ----------------------------

    DROP TABLE IF EXISTS `gamemaster_restriction`;

    CREATE TABLE `gamemaster_restriction` (

    `gamemaster` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',

    PRIMARY KEY (`gamemaster`) USING BTREE

    ) ENGINE = MyISAM CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

    SET FOREIGN_KEY_CHECKS = 1;

    [/CODE]
    • Love 1
  2. there are a few options you can choose from:

    - Set a timer once taking/dealing pvp damage and block mount/unmount during this time (probably only mounting because people might annoy you and block you from unmounting)

    - Check if the player is using skills etc. while issuing the mount command (there are indeed functions present and you can check if the character is actually using a skill and block mounting if that's the case)

    - Set a short timer after mount/unmount on which you cannot use skills or deal dmg in pvp

     

    One thing I'd also suggest: Disable damage and knockback/fall when mounting for pvp. That's also a big change preventing people from annoying other players with their horses.

  3. 32 minutes ago, Kafa said:

     

    beep beep boop beep

     

    beep.

     

    (translates to: are you a gril ?

    beep beep beep boop boop beep bopp

     

    beep beep beep. boop. beep boop beep.

     

    (translates to: locale_find: LOCALE_ERROR: "beep beep beep boop boop beep bopp beep beep beep. boop. beep boop beep.")

     

    Let's stick to our newest addition to our collection. Neurooooooooooooooooooooo *dramatic music plays here*

    • Lmao 2
  4. 1st make sure you always use the correct libraries. Your dev system is freebsd 12.1 32 bit, your production enviroment is 12.1 64 bit. If you install cryptopp via pkg on your production system you'll also get the 64 bit libraries, NOT 32 bit. Your 32 bit application cannot use these libraries.

    2nd I highly recommend you using rpath as a linker option to specify a directory where you load your libraries from (e. g. /usr/local32/metin2).

    3rd After building your game db, run ldd for both of them. Doing so will reveal all the locations of your libraries on the dev system. You can just download and upload them on your production server in the correct direcoty (see rpath).

    4th Your game won't start without the correct libs to load. Obviously you cannot login if the server doesn't even start

    5th Your problem may have occured now due to the fact that your libs have changed after upgrading. Remember: always keep the libs you need in sync.

     

    Not to mention: DO NOT OVERWRITE LIBS. Make sure you have a special directory (see above rpath) and do not overwrite system libraries.

     

     

    And finally 6th: If you solved your issue, post a solution for other members. Don't be selfish.

    • Metin2 Dev 1
    • Love 2
  5. Interesting, but big project.

     

    I do agree with some stuff, but highly disagree with other points.

    In fact I do like the c++ part. I don't have any experience with rust but I do know that a mighty c++ version along with current standards is not a disadvantage at all. Things like memory management were an issue back then. Today with stuff like smart pointers you even have more tools to avoid memory corruption. Though yes, Rust is definitely not bad at all and a rust-port would be interesting to see.

     

    What I don't agree is the "rant" about BSD. It doesn't matter if there was no big choice back then. If you wanna rewrite the game then it's mandatory what matters today, not in the past. And nowadays FreeBSD is a very stable, fast and reliable system. Yet I even happened to catch more errors in linux than in BSD (like faulty pkg installations and stuff, but that doesn't matter much for this project). What matters is: Speed, security and reliability. So, why the heck should BSD be an issue there? Why even bother porting it to linux if BSD does the job quite well? I often see people not setting up their system correctly and then wonder about issues they wouldn't have if they read a bit about it. Heck, even now many people are still using BSD versions from years ago.

     

    Though yes, a complete rewrite that actually focuses on more stability and speed, utilizing the more recent tools we have (threading, etc.) would be very benenificient for this. But it's also a big task and don't be fooled - if you rewrite it from scratch, there WILL be bugs. A game project as big as a metin2 server will potentially cause bugs. Where there are humans, there's also error. That's a fact and yeah, you can obviously fix those. What I wanna say is: I'm reading this text like "hey, let's all get together and set up a project" but I think the project isn't thought through well enough. And to completely rely on the devs makes it sound like "I wanna create something huge, come all devs and help me do it". Don't get me wrong, it's not bad to somewhat unite the people who know about development. But it makes the project sound kinda fishy.

     

    I'd love to see such a project come to live. But to do so it takes more than a bright idea. Or, to quote a well-known meme: "One cannot simply rewrite a whole game". You'd think this through and if there's a plan, a concept and if you brainstormed well enough then the project has a chance of success. For now it more looks like an idea, something you had in mind and want to present. But it lacks the core thoughts about it. The first post is more about "ranting" about the stuff the old source has - supposedly - done wrong and how to fix it. And yes, some points do count. But there's high disagreement on other things and as much as it'd look cool to have e. g. a linux port.. It's basically pointless given what we already have. I hope you understand what I'm trying to say, no offense intended here.

    • Love 3
  6. One thing I can absolutely recommend is stop using package system. It gave me enought trouble. I recommend you to stick with the ports tree and build your programs this way.

    Why do I say this?

    I've seen a lot of issues occuring with package system and building the source. If you build the programs via ports tree you make sure they are being built according to your system environment. Especially when encountering lib problems it might help you fix this issue.

     

    Next I'd like to know what exactly are in those lines?

    #7  0x00446040 in CClientManager::FlushItemCacheSet (this=0xffbfe910, pid=792) at ClientManager.cpp:1408
    #8  0x0043c308 in CClientManager::UpdateLogoutPlayer (this=0xffbfe910) at ClientManagerPlayer.cpp:1335

     

    And obviously Main.cpp:58

     

    Can you post the whole functions and mark down the line that's mentioned there?

     

    And thanks for using it, though it's clearly outdated and would need a few fixes here and there ^^' I'm glad you like my work nevertheless and I hope you'll enjoy it in the future, too!

  7. 46 minutes ago, Gurgarath said:

    Your question makes sense. But at the same times it doesnt. Let me explain you the point. It can be hard for a behinner but I will try my best to explain it.

     

     

    This sentence is wrong, really wrong. When it comes to encryption, there isn't a way to do it. There are bilions and bilions. The fact that no one should make a tutorial about it is that it won't help anyone to protect their client but on the contrary it will ruin the solution for good. That's why it exists barely no tutorials at all. You can easily break something that is open source, at least, more easily (open source is great though).

    Also, make sure that no matter how strong is your security (it depends on the level of course) it can get unpacked. Back then, we had Rubinuum with the nec plus ultra of the security at that time being FoxFS (based on what the community said, not based on facts). They got unpacked anyway because of reverse engineering and the lack of uniqueness in their encryption and compression. Now, FoxFS is open source, but no one is using it, either because they don't know how, or simply because they know that it is not effective anymore.

    Instead of giving away how you can secure it, I will simply give you some hint, teach a man how to fish as we commonly say:

    • Change LZO to something better, no matter which one you choose.
    • Despite being small and fast, TEA is somehow depreciated, some newer versions exists, but consider changing it as well. AES, SHA256, SHA512, well, we have a bunch.
    • The usage of keys is good but once you got them (trust me it's easy) you got the masterkey to unpack everything. Change the system, obfuscate them, change the way it works. There are tons of ways to deal with it.
    • The current pack system is working using index and packs, you can change that as well, you can merge them, you can delete them, thousands of methods as well.
    • You can add a bit of salt and pepper to your system, here in France we like when it's perfectly seasoned.
    • You can as well use type4 and type 5. i.e a key sent by the server to your client that decrypt the files. Those are nice, the only problem official had was a backdoor and the lack of overall security, you sniff the keys and you ruin these methods whole career.
    • You can use a brand new method as well. Base yourself upon other protections, you are not forced to use eterpack at all.

    Make also sure that you use more than two of the things listed above. What official did with type6 was simply an encrypted snappy, which is funny because that's what I did that for the first pack method I made in late 2014.

     

     

    I cannot agree more. If there's need for a special encryption (and trust me, there is) you can just use a tool that's already included in source: Metin2PackMaker. Afaik it's bugged from start and needs a bit of a setup but it's not that much. As soon as you have it working you're simply having a program that can archive and extract pack files. After this you can think about changing compression or encryption algorithms. It's definitely worth it.

    • Love 1
  8. Best way to determine this is analyzing a .wav file that's currently in client.

    I did that for fishing_fail.wav from Sound/warrior/fishing and it tells me:

    353 kbps with 22 KHz

    So make sure you convert your file with a bitrate of 353 kbps. I dunno if other values are possible but this one should be a safe one.

  9. Your faulty line is:

    self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)

     

    How does TITLE_NAME_LIST look like? And what is your grade? Most likely your title (Pvp title) mismatches and therefore the 'grade' value is higher than your list of titles. This leads to your issue. Check if you made some changes there and if everything is correct like it should be.

    • Love 1
  10. first you shouldn't use devel compiler, you'd rather take a stable one. Second there's no reason in using GCC anymore since clang is now part of FreeBSDs base system. Though if you wanna use GCC that's fine, but you shouldn't use devel versions. They can lead to unexpected outcome like you mentioned. Try to revert what you do and go for a stable version. If that doesn't work we need more information on what exactly happens (logfiles etc..)

  11. This means that something is already bound to this address (ip and port). So in this case you either have another program running that listens to the ports of ch2 or ch2 is already running. Can you check with ps -aux if ch2 is already running? Also I saw a critical error from your Ch2 log:

    !!! FATAL ERROR !!! multiple MAP_ALLOW setting!!

    You may want to have a look at this. It may be the reason why your ch2 freezes.

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