The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.ADMIN menu hardcoded
Author Message
x77x
Master
**

Posts: 488
Likes Given: 0
Likes Received: 15 in 15 posts
Joined: Mar 2012
Reputation: -4



Post: #8
RE: .ADMIN menu hardcoded
hmm

Code:
void CClient::addGumpDialogAdmin( int iAdPage, int iSortType )
    {
        // Alter this routine at your own risk....if anymore
        // bytes get sent to the client, you WILL crash them
        // Take away, but don't add (heh) (actually there's like
        // 100 bytes available, but they get eaten up fast with
        // this gump stuff)
    
        static LPCTSTR const sm_szGumps = // These are on every page and don't change
        {
                "page 0",
                "resizepic 0 0 5120 623 310",
                "resizepic 242 262 5120 170 35",
                "text 230 10 955 0",
        };
    
        CGString sControls;
        int iControls = 0;
    
        while ( iControls<COUNTOF(sm_szGumps))
        {
                sControls = sm_szGumps;
                iControls++;
        }
    
        CGString sText;
        int iTexts=1;
        sText.Format( "Admin Control Panel (%d clients)", g_Serv.m_Clients.GetCount());
    
        static const int sm_iColSpaces = // These are on every page and don't change
        {
                8 + 19,         // Text (sock)
                8 + 73,         // Text (account name)
                8 + 188,        // Text (name)
                8 + 328,        // Text (ip)
                8 + 474         // Text (location)
        };
    
        static LPCTSTR const sm_szColText = // These are on every page and don't change
        {
                "Sock",
                "Account",
                "Name",
                "IP Address",
                "Location"
        };
    
        while ( iTexts<=COUNTOF(sm_szColText) )
        {
                sControls.Format( "text %d 30 955 %d", sm_iColSpaces-2, iTexts );
                iControls++;
    
                sText = sm_szColText;
                iTexts++;
        }
    
        // Count clients to show.
        // Create sorted list.
        CClientSortList ClientList;
        ClientList.SortByType( 1, m_pChar );
    
        // none left to display for this page ?
        int iClient = iAdPage*ADMIN_CLIENTS_PER_PAGE;
        if ( iClient >= ClientList.GetCount())
        {
                iAdPage = 0;    // just go back to first page.
                iClient = 0;
        }
    
        m_tmGumpAdmin.m_iPageNum = iAdPage;
        m_tmGumpAdmin.m_iSortType = iSortType;
    
        int iY = 50;
    
        for ( int i=0; iClient<ClientList.GetCount() && i<ADMIN_CLIENTS_PER_PAGE; iClient++, i++ )
        {
                CClient * pClient = ClientList.GetAt(iClient);
                ASSERT(pClient);
    
                // Sock buttons
                //      X, Y, Down gump, Up gump, pressable, iPage, id
                sControls.Format(
                        "button 12 %i 2362 2361 1 1 %i",
                        iY + 4, // Y
                        901 + i );      // id
    
                for ( int j=0; j<COUNTOF(sm_iColSpaces); j++ )
                {
                        sControls.Format(
                                "text %i %i 955 %i",
                                sm_iColSpaces,
                                iY,
                                iTexts+j );
                }
    
                CSocketAddress PeerName = pClient->m_Socket.GetPeerName();
    
                TCHAR accountName;
                strcpylen( accountName, pClient->GetName(), 12 );
                // max name size for this dialog....otherwise CRASH!!!, not a big enuf buffer :(
    
                CChar * pChar = pClient->GetChar();
                if ( pClient->IsPriv(PRIV_GM) || pClient->GetPrivLevel() >= PLEVEL_Counsel )
                {
                        memmove( accountName+1, accountName, 13 );
                        accountName = ( pChar && pChar->IsDND()) ? '*' : '+';
                }
    
                ASSERT( i<COUNTOF(m_tmGumpAdmin.m_Item));
                if ( pChar != NULL )
                {
                        m_tmGumpAdmin.m_Item = pChar->GetUID();
    
                        TCHAR characterName;
                        strcpy(characterName, pChar->GetName());
                        characterName = 0; // same comment as the accountName...careful with this stuff!
                        sText.Format("%x", pClient->m_Socket.GetSocket());
                        sText = accountName;
                        sText = characterName;
    
                        CPointMap pt = pChar->GetTopPoint();
                        sText.Format( "%s", PeerName.GetAddrStr()) ;
                        sText.Format( "%d,%d,%d ",
                                pt.m_x,
                                pt.m_y,
                                pt.m_z,
                                pt.m_mapplane) ;
                }
                else
                {
                        m_tmGumpAdmin.m_Item = 0;
    
                        sText.Format( "%03x", pClient->m_Socket.GetSocket());
                        sText = accountName;
                        sText = "N/A";
                        sText = PeerName.GetAddrStr();
                        sText = "N/A";
                }
    
                iY += 20; // go down a 'line' on the dialog
        }
    
        if ( m_tmGumpAdmin.m_iPageNum ) // is there a previous ?
        {
                sControls = "button 253 267 5537 5539 1 0 801"; // p
        }
        if ( iClient<ClientList.GetCount())     // is there a next ?
        {
                sControls = "button 385 267 5540 5542 1 0 802"; // n
        }
    
        addGumpDialog( CLIMODE_DIALOG_ADMIN, sControls, iControls, sText, iTexts, 0x05, 0x46 );
    }

Dragons of Time 2000-2020
http://dragonsoftime.com
(This post was last modified: 05-03-2014 10:47 AM by x77x.)
05-03-2014 10:38 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
.ADMIN menu hardcoded - x77x - 05-01-2014, 09:58 PM
RE: .ADMIN menu hardcoded - Avatar - 05-02-2014, 12:51 AM
RE: .ADMIN menu hardcoded - darksun84 - 05-02-2014, 12:54 AM
RE: .ADMIN menu hardcoded - Avatar - 05-02-2014, 06:10 AM
RE: .ADMIN menu hardcoded - x77x - 05-02-2014, 09:16 PM
RE: .ADMIN menu hardcoded - XuN - 05-02-2014, 10:08 PM
RE: .ADMIN menu hardcoded - x77x - 05-03-2014, 12:22 AM
RE: .ADMIN menu hardcoded - x77x - 05-03-2014 10:38 AM
RE: .ADMIN menu hardcoded - XuN - 05-03-2014, 04:55 PM
RE: .ADMIN menu hardcoded - x77x - 05-04-2014, 12:16 AM
RE: .ADMIN menu hardcoded - x77x - 10-23-2016, 05:46 AM
RE: .ADMIN menu hardcoded - Kanibal - 10-23-2016, 08:21 AM
RE: .ADMIN menu hardcoded - x77x - 10-23-2016, 09:10 AM
RE: .ADMIN menu hardcoded - Kanibal - 10-23-2016, 10:32 AM
RE: .ADMIN menu hardcoded - x77x - 10-23-2016, 11:12 PM

Forum Jump:


User(s) browsing this thread: 11 Guest(s)