// Modified by Zunath #include "zzdlg_main_inc" #include "inc_mysql_tables" #include "colors_inc" #include "portrait_include" const string RESPONSE_PAGE = "headmenu_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 ) { object oPC = dlgGetSpeakingPC(); DeleteList( RESPONSE_PAGE, oPC ); // Reset to original head SetCreatureBodyPart(CREATURE_PART_HEAD, GetLocalInt(oPC, "TEMP_ORIGINAL_HEAD")); // Remove temporary variables DeleteLocalInt(oPC, "TEMP_ORIGINAL_HEAD"); DeleteLocalInt(oPC, "TEMP_ORIGINAL_HEAD_DBID"); DeleteLocalInt(oPC, "TEMP_CURRENT_HEAD_DBID"); } void OnEnd( string sPage ) { object oPC = dlgGetSpeakingPC(); DeleteList( RESPONSE_PAGE, oPC ); // Reset to original head SetCreatureBodyPart(CREATURE_PART_HEAD, GetLocalInt(oPC, "TEMP_ORIGINAL_HEAD")); // Remove temporary variables DeleteLocalInt(oPC, "TEMP_ORIGINAL_HEAD"); DeleteLocalInt(oPC, "TEMP_ORIGINAL_HEAD_DBID"); DeleteLocalInt(oPC, "TEMP_CURRENT_HEAD_DBID"); } void OnContinue( string sPage, int iContinuePage ) { } // Message handler void main() { dlgOnMessage(); } // Specific scripting starts here // MAIN PAGE START void MainPageInit( ) { object oPC = dlgGetSpeakingPC(); int iOriginalHead = GetLocalInt(oPC, "TEMP_ORIGINAL_HEAD"); int iOriginalDBID = GetLocalInt(oPC, "TEMP_ORIGINAL_HEAD_DBID"); int iCurrentHead = GetCreatureBodyPart(CREATURE_PART_HEAD, oPC); SetLocalInt(oPC, "TEMP_CURRENT_HEAD_DBID", iCurrentHead); string sPrompt = "You may adjust your character's head here.\n\n"; sPrompt += ColorTokenGreen() + "Set Head ID: " + ColorTokenEnd() + IntToString(iOriginalDBID) + "\n"; sPrompt += ColorTokenGreen() + "Viewing Head ID: " + ColorTokenEnd() + IntToString(iCurrentHead); dlgSetPrompt(sPrompt); // Action commands (Increase/Decrease head ID by set value) dlgAddResponseAction(RESPONSE_PAGE, "Advance Head ID by 1"); dlgAddResponseAction(RESPONSE_PAGE, "Advance Head ID by 10"); dlgAddResponseAction(RESPONSE_PAGE, "Advance Head ID by 100"); dlgAddResponseAction(RESPONSE_PAGE, "Decrease Head ID by 1"); dlgAddResponseAction(RESPONSE_PAGE, "Decrease Head ID by 10"); dlgAddResponseAction(RESPONSE_PAGE, "Decrease Head ID by 100"); // Action commands (Set current head ID permanently) dlgAddResponseAction(RESPONSE_PAGE, "Set Head ID (" + IntToString(iCurrentHead) + ")"); // Action commands (Revert to original head ID) dlgAddResponseAction(RESPONSE_PAGE, "Reset Head"); // Return to main menu dlgAddResponseAction(RESPONSE_PAGE, "Back", ColorTokenBlue()); dlgDeactivateResetResponse(); } void MainPageSelect( ) { object oPC = dlgGetSpeakingPC(); object oModule = GetModule(); int iCurrentHead = GetCreatureBodyPart(CREATURE_PART_HEAD, oPC); int iCurrentDBID = GetLocalInt(oPC, "TEMP_CURRENT_HEAD_DBID"); if(dlgIsSelectionEqualToName("Back")) { // Reset to original head SetCreatureBodyPart(CREATURE_PART_HEAD, GetLocalInt(oPC, "TEMP_ORIGINAL_HEAD"), oPC); // Remove temporary variables DeleteLocalInt(oPC, "TEMP_ORIGINAL_HEAD"); DeleteLocalInt(oPC, "TEMP_ORIGINAL_HEAD_DBID"); DeleteLocalInt(oPC, "TEMP_CURRENT_HEAD_DBID"); dlgChangeDlgScript(oPC, "rest_menu"); return; } else if(dlgIsSelectionEqualToName("Advance Head ID by 1")) { int iNewID = iCurrentDBID + 1; if(iNewID > HEAD_COUNT) iNewID = 1; SetCreatureBodyPart(CREATURE_PART_HEAD, iNewID, oPC); } else if(dlgIsSelectionEqualToName("Advance Head ID by 10")) { int iNewID = iCurrentDBID + 10; if(iNewID > HEAD_COUNT) iNewID = iNewID - HEAD_COUNT; SetCreatureBodyPart(CREATURE_PART_HEAD, iNewID, oPC); } else if(dlgIsSelectionEqualToName("Advance Head ID by 100")) { int iNewID = iCurrentDBID + 100; if(iNewID > HEAD_COUNT) iNewID = iNewID - HEAD_COUNT; SetCreatureBodyPart(CREATURE_PART_HEAD, iNewID, oPC); } else if(dlgIsSelectionEqualToName("Decrease Head ID by 1")) { int iNewID = iCurrentDBID - 1; if(iNewID < 1) iNewID = HEAD_COUNT; SetCreatureBodyPart(CREATURE_PART_HEAD, iNewID, oPC); } else if(dlgIsSelectionEqualToName("Decrease Head ID by 10")) { int iNewID = iCurrentDBID - 10; if(iNewID < 1) iNewID = HEAD_COUNT - abs(iNewID); SetCreatureBodyPart(CREATURE_PART_HEAD, iNewID, oPC); } else if(dlgIsSelectionEqualToName("Decrease Head ID by 100")) { int iNewID = iCurrentDBID - 100; if(iNewID < 1) iNewID = HEAD_COUNT - abs(iNewID); SetCreatureBodyPart(CREATURE_PART_HEAD, iNewID, oPC); } else if(dlgIsSelectionEqualToName("Set Head ID (" + IntToString(iCurrentDBID) + ")")) { SetLocalInt(oPC, "TEMP_ORIGINAL_HEAD", iCurrentHead); SetLocalInt(oPC, "TEMP_ORIGINAL_HEAD_DBID", iCurrentDBID); } else if(dlgIsSelectionEqualToName("Reset Head")) { SetCreatureBodyPart(CREATURE_PART_HEAD, GetLocalInt(oPC, "TEMP_ORIGINAL_HEAD"), oPC); } }