// Modified by Zunath #include "zzdlg_main_inc" #include "inc_mysql_tables" #include "colors_inc" const string RESPONSE_PAGE = "authorization_responses"; const string PAGE_MAIN = "main_page"; // Prototypes void MainPageInit(); void MainPageSelect(); void OnInit() { dlgChangeLabelNext("Next page"); dlgChangeLabelPrevious("Previous page"); dlgChangePage(PAGE_MAIN); dlgActivatePreservePageNumberOnSelection(); dlgActivateResetResponse(); } // Create the page void OnPageInit( string sPage ) { DeleteList( RESPONSE_PAGE, dlgGetSpeakingPC() ); if( sPage == PAGE_MAIN ) MainPageInit( ); dlgSetActiveResponseList( RESPONSE_PAGE ); } // Handles any selection. void OnSelection( string sPage ) { if ( sPage == PAGE_MAIN ) MainPageSelect( ); } void OnReset( string sPage ) { dlgChangePage( PAGE_MAIN ); dlgResetPageNumber( ); } void OnAbort( string sPage ) { DeleteList( RESPONSE_PAGE, dlgGetSpeakingPC() ); } void OnEnd( string sPage ) { DeleteList( RESPONSE_PAGE, dlgGetSpeakingPC() ); } void OnContinue( string sPage, int iContinuePage ) { } // Message handler void main() { dlgOnMessage(); } // Specific scripting starts here // MAIN PAGE START void MainPageInit( ) { object oPC = dlgGetSpeakingPC(); string sPrompt = "If you use more than one CD key to log into this account, you will need to add it to your list of authorized CD keys.\n\n"; sPrompt += "To add a new key to your account select the 'Add CD Key to Account' option below. Once you have done that, you simply need to log in using the new CD key.\n\n"; sPrompt += "Please keep in mind that if you use only one CD key, none of this applies to you. If you have any questions please feel free to ask a DM for help."; dlgSetPrompt(sPrompt); dlgAddResponseAction(RESPONSE_PAGE, "Add CD Key to Account"); dlgAddResponseAction(RESPONSE_PAGE, "Back", ColorTokenBlue()); dlgDeactivateResetResponse(); } void MainPageSelect( ) { object oPC = dlgGetSpeakingPC(); string sAccount = SQLEncodeSpecialChars(GetPCPlayerName(oPC)); if(dlgIsSelectionEqualToName("Back")) { dlgChangeDlgScript(oPC, "rest_menu"); } else if(dlgIsSelectionEqualToName("Add CD Key to Account")) { int iNumberOfKeys = StringToInt(GetMySQLDataKeyString(AUTHORIZATION_TABLE, "NumberOfKeys", sAccount, "Account")); if(iNumberOfKeys < 7) { FloatingTextStringOnCreature(ColorTokenGreen() + "Please log in using the new CD key you wish to tie to your account. This should be done as soon as possible!" + ColorTokenEnd(), oPC, FALSE); string sSQL = "UPDATE " + AUTHORIZATION_TABLE + " SET Status=1 WHERE Account='" + sAccount + "'"; SQLExecDirect(sSQL); } else { FloatingTextStringOnCreature(ColorTokenRed() + "You cannot link any more CD keys to this account. If you would like to remove a linked CD key, please contact a DM." + ColorTokenEnd(), oPC, FALSE); } } }