// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //:::::::::::::::::::::::: Shayan's Subrace Engine ::::::::::::::::::::::::::::: // ::::::::::Extension: Moon's Subrace Selection Converstion for SSE ::::::::::: // ::::::::::::Contact: http://p2.forumforfree.com/shayan.html:::::::::::::::::: // :::: // :::: Written by: DM_Moon // :: // :: Description: Subrace Conversation used in SSE's Wand system. // :: #include "sha_wand_inc" int moon_BuildConversationDialog(int nCurrent, int nChoice, int iConversation, int iParams, int iFunction=0) { switch(iConversation) { case CONV_START: if(GetIsDM(oMySpeaker)) return moon_conv_Start_DM(nCurrent, nChoice, iParams, iFunction); return moon_conv_Start_PC(nCurrent, nChoice, iParams, iFunction); case CONV_LIST_OBJECTS: return moon_conv_ListObjects(nCurrent, nChoice, iParams, iFunction); case CONV_LIST_RACES: return moon_conv_ListRaces(nCurrent, nChoice, iParams, iFunction); case CONV_READ_RACE: if(GetIsDM(oMySpeaker)) return moon_conv_ReadRaces_DM(nCurrent, nChoice, iParams, iFunction); return moon_conv_ReadRaces_PC(nCurrent, nChoice, iParams, iFunction); case CONV_WORK_TARGET: if(GetIsDM(oMySpeaker)) return moon_conv_WorkWithTarget_DM(nCurrent, nChoice, iParams, iFunction); return moon_conv_WorkWithTarget_PC(nCurrent, nChoice, iParams, iFunction); case CONV_MATCH: if(GetIsDM(oMySpeaker)) return moon_conv_Match_DM(nCurrent, nChoice, iParams, iFunction); return moon_conv_Match_PC(nCurrent, nChoice, iParams, iFunction); case CONV_TEST_LETO: return moon_conv_LetoTest(nCurrent, nChoice, iParams, iFunction); case CONV_CONFIRM_SUBRACE_CHANGE: if(GetIsDM(oMySpeaker)) return moon_conv_ConfirmSubraceChange_DM(nCurrent, nChoice, iParams, iFunction); return moon_conv_ConfirmSubraceChange_PC(nCurrent, nChoice, iParams, iFunction); } return FALSE; } void moon_BuildConversation(int iConversation, int iParams, int iFunction = 0, int iMenu=0) { int iLast; int iTemp; int iChoice = 1; int iCurrent = 1; int iMatch; if(iMenu & MENU_PREV) { //Get the number choice to start with iCurrent = GetLocalInt(oMySpeaker, "mn_dialogprev"); //Since we're going to the previous page, there will be a next SetLocalString(oMySpeaker, "mn_dialog9", "More Options >>"); SetLocalInt(oMySpeaker, "mn_call9", iConversation); SetLocalInt(oMySpeaker, "mn_menu9", MENU_NEXT); SetLocalInt(oMySpeaker, "mn_params9", iParams); SetLocalInt(oMySpeaker, "mn_dialognext", iCurrent); iChoice = 8; for(;iChoice >= 0; iChoice--) { int iTemp1 = iCurrent; int iTemp2 = iCurrent; iMatch = iTemp2; while((iCurrent == iMatch) && (iTemp2 > 0)) { iTemp2--; iMatch = moon_BuildConversationDialog(iTemp2, iChoice, iConversation, iParams, iFunction); } if(iTemp2 <= 0) { //we went back too far for some reason, so make this choice blank DeleteLocalString(oMySpeaker, "mn_dialog" + IntToString(iChoice)); DeleteLocalInt(oMySpeaker, "mn_call" + IntToString(iChoice)); DeleteLocalInt(oMySpeaker, "mn_menu" + IntToString(iChoice)); DeleteLocalInt(oMySpeaker, "mn_params" + IntToString(iChoice)); DeleteLocalInt(oMySpeaker, "mn_function" + IntToString(iChoice)); } iLast = iTemp; iTemp = iTemp1; iTemp1 = iMatch; iCurrent = iMatch; } if(iMatch > 0) { SetLocalString(oMySpeaker, "mn_dialog1", "Previous Options <<"); SetLocalInt(oMySpeaker, "mn_call1", iConversation); SetLocalInt(oMySpeaker, "mn_menu1", MENU_PREV); SetLocalInt(oMySpeaker, "mn_params1", iParams); SetLocalInt(oMySpeaker, "mn_dialogprev", iLast); } //fill the NPC's dialog spot //(saved for last because the build process tromps on it) moon_BuildConversationDialog(0, 0, iConversation, iParams, iFunction); } else { //fill the NPC's dialog spot moon_BuildConversationDialog(0, 0, iConversation, iParams, iFunction); //A "next->" choice was selected if(iMenu & MENU_NEXT) { //get the number choice to start with iCurrent = GetLocalInt(oMySpeaker, "mn_dialognext"); //set this as the number for the "previous" choice to use SetLocalInt(oMySpeaker, "mn_dialogprev", iCurrent); //Set the first dialog choice to be "previous" iChoice = 2; SetLocalString(oMySpeaker, "mn_dialog1", "Previous Options <<"); SetLocalInt(oMySpeaker, "mn_call1", iConversation); SetLocalInt(oMySpeaker, "mn_menu1", MENU_PREV); SetLocalInt(oMySpeaker, "mn_params1", iParams); } //Loop through to build the dialog list for(;iChoice <= 10; iChoice++) { iMatch = moon_BuildConversationDialog(iCurrent, iChoice, iConversation, iParams, iFunction); //nLast will be the value of the choice before the last one iLast = iTemp; iTemp = iMatch; if(iMatch > 0) { iCurrent = iMatch; } else if(iMatch == 0) { iLast = 0; } iCurrent++; } //If there were enough choices to fill 10 spots, make spot 9 a "next" if(iLast > 0) { SetLocalString(oMySpeaker, "mn_dialog9", "More Options >>"); SetLocalInt(oMySpeaker, "mn_call9", iConversation); SetLocalInt(oMySpeaker, "mn_menu9", MENU_NEXT); SetLocalInt(oMySpeaker, "mn_dialognext", iLast); SetLocalInt(oMySpeaker, "mn_params9", iParams); } } } /*int moon_conv_Start(int nCurrent, int nChoice, int iParams = 0, int iFunction=0) { //Sample Conversation Setup string sText = ""; int iCall = 0; int iCallParams = 0; int iFunction=0; switch(nCurrent) { case 0: nCurrent = 0; sText = "NPC Answer"; iCall = 0; iCallFunction = 0; break; case 1: nCurrent = 1; sText = "PC Answer 1"; iCall = CONV_X;//Call a new part of the conversation iFunction = 0; break; case 2: nCurrent = 2; sText = ""; iCall = 0; iFunction = 0; break; default: //This is (usually) a "No more PC Replies" nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; }*/ int moon_conv_Start_DM(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; switch(nCurrent) { case 0: nCurrent = 0; sText = "Welcome to Shayan's Subrace Engine's Subrace Wand for DMs [SSE SW]." + "\nEngine Version: " + Moon_ColourString(SUBRACE_ENGINE_VERSION, COLOUR_LBLUE) + "\nStatus: " + (GetLocalInt(oStorer, "SHUTDOWN_SSE")?Moon_ColourString("\nSSE is DISABLED MODULE WIDE!", COLOUR_RED):Moon_ColourString("\nSSE is ACTIVATED and functioning!", COLOUR_GREEN_SSE)) + (GetLocalInt(GetArea(oMySpeaker), "DISABLE_SUBRACE_ENGINE")?Moon_ColourString("\nThe Engine is disabled in this Area", COLOUR_YELLOW):Moon_ColourString("\nThe Engine is enabled in this Area", COLOUR_GREEN_SSE)); iCall = 0; break; case 1: sText = (GetIsObjectValid(GetMyTarget())&&(SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_OPTIONS_DM))?"Work with my target: "+ Moon_ColourString(GetName(GetMyTarget()) ):""; iCall = CONV_WORK_TARGET; break; case 2: sText = "List Players"; iCall = CONV_LIST_OBJECTS|CONV_DO_FUNCTION; iFunction = FUNCTION_BUILD_CACHE; break; case 3: sText = "List Subraces"; iCall = CONV_LIST_RACES; iParams = CONV_READ_RACE; iFunction = 0; break; case 4: sText = (GetIsObjectValid(GetMyTarget()))?"Show me all subraces available to my target...":""; iCall = CONV_LIST_RACES; iParams = CONV_READ_RACE; iFunction = 1; break; case 5: sText = SWAND_RESTRICT_LETO?"Check NWNX-Leto":""; iCall = CONV_TEST_LETO; break; case 6: sText = "Reset Server"; iCall = CONV_DO_FUNCTION; iFunction = FUNCTION_DO_RESET; break; case 7: sText = (GetLocalInt(GetArea(oMySpeaker), "DISABLE_SUBRACE_ENGINE")?Moon_ColourString("Enable"):Moon_ColourString("Disable", COLOUR_RED)) + " Shayan's Subrace Engine in this area"; iCall = CONV_DO_FUNCTION|CONV_START;//To update "case 0" iFunction = FUNCTION_DO_DISABLE_ENGINE; break; case 8: sText = (GetLocalInt(oStorer, "SHUTDOWN_SSE")?Moon_ColourString("START"):Moon_ColourString("STOP", COLOUR_RED)) + " Shayan's Subrace Engine in the Module."; iCall = CONV_DO_FUNCTION|CONV_START;//To update "case 0" iFunction = FUNCTION_DO_SHUTDOWN_ENGINE; break; default: nCurrent = 0; iFunction = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_ListObjects(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = CONV_WORK_TARGET| CONV_DO_FUNCTION; object oObject; int nCache = GetLocalInt(oMySpeaker, "moon_object_cache"); iFunction = FUNCTION_CACHE_2_TARGET; // string sStoreParam = GetLocalString(oMySpeaker, "moon_object_para"); switch(nCurrent) { case 0: nCurrent = 0; sText = "Which Player do you wish to Target?"; iCall = 0; break; default: //Find the next object in the cache which is valid oObject = GetLocalObject(oMySpeaker, "moon_object_cache" + IntToString(nCurrent)); while((! GetIsObjectValid(oObject)) && (nCurrent <= nCache)) { nCurrent++; oObject = GetLocalObject(oMySpeaker, "moon_object_cache" + IntToString(nCurrent)); } if(nCurrent > nCache) { //We've run out of cache, any other spots in this list should be //skipped nCurrent = 0; sText = ""; iCall = 0; iFunction = 0; iParams = 0; } else { //We found an Object, set up the list entry sText = GetInfoCurrentTarget(oObject); iParams = nCurrent; } break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_ListRaces(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = 0; int iSubraceCount = GetLocalInt(oStorer, MODULE_SUBRACE_COUNT); switch(nCurrent) { case 0: nCurrent = 0; sText = "Which race do you wish to select?"; iCall = 0; break; default: nCurrent--; if(nCurrent > iSubraceCount) { //We've run out of cache, any other spots in this list should be //skipped //nCurrent = 0; return 0; } else { if(nCurrent == 0) nCurrent++; string sNum = GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(nCurrent)); switch(iFunction) { case 1: while(sText == "" && nCurrent <= iSubraceCount) { sNum = GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(nCurrent)); if(CheckIfPCMeetsBaseRaceCriteria(GetMyTarget(), SUBRACE_TAG + "_" + sNum) ) { sText = OutputSubraceInformation(sNum); iCall = iParams; iCallParams = nCurrent; } nCurrent++; } break; case 2: while(sText == "" && nCurrent <= iSubraceCount) { sNum = GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(nCurrent)); if(!CheckIfPCGetsAnyErrorsWithSubraceTest(GetMyTarget(), SUBRACE_TAG + "_" + sNum)) { sText = OutputSubraceInformation(sNum); iCall = iParams; iCallParams = nCurrent; } nCurrent++; } break; default: sText = OutputSubraceInformation(sNum); iCall = iParams; iCallParams = nCurrent; break; } } nCurrent++; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_ReadRaces_DM(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = 0; switch(nCurrent) { case 0: sText = OutputFullSubraceInformation(GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)));; iCall = 0; break; case 1: sText = (GetIsObjectValid(GetMyTarget())&&(SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_OPTIONS_DM))? "Work with my target: "+ Moon_ColourString(GetName(GetMyTarget()) ):""; iCall = CONV_MATCH; iCallParams = iParams; break; case 2: sText = "Back to Race List"; iCall = CONV_LIST_RACES; iCallParams = CONV_READ_RACE; break; case 3: sText = "Back to Main Menu"; iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_WorkWithTarget_DM(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = 0; int iFunction =0; switch(nCurrent) { case 0: sText = GetInfoCurrentTarget(GetMyTarget() ); break; case 1: sText = (SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_CHANGE_SUBRACE_DM)?"Give Player a new Subrace. This will remove the old subrace.":""; iCall = CONV_LIST_RACES; iCallParams = CONV_MATCH; break; case 2: sText = (SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_REMOVE_SUBRACE_DM)?"Purge Player's Subrace":""; iCall = CONV_CONFIRM_SUBRACE_CHANGE; iCallParams = -1; break; case 3: break; case 7: sText = "Search for a new Object and Replace the old."; iCall = CONV_LIST_OBJECTS|CONV_DO_FUNCTION; iFunction = FUNCTION_BUILD_CACHE; break; case 8: sText = Moon_ColourString("Back to Main Conversaion"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_Match_DM(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = iParams; // int iFunction =0; switch(nCurrent) { case 0: sText = GetTestMatch(GetMyTarget(), GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)) ); break; case 1: sText = (SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_CHANGE_SUBRACE_DM)?"Change Subrace!":""; iCall = CONV_CONFIRM_SUBRACE_CHANGE; break; case 7: sText = "Select a different Race"; iCall = CONV_LIST_RACES; iCallParams = CONV_MATCH; break; case 8: sText = Moon_ColourString("Back to Main Conversaion"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_LetoTest(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; object oTarget; string sFilename; string sLoc; switch(nCurrent) { case 0: oTarget = GetMyTarget(); if(!GetIsObjectValid(oTarget)) { oTarget = GetPCSpeaker(); } sFilename = GetLocalString(oTarget, "SUBR_FileName"); sLoc = LETO_GetBicPath_Wand(oTarget); sText =ENABLE_LETO? "Leto is " +(LetoPingPong()?"":Moon_ColourString("not", COLOUR_RED) )+" Responding."+ (GetIsDM(oTarget)?"": "\n\nThe Information Leto has given about " + GetName(oTarget) + "\nPath: " + sLoc + "\nFilename: " + sFilename) + "\n\n" +(LETO_ACTIVATE_PORTAL? "Use Portal: Yes\nIP: " + LETO_PORTAL_IP_ADDRESS + "\nPassword: " + ((SWAND_RESTRICT_LETO-1)?LETO_PORAL_SERVER_PASSWORD:"********") + "\nWaypoint Tag: " + LETO_PORTAL_WAYPOINT + "\nKeep PC In Place: " + (LETO_PORTAL_KEEP_CHARACTER_IN_THE_SAME_PLACE? "Yes":"No") : "Use Portal: No\nDo Auto-Booting: " + (LETO_AUTOMATICALLY_BOOT?"Yes":"No") + "\nBoot Delay: " + IntToString(LETO_AUTOMATIC_PORTAL_DELAY) + " seconds" ) : "Leto is disabled!" ; break; case 1: break; case 8: sText = Moon_ColourString("Back to Main Conversaion"); iCall = CONV_START; iParams = 0; iFunction = 0; break; default: nCurrent = 0; iFunction = 0; iParams = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_ConfirmSubraceChange_DM(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = iParams; // int iFunction =0; switch(nCurrent) { case 0: if(GetLocalInt(OBJECT_SELF, SUBRACE_TAG + GetName(GetMyTarget()))) { sText = "You are about to "+ ( (iParams!=-1)? Moon_ColourString("change ", COLOUR_YELLOW) + Moon_ColourString(GetName(GetMyTarget())) + "'s subrace to " + Moon_ColourString(CapitalizeString( GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)) ), COLOUR_LBLUE ) : Moon_ColourString("remove ", COLOUR_RED)+ Moon_ColourString(GetName(GetMyTarget())) + "'s subrace"); } else { sText = GetName(GetMyTarget()) + "'s subrace has been changed."; } break; case 1: if(GetLocalInt(OBJECT_SELF, SUBRACE_TAG + GetName(GetMyTarget()))) { sText = "Proceed with the change."; iCall = CONV_DO_FUNCTION; iFunction = FUNCTION_CHANGE_SUBRACE; } else { nCurrent = 0; } break; case 7: sText = "Select a different subrace"; iCall = CONV_LIST_RACES; iCallParams = CONV_MATCH; break; case 8: sText = Moon_ColourString("Back to Start"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_Start_PC(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; switch(nCurrent) { case 0: nCurrent = 0; sText = "Welcome to Shayan's Subrace Engine's Subrace Chooser for Players."; iCall = 0; break; case 1: sText = "Apply a new subrace..."; iCall = CONV_WORK_TARGET; break; case 2: sText = "Show me all subraces, to which my character meets all requirements..."; iCall = CONV_LIST_RACES; iParams = CONV_READ_RACE; iFunction = 2; break; case 3: sText = "Show me all subraces, which has the same base race as my character."; iCall = CONV_LIST_RACES; iParams = CONV_READ_RACE; iFunction = 1; break; case 4: sText = "Show me all subraces..."; iCall = CONV_LIST_RACES; iParams = CONV_READ_RACE; iFunction = 0; break; case 5: sText = "Reload my subrace. (May fix misc. such as wrong appearence)"; iCall = CONV_DO_FUNCTION; iFunction = FUNCTION_RELOAD_SUBRACE; break; default: nCurrent = 0; iFunction = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_WorkWithTarget_PC(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = 0; int iFunction =0; switch(nCurrent) { case 0: sText = GetName(oMySpeaker) + ", what do you wish to do?"; break; case 1: sText = (SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_CHANGE_SUBRACE_PC)?"Give me a new Subrace. I accept that this will remove my old Subrace.":""; iCall = CONV_LIST_RACES; iCallParams = CONV_MATCH; break; case 2: sText = (SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_REMOVE_SUBRACE_PC)?"Purge my Subrace":""; iCall = CONV_CONFIRM_SUBRACE_CHANGE; iCallParams = -1; break; case 8: sText = Moon_ColourString("Back to Start"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_ReadRaces_PC(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = 0; switch(nCurrent) { case 0: sText = OutputFullSubraceInformation(GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)));; iCall = 0; break; case 1: sText = (SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_CHANGE_SUBRACE_PC) ? "I want this to be my new Subrace.":""; iCall = CONV_MATCH; iCallParams = iParams; break; case 2: sText = "Back to Race List"; iCall = CONV_LIST_RACES; iCallParams = CONV_READ_RACE; break; case 3: sText = Moon_ColourString("Back to Start"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_Match_PC(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = iParams; switch(nCurrent) { case 0: sText = GetTestMatch(oMySpeaker, GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)) ); break; case 1: iFunction = CheckIfPCGetsAnyErrorsWithSubraceTest(oMySpeaker, SUBRACE_TAG + "_" + GetStringLowerCase(GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)))); if((SWAND_RESTRICT_SUBRACE_MODIFICATION&SWAND_MAY_CHANGE_SUBRACE_PC) ) { if(!iFunction) { sText = "I wish to obtain this subrace."; iCall = CONV_CONFIRM_SUBRACE_CHANGE; } else { iCall=0; while(iFunction ) { iCall += iFunction&FLAG1; iFunction>>=1; } sText = "There was " + IntToString(iCall) + " " + ((iCall!=1)?"mismatches":"mismatch") + "."+ "\nYou cannot change your subrace, if you do not meet the requirements for it."; iCall=0; } } iFunction = 0; break; case 7: sText = "Select a different Race"; iCall = CONV_LIST_RACES; iCallParams = CONV_MATCH; break; case 8: sText = Moon_ColourString("Back to Main Conversaion"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } int moon_conv_ConfirmSubraceChange_PC(int nCurrent, int nChoice, int iParams = 0, int iFunction = 0) { string sText = ""; int iCall = 0; int iCallParams = iParams; // int iFunction =0; switch(nCurrent) { case 0: if(!GetLocalInt(GetMyTarget(), MOON_CHANGE_SUBRACE)) { sText = "You are about to "+ ( (iParams!=-1)? Moon_ColourString("change ", COLOUR_YELLOW) + Moon_ColourString("your") + " subrace to " + Moon_ColourString(CapitalizeString( GetLocalString(oStorer, MODULE_SUBRACE_NUMBER + IntToString(iParams)) ), COLOUR_LBLUE ) : Moon_ColourString("remove ", COLOUR_RED)+ Moon_ColourString("your") + " subrace"); SetMyTarget(oMySpeaker); } else { sText = "Your subrace has been changed."; } break; case 1: if(!GetLocalInt(GetMyTarget(), MOON_CHANGE_SUBRACE)) { sText = "Proceed with the change."; iCall = CONV_DO_FUNCTION; iFunction = FUNCTION_CHANGE_SUBRACE; } else { nCurrent = 0; } break; case 7: sText = "Select a different subrace"; iCall = CONV_LIST_RACES; iCallParams = CONV_MATCH; break; case 8: sText = Moon_ColourString("Back to Start"); iCall = CONV_START; break; default: nCurrent = 0; break; } SetLocalString(oMySpeaker, "mn_dialog" + IntToString(nChoice), sText); SetLocalInt(oMySpeaker, "mn_call" + IntToString(nChoice), iCall); SetLocalInt(oMySpeaker, "mn_params" + IntToString(nChoice), iCallParams); SetLocalInt(oMySpeaker, "mn_function"+ IntToString(nChoice), iFunction); DeleteLocalInt(oMySpeaker, "mn_menu"+ IntToString(nChoice)); return nCurrent; } void moon_StartConversation() { if(! GetIsObjectValid(oMySpeaker)) { return; } object oTarget = GetItemActivatedTarget(); if(!GetIsDM(oMySpeaker)) { SetMyTarget(oMySpeaker); } else if( GetIsPC( oTarget ) && !GetIsDM(oTarget) ) { SetMyTarget(oTarget); } int iConv = GetLocalInt(oMySpeaker, MOON_PREFIX + MOON_SPECIAL_START); if(!iConv) iConv = CONV_START; moon_BuildConversation(iConv, 0); DeleteLocalInt(oMySpeaker, MOON_PREFIX + MOON_SPECIAL_START); }