extract influence support for missions that affect more than one faction
This commit is contained in:
		
							parent
							
								
									ceaf8035e9
								
							
						
					
					
						commit
						8f40c1d75e
					
				
							
								
								
									
										24
									
								
								BGS/InfluenceSupport.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								BGS/InfluenceSupport.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | |||||||
|  | using System.Text; | ||||||
|  | 
 | ||||||
|  | namespace EliteBGS.BGS { | ||||||
|  |     /// <summary> | ||||||
|  |     /// This class is used when a completed mission gives influence to another | ||||||
|  |     /// faction as well. This happens, for example, when you deliver cargo from one | ||||||
|  |     /// faction to another. Both sometimes gain influence. | ||||||
|  |     /// </summary> | ||||||
|  |     public class InfluenceSupport : LogEntry { | ||||||
|  |         public string Influence { get; set; } | ||||||
|  |         public MissionCompleted RelevantMission { get; set; } | ||||||
|  | 
 | ||||||
|  |         public override string ToString() { | ||||||
|  |             StringBuilder builder = new StringBuilder(); | ||||||
|  | 
 | ||||||
|  |             builder.AppendFormat("Influence gained from \"{0}\": \"{1}\"", | ||||||
|  |                 RelevantMission.MissionName, | ||||||
|  |                 string.IsNullOrEmpty(Influence) ? "NONE" : Influence | ||||||
|  |                 ); | ||||||
|  | 
 | ||||||
|  |             return builder.ToString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -107,6 +107,17 @@ namespace EliteBGS.BGS { | |||||||
|                             completed.Name + |                             completed.Name + | ||||||
|                             "\" was generated, please report this."); |                             "\" was generated, please report this."); | ||||||
|                     } |                     } | ||||||
|  | 
 | ||||||
|  |                     foreach (string other in completed.AffectedFactions.Where(x => !x.Equals(results[0].Faction))) { | ||||||
|  |                         string faction = other; | ||||||
|  |                         string influence = completed.GetInfluenceForFaction(faction); | ||||||
|  | 
 | ||||||
|  |                         results.Add(new InfluenceSupport() { | ||||||
|  |                             Faction = faction, | ||||||
|  |                             Influence = influence, | ||||||
|  |                             RelevantMission = results[0] as MissionCompleted | ||||||
|  |                         }); | ||||||
|  |                     } | ||||||
|                 } else if (e.Is(Events.MissionAccepted)) { |                 } else if (e.Is(Events.MissionAccepted)) { | ||||||
|                     MissionAcceptedEntry accepted = e as MissionAcceptedEntry; |                     MissionAcceptedEntry accepted = e as MissionAcceptedEntry; | ||||||
|                     acceptedMissions[accepted.MissionID] = accepted; |                     acceptedMissions[accepted.MissionID] = accepted; | ||||||
|  | |||||||
| @ -82,6 +82,7 @@ | |||||||
|     </Compile> |     </Compile> | ||||||
|     <Compile Include="BGS\DiscordLogGenerator.cs" /> |     <Compile Include="BGS\DiscordLogGenerator.cs" /> | ||||||
|     <Compile Include="BGS\GenericDiscordLog.cs" /> |     <Compile Include="BGS\GenericDiscordLog.cs" /> | ||||||
|  |     <Compile Include="BGS\InfluenceSupport.cs" /> | ||||||
|     <Compile Include="BGS\MissionFailed.cs" /> |     <Compile Include="BGS\MissionFailed.cs" /> | ||||||
|     <Compile Include="BGS\NonaDiscordLog.cs" /> |     <Compile Include="BGS\NonaDiscordLog.cs" /> | ||||||
|     <Compile Include="BGS\SellCargo.cs" /> |     <Compile Include="BGS\SellCargo.cs" /> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user