bool ProcessCommandSP$( string command$, string input$, int elements$ ) { string bang$ = StringTool.Left( command$, 1 ); if ( bang$ == "/" ) { command$ = StringTool.Mid( command$, 1 ); if ( StringTool.SameNoCase( command$, "give", 3 ) ) { if ( elements$ > 1 ) { //use GetDelimitedString instead of Mid to trim away the whitespace string pcontent$ = StringTool.GetDelimitedString( input$, 1, ' ', "" ); if ( pcontent$ == "" ) { Report.Screen( msg_params_need$ ); } else { GoCloneReq req$ = MakeGoCloneReq( pcontent$ ); Go player$ = GoDb.GetFocusGo.Go; req$.FadeIn = true; req$.SnapToTerrain = true; req$.StartingPos = player$.Placement.Position; if ( player$.HasMind() ) { //sanity check if ( AIQuery.FindSpotRelativeToSource( player$, .25, .5, 2, player$.Mind.TempPos1 ) ) { req$.StartingPos = player$.Mind.TempPos1; } } Goid item$ = GoDb.SCloneGo( req$ ); if ( item$.IsValid ) { string item_name$; item$.Go.Common.GetScreenName( item_name$ ); Report.ScreenF( "Created item \"%s\" (%s) at %s", item_name$, pcontent$, MakeSiegePosString( item$.Go.Placement.Position ) ); } else { Report.ScreenF( "Failed to clone %s", pcontent$ ); } } } else { Report.Screen( msg_params_need$ ); } return true; } else if ( StringTool.SameNoCase( command$, "name", 3 ) ) { if ( elements$ > 1 ) { //enforce the 14 character limit string name$ = StringTool.Mid( StringTool.Mid( input$, 6 ), 0, 14 ); elements$ -= 1; //the nested StringTool.Mid command strips away the first element //detect characters that are normally excluded in the character creation edit box..."<>:/\|?*.%; if ( !IsSanitaryText$( name$ ) ) { Report.Screen( "Your name cannot contain any of the following characters: \"<>:/\|?*.%;" ); } else { string oldname$; Go player$ = GoDb.GetFocusGo.Go; player$.Common.GetScreenName( oldname$ ); player$.Common.SSetScreenName( name$ ); Report.ScreenF( "%s changed %s name to %s", oldname$, ( player$.Actor.IsMale ? "his" : "her" ) , name$ ); } } else { Report.Screen( msg_params_need$ ); } return true; } else if ( StringTool.SameNoCase( command$, "inventory", 3 ) ) { if ( elements$ > 1 ) { command$ = StringTool.GetDelimitedString( input$, 1, ' ', "" ); if ( command$ == "" ) { Report.Screen( msg_params_need$ ); } else if ( StringTool.SameNoCase( command$ , "delete", 3 ) ) { Go player$ = GoDb.GetFocusGo.Go; GopColl contents$ = ( player$.HasMind ? player$.Mind.TempGopColl1 : AIQuery.TempGopColl1 ); //sanity check player$.Inventory.ListItems( IL_MAIN, contents$ ); int index$ = contents$.Size - 1; int count$ = 0; Go item$; while ( index$ > -1 ) { item$ = contents$.Get( index$ ); if ( item$ != NULL ) { if ( !item$.IsEquipped() ) { //weird, il_main includes equip slots... GoDb.RSMarkForDeletion( item$, true, false, false ); count$ += 1; } } index$ -= 1; } Report.ScreenF( "Deleted %d items from inventory", count$ ); } else if ( StringTool.SameNoCase( command$, "drop", 3 ) ) { Go player$ = GoDb.GetFocusGo.Go; GopColl contents$ = ( player$.HasMind ? player$.Mind.TempGopColl1 : AIQuery.TempGopColl1 ); //sanity check player$.Inventory.ListItems( IL_MAIN, contents$ ); int index$ = contents$.Size - 1; int count$ = 0; Go item$; while ( index$ > -1 ) { item$ = contents$.Get( index$ ); if ( item$ != NULL ) { if ( !item$.IsEquipped() ) { //weird, il_main includes equip slots... player$.Inventory.RSRemove( item$, true ); count$ += 1; } } index$ -= 1; } Report.ScreenF( "Dropped %d items from inventory", count$ ); } else if ( StringTool.SameNoCase( command$, "unlock", 3 ) ) { GoDb.GetFocusGo.Go.Inventory.RCEndUse(); Report.Screen( "Attempted to end all inventory locks..." ); } else { Report.Screen( msg_params_bad$ ); } } else { Report.Screen( msg_params_need$ ); } return true; } else if ( StringTool.SameNoCase( command$, "gold", 3 ) ) { if ( elements$ > 1 ) { int amount$ = StringTool.GetDelimitedInt( input$, 1, ' ', 0 ); if ( amount$ > 0 ) { Go player$ = GoDb.GetFocusGo.Go; player$.Inventory.RSAddGold( amount$ ); string screen_name$; player$.Common.GetScreenName( screen_name$ ); Report.ScreenF( "Increased %s's gold balance by %d", screen_name$, amount$ ); } else { Report.Screen( msg_params_bad$ ); } } else { Report.Screen( msg_params_need$ ); } return true; } else if ( StringTool.SameNoCase( command$, "camera", 3 ) ) { if ( elements$ > 1 ) { command$ = StringTool.GetDelimitedString( input$, 1, ' ', "" ); if ( command$ == "" ) { Report.Screen( msg_params_need$ ); } else if ( StringTool.SameNoCase( command$, "test", 2 ) ) { //the "test" preset range SiegeEngine.Camera.SetMinDistance(0); SiegeEngine.Camera.SetMaxDistance(20); SiegeEngine.Camera.SetMinAzimuth(-50); SiegeEngine.Camera.SetMaxAzimuth(90); } else if ( elements$ > 2 ) { if ( StringTool.SameNoCase( command$, "azimuth", 1 ) ) { int min_azimuth$ = StringTool.GetDelimitedInt( input$, 2, ' ', -88 ); if ( min_azimuth$ < -87 || min_azimuth$ > 90 ) { Report.ScreenF( "Camera min azimuth (%d) must be between -87 and 90 inclusive", min_azimuth$ ); } else { Report.ScreenF( "Camera min azimuth was set to %d", min_azimuth$ ); SiegeEngine.Camera.SetMinAzimuth( min_azimuth$ ); } if ( elements$ > 3 ) { int max_azimuth$ = StringTool.GetDelimitedInt( input$, 3, ' ', 91 ); min_azimuth$ = Math.MaxInt( 0, min_azimuth$ ); if ( max_azimuth$ < min_azimuth$ ) { Report.ScreenF( "Camera max azimuth (%d) must be between %d and 90 inclusive", min_azimuth$ ); Report.ScreenF( "Camera max azimuth was set to %d", min_azimuth$ ); SiegeEngine.Camera.SetMaxAzimuth( min_azimuth$ ); } else if ( max_azimuth$ > 90 ) { Report.ScreenF( "Camera max azimuth (%d) must be between -87 and 90 inclusive", max_azimuth$ ); Report.ScreenF( "Camera max azimuth was set to 90" ); SiegeEngine.Camera.SetMaxAzimuth( 90 ); } else { Report.ScreenF( "Camera max azimuth was set to %d", max_azimuth$ ); SiegeEngine.Camera.SetMaxAzimuth( max_azimuth$ ); } } } else if ( StringTool.SameNoCase( command$, "distance", 1 ) ) { int min_distance$ = StringTool.GetDelimitedInt( input$, 2, ' ', -1 ); if ( min_distance$ < 0 ) { Report.Screen("Camera min distance must be greater than or equal to 0"); } else { SiegeEngine.Camera.SetMinDistance( min_distance$ ); } if ( elements$ > 3 ) { int max_distance$ = StringTool.GetDelimitedInt( input$, 3, ' ', -83775638 ); if ( max_distance$ < min_distance$ ) { if ( min_distance$ < 1 ) { Report.Screen( "Camera max distance must be greater than or equal to 1" ); } else { Report.ScreenF( "Camera max distance must be greater than or equal to %d", min_distance$ ); if ( max_distance$ != -83775638 ) { Report.ScreenF( "Camera max distance was set to %d", min_distance$ ); SiegeEngine.Camera.SetMaxDistance( min_distance$ ); } } } else { Report.ScreenF( "Camera max distance was set to %d", min_distance$ ); SiegeEngine.Camera.SetMaxDistance( max_distance$ ); } } } else { Report.Screen( msg_params_bad$ ); } } else { Report.Screen( msg_params_bad$ ); } } else { Report.Screen( msg_params_need$ ); } return true; } else if ( StringTool.SameNoCase( command$, "party", 3 ) ) { if ( elements$ > 2 ) { command$ = StringTool.GetDelimitedString( input$, 1, ' ', "" ); if ( StringTool.SameNoCase( command$, "add", 1 ) ) { string template$ = StringTool.GetDelimitedString( input$, 2, ' ', "" ); if ( !IsSanitaryText$( template$ ) ) { Report.Screen( "The party member template name cannot contain any of the following characters: \"<>:/\|?*.%;" ); } else { GoCloneReq req$ = MakeGoCloneReq( template$ ); Go player$ = GoDb.GetFocusGo.Go; req$.FadeIn = true; req$.SnapToTerrain = true; req$.StartingPos = player$.Placement.Position; if ( player$.HasMind() ) { //sanity check if( AIQuery.FindSpotRelativeToSource( player$, player$.Mind.PersonalSpaceRange * 0.25, player$.Mind.InnerComfortZoneRange * 0.5, 2.0, player$.Mind.TempPos1 ) ) { req$.StartingPos = player$.Mind.TempPos1; } } Goid member$ = GoDb.SCloneGo( req$ ); if ( member$.IsValid ) { member$.Go.Aspect.SSetIsVisible( false ); if ( player$.OwningParty != NULL ) { player$.OwningParty.Party.AddMemberNow( member$.Go ); string player_name$; player$.Common.GetScreenName( player_name$ ); string member_name$; member$.Go.Common.GetScreenName( member_name$ ); member$.Go.Aspect.SSetIsVisible( true ); Report.ScreenF( "%s added %s to the party", player_name$, member_name$ ); } else { string player_name$; player$.Common.GetScreenName( player_name$ ); GoDb.SMarkGoAndChildrenForDeletion( member$ ); Report.ScreenF( "%s doesn't have a party...", player_name$ ); } } else { Report.ScreenF( "Party member addition failed: no such template (%s)", template$ ); } } } else { Report.Screen( msg_params_bad$ ); } } return true; } } return false; }