1. Соблюдайте Правила форума и проявляйте уважение к другим участникам беседы.

Help Ошибка при установке патча

Тема в разделе 'Кодинг/Собственные решения', создана пользователем ELITE, 17 май 2013.

  1. ELITE Гуру

    Сообщения:
    252
    Спасибы:
    23
    Дата начала использования бота:
    00.00.2012
    ставлю патч gcbi-extend.patch на бота ghost one
    всё поставилось но на этот куске:
    Код:
    @@ -169,6 +190,16 @@
                    return;
                }
            }
    +
    +        else if( Packet->GetPacketType( ) == GCBI_HEADER_CONSTANT )
    +        {
    +            if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT )
    +            {
    +                delete m_IncomingGarenaUser;
    +                m_IncomingGarenaUser = m_Game->m_GHost->m_GCBIProtocol->RECEIVE_GCBI_INIT( Packet->GetData( ) );
    +                CONSOLE_Print( "[GCBI] Garena user detected; userid=" + UTIL_ToString( m_IncomingGarenaUser->GetUserID( ) ) + ", roomid=" + UTIL_ToString( m_IncomingGarenaUser->GetRoomID( ) ) + ", experience=" + UTIL_ToString( m_IncomingGarenaUser->GetUserExp( ) ) + ", country=" + m_IncomingGarenaUser->GetCountryCode( ) );
    +            }
    +        }
     
            delete Packet;
        }
    у меня ошибки
    помогите что не так, вроде всё должно работать - ниже этот Packet работает и не ругается - а тут не объявленым оказался...
  2. Suicider Старожила

    Сообщения:
    673
    Спасибы:
    117
    Сборка бота GHost:
    Ghost++ 17.1 by w3gh
    Дата начала использования бота:
    12.07.2011
    собственно весь патч бы выложить... разве по куску патча можно узнать всю проблему???
  3. ELITE Гуру

    Сообщения:
    252
    Спасибы:
    23
    Дата начала использования бота:
    00.00.2012
    Код:
    Index: ghost/game_base.h
    ===================================================================
    --- ghost/game_base.h    (revision 573)
    +++ ghost/game_base.h    (working copy)
    @@ -39,6 +39,7 @@
    class CIncomingChatPlayer;
    class CIncomingMapSize;
    class CCallableScoreCheck;
    +class CIncomingGarenaPlayer;
     
    class CBaseGame
    {
    Index: ghost/Makefile
    ===================================================================
    --- ghost/Makefile    (revision 573)
    +++ ghost/Makefile    (working copy)
    @@ -4,7 +4,7 @@
    CC = gcc
    DFLAGS = -DGHOST_MYSQL
    OFLAGS = -O3
    -LFLAGS = -L. -L../bncsutil/src/bncsutil/ -L../StormLib/stormlib/ -lbncsutil -lpthread -ldl -lz -lStorm -lmysqlclient_r -lboost_date_time-mt -lboost_thread-mt -lboost_system-mt -lboost_filesystem-mt
    +LFLAGS = -L. -L../bncsutil/src/bncsutil/ -L../StormLib/stormlib/ -lbncsutil -lpthread -ldl -lz -lStorm -lmysqlclient_r -lboost_date_time -lboost_thread -lboost_system -lboost_filesystem
    CFLAGS =
     
    ifeq ($(SYSTEM),Darwin)
    @@ -29,7 +29,7 @@
    CFLAGS += -I../mysql/include/
    endif
     
    -OBJS = bncsutilinterface.o bnet.o bnetprotocol.o bnlsclient.o bnlsprotocol.o commandpacket.o config.o crc32.o csvparser.o game.o game_admin.o game_base.o gameplayer.o gameprotocol.o gameslot.o ghost.o ghostdb.o ghostdbmysql.o ghostdbsqlite.o gpsprotocol.o language.o map.o packed.o replay.o savegame.o sha1.o socket.o stats.o statsdota.o statsw3mmd.o util.o
    +OBJS = bncsutilinterface.o bnet.o bnetprotocol.o bnlsclient.o bnlsprotocol.o commandpacket.o config.o crc32.o csvparser.o game.o game_admin.o game_base.o gameplayer.o gameprotocol.o gameslot.o gcbiprotocol.o ghost.o ghostdb.o ghostdbmysql.o ghostdbsqlite.o gpsprotocol.o language.o map.o packed.o replay.o savegame.o sha1.o socket.o stats.o statsdota.o statsw3mmd.o util.o
    COBJS = sqlite3.o
    PROGS = ./ghost++
     
    @@ -63,10 +63,11 @@
    game.o: ghost.h includes.h util.h config.h language.h socket.h ghostdb.h bnet.h map.h packed.h savegame.h gameplayer.h gameprotocol.h game_base.h game.h stats.h statsdota.h statsw3mmd.h
    game_admin.o: ghost.h includes.h util.h config.h language.h socket.h ghostdb.h bnet.h map.h packed.h savegame.h replay.h gameplayer.h gameprotocol.h game_base.h game_admin.h
    game_base.o: ghost.h includes.h util.h config.h language.h socket.h ghostdb.h bnet.h map.h packed.h savegame.h replay.h gameplayer.h gameprotocol.h game_base.h next_combination.h
    -gameplayer.o: ghost.h includes.h util.h language.h socket.h commandpacket.h bnet.h map.h gameplayer.h gameprotocol.h gpsprotocol.h game_base.h
    +gameplayer.o: ghost.h includes.h util.h language.h socket.h commandpacket.h bnet.h map.h gameplayer.h gameprotocol.h gpsprotocol.h game_base.h gcbiprotocol.h
    gameprotocol.o: ghost.h includes.h util.h crc32.h gameplayer.h gameprotocol.h game_base.h
    gameslot.o: ghost.h includes.h gameslot.h
    -ghost.o: ghost.h includes.h util.h crc32.h sha1.h csvparser.h config.h language.h socket.h ghostdb.h ghostdbsqlite.h ghostdbmysql.h bnet.h map.h packed.h savegame.h gameplayer.h gameprotocol.h gpsprotocol.h game_base.h game.h game_admin.h
    +gcbiprotocol.o: gcbiprotocol.h ghost.h util.h
    +ghost.o: ghost.h includes.h util.h crc32.h sha1.h csvparser.h config.h language.h socket.h ghostdb.h ghostdbsqlite.h ghostdbmysql.h bnet.h map.h packed.h savegame.h gameplayer.h gameprotocol.h gpsprotocol.h game_base.h game.h game_admin.h gcbiprotocol.h
    ghostdb.o: ghost.h includes.h util.h config.h ghostdb.h
    ghostdbmysql.o: ghost.h includes.h util.h config.h ghostdb.h ghostdbmysql.h
    ghostdbsqlite.o: ghost.h includes.h util.h config.h ghostdb.h ghostdbsqlite.h
    Index: ghost/game_base.cpp
    ===================================================================
    --- ghost/game_base.cpp    (revision 573)
    +++ ghost/game_base.cpp    (working copy)
    @@ -32,6 +32,7 @@
    #include "gameplayer.h"
    #include "gameprotocol.h"
    #include "game_base.h"
    +#include "gcbiprotocol.h"
     
    #include <cmath>
    #include <string.h>
    @@ -200,6 +201,7 @@
        if( !m_GameLoaded || m_Lagging )
            return 50;
     
    +
        uint32_t TicksSinceLastUpdate = GetTicks( ) - m_LastActionSentTicks;
     
        if( TicksSinceLastUpdate > m_Latency - m_LastActionLateBy )
    @@ -363,7 +365,7 @@
     
        // create the virtual host player
     
    -    if( !m_GameLoading && !m_GameLoaded && GetNumPlayers( ) < 12 )
    +    if( !m_GameLoading && !m_GameLoaded && GetSlotsOccupied() < m_Slots.size() )
            CreateVirtualHost( );
     
        // unlock the game
    @@ -411,6 +413,11 @@
                // so if we try to send accurate numbers it'll always be off by one and results in Warcraft 3 assuming the game is full when it still needs one more player
                // the easiest solution is to simply send 12 for both so the game will always show up as (1/12) players
     
    +            uint32_t slotstotal = m_Slots.size( );
    +            uint32_t slotsopen = GetSlotsOpen();
    +            if (slotsopen<2) slotsopen = 2;
    +            if(slotstotal > 12) slotstotal = 12;
    +
                if( m_SaveGame )
                {
                    // note: the PrivateGame flag is not set when broadcasting to LAN (as you might expect)
    @@ -422,7 +429,7 @@
                    BYTEARRAY MapHeight;
                    MapHeight.push_back( 0 );
                    MapHeight.push_back( 0 );
    -                m_GHost->m_UDPSocket->Broadcast( 6112, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), MapWidth, MapHeight, m_GameName, "Varlock", GetTime( ) - m_CreationTime, "Save\\Multiplayer\\" + m_SaveGame->GetFileNameNoPath( ), m_SaveGame->GetMagicNumber( ), 12, 12, m_HostPort, FixedHostCounter, m_EntryKey ) );
    +                m_GHost->m_UDPSocket->Broadcast( 6112, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), MapWidth, MapHeight, m_GameName, "Varlock", GetTime( ) - m_CreationTime, "Save\\Multiplayer\\" + m_SaveGame->GetFileNameNoPath( ), m_SaveGame->GetMagicNumber( ), slotstotal, slotsopen, m_HostPort, FixedHostCounter, m_EntryKey ) );
                }
                else
                {
    @@ -430,7 +437,7 @@
                    // note: we do not use m_Map->GetMapGameType because none of the filters are set when broadcasting to LAN (also as you might expect)
     
                    uint32_t MapGameType = MAPGAMETYPE_UNKNOWN0;
    -                m_GHost->m_UDPSocket->Broadcast( 6112, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), m_Map->GetMapWidth( ), m_Map->GetMapHeight( ), m_GameName, "Varlock", GetTime( ) - m_CreationTime, m_Map->GetMapPath( ), m_Map->GetMapCRC( ), 12, 12, m_HostPort, FixedHostCounter, m_EntryKey ) );
    +                m_GHost->m_UDPSocket->Broadcast( 6112, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), m_Map->GetMapWidth( ), m_Map->GetMapHeight( ), m_GameName, "Varlock", GetTime( ) - m_CreationTime, m_Map->GetMapPath( ), m_Map->GetMapCRC( ), slotstotal, slotsopen, m_HostPort, FixedHostCounter, m_EntryKey ) );
                }
            }
     
    @@ -826,6 +833,7 @@
                        // this resets the lag screen timer
     
                        if( UsingGProxy && !(*i)->GetGProxy( ) )
    +
                        {
                            // we must send additional empty actions to non-GProxy++ players
                            // GProxy++ will insert these itself so we don't need to send them to GProxy++ players
    @@ -1599,6 +1607,8 @@
            }
     
            return;
    +
    +
        }
     
        player->SetDeleteMe( true );
    @@ -1914,7 +1924,7 @@
        // we have a slot for the new player
        // make room for them by deleting the virtual host player if we have to
     
    -    if( GetNumPlayers( ) >= 11 || EnforcePID == m_VirtualHostPID )
    +    if( GetSlotsOccupied( ) >= m_Slots.size() - 1 || EnforcePID == m_VirtualHostPID )
            DeleteVirtualHost( );
     
        // turning the CPotentialPlayer into a CGamePlayer is a bit of a pain because we have to be careful not to close the socket
    @@ -1924,6 +1934,11 @@
        CONSOLE_Print( "[GAME: " + m_GameName + "] player [" + joinPlayer->GetName( ) + "|" + potential->GetExternalIPString( ) + "] joined the game" );
        CGamePlayer *Player = new CGamePlayer( potential, m_SaveGame ? EnforcePID : GetNewPID( ), JoinedRealm, joinPlayer->GetName( ), joinPlayer->GetInternalIP( ), Reserved );
     
    +    if( potential->GetGarenaUser( ) != NULL ) {
    +        Player->SetGarenaUser( potential->GetGarenaUser( ) );
    +        potential->SetGarenaUser( NULL );
    +    }
    +   
        // consider LAN players to have already spoof checked since they can't
        // since so many people have trouble with this feature we now use the JoinedRealm to determine LAN status
     
    @@ -2304,7 +2319,7 @@
        // we have a slot for the new player
        // make room for them by deleting the virtual host player if we have to
     
    -    if( GetNumPlayers( ) >= 11 )
    +    if( GetSlotsOccupied( ) >= m_Slots.size() - 1 )
            DeleteVirtualHost( );
     
        // identify their joined realm
    @@ -4063,6 +4078,7 @@
     
                                    if( Difference > LargestDifference )
                                        LargestDifference = Difference;
    +
                                }
                            }
                        }
    @@ -4319,6 +4335,7 @@
    bool CBaseGame :: IsGameDataSaved( )
    {
        return true;
    +
    }
     
    void CBaseGame :: SaveGameData( )
    @@ -4349,6 +4366,7 @@
     
                string StillDownloading;
     
    +
                            for( vector<CGameSlot> :: iterator i = m_Slots.begin( ); i != m_Slots.end( ); ++i )
                {
                    if( (*i).GetSlotStatus( ) == SLOTSTATUS_OCCUPIED && (*i).GetComputer( ) == 0 && (*i).GetDownloadStatus( ) != 100 )
    @@ -4570,7 +4588,7 @@
     
        if( SID < m_Slots.size( ) )
        {
    -        if( GetNumPlayers( ) >= 11 )
    +        if( GetSlotsOccupied( ) >= m_Slots.size() - 1 )
                DeleteVirtualHost( );
     
            m_FakePlayerPID = GetNewPID( );
    Index: ghost/ghost.cpp
    ===================================================================
    --- ghost/ghost.cpp    (revision 573)
    +++ ghost/ghost.cpp    (working copy)
    @@ -35,6 +35,7 @@
    #include "savegame.h"
    #include "gameplayer.h"
    #include "gameprotocol.h"
    +#include "gcbiprotocol.h"
    #include "gpsprotocol.h"
    #include "game_base.h"
    #include "game.h"
    @@ -398,6 +399,7 @@
        m_UDPSocket->SetDontRoute( CFG->GetInt( "udp_dontroute", 0 ) == 0 ? false : true );
        m_ReconnectSocket = NULL;
        m_GPSProtocol = new CGPSProtocol( );
    +    m_GCBIProtocol = new CGCBIProtocol( );
        m_CRC = new CCRC32( );
        m_CRC->Initialize( );
        m_SHA = new CSHA1( );
    @@ -699,6 +701,7 @@
            delete *i;
     
        delete m_GPSProtocol;
    +    delete m_GCBIProtocol;
        delete m_CRC;
        delete m_SHA;
     
    @@ -827,6 +830,7 @@
                    CONSOLE_Print( "[GHOST] error listening for GProxy++ reconnects on port " + UTIL_ToString( m_ReconnectPort ) );
                    delete m_ReconnectSocket;
                    m_ReconnectSocket = NULL;
    +
                    m_Reconnect = false;
                }
            }
    Index: ghost/gcbiprotocol.cpp
    ===================================================================
    --- ghost/gcbiprotocol.cpp    (revision 0)
    +++ ghost/gcbiprotocol.cpp    (revision 0)
    @@ -0,0 +1,126 @@
    +/*
    +
    +  Copyright 2010 Trevor Hogan
    +
    +  Licensed under the Apache License, Version 2.0 (the "License");
    +  you may not use this file except in compliance with the License.
    +  You may obtain a copy of the License at
    +
    +      http://www.apache.org/licenses/LICENSE-2.0
    +
    +  Unless required by applicable law or agreed to in writing, software
    +  distributed under the License is distributed on an "AS IS" BASIS,
    +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +  See the License for the specific language governing permissions and
    +  limitations under the License.
    +
    +*/
    +
    +#include "ghost.h"
    +#include "util.h"
    +#include "gcbiprotocol.h"
    +
    +//
    +// CGCBIProtocol
    +//
    +
    +CGCBIProtocol :: CGCBIProtocol( )
    +{
    +
    +}
    +
    +CGCBIProtocol :: ~CGCBIProtocol( )
    +{
    +
    +}
    +
    +///////////////////////
    +// RECEIVE FUNCTIONS //
    +///////////////////////
    +
    +CIncomingGarenaUser *CGCBIProtocol :: RECEIVE_GCBI_INIT( BYTEARRAY data )
    +{
    +    // 2 bytes                    -> Header
    +    // 2 bytes                    -> Length
    +    // 4 bytes                    -> actual IP address (big endian)
    +    // 4 bytes                    -> Garena user ID (big endian)
    +    // 4 bytes                    -> Garena room ID (big endian)
    +    // 4 bytes                    -> Garena user experience (big endian)
    +    // 2 bytes                    -> country string from Garena
    +
    +    if( ValidateLength( data ) && data.size( ) == 22 )
    +    {
    +        BYTEARRAY IP = BYTEARRAY( data.begin( ) + 4, data.begin( ) + 8 );
    +        BYTEARRAY UserID = BYTEARRAY( data.begin( ) + 8, data.begin( ) + 12 );
    +        BYTEARRAY RoomID = BYTEARRAY( data.begin( ) + 12, data.begin( ) + 16 );
    +        BYTEARRAY UserExp = BYTEARRAY( data.begin( ) + 16, data.begin( ) + 20 );
    +        BYTEARRAY Country = BYTEARRAY( data.begin( ) + 20, data.begin( ) + 22 );
    +       
    +        return new CIncomingGarenaUser(UTIL_ByteArrayToUInt32( IP, true ),
    +                                            UTIL_ByteArrayToUInt32( UserID, true ),
    +                                            UTIL_ByteArrayToUInt32( RoomID, true ),
    +                                            UTIL_ByteArrayToUInt32( UserExp, true ),
    +                                            string( Country.begin( ), Country.end( ) ) );
    +    }
    +
    +    return NULL;
    +}
    +
    +////////////////////
    +// SEND FUNCTIONS //
    +////////////////////
    +
    +/////////////////////
    +// OTHER FUNCTIONS //
    +/////////////////////
    +
    +bool CGCBIProtocol :: AssignLength( BYTEARRAY &content )
    +{
    +    // insert the actual length of the content array into bytes 3 and 4 (indices 2 and 3)
    +
    +    BYTEARRAY LengthBytes;
    +
    +    if( content.size( ) >= 4 && content.size( ) <= 65535 )
    +    {
    +        LengthBytes = UTIL_CreateByteArray( (uint16_t)content.size( ), false );
    +        content[2] = LengthBytes[0];
    +        content[3] = LengthBytes[1];
    +        return true;
    +    }
    +
    +    return false;
    +}
    +
    +bool CGCBIProtocol :: ValidateLength( BYTEARRAY &content )
    +{
    +    // verify that bytes 3 and 4 (indices 2 and 3) of the content array describe the length
    +
    +    uint16_t Length;
    +    BYTEARRAY LengthBytes;
    +
    +    if( content.size( ) >= 4 && content.size( ) <= 65535 )
    +    {
    +        LengthBytes.push_back( content[2] );
    +        LengthBytes.push_back( content[3] );
    +        Length = UTIL_ByteArrayToUInt16( LengthBytes, false );
    +
    +        if( Length == content.size( ) )
    +            return true;
    +    }
    +
    +    return false;
    +}
    +
    +//
    +// CIncomingGarenaUser
    +//
    +
    +CIncomingGarenaUser :: CIncomingGarenaUser( uint32_t nIP, uint32_t nUserID, uint32_t nRoomID, uint32_t nUserExp, string nCountryCode ) : m_IP( nIP ), m_UserID( nUserID ), m_RoomID( nRoomID ), m_UserExp( nUserExp ), m_CountryCode( nCountryCode )
    +{
    +
    +}
    +
    +CIncomingGarenaUser :: ~CIncomingGarenaUser( )
    +{
    +
    +}
    Index: ghost/gameplayer.cpp
    ===================================================================
    --- ghost/gameplayer.cpp    (revision 573)
    +++ ghost/gameplayer.cpp    (working copy)
    @@ -27,6 +27,7 @@
    #include "map.h"
    #include "gameplayer.h"
    #include "gameprotocol.h"
    +#include "gcbiprotocol.h"
    #include "gpsprotocol.h"
    #include "game_base.h"
     
    @@ -34,7 +35,7 @@
    // CPotentialPlayer
    //
     
    -CPotentialPlayer :: CPotentialPlayer( CGameProtocol *nProtocol, CBaseGame *nGame, CTCPSocket *nSocket ) : m_Protocol( nProtocol ), m_Game( nGame ), m_Socket( nSocket ), m_DeleteMe( false ), m_Error( false ), m_IncomingJoinPlayer( NULL )
    +CPotentialPlayer :: CPotentialPlayer( CGameProtocol *nProtocol, CBaseGame *nGame, CTCPSocket *nSocket ) : m_Protocol( nProtocol ), m_Game( nGame ), m_Socket( nSocket ), m_DeleteMe( false ), m_Error( false ), m_IncomingJoinPlayer( NULL ), m_IncomingGarenaUser( NULL )
    {
     
    }
    @@ -51,22 +52,42 @@
        }
     
        delete m_IncomingJoinPlayer;
    +    delete m_IncomingGarenaUser;
    }
     
    +BYTEARRAY CPotentialPlayer :: GetGarenaIP( )
    +{
    +    if( m_IncomingGarenaUser == NULL ) {
    +        return UTIL_CreateByteArray( (uint32_t) 0, true );
    +    } else {
    +        return UTIL_CreateByteArray( m_IncomingGarenaUser->GetIP( ), true );
    +    }
    +}
    +
    BYTEARRAY CPotentialPlayer :: GetExternalIP( )
    {
        unsigned char Zeros[] = { 0, 0, 0, 0 };
     
    -    if( m_Socket )
    -        return m_Socket->GetIP( );
    +    if( m_Socket ) {
    +        if( m_IncomingGarenaUser != NULL )
    +            return GetGarenaIP( );
    +        else
    +            return m_Socket->GetIP( );
    +    }
     
        return UTIL_CreateByteArray( Zeros, 4 );
    }
     
    string CPotentialPlayer :: GetExternalIPString( )
    {
    -    if( m_Socket )
    -        return m_Socket->GetIPString( );
    +    if( m_Socket ) {
    +        if( m_IncomingGarenaUser != NULL ) {
    +            BYTEARRAY GarenaIP = GetGarenaIP( );
    +            return UTIL_ToString(GarenaIP[0]) + "." + UTIL_ToString(GarenaIP[1]) + "." + UTIL_ToString(GarenaIP[2]) + "." + UTIL_ToString(GarenaIP[3]);
    +        } else {
    +            return m_Socket->GetIPString( );
    +        }
    +    }
     
        return string( );
    }
    @@ -103,7 +124,7 @@
     
        while( Bytes.size( ) >= 4 )
        {
    -        if( Bytes[0] == W3GS_HEADER_CONSTANT || Bytes[0] == GPS_HEADER_CONSTANT )
    +        if( Bytes[0] == W3GS_HEADER_CONSTANT || Bytes[0] == GPS_HEADER_CONSTANT || Bytes[0] == GCBI_HEADER_CONSTANT )
            {
                // bytes 2 and 3 contain the length of the packet
     
    @@ -169,6 +190,16 @@
                    return;
                }
            }
    +       
    +        else if( Packet->GetPacketType( ) == GCBI_HEADER_CONSTANT )
    +        {
    +            if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT )
    +            {
    +                delete m_IncomingGarenaUser;
    +                m_IncomingGarenaUser = m_Game->m_GHost->m_GCBIProtocol->RECEIVE_GCBI_INIT( Packet->GetData( ) );
    +                CONSOLE_Print( "[GCBI] Garena user detected; userid=" + UTIL_ToString( m_IncomingGarenaUser->GetUserID( ) ) + ", roomid=" + UTIL_ToString( m_IncomingGarenaUser->GetRoomID( ) ) + ", experience=" + UTIL_ToString( m_IncomingGarenaUser->GetUserExp( ) ) + ", country=" + m_IncomingGarenaUser->GetCountryCode( ) );
    +            }
    +        }
     
            delete Packet;
        }
    @@ -348,7 +379,7 @@
     
        while( Bytes.size( ) >= 4 )
        {
    -        if( Bytes[0] == W3GS_HEADER_CONSTANT || Bytes[0] == GPS_HEADER_CONSTANT )
    +        if( Bytes[0] == W3GS_HEADER_CONSTANT || Bytes[0] == GPS_HEADER_CONSTANT || Bytes[0] == GCBI_HEADER_CONSTANT )
            {
                // bytes 2 and 3 contain the length of the packet
     
    @@ -480,6 +511,7 @@
                case CGameProtocol :: W3GS_PONG_TO_HOST:
                    Pong = m_Protocol->RECEIVE_W3GS_PONG_TO_HOST( Packet->GetData( ) );
     
    +
                    // we discard pong values of 1
                    // the client sends one of these when connecting plus we return 1 on error to kill two birds with one stone
     
    Index: ghost/ghost.h
    ===================================================================
    --- ghost/ghost.h    (revision 573)
    +++ ghost/ghost.h    (working copy)
    @@ -31,6 +31,7 @@
    class CTCPServer;
    class CTCPSocket;
    class CGPSProtocol;
    +class CGCBIProtocol;
    class CCRC32;
    class CSHA1;
    class CBNET;
    @@ -50,6 +51,7 @@
        CTCPServer *m_ReconnectSocket;            // listening socket for GProxy++ reliable reconnects
        vector<CTCPSocket *> m_ReconnectSockets;// vector of sockets attempting to reconnect (connected but not identified yet)
        CGPSProtocol *m_GPSProtocol;
    +    CGCBIProtocol *m_GCBIProtocol;
        CCRC32 *m_CRC;                            // for calculating CRC's
        CSHA1 *m_SHA;                            // for calculating SHA1's
        vector<CBNET *> m_BNETs;                // all our battle.net connections (there can be more than one)
    Index: ghost/gcbiprotocol.h
    ===================================================================
    --- ghost/gcbiprotocol.h    (revision 0)
    +++ ghost/gcbiprotocol.h    (revision 0)
    @@ -0,0 +1,79 @@
    +/*
    +
    +  Copyright 2010 Trevor Hogan
    +
    +  Licensed under the Apache License, Version 2.0 (the "License");
    +  you may not use this file except in compliance with the License.
    +  You may obtain a copy of the License at
    +
    +      http://www.apache.org/licenses/LICENSE-2.0
    +
    +  Unless required by applicable law or agreed to in writing, software
    +  distributed under the License is distributed on an "AS IS" BASIS,
    +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +  See the License for the specific language governing permissions and
    +  limitations under the License.
    +
    +*/
    +
    +#ifndef GCBIPROTOCOL_H
    +#define GCBIPROTOCOL_H
    +
    +//
    +// CGCBIProtocol
    +//
    +
    +#define GCBI_HEADER_CONSTANT        249
    +
    +#define REJECTGCBI_INVALID            1
    +#define REJECTGCBI_NOTFOUND            2
    +
    +class CIncomingGarenaUser;
    +
    +class CGCBIProtocol
    +{
    +public:
    +    enum Protocol {
    +        GCBI_INIT                = 1
    +    };
    +
    +    CGCBIProtocol( );
    +    ~CGCBIProtocol( );
    +
    +    // receive functions
    +    CIncomingGarenaUser *RECEIVE_GCBI_INIT( BYTEARRAY data );
    +
    +    // send functions
    +
    +    // other functions
    +
    +private:
    +    bool AssignLength( BYTEARRAY &content );
    +    bool ValidateLength( BYTEARRAY &content );
    +};
    +
    +//
    +// CIncomingGarenaUser
    +//
    +   
    +class CIncomingGarenaUser
    +{
    +private:
    +    uint32_t m_IP;
    +    uint32_t m_UserID;
    +    uint32_t m_RoomID;
    +    uint32_t m_UserExp;
    +    string m_CountryCode;
    +
    +public:
    +    CIncomingGarenaUser( uint32_t nIP, uint32_t nUserID, uint32_t nRoomID, uint32_t nUserExp, string nCountryCode );
    +    ~CIncomingGarenaUser( );
    +
    +    uint32_t GetIP( ) { return m_IP; }
    +    uint32_t GetUserID( ) { return m_UserID; }
    +    uint32_t GetRoomID( ) { return m_RoomID; }
    +    uint32_t GetUserExp( ) { return m_UserExp; }
    +    string GetCountryCode( ) { return m_CountryCode; }
    +};
    +
    +#endif
    Index: ghost/gameplayer.h
    ===================================================================
    --- ghost/gameplayer.h    (revision 573)
    +++ ghost/gameplayer.h    (working copy)
    @@ -26,6 +26,7 @@
    class CGameProtocol;
    class CGame;
    class CIncomingJoinPlayer;
    +class CIncomingGarenaUser;
     
    //
    // CPotentialPlayer
    @@ -47,6 +48,7 @@
        bool m_Error;
        string m_ErrorString;
        CIncomingJoinPlayer *m_IncomingJoinPlayer;
    +    CIncomingGarenaUser *m_IncomingGarenaUser;
     
    public:
        CPotentialPlayer( CGameProtocol *nProtocol, CBaseGame *nGame, CTCPSocket *nSocket );
    @@ -60,9 +62,12 @@
        virtual bool GetError( )                        { return m_Error; }
        virtual string GetErrorString( )                { return m_ErrorString; }
        virtual CIncomingJoinPlayer *GetJoinPlayer( )    { return m_IncomingJoinPlayer; }
    +    virtual CIncomingGarenaUser *GetGarenaUser( )    { return m_IncomingGarenaUser; }
    +    virtual BYTEARRAY GetGarenaIP( );
     
        virtual void SetSocket( CTCPSocket *nSocket )    { m_Socket = nSocket; }
        virtual void SetDeleteMe( bool nDeleteMe )        { m_DeleteMe = nDeleteMe; }
    +    virtual void SetGarenaUser( CIncomingGarenaUser *nIncomingGarenaUser ) { m_IncomingGarenaUser = nIncomingGarenaUser; }
     
        // processing functions
     
    
  4. Suicider Старожила

    Сообщения:
    673
    Спасибы:
    117
    Сборка бота GHost:
    Ghost++ 17.1 by w3gh
    Дата начала использования бота:
    12.07.2011
    Проверь, правильно ли вставил этот код... Поставил именно этот кусок, всё норм сработало...
    Покажи 10 строк выше и ниже, куда ты вставил
  5. ELITE Гуру

    Сообщения:
    252
    Спасибы:
    23
    Дата начала использования бота:
    00.00.2012
    закоментированный кусок
    Код:
    void CPotentialPlayer :: ExtractPackets( )
    {
        if( !m_Socket )
            return;
     
        // extract as many packets as possible from the socket's receive buffer and put them in the m_Packets queue
     
        string *RecvBuffer = m_Socket->GetBytes( );
        BYTEARRAY Bytes = UTIL_CreateByteArray( (unsigned char *)RecvBuffer->c_str( ), RecvBuffer->size( ) );
     
        // a packet is at least 4 bytes so loop as long as the buffer contains 4 bytes
     
        while( Bytes.size( ) >= 4 )
        {
            if( Bytes[0] == W3GS_HEADER_CONSTANT || Bytes[0] == GPS_HEADER_CONSTANT || Bytes[0] == GCBI_HEADER_CONSTANT )
            {
                // bytes 2 and 3 contain the length of the packet
     
                uint16_t Length = UTIL_ByteArrayToUInt16( Bytes, false, 2 );
     
                if( Length >= 4 )
                {
                    if( Bytes.size( ) >= Length )
                    {
                        m_Packets.push( new CCommandPacket( Bytes[0], Bytes[1], BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) );
                        *RecvBuffer = RecvBuffer->substr( Length );
                        Bytes = BYTEARRAY( Bytes.begin( ) + Length, Bytes.end( ) );
                    }
                    else
                        return;
                }
                else
                {
                    m_Error = true;
                    m_ErrorString = "received invalid packet from player (bad length)";
                    return;
                }
            }
    //        /*gcbi*/
    //        else if( Packet->GetPacketType( ) == GCBI_HEADER_CONSTANT )
    //        {
    //            if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT )
    //            {
    //                delete m_IncomingGarenaUser;
    //                m_IncomingGarenaUser = m_Game->m_GHost->m_GCBIProtocol->RECEIVE_GCBI_INIT( Packet->GetData( ) );
    //                CONSOLE_Print( "[GCBI] Garena user detected; userid=" + UTIL_ToString( m_IncomingGarenaUser->GetUserID( ) ) + ", roomid=" + UTIL_ToString( m_IncomingGarenaUser->GetRoomID( ) ) + ", experience=" + UTIL_ToString( m_IncomingGarenaUser->GetUserExp( ) ) + ", country=" + m_IncomingGarenaUser->GetCountryCode( ) );
    //            }
    //        }
    //
            else
            {
                m_Error = true;
                m_ErrorString = "received invalid packet from player (bad header constant)";
                return;
            }
        }
    }
     
    void CPotentialPlayer :: ProcessPackets( )
  6. Sparko_Dima Старожила

    Сообщения:
    744
    Спасибы:
    104
    Сборка бота GHost:
    Ghost Sparko
    Дата начала использования бота:
    10.10.09
    мой кусок тока он весь гцб под бан если не проходит спуфер чек и новый ip-to-country под гарену если надо расспишу в скайпе завтра
    Код:
    void CPotentialPlayer :: ProcessPackets( )
    {
        if( !m_Socket )
            return;
     
        // process all the received packets in the m_Packets queue
     
        while( !m_Packets.empty( ) )
        {
            CCommandPacket *Packet = m_Packets.front( );
            m_Packets.pop( );
     
            if( Packet->GetPacketType( ) == W3GS_HEADER_CONSTANT )
            {
                // the only packet we care about as a potential player is W3GS_REQJOIN, ignore everything else
     
                switch( Packet->GetID( ) )
                {
                case CGameProtocol :: W3GS_REQJOIN:
                    delete m_IncomingJoinPlayer;
                    m_IncomingJoinPlayer = m_Protocol->RECEIVE_W3GS_REQJOIN( Packet->GetData( ) );
     
                    if( m_IncomingJoinPlayer && !m_Banned )
                        m_Game->EventPlayerJoined( this, m_IncomingJoinPlayer, NULL );
     
                    // don't continue looping because there may be more packets waiting and this parent class doesn't handle them
                    // EventPlayerJoined creates the new player, NULLs the socket, and sets the delete flag on this object so it'll be deleted shortly
                    // any unprocessed packets will be copied to the new CGamePlayer in the constructor or discarded if we get deleted because the game is full
     
                    delete Packet;
                    return;
                }
            }
     
            else if( Packet->GetPacketType( ) == GCBI_HEADER_CONSTANT )
            {
                if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT && m_Game->m_GHost->IsLocal( GetExternalIPString( ) ) )
                {
                    delete m_IncomingGarenaUser;
                    m_IncomingGarenaUser = m_Game->m_GHost->m_GCBIProtocol->RECEIVE_GCBI_INIT( Packet->GetData( ) );
                    CONSOLE_Print( "[GCBI] Garena user detected; userid=" + UTIL_ToString( m_IncomingGarenaUser->GetUserID( ) ) + ", roomid=" + UTIL_ToString( m_IncomingGarenaUser->GetRoomID( ) ) + ", experience=" + UTIL_ToString( m_IncomingGarenaUser->GetUserExp( ) ) + ", country=" + m_IncomingGarenaUser->GetCountryCode( ) );
                }
            }
     
            delete Packet;
        }
    }
  7. MAMA_YA_DNO Гуру

    Сообщения:
    187
    Спасибы:
    9
    Сборка бота GHost:
    Ghost Rakata Edition
    Дата начала использования бота:
    15.08.2012
    && m_Game->m_GHost->IsLocal( GetExternalIPString( ) )
    в каком патче был этот код? Или кто тебе сказал это дописать?
  8. Sparko_Dima Старожила

    Сообщения:
    744
    Спасибы:
    104
    Сборка бота GHost:
    Ghost Sparko
    Дата начала использования бота:
    10.10.09
    if( m_IncomingJoinPlayer && !m_Banned )
    m_Game->EventPlayerJoined( this, m_IncomingJoinPlayer, NULL ); но ее надо обьявлять)

    тут тоже дописано

    ща хорошо чекает спуферов в гарене)) и даже спуфер админ права не получает))
    нету пача люди помогали ище давно очень
    Код:
    void CBaseGame :: SendLocalAdminChat( string message )
    {
        if( !m_LocalAdminMessages )
            return;
     
        // send a message to LAN/local players who are admins
        // at the time of this writing it is only possible for the game owner to meet this criteria because being an admin requires spoof checking
        // this is mainly used for relaying battle.net whispers, chat messages, and emotes to these players
     
        for( vector<CGamePlayer *> :: iterator i = m_Players.begin( ); i != m_Players.end( ); ++i )
        {
            if( (*i)->GetSpoofed( ) && IsOwner( (*i)->GetName( ) ) && ( UTIL_IsLanIP( (*i)->GetExternalIP( ) ) || UTIL_IsLocalIP( (*i)->GetExternalIP( ), m_GHost->m_LocalAddresses ) ) )
            {
                if( m_VirtualHostPID != 255 )
                    SendChat( m_VirtualHostPID, *i, message );
                else
                {
                    // make the chat message originate from the recipient since it's not going to be logged to the replay
     
                    SendChat( (*i)->GetPID( ), *i, message );
                }
            }
        }
    }
    тут и тп во многих кусках это
  9. MAMA_YA_DNO Гуру

    Сообщения:
    187
    Спасибы:
    9
    Сборка бота GHost:
    Ghost Rakata Edition
    Дата начала использования бота:
    15.08.2012
    просто у меня трабла была, с GCBI патчем половина с гарены зайти не может.
    CONSOLE_Print( "[GCBI] Garena user detected; userid=" +
    эта строка пишется в консоль, а сообщение о том что игрок зашёл нет. И его не пускает. Сталкивался мб?[IMG]
  10. Sparko_Dima Старожила

    Сообщения:
    744
    Спасибы:
    104
    Сборка бота GHost:
    Ghost Sparko
    Дата начала использования бота:
    10.10.09
    у меня такова небыла да и консоль особа не смотрел) но у меня даже локальный айпи определяет в гарене))
    просто не тестил простой пач тот который лежал в GCB у меня чутка подругому реализован)
  11. MAMA_YA_DNO Гуру

    Сообщения:
    187
    Спасибы:
    9
    Сборка бота GHost:
    Ghost Rakata Edition
    Дата начала использования бота:
    15.08.2012
    я не знаю, не тестил.
  12. ELITE Гуру

    Сообщения:
    252
    Спасибы:
    23
    Дата начала использования бота:
    00.00.2012
    так не отходим от темы
  13. MAMA_YA_DNO Гуру

    Сообщения:
    187
    Спасибы:
    9
    Сборка бота GHost:
    Ghost Rakata Edition
    Дата начала использования бота:
    15.08.2012
    ты не в ту функцию копировал ракал
  14. ELITE Гуру

    Сообщения:
    252
    Спасибы:
    23
    Дата начала использования бота:
    00.00.2012
    ну как не в ту
    там же четко прописано ставить в string CPotentialPlayer :: GetExternalIPString( )
    в коде это только в одном месте...
  15. Sparko_Dima Старожила

    Сообщения:
    744
    Спасибы:
    104
    Сборка бота GHost:
    Ghost Sparko
    Дата начала использования бота:
    10.10.09
    может че нить даст))
    Код:
    void CPotentialPlayer :: ExtractPackets( )
    {
        if( !m_Socket )
            return;
     
        // extract as many packets as possible from the socket's receive buffer and put them in the m_Packets queue
     
        string *RecvBuffer = m_Socket->GetBytes( );
        BYTEARRAY Bytes = UTIL_CreateByteArray( (unsigned char *)RecvBuffer->c_str( ), RecvBuffer->size( ) );
     
        // a packet is at least 4 bytes so loop as long as the buffer contains 4 bytes
     
        while( Bytes.size( ) >= 4 )
        {
            if( Bytes[0] == W3GS_HEADER_CONSTANT || Bytes[0] == GPS_HEADER_CONSTANT || Bytes[0] == GCBI_HEADER_CONSTANT )
            {
                // bytes 2 and 3 contain the length of the packet
     
                uint16_t Length = UTIL_ByteArrayToUInt16( Bytes, false, 2 );
     
                if( Length >= 4 )
                {
                    if( Bytes.size( ) >= Length )
                    {
                        m_Packets.push( new CCommandPacket( Bytes[0], Bytes[1], BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) );
                        *RecvBuffer = RecvBuffer->substr( Length );
                        Bytes = BYTEARRAY( Bytes.begin( ) + Length, Bytes.end( ) );
                    }
                    else
                        return;
                }
                else
                {
                    m_Error = true;
                    m_ErrorString = "received invalid packet from player (bad length)";
                    return;
                }
            }
            else
            {
                m_Error = true;
                m_ErrorString = "received invalid packet from player (bad header constant)";
                return;
            }
        }
    }
     
    void CPotentialPlayer :: ProcessPackets( )
    {
        if( !m_Socket )
            return;
     
        // process all the received packets in the m_Packets queue
     
        while( !m_Packets.empty( ) )
        {
            CCommandPacket *Packet = m_Packets.front( );
            m_Packets.pop( );
     
            if( Packet->GetPacketType( ) == W3GS_HEADER_CONSTANT )
            {
                // the only packet we care about as a potential player is W3GS_REQJOIN, ignore everything else
     
                switch( Packet->GetID( ) )
                {
                case CGameProtocol :: W3GS_REQJOIN:
                    delete m_IncomingJoinPlayer;
                    m_IncomingJoinPlayer = m_Protocol->RECEIVE_W3GS_REQJOIN( Packet->GetData( ) );
     
                    if( m_IncomingJoinPlayer && !m_Banned )
                        m_Game->EventPlayerJoined( this, m_IncomingJoinPlayer, NULL );
     
                    // don't continue looping because there may be more packets waiting and this parent class doesn't handle them
                    // EventPlayerJoined creates the new player, NULLs the socket, and sets the delete flag on this object so it'll be deleted shortly
                    // any unprocessed packets will be copied to the new CGamePlayer in the constructor or discarded if we get deleted because the game is full
     
                    delete Packet;
                    return;
                }
            }
           
            else if( Packet->GetPacketType( ) == GCBI_HEADER_CONSTANT )
            {
                if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT && m_Game->m_GHost->IsLocal( GetExternalIPString( ) ) )
                {
                    delete m_IncomingGarenaUser;
                    m_IncomingGarenaUser = m_Game->m_GHost->m_GCBIProtocol->RECEIVE_GCBI_INIT( Packet->GetData( ) );
                    CONSOLE_Print( "[GCBI] Garena user detected; userid=" + UTIL_ToString( m_IncomingGarenaUser->GetUserID( ) ) + ", roomid=" + UTIL_ToString( m_IncomingGarenaUser->GetRoomID( ) ) + ", experience=" + UTIL_ToString( m_IncomingGarenaUser->GetUserExp( ) ) + ", country=" + m_IncomingGarenaUser->GetCountryCode( ) );
                }
            }
     
            delete Packet;
        }
    }
  16. ELITE Гуру

    Сообщения:
    252
    Спасибы:
    23
    Дата начала использования бота:
    00.00.2012
    да спс уже понял ошибку
    теперь компилится но толку никакого :( не показывает руму....
    ошибка IsLocal не является членом m_Game
  17. Sparko_Dima Старожила

    Сообщения:
    744
    Спасибы:
    104
    Сборка бота GHost:
    Ghost Sparko
    Дата начала использования бота:
    10.10.09
    ghost.h
    под этой строчкой
    вставляй ниже
    bool CGHost :: FlameCheck( string message )
    хотя лучше в скайп отпишу этот пач на 600 строк будет -_-
    Код:
    bool CGHost :: IsLocal( string ip )
    {
        // multiple local IP's are space separated
     
        stringstream SS;
        string s;
        SS << m_LocalIPs;
     
        while( !SS.eof( ) )
        {
            SS >> s;
     
            if( ip == s )
                return true;
        }
     
        return false;
    }