Jump to content

IceShiva

Member
  • Posts

    134
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by IceShiva

  1. Of course you can use great lib created by imer for extending functionality of precompiled binaries

    Here you have orginal topic:

    https://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/2754769-libm2-libgame-sdk.html

    but using old game is not recommended since source is available. Fixing all posible bug is insane. Additionally you must keep your game unchanged because you can unfortunally change function offsets, so this method is very intrusive.

    • Love 1
  2. Which gcc version did you use on working core

    btw

    Quote

    To avoid run-time errors that are difficult to detect and diagnose, we recommend that you never statically link to binaries that were compiled by using different versions of the compiler. Also, when you upgrade an EXE or DLL project, make sure to upgrade the libraries that it links to. If you're using CRT (C Runtime) or STL (Standard Template Library) types, don't pass them between binaries (including DLLs) that were compiled by using different versions of the compiler.

    You can of course replace keyworks like EXE to ELF DLL to shared object regardless

    Additionally you dont have correctly setuped flags for producting debug builds in you makefile.

  3. 54 minutes ago, masodikbela said:

    In Hungary players sometimes complaining about that they cant start their clients on WinXP 417679821447888898.png?v=1

    It's most cases that are crt's problems. Now Microsoft have new crt implemantation that may be not compatibile with older than vista system (like Windows XP, Windows Server 2003). Ofc if client bin is compiled under vc14+. According to this

    https://support.efolder.net/hc/en-us/articles/115010659028-VC-Redistributable-UCRT-Requirements-

  4. desc_client.cpp in void CLIENT_DESC::SetPhase(int iPhase) edit

    				if (!bSentBoot)
    				{
    					bSentBoot = true;
    					TPacketGDBoot p;
    					p.dwItemIDRange[0] = 0;
    					p.dwItemIDRange[1] = 0;
    					memcpy(p.szIP, g_szPublicIP, 16); // set you external ip instead g_szPublicIP 
    					DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
    				}

    or you can do it in client side at NetAddress.cpp

    void CNetworkAddress::GetIP(char* szIP, int len)
    {
    	BYTE IPs[4];
    	*((DWORD*)IPs)=m_sockAddrIn.sin_addr.s_addr;
    
    	_snprintf(szIP, len, "%d.%d.%d.%d", IPs[0], IPs[1], IPs[2], IPs[3]); // replace with you external server ip
    }

     

    • Love 1
  5. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Hello. Yesterday I have to measure exp table on server, so I decidet to move exp table from array to mysql to avoid recompile every time.

     

    Go to constant.cpp and delete:

    Spoiler
    
    
    const DWORD * exp_table = NULL;
    
    const DWORD exp_table_euckr[PLAYER_EXP_TABLE_MAX + 1] =    
    {
        0,            // 0
    
        100,
        150,
        260,
        380,
        600,
    
        1300,
        3300,
        5700,
        8700,
        12800,        // 10
        18000,
        25000,
        36000,
        52000,
        73000,
        100000,
        125000,
        160000,
        220000,
        280000,        // 20
        370000,
        540000,
        670000,
        880000,
        1000000,
    
        1237000,
        1418000,
        1624000,
        1857000,
        2122000,    // 30
        2421000,
        2761000,
        3145000,
        3580000,
        4073000,
        4632000,
        5194000,
        5717000,
        6264000,
        6837000,    // 40
        7600000,
        8274000,
        8990000,
        9753000,
        10560000,
        11410000,
        12320000,
        13270000,
        14280000,
        15340000,    // 50
        16870000,
        18960000,
        19980000,
        21420000,
        22930000,
        24530000,
        26200000,
        27960000,
        29800000,
        32780000,    // 60
        36060000,
        39670000,
        43640000,
        48000000,
        52800000,
        58080000,
        63890000,
        70280000,
        77310000,
        85040000,     // 70
        93540000,
        102900000,
        113200000,
        124500000,
        137000000,
        150700000,
        165700000,
        236990000,
        260650000,
        286780000,    // 80
        315380000,
        346970000,
        381680000,
        419770000,
        461760000,
        508040000,
        558740000,
        614640000,
        676130000,
        743730000,    // 90
        1041222000,
        1145344200,
        1259878620,
        1385866482,
        1524453130,
        1676898443,
        1844588288,
        2029047116,
        2100000000,    //    99        99레벨일 때 필요경험치 (100레벨이 되기 위한)
        2100000000,    //    100
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,    //    105
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,    //    110
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,    //    115
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,        
        2100000000,    //    120
    };
    
    const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =
    {
        0,    //    0
        300,        
        800,        
        1500,        
        2500,        
        4300,        
        7200,        
        11000,        
        17000,        
        24000,        
        33000,    //    10
        43000,        
        58000,        
        76000,        
        100000,        
        130000,        
        169000,        
        219000,        
        283000,        
        365000,        
        472000,    //    20
        610000,        
        705000,        
        813000,        
        937000,        
        1077000,        
        1237000,        
        1418000,        
        1624000,        
        1857000,        
        2122000,    //    30
        2421000,        
        2761000,        
        3145000,        
        3580000,        
        4073000,        
        4632000,        
        5194000,        
        5717000,        
        6264000,        
        6837000,    //    40
        7600000,        
        8274000,        
        8990000,        
        9753000,        
        10560000,        
        11410000,        
        12320000,        
        13270000,        
        14280000,        
        15340000,    //    50
        16870000,        
        18960000,        
        19980000,        
        21420000,        
        22930000,        
        24530000,        
        26200000,        
        27960000,        
        29800000,        
        32780000,    //    60
        36060000,        
        39670000,        
        43640000,        
        48000000,        
        52800000,        
        58080000,        
        63890000,        
        70280000,        
        77310000,        
        85040000,    //    70
        93540000,        
        102900000,        
        113200000,        
        124500000,        
        137000000,        
        150700000,        
        165700000,        
        236990000,        
        260650000,        
        286780000,    //    80
        315380000,        
        346970000,        
        381680000,        
        419770000,        
        461760000,        
        508040000,        
        558740000,        
        614640000,        
        676130000,        
        743730000,    //    90
        1041222000,        
        1145344200,        
        1259878620,        
        1385866482,        
        1524453130,        
        1676898443,        
        1844588288,        
        2029047116,        
        2050000000,    //    99레벨 일 때 필요경험치 (100레벨이 되기 위한)
        2150000000,    //    100
        2210000000,        
        2250000000,        
        2280000000,        
        2310000000,        
        2330000000,    //    105
        2350000000,        
        2370000000,        
        2390000000,        
        2400000000,        
        2410000000,    //    110
        2420000000,        
        2430000000,        
        2440000000,        
        2450000000,        
        2460000000,    //    115
        2470000000,        
        2480000000,        
        2490000000,        
        2490000000,        
        2500000000,    //    120
    };
    
    const DWORD exp_table_newcibn[PLAYER_EXP_TABLE_MAX + 1 ] =
    {
        300,    // 0
        800,    // 1
        1500,
        2500,
        4300,
        7200,
        11400,
        17000,
        24000,
        33000,
        46000,    // 10
        62000,
        83000,
        111000,
        149000,
        200000,
        268000,
        360000,
        482000,
        647000,
        868000,    // 20
        996000,
        1143000,
        1312000,
        1506000,
        1729000,
        1984000,
        2277000,
        2614000,
        3000000,
        3443000,    // 30
        3952000,
        4536000,
        5206000,
        5975000,
        6858000,
        7730000,
        8504000,
        9307000,
        10140000,
        11330000,    // 40
        12320000,
        13370000,
        14490000,
        15670000,
        16920000,
        18240000,
        19630000,
        21090000,
        22630000,
        24670000,    // 50
        26890000,
        29310000,
        31950000,
        34820000,
        37960000,
        41370000,
        45100000,
        49160000,
        53580000,
        58400000,    // 60
        63660000,
        69390000,
        75630000,
        82440000,
        89860000,
        97950000,
        106760000,
        136370000,
        151800000,
        168300000,    // 70
        250000000,
        340000000,
        450000000,
        570000000,
        690000000,
        810000000,
        912600000,
        1004000000,
        1094000000,
        1182000000,    // 80
        1269000000,
        1354000000,
        1438000000,
        1521000000,
        1603000000,
        1684000000,
        1764000000,
        1844000000,
        1922000000,
        2000000000,    // 90
        2000000000,
        2000000000,
        2000000000,
        2000000000,
        2000000000,
        2000000000,
        2000000000,
        2000000000,
        2000000000,    //    99        99레벨일 때 필요경험치 (100레벨이 되기 위한).. 현재 CIBN이 어떻게 운영하고 있는 지 모르니 신규 테이블을 쓰지 않고 기존값 계속 연장 유지
        2000000000,    //    100
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,    //    105
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,    //    110
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,    //    115
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,        
        2000000000,    //    120
    };

     

    2. Go to constants.h and delete

    Spoiler
    
    
    extern const DWORD*        exp_table;

    then add

    
    
    typedef std::vector<long long> exp_vec;
    extern exp_vec exp_vector;
    bool LoadExpTableFromMYSQL(void);

     

    3. Go to constants.cpp and add on last line or whatever you want in file

    #include "db.h"
    #include "dev_log.h"
    
    exp_vec exp_vector;
    
    bool LoadExpTableFromMYSQL(void)
    {
        char szCountQuery[64];
        char szExp[64];
    
        sprintf(szCountQuery, "%s", "SELECT COUNT(level) FROM common.exp_table");
        sprintf(szExp, "%s", "SELECT exp FROM common.exp_table");
    
        std::auto_ptr<SQLMsg> pCountQuery(DBManager::Instance().DirectQuery(szCountQuery));
    
    
        if (pCountQuery.get() == NULL)
        {
            sys_err("Failed to fetch level count from mysql! Check table or database.");
            pCountQuery.release();
            pCountQuery.reset();
            return false;
        }
    
        std::auto_ptr<SQLResult> pRes(pCountQuery.get()->Get());
    
        if (pRes->uiNumRows > 0)
        {
    
            MYSQL_ROW row = mysql_fetch_row(pRes.get()->pSQLResult);
    
            int level = 0; str_to_number(level, row[0]);
    
            exp_vector.reserve(level);
    
            sys_log(0, "ExpTable reserved for %d levels", level);
    
            pCountQuery.release();
            pRes.release();
            pCountQuery.reset();
            pRes.reset();
        }
    
    
        std::auto_ptr<SQLMsg> pExp(DBManager::Instance().DirectQuery(szExp));
    
        if (pExp.get() == NULL)
        {
            sys_err("Failed to fetch level count from mysql! Check table or database.");
            pExp.release();
            pExp.reset();
            return false;
        }
    
        std::auto_ptr<SQLResult> pRes2(pExp.get()->Get());
    
        if (pRes2->uiNumRows > 0)
        {
            for (uint uiRow = 0; uiRow != pRes2->uiNumRows; ++uiRow)
            {
                MYSQL_ROW row = mysql_fetch_row(pRes2->pSQLResult);
    
                long long exp = 0; str_to_number(exp, row[0]);
    
                exp_vector.push_back(exp);
                sys_log(0, "Pushing exp %d to exp_vector", exp);
    
    
            }
            pExp.release();
            pExp.reset();
            pRes2.release();
            pRes2.reset();
            return true;
        }
        return false;
    }

    4. Go to static void __LocaleService_Init_Korea() in locale_service.cpp and delete exp_table = exp_table_euckr;

    static void __LocaleService_Init_YMIR() delete exp_table = exp_table_euckr;
    static void __LocaleService_Init_Singapore() delete exp_table = exp_table_newcibn;
    static void __LocaleService_Init_Vietnam() delete exp_table = exp_table_newcibn;

    void LocaleService_TransferDefaultSetting() change

    if (!exp_table)
            exp_table = exp_table_common;

    to

    if(!LoadExpTableFromMYSQL())
    {
      sys_err("Failed to load exp table from mysql!");
      exit(1);
    }

     

    char.cpp CHARACTER::GetNextExp() const

    change exp_table to exp_vector

    questlua_pc.cpp int pc_give_exp_perc(lua_State* L)

    change exp_table to exp_vector

    and int pc_get_exp_perc(lua_State* L)

    change exp_table to exp_vector

     

    Thats all.

    Code can be refactored.

    Written in 10min

    • Metin2 Dev 6
    • Good 4
    • Love 11
×
×
  • 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.