Automatic rank updating server

Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Currently Stoned ! Ronny786 is offline
    MemberRank
    Dec 2011 Join Date
    Lost WorldLocation
    984Posts

    Automatic rank updating server

    Automatic ranking updating from matchserver.

    MatchServer Solution:
    -----------------------------------------------

    MBMatchServer.h
    Below:
    Code:
    bool LoadFileMD5HashValue();
    Paste :
    Code:
    bool RankUpdate();
    -----------------------------------------------

    MBMatchServer.cpp

    Below:
    Code:
    #include "MMatchCheckLoopTime.h"
    (on line 22)

    Paste:
    Code:
    #include <iostream>
    #include <fstream>
    using namespace std;
    #include <stdio.h>
    
    #define OTL_ODBC_MSSQL_2005
    #define OTL_ENABLE_MSSQL_MARS
    #define OTL_DEFAULT_NUMERIC_NULL_TO_VAL	0
    #include "otlv4.h"
    
    #include <Windows.h>
    #pragma comment(lib, "winmm.lib")
    
    
    
    #define MILLISECOND_SECOND	(1000)						// 1 sec.
    #define MILLISECOND_MINUTE	(MILLISECOND_SECOND * 60)	// 1 min.
    #define MILLISECOND_HOUR	(MILLISECOND_MINUTE * 60)	// 1 hour.
    #define MILLISECOND_DAY		(MILLISECOND_HOUR * 24)		// 1 day.
    #define MILLISECOND_WEEK	(MILLISECOND_DAY * 7)		// 1 week.
    #define TIME_COLOR	RGB(128, 128, 128)
    
    char m_szDB_DNS[64];					///< DB DNS
    char m_szDB_UserName[64];				///< DB Username
    char m_szDB_Password[64];				///< DB Password
    
    otl_connect db;

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

    Below :
    Code:
    	if( !LoadFileMD5HashValue() )
    		return false; // - by SungE 2007-05-28
    Paste :
    Code:
    	if( !RankUpdate() )
    		return false;


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

    ABOVE :
    Code:
    void MBMatchServer::ReleaseSecurity()
    Paste:
    Spoiler:
    bool SQLErr(otl_exception *e) {
    cout << e->msg << '\n' << e->stm_text << '\n' << e->var_info << '\n';
    cout << "An error occurred while processing SQL.\n";

    ofstream ErrLog("RankingUpdateError.txt", ios::out | ios::app);
    ErrLog << e->msg << '\n' << e->stm_text << '\n' << e->var_info << '\n';
    ErrLog << "----------------------------------------------------------------------\n";
    ErrLog.close();
    return true;
    }


    bool MBMatchServer::RankUpdate()
    {
    mlog("================================== Ranking Updater Info ======================================\n\n");
    mlog("CLEAN : Release Date : %s %s\n",__DATE__,__TIME__ );
    mlog("CLEAN : Credits : DelPa, SeaTroll, Ronny\n\n");

    #define SERVER_CONFIG_FILENAME "./server.ini"
    GetPrivateProfileString("DB", "DNS", "dns", m_szDB_DNS, 64, SERVER_CONFIG_FILENAME);
    GetPrivateProfileString("DB", "USERNAME", "username", m_szDB_UserName, 64, SERVER_CONFIG_FILENAME);
    GetPrivateProfileString("DB", "PASSWORD", "password", m_szDB_Password, 64, SERVER_CONFIG_FILENAME);

    // lOGIN DATABASE
    char strConnectToDB[256];
    sprintf(strConnectToDB, "%s/%s@%s", m_szDB_UserName, m_szDB_Password, m_szDB_DNS);
    try
    {
    // try to connect to the db via ODBC.
    db.rlogon(strConnectToDB);
    db.auto_commit_on();
    }
    catch(otl_exception &e)
    {
    // OTL init failed.
    SQLErr(&e);
    mlog("CLEAN : Failed to connect to the database.\n");
    }
    // LOGIN DATABASE END

    // TIME SAVE DWORD
    DWORD dwCleanSystemTime= timeGetTime();
    DWORD dwClanDelTime = timeGetTime();
    DWORD dwCharacterTime = timeGetTime();
    DWORD dwClanTime = timeGetTime();
    DWORD dwSurvivalTime = timeGetTime();
    DWORD dwDuelTournamentTime = timeGetTime();

    // Delete clan start.
    if(dwCleanSystemTime <= timeGetTime())
    {
    dwCleanSystemTime = timeGetTime() + (MILLISECOND_HOUR * 1);

    if(dwClanDelTime <= timeGetTime())
    {
    dwClanDelTime = timeGetTime() + (MILLISECOND_HOUR * 1);
    try
    {
    db.direct_exec("DELETE FROM ClanMember WHERE CLID=(SELECT CLID FROM Clan WHERE DeleteFlag=2);", otl_exception::enabled); // clean clan member.
    db.direct_exec("UPDATE Clan SET Name=NULL, DeleteFlag=1, DeleteName=Name WHERE DeleteFlag=2;", otl_exception::enabled); // clean clan.
    }
    catch(otl_exception &e)
    {
    // fail.
    SQLErr(&e);
    mlog("CLEAN : Clan cleaning - FAILED.\n");
    }
    // success.
    mlog("CLEAN : Clans cleaned successfully successfully.\n");
    }
    // Delete clan end.

    // Character ranking start.
    if(dwCharacterTime <= timeGetTime())
    {
    dwCharacterTime = timeGetTime() + (MILLISECOND_HOUR * 1);
    try
    {
    db.direct_exec("EXECUTE spFetchTotalRanking;", otl_exception::enabled); // call character ranking update stored function.
    }
    catch(otl_exception &e)
    {
    // fail.
    mlog("CLEAN : Character ranking updated - FAILED.\n");
    }
    // success.
    mlog("CLEAN : Character Ranking Updated successfully.\n");
    }
    // Character ranking end.

    // Clan ranking start.
    if(dwClanTime <= timeGetTime())
    {
    dwClanTime = dwClanTime + (MILLISECOND_HOUR * 1);
    try
    {
    db.direct_exec("EXECUTE spRegularUpdateClanRanking;", otl_exception::enabled); // call clan ranking update stored function.
    }
    catch(otl_exception &e)
    {
    // fail.
    SQLErr(&e);
    mlog("CLEAN : Clan ranking updated - FAILED.\n");
    }
    // success.
    mlog("CLEAN : Clan Ranking Updated successfully.\n");
    }
    // Clan ranking end.

    // Survival ranking start.
    if(dwSurvivalTime <= timeGetTime())
    {
    dwSurvivalTime = timeGetTime() + (MILLISECOND_HOUR * 1);
    try
    {
    db.direct_exec("EXECUTE spFetchSurvivalRanking;", otl_exception::enabled); // call survival ranking update stored function.
    }
    catch(otl_exception &e)
    {
    // fail.
    SQLErr(&e);
    mlog("CLEAN : Survival ranking updated - FAILED.\n");
    }
    // success.
    mlog("CLEAN : Survival Ranking Updated successfully.\n");
    }
    // Survival ranking end.


    // Duel tournament ranking start.
    if(dwDuelTournamentTime <= timeGetTime())
    {
    dwDuelTournamentTime = timeGetTime() + (MILLISECOND_HOUR * 1);
    try
    {
    #ifdef DUELTOURNAMENT_RANKING_WEEKLY_UPDATE
    // weekly update.
    db.direct_exec(
    "IF NOT EXISTS(SELECT * FROM DTTimeStamp WHERE TimeStamp=(CONVERT( CHAR(8), DATEADD(dd, DATEPART(WEEKDAY, CONVERT(DATETIME, GETDATE()))*(-1)+2, CONVERT(DATETIME, GETDATE())), 112))) BEGIN\n"
    " EXECUTE spDTInsertDTTimeStamp 1;\n"
    "END\n"
    "EXECUTE spDTFetchDTRanking;",
    otl_exception::enabled);
    #else
    // daily update.
    db.direct_exec(
    "IF NOT EXISTS(SELECT * FROM DTTimeStamp WHERE TimeStamp=(CONVERT( CHAR(8), GETDATE(), 112))) BEGIN\n"
    " EXECUTE spDTInsertDTTimeStamp 0;\n"
    "END\n"
    "EXECUTE spDTFetchDTRanking;",
    otl_exception::enabled);
    #endif
    }
    catch(otl_exception &e)
    {
    // fail.
    SQLErr(&e);
    mlog("CLEAN : Process duel tournament ranking - FAILED.\n");
    }
    // success.
    mlog("CLEAN : Duel Tournament Ranking Updated successfully.\n\n");
    mlog("=============================== All Rankings Updated Successfully ======================================\n\n");
    }
    // Duel tournament ranking end.

    db.logoff();
    }
    return true;
    }


    -----------------------------------------------
    place this file in server solution
    otlv4.h
    otlv4.7z

    -------------------------------------------------
    Credits:
    Rank Updater source : Seatroll and Delpa
    implementation in server : me
    Last edited by Ronny786; 03-05-13 at 06:01 AM.


  2. #2
    Intelligent DoucheBag jur13n is offline
    MemberRank
    Jan 2008 Join Date
    Zwolle,Location
    1,946Posts

    Re: Automatic rank updating server

    Well, this is usefull, for once.

  3. #3
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Automatic rank updating server

    Quote Originally Posted by jur13n View Post
    Well, this is usefull, for once.
    It's still too late, meaning it's useless. No private server can rise right now, only the ones that are already there. And this IS useless to them as they already have it done.

  4. #4
    Developer / Patch Finder Tankado is offline
    MemberRank
    Oct 2011 Join Date
    The NetherlandsLocation
    451Posts

    Re: Automatic rank updating server

    is this a joke ><

  5. #5
    Intelligent DoucheBag jur13n is offline
    MemberRank
    Jan 2008 Join Date
    Zwolle,Location
    1,946Posts

    Re: Automatic rank updating server

    Quote Originally Posted by Vusion View Post
    It's still too late, meaning it's useless. No private server can rise right now, only the ones that are already there. And this IS useless to them as they already have it done.
    So was my repack.
    still people over use it.

  6. #6
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Automatic rank updating server

    Can't believe I minimized dark souls for this...

  7. #7

    Re: Automatic rank updating server

    Quote Originally Posted by Wizkidje View Post
    Can't believe I minimized dark souls for this...
    I can't believe you did either.

  8. #8
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Automatic rank updating server

    Quote Originally Posted by GUNZ DEVELOPER View Post
    I can't believe you did either.
    3x 2v1, 11x 1v1, haven't died once. I'm on a killing spree.

  9. #9
    Account Upgraded | Title Enabled! medotarek is offline
    MemberRank
    Apr 2012 Join Date
    Egypt/RageZoneLocation
    615Posts

    Re: Automatic rank updating server


  10. #10
    Enthusiast juanjunio is offline
    MemberRank
    Jul 2010 Join Date
    49Posts

    Re: Automatic rank updating server

    Very nice!


    edit:

    Do not forget to place the otlv4.h on file for error they do not!

  11. #11
    Newbie kn95951135 is offline
    MemberRank
    Nov 2005 Join Date
    MalaysiaLocation
    388Posts

    Re: Automatic rank updating server

    Where can i get otlv4.h?

  12. #12
    Currently Stoned ! Ronny786 is offline
    MemberRank
    Dec 2011 Join Date
    Lost WorldLocation
    984Posts

    Re: Automatic rank updating server


  13. #13
    Newbie kn95951135 is offline
    MemberRank
    Nov 2005 Join Date
    MalaysiaLocation
    388Posts

    Re: Automatic rank updating server

    where to put? and thanks~

  14. #14

    Re: Automatic rank updating server

    Quote Originally Posted by Wizkidje View Post
    3x 2v1, 11x 1v1, haven't died once. I'm on a killing spree.
    C-c-c-c-combo breaker!

  15. #15
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Automatic rank updating server

    Quote Originally Posted by GUNZ DEVELOPER View Post
    C-c-c-c-combo breaker!
    I altf4'd after I got lamed in a 3v1 twice in a row, no fun in killing 3 noobs and then getting hate-mail from all three of them (my mother had quite a busy night according to them).

    Still, 15 kills 0 deaths on a game that actually requires skill... can't wait to play GunZ again.



Page 1 of 2 12 LastLast

Advertisement