public override void HandleInput(InputState input)
 {
     if (HelperFunctions.CheckIntersection(new Rectangle(this.TrustRect.X - (int)Fonts.Pirulen16.MeasureString("Trust").X, this.TrustRect.Y, (int)Fonts.Pirulen16.MeasureString("Trust").X + this.TrustRect.Width, 14), input.CursorPosition))
         ToolTip.CreateTooltip(47, this.ScreenManager);
     if (HelperFunctions.CheckIntersection(new Rectangle(this.AngerRect.X - (int)Fonts.Pirulen16.MeasureString("Anger").X, this.AngerRect.Y, (int)Fonts.Pirulen16.MeasureString("Anger").X + this.AngerRect.Width, 14), input.CursorPosition))
         ToolTip.CreateTooltip(48, this.ScreenManager);
     if (HelperFunctions.CheckIntersection(new Rectangle(this.FearRect.X - (int)Fonts.Pirulen16.MeasureString("Fear").X, this.FearRect.Y, (int)Fonts.Pirulen16.MeasureString("Fear").X + this.FearRect.Width, 14), input.CursorPosition))
         ToolTip.CreateTooltip(49, this.ScreenManager);
     if (this.Exit.HandleInput(input) && this.dState != DiplomacyScreen.DialogState.TheirOffer)
     {
         this.ExitScreen();
         return;
     }
     if (this.dState == DiplomacyScreen.DialogState.End)
         return;
     if (this.dState != DiplomacyScreen.DialogState.TheirOffer)
     {
         if (!this.playerEmpire.GetRelations()[this.them].Treaty_Peace)
         {
             if (this.DeclareWar != null && this.DeclareWar.HandleInput(input))
             {
                 this.StatementsSL.Reset();
                 this.dState = DiplomacyScreen.DialogState.End;
                 if (this.playerEmpire.GetRelations()[this.them].Treaty_NAPact)
                 {
                     this.TheirText = this.GetDialogueByName("WarDeclared_FeelsBetrayed");
                     this.playerEmpire.GetGSAI().DeclareWarOn(this.them, WarType.ImperialistWar);
                     this.them.GetGSAI().GetWarDeclaredOnUs(this.playerEmpire, WarType.ImperialistWar);
                 }
                 else
                 {
                     this.TheirText = this.GetDialogueByName("WarDeclared_Generic");
                     this.playerEmpire.GetGSAI().DeclareWarOn(this.them, WarType.ImperialistWar);
                     this.them.GetGSAI().GetWarDeclaredOnUs(this.playerEmpire, WarType.ImperialistWar);
                 }
                 this.playerEmpire.GetGSAI().DeclareWarOn(this.them, WarType.ImperialistWar);
             }
         }
         else if (this.DeclareWar != null && HelperFunctions.CheckIntersection(this.DeclareWar.R, input.CursorPosition))
             ToolTip.CreateTooltip(128, this.ScreenManager);
         if (this.Discuss != null && this.Discuss.HandleInput(input))
         {
             this.StatementsSL.Entries.Clear();
             this.StatementsSL.indexAtTop = 0;
             this.dState = DiplomacyScreen.DialogState.Discuss;
             foreach (StatementSet statementSet in ResourceManager.DDDict["SharedDiplomacy"].StatementSets)
             {
                 if (statementSet.Name == "Ordinary Discussion")
                 {
                     int n = 1;
                     Vector2 Cursor = this.TextCursor;
                     foreach (DialogOption dialogOption1 in statementSet.DialogOptions)
                     {
                         string str = dialogOption1.words;
                         if (!string.IsNullOrEmpty(dialogOption1.SpecialInquiry))
                             str = this.GetDialogueByName(dialogOption1.SpecialInquiry);
                         DialogOption dialogOption2 = new DialogOption(n, str, Cursor, Fonts.Consolas18);
                         dialogOption2.words = this.parseText(str, (float)(this.DialogRect.Width - 20), Fonts.Consolas18);
                         this.StatementsSL.AddItem((object)dialogOption2);
                         dialogOption2.Response = dialogOption1.Response;
                         Cursor.Y += (float)(Fonts.Consolas18.LineSpacing + 5);
                         ++n;
                     }
                 }
             }
         }
         if (this.dState == DiplomacyScreen.DialogState.Discuss)
         {
             this.StatementsSL.HandleInput(input);
             foreach (ScrollList.Entry entry in (List<ScrollList.Entry>)this.StatementsSL.Entries)
             {
                 if ((entry.item as DialogOption).HandleInput(input) != null)
                 {
                     this.Respond(entry.item as DialogOption);
                     break;
                 }
             }
         }
         if (this.dState == DiplomacyScreen.DialogState.Negotiate)
         {
             if ((!this.TheirOffer.IsBlank() || !this.OurOffer.IsBlank() || this.TheirOffer.Alliance) && this.SendOffer.HandleInput(input))
             {
                 this.DoNegotiationResponse(this.them.GetGSAI().AnalyzeOffer(this.OurOffer, this.TheirOffer, this.playerEmpire, this.Attitude));
                 this.OurOffer = new Offer();
                 this.TheirOffer = new Offer();
                 this.TheirOffer.Them = this.them;
             }
             this.OfferTextSL.HandleInput(input);
             this.OurItemsSL.HandleInput(input);
             //string str = (string)null;
             foreach (ScrollList.Entry e in (List<ScrollList.Entry>)this.OurItemsSL.Copied)
             {
                 switch ((e.item as ItemToOffer).HandleInput(input, e))
                 {
                     case "NAPact":
                         this.OurOffer.NAPact = !this.OurOffer.NAPact;
                         this.TheirOffer.NAPact = this.OurOffer.NAPact;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "NAPact")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "We Declare War":
                         this.OurOffer.NAPact = !this.OurOffer.NAPact;
                         this.TheirOffer.NAPact = this.OurOffer.NAPact;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "NAPact")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "Peace Treaty":
                         this.OurOffer.PeaceTreaty = !this.OurOffer.PeaceTreaty;
                         this.TheirOffer.PeaceTreaty = this.OurOffer.PeaceTreaty;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "Peace Treaty")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "OfferAlliance":
                         this.OurOffer.Alliance = !this.OurOffer.Alliance;
                         this.TheirOffer.Alliance = this.OurOffer.Alliance;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "OfferAlliance")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "OpenBorders":
                         this.OurOffer.OpenBorders = !this.OurOffer.OpenBorders;
                         continue;
                     case "Tech":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.OurOffer.TechnologiesOffered.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.OurOffer.TechnologiesOffered.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "Artifacts":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.OurOffer.ArtifactsOffered.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.OurOffer.ArtifactsOffered.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "Colony":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.OurOffer.ColoniesOffered.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.OurOffer.ColoniesOffered.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "TradeTreaty":
                         this.OurOffer.TradeTreaty = !this.OurOffer.TradeTreaty;
                         this.TheirOffer.TradeTreaty = this.OurOffer.TradeTreaty;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "TradeTreaty")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     default:
                         continue;
                 }
             }
             this.OurItemsSL.Update();
             this.TheirItemsSL.HandleInput(input);
             //str = (string)null;
             foreach (ScrollList.Entry e in (List<ScrollList.Entry>)this.TheirItemsSL.Copied)
             {
                 switch ((e.item as ItemToOffer).HandleInput(input, e))
                 {
                     case "NAPact":
                         this.TheirOffer.NAPact = !this.TheirOffer.NAPact;
                         this.OurOffer.NAPact = this.TheirOffer.NAPact;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "NAPact")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "Declare War":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.TheirOffer.EmpiresToWarOn.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.TheirOffer.EmpiresToWarOn.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "Peace Treaty":
                         this.TheirOffer.PeaceTreaty = !this.TheirOffer.PeaceTreaty;
                         this.OurOffer.PeaceTreaty = this.TheirOffer.PeaceTreaty;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "Peace Treaty")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "OfferAlliance":
                         this.TheirOffer.Alliance = !this.TheirOffer.Alliance;
                         this.OurOffer.Alliance = this.TheirOffer.Alliance;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "OfferAlliance")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     case "Colony":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.TheirOffer.ColoniesOffered.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.TheirOffer.ColoniesOffered.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "Tech":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.TheirOffer.TechnologiesOffered.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.TheirOffer.TechnologiesOffered.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "Artifacts":
                         if ((e.item as ItemToOffer).Selected)
                         {
                             this.TheirOffer.ArtifactsOffered.Add((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                         else
                         {
                             this.TheirOffer.ArtifactsOffered.Remove((e.item as ItemToOffer).SpecialInquiry);
                             continue;
                         }
                     case "OpenBorders":
                         this.TheirOffer.OpenBorders = !this.TheirOffer.OpenBorders;
                         continue;
                     case "TradeTreaty":
                         this.TheirOffer.TradeTreaty = !this.TheirOffer.TradeTreaty;
                         this.OurOffer.TradeTreaty = this.TheirOffer.TradeTreaty;
                         using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ScrollList.Entry current = enumerator.Current;
                                 if ((current.item as ItemToOffer).Response == "TradeTreaty")
                                     (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected;
                             }
                             continue;
                         }
                     default:
                         continue;
                 }
             }
             this.TheirItemsSL.Update();
             if (this.ap.HandleInput(input))
             {
                 this.ap.ToggleOn = true;
                 this.ar.ToggleOn = false;
                 this.at.ToggleOn = false;
                 this.Attitude = Offer.Attitude.Pleading;
             }
             if (this.ar.HandleInput(input))
             {
                 this.ar.ToggleOn = true;
                 this.ap.ToggleOn = false;
                 this.at.ToggleOn = false;
                 this.Attitude = Offer.Attitude.Respectful;
             }
             if (this.at.HandleInput(input))
             {
                 this.at.ToggleOn = true;
                 this.ap.ToggleOn = false;
                 this.ar.ToggleOn = false;
                 this.Attitude = Offer.Attitude.Threaten;
             }
         }
         if (this.Negotiate.HandleInput(input))
         {
             this.dState = DiplomacyScreen.DialogState.Negotiate;
             this.OurOffer = new Offer();
             this.TheirOffer = new Offer();
             this.TheirOffer.Them = this.them;
             this.FillOurItems();
             this.FillTheirItems();
         }
     }
     if (this.dState == DiplomacyScreen.DialogState.TheirOffer)
     {
         if (this.Accept.HandleInput(input))
         {
             if (this.TheirOffer.ValueToModify != null)
                 this.TheirOffer.ValueToModify.Value = false;
             if (this.OurOffer.ValueToModify != null)
                 this.OurOffer.ValueToModify.Value = true;
             this.dState = DiplomacyScreen.DialogState.End;
             this.TheirText = this.GetDialogueByName(this.TheirOffer.AcceptDL);
             this.playerEmpire.GetGSAI().AcceptOffer(this.TheirOffer, this.OurOffer, this.playerEmpire, this.them);
         }
         if (this.Reject.HandleInput(input))
         {
             if (this.TheirOffer.ValueToModify != null)
                 this.TheirOffer.ValueToModify.Value = true;
             if (this.OurOffer.ValueToModify != null)
                 this.OurOffer.ValueToModify.Value = false;
             this.dState = DiplomacyScreen.DialogState.End;
             this.TheirText = this.GetDialogueByName(this.TheirOffer.RejectDL);
         }
     }
     if (input.Escaped)
         this.ExitScreen();
     base.HandleInput(input);
 }
 private void Respond(DialogOption resp)
 {
     string Name = resp.Response;
     if (resp.Target is Empire)
         this.empToDiscuss = resp.Target as Empire;
     switch (Name)
     {
         case "Target_Opinion":
             if (this.empToDiscuss == null)
                 break;
             this.StatementsSL.Reset();
             float strength = this.them.GetRelations()[this.empToDiscuss].GetStrength();
             if ((double)strength >= 65.0)
                 this.TheirText = this.GetDialogueByName("Opinion_Positive_" + this.empToDiscuss.data.Traits.ShipType);
             else if ((double)strength < 65.0 && (double)strength >= 40.0)
                 this.TheirText = this.GetDialogueByName("Opinion_Neutral_" + this.empToDiscuss.data.Traits.ShipType);
             else if ((double)strength < 40.0)
                 this.TheirText = this.GetDialogueByName("Opinion_Negative_" + this.empToDiscuss.data.Traits.ShipType);
             this.dState = DiplomacyScreen.DialogState.Them;
             break;
         case "EmpireDiscuss":
             using (List<StatementSet>.Enumerator enumerator = ResourceManager.DDDict["SharedDiplomacy"].StatementSets.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     StatementSet current = enumerator.Current;
                     if (current.Name == "EmpireDiscuss")
                     {
                         this.StatementsSL.Reset();
                         int n = 1;
                         Vector2 Cursor = this.TextCursor;
                         foreach (DialogOption dialogOption1 in current.DialogOptions)
                         {
                             DialogOption dialogOption2 = new DialogOption(n, dialogOption1.words, Cursor, Fonts.Consolas18);
                             dialogOption2.words = this.parseText(dialogOption1.words, (float)(this.DialogRect.Width - 20), Fonts.Consolas18);
                             this.StatementsSL.AddItem((object)dialogOption2);
                             dialogOption2.Response = dialogOption1.Response;
                             dialogOption2.Target = (object)this.empToDiscuss;
                             Cursor.Y += (float)(Fonts.Consolas18.LineSpacing + 5);
                             ++n;
                         }
                     }
                 }
                 break;
             }
         case "Hardcoded_EmpireChoose":
             this.StatementsSL.Entries.Clear();
             Vector2 Cursor1 = this.TextCursor;
             int n1 = 1;
             foreach (KeyValuePair<Empire, Relationship> keyValuePair in this.them.GetRelations())
             {
                 if (keyValuePair.Value.Known && !keyValuePair.Key.isFaction && (keyValuePair.Key != this.playerEmpire && !keyValuePair.Key.data.Defeated) && this.playerEmpire.GetRelations()[keyValuePair.Key].Known)
                 {
                     DialogOption dialogOption = new DialogOption(n1, Localizer.Token(2220) + " " + keyValuePair.Key.data.Traits.Name, Cursor1, Fonts.Consolas18);
                     dialogOption.Target = (object)keyValuePair.Key;
                     dialogOption.words = this.parseText(dialogOption.words, (float)(this.DialogRect.Width - 20), Fonts.Consolas18);
                     dialogOption.Response = "EmpireDiscuss";
                     Cursor1.Y += (float)(Fonts.Consolas18.LineSpacing + 5);
                     this.StatementsSL.AddItem((object)dialogOption);
                     ++n1;
                 }
             }
             if (this.StatementsSL.Entries.Count != 0)
                 break;
             this.StatementsSL.Reset();
             this.TheirText = this.GetDialogueByName("Dunno_Anybody");
             this.dState = DiplomacyScreen.DialogState.Them;
             break;
         case "Hardcoded_War_Analysis":
             this.TheirText = "";
             this.dState = DiplomacyScreen.DialogState.Them;
             if (this.empToDiscuss == null)
                 break;
             if (!this.playerEmpire.GetRelations()[this.empToDiscuss].AtWar)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_YouAreNotAtWar");
                 diplomacyScreen.TheirText = str;
                 break;
             }
             else if (this.them.GetRelations()[this.empToDiscuss].AtWar)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_WeAreAtWar");
                 diplomacyScreen.TheirText = str;
                 break;
             }
             else if (this.them.GetRelations()[this.playerEmpire].Treaty_Alliance)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_Allied_OK");
                 diplomacyScreen.TheirText = str;
                 this.them.GetGSAI().DeclareWarOn(this.empToDiscuss, WarType.ImperialistWar);
                 this.empToDiscuss.GetGSAI().GetWarDeclaredOnUs(this.them, WarType.ImperialistWar);
                 break;
             }
             else if ((double)this.them.GetRelations()[this.playerEmpire].GetStrength() < 30.0)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_Reject_PoorRelations");
                 diplomacyScreen.TheirText = str;
                 break;
             }
             else if (this.them.data.DiplomaticPersonality.Name == "Pacifist" || this.them.data.DiplomaticPersonality.Name == "Honorable")
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_Reject_Pacifist");
                 diplomacyScreen.TheirText = str;
                 break;
             }
             else if ((double)this.them.GetRelations()[this.empToDiscuss].GetStrength() > 60.0)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_Allied_DECLINE");
                 diplomacyScreen.TheirText = str;
                 break;
             }
             else if ((double)this.them.GetRelations()[this.playerEmpire].GetStrength() > 60.0 && (double)this.empToDiscuss.MilitaryScore < (double)this.them.MilitaryScore)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_OK");
                 diplomacyScreen.TheirText = str;
                 this.them.GetGSAI().DeclareWarOn(this.empToDiscuss, WarType.ImperialistWar);
                 this.empToDiscuss.GetGSAI().GetWarDeclaredOnUs(this.them, WarType.ImperialistWar);
                 break;
             }
             else
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("JoinWar_Reject_TooDangerous");
                 diplomacyScreen.TheirText = str;
                 break;
             }
         case "Hardcoded_Federation_Analysis":
             this.StatementsSL.Entries.Clear();
             this.TheirText = "";
             this.dState = DiplomacyScreen.DialogState.Them;
             if (!this.them.GetRelations()[this.playerEmpire].Treaty_Alliance)
             {
                 if (this.them.GetRelations()[this.playerEmpire].TurnsKnown < 50)
                 {
                     DiplomacyScreen diplomacyScreen = this;
                     string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_JustMet");
                     diplomacyScreen.TheirText = str;
                     break;
                 }
                 else if ((double)this.them.GetRelations()[this.playerEmpire].GetStrength() >= 75.0)
                 {
                     DiplomacyScreen diplomacyScreen = this;
                     string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_NoAlliance");
                     diplomacyScreen.TheirText = str;
                     break;
                 }
                 else
                 {
                     DiplomacyScreen diplomacyScreen = this;
                     string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_RelationsPoor");
                     diplomacyScreen.TheirText = str;
                     break;
                 }
             }
             else if (this.them.GetRelations()[this.playerEmpire].TurnsAllied < 100)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_AllianceTooYoung");
                 diplomacyScreen.TheirText = str;
                 break;
             }
             else
             {
                 if (this.them.GetRelations()[this.playerEmpire].TurnsAllied < 100)
                     break;
                 if ((double)this.them.TotalScore > (double)this.playerEmpire.TotalScore * 0.800000011920929 && (double)this.them.GetRelations()[this.playerEmpire].Threat < 0.0)
                 {
                     DiplomacyScreen diplomacyScreen = this;
                     string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_WeAreTooStrong");
                     diplomacyScreen.TheirText = str;
                     break;
                 }
                 else
                 {
                     List<Empire> warTargets = new List<Empire>();
                     List<Empire> list2 = new List<Empire>();
                     foreach (KeyValuePair<Empire, Relationship> keyValuePair in this.them.GetRelations())
                     {
                         if (!keyValuePair.Key.isFaction && keyValuePair.Value.AtWar)
                             warTargets.Add(keyValuePair.Key);
                         if (this.playerEmpire.GetRelations().ContainsKey(keyValuePair.Key) && !keyValuePair.Key.isFaction && ((double)keyValuePair.Value.GetStrength() > 75.0 && this.playerEmpire.GetRelations()[keyValuePair.Key].AtWar))
                             list2.Add(keyValuePair.Key);
                     }
                     if (warTargets.Count > 0)
                     {
                         IOrderedEnumerable<Empire> orderedEnumerable = Enumerable.OrderByDescending<Empire, int>((IEnumerable<Empire>)warTargets, (Func<Empire, int>)(emp => emp.TotalScore));
                         if (Enumerable.Count<Empire>((IEnumerable<Empire>)orderedEnumerable) <= 0)
                             break;
                         this.empToDiscuss = Enumerable.First<Empire>((IEnumerable<Empire>)orderedEnumerable);
                         DiplomacyScreen diplomacyScreen = this;
                         string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_Quest_DestroyEnemy");
                         diplomacyScreen.TheirText = str;
                         this.them.GetRelations()[this.playerEmpire].FedQuest = new FederationQuest()
                         {
                             EnemyName = this.empToDiscuss.data.Traits.Name
                         };
                         break;
                     }
                     else if (list2.Count > 0)
                     {
                         IOrderedEnumerable<Empire> orderedEnumerable = Enumerable.OrderByDescending<Empire, float>((IEnumerable<Empire>)list2, (Func<Empire, float>)(emp => this.them.GetRelations()[emp].GetStrength()));
                         if (Enumerable.Count<Empire>((IEnumerable<Empire>)orderedEnumerable) <= 0)
                             break;
                         this.empToDiscuss = Enumerable.First<Empire>((IEnumerable<Empire>)orderedEnumerable);
                         DiplomacyScreen diplomacyScreen = this;
                         string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_Quest_AllyFriend");
                         diplomacyScreen.TheirText = str;
                         this.them.GetRelations()[this.playerEmpire].FedQuest = new FederationQuest()
                         {
                             type = QuestType.AllyFriend,
                             EnemyName = this.empToDiscuss.data.Traits.Name
                         };
                         break;
                     }
                     else
                     {
                         DiplomacyScreen diplomacyScreen = this;
                         string str = diplomacyScreen.TheirText + this.GetDialogueByName("Federation_Accept");
                         diplomacyScreen.TheirText = str;
                         this.playerEmpire.AbsorbEmpire(this.them);
                         break;
                     }
                 }
             }
         case "Hardcoded_Grievances":
             this.StatementsSL.Entries.Clear();
             this.TheirText = "";
             float num = this.them.GetRelations()[this.playerEmpire].GetStrength();
             if ((double)num < 0.0)
                 num = 0.0f;
             if (this.them.GetRelations()[this.playerEmpire].TurnsKnown < 20)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("Opinion_JustMetUs");
                 diplomacyScreen.TheirText = str;
             }
             else if ((double)num > 60.0)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("Opinion_NoProblems");
                 diplomacyScreen.TheirText = str;
             }
             else if (this.them.GetRelations()[this.playerEmpire].WarHistory.Count > 0 && (double)this.them.GetRelations()[this.playerEmpire].WarHistory[this.them.GetRelations()[this.playerEmpire].WarHistory.Count - 1].EndStarDate - (double)this.them.GetRelations()[this.playerEmpire].WarHistory[this.them.GetRelations()[this.playerEmpire].WarHistory.Count - 1].StartDate < 50.0)
             {
                 DiplomacyScreen diplomacyScreen = this;
                 string str = diplomacyScreen.TheirText + this.GetDialogueByName("PROBLEM_RECENTWAR");
                 diplomacyScreen.TheirText = str;
             }
             else if ((double)num >= 0.0)
             {
                 bool flag = false;
                 if ((double)this.them.GetRelations()[this.playerEmpire].Anger_TerritorialConflict + (double)this.them.GetRelations()[this.playerEmpire].Anger_FromShipsInOurBorders > (double)(this.them.data.DiplomaticPersonality.Territorialism / 2))
                 {
                     DiplomacyScreen diplomacyScreen1 = this;
                     string str1 = diplomacyScreen1.TheirText + this.GetDialogueByName("Opinion_Problems");
                     diplomacyScreen1.TheirText = str1;
                     flag = true;
                     if ((double)this.them.GetRelations()[this.playerEmpire].Threat > 75.0)
                     {
                         DiplomacyScreen diplomacyScreen2 = this;
                         string str2 = diplomacyScreen2.TheirText + this.GetDialogueByName("Problem_Territorial");
                         diplomacyScreen2.TheirText = str2;
                         DiplomacyScreen diplomacyScreen3 = this;
                         string str3 = diplomacyScreen3.TheirText + this.GetDialogueByName("Problem_AlsoMilitary");
                         diplomacyScreen3.TheirText = str3;
                     }
                     else if ((double)this.them.GetRelations()[this.playerEmpire].Threat < -20.0 && (this.them.data.DiplomaticPersonality.Name == "Ruthless" || this.them.data.DiplomaticPersonality.Name == "Aggressive"))
                     {
                         DiplomacyScreen diplomacyScreen2 = this;
                         string str2 = diplomacyScreen2.TheirText + this.GetDialogueByName("Problem_Territorial");
                         diplomacyScreen2.TheirText = str2;
                         DiplomacyScreen diplomacyScreen3 = this;
                         string str3 = diplomacyScreen3.TheirText + this.GetDialogueByName("Problem_AlsoMilitaryWeak");
                         diplomacyScreen3.TheirText = str3;
                     }
                     else
                     {
                         DiplomacyScreen diplomacyScreen2 = this;
                         string str2 = diplomacyScreen2.TheirText + this.GetDialogueByName("Problem_JustTerritorial");
                         diplomacyScreen2.TheirText = str2;
                     }
                 }
                 else if ((double)this.them.GetRelations()[this.playerEmpire].Threat > 75.0)
                 {
                     flag = true;
                     DiplomacyScreen diplomacyScreen1 = this;
                     string str1 = diplomacyScreen1.TheirText + this.GetDialogueByName("Opinion_Problems");
                     diplomacyScreen1.TheirText = str1;
                     DiplomacyScreen diplomacyScreen2 = this;
                     string str2 = diplomacyScreen2.TheirText + this.GetDialogueByName("Problem_PrimaryMilitary");
                     diplomacyScreen2.TheirText = str2;
                 }
                 else if ((double)this.them.GetRelations()[this.playerEmpire].Threat < -20.0 && (this.them.data.DiplomaticPersonality.Name == "Ruthless" || this.them.data.DiplomaticPersonality.Name == "Aggressive"))
                 {
                     DiplomacyScreen diplomacyScreen1 = this;
                     string str1 = diplomacyScreen1.TheirText + this.GetDialogueByName("Opinion_Problems");
                     diplomacyScreen1.TheirText = str1;
                     DiplomacyScreen diplomacyScreen2 = this;
                     string str2 = diplomacyScreen2.TheirText + this.GetDialogueByName("Problem_MilitaryWeak");
                     diplomacyScreen2.TheirText = str2;
                 }
                 if (!flag)
                 {
                     DiplomacyScreen diplomacyScreen = this;
                     string str = diplomacyScreen.TheirText + this.GetDialogueByName("Opinion_NothingMajor");
                     diplomacyScreen.TheirText = str;
                 }
             }
             this.dState = DiplomacyScreen.DialogState.Them;
             break;
         default:
             this.StatementsSL.Reset();
             this.TheirText = this.GetDialogueByName(Name);
             this.dState = DiplomacyScreen.DialogState.Them;
             break;
     }
 }