Advertisement
Guest User

Untitled

a guest
Apr 1st, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.74 KB | None | 0 0
  1. // StardewValley.Dialogue
  2. private void parseDialogueString(string masterString)
  3. {
  4.     bool flag = masterString == null;
  5.     if (flag)
  6.     {
  7.         masterString = "...";
  8.     }
  9.     this.temporaryDialogue = null;
  10.     bool flag2 = this.playerResponses != null;
  11.     if (flag2)
  12.     {
  13.         this.playerResponses.Clear();
  14.     }
  15.     string[] array = masterString.Split(new char[]
  16.     {
  17.         '#'
  18.     });
  19.     int num2;
  20.     for (int i = 0; i < array.Count<string>(); i = num2 + 1)
  21.     {
  22.         bool flag3 = array[i].Count<char>() >= 2;
  23.         if (flag3)
  24.         {
  25.             array[i] = this.checkForSpecialCharacters(array[i]);
  26.             string text;
  27.             try
  28.             {
  29.                 text = array[i].Substring(0, 2);
  30.             }
  31.             catch (Exception)
  32.             {
  33.                 text = "     ";
  34.             }
  35.             bool flag4 = !text.Equals("$e");
  36.             if (flag4)
  37.             {
  38.                 bool flag5 = text.Equals("$b");
  39.                 if (flag5)
  40.                 {
  41.                     bool flag6 = this.dialogues.Count<string>() > 0;
  42.                     if (flag6)
  43.                     {
  44.                         List<string> list;
  45.                         int index;
  46.                         (list = this.dialogues)[index = this.dialogues.Count<string>() - 1] = list[index] + "{";
  47.                     }
  48.                 }
  49.                 else
  50.                 {
  51.                     bool flag7 = text.Equals("$k");
  52.                     if (flag7)
  53.                     {
  54.                         this.dialogueToBeKilled = true;
  55.                     }
  56.                     else
  57.                     {
  58.                         bool flag8 = text.Equals("$1") && array[i].Split(new char[]
  59.                         {
  60.                             ' '
  61.                         }).Count<string>() > 1;
  62.                         if (flag8)
  63.                         {
  64.                             string text2 = array[i].Split(new char[]
  65.                             {
  66.                                 ' '
  67.                             })[1];
  68.                             bool flag9 = !Game1.player.mailReceived.Contains(text2);
  69.                             if (flag9)
  70.                             {
  71.                                 array[i + 1] = this.checkForSpecialCharacters(array[i + 1]);
  72.                                 this.dialogues.Add(text2 + "}" + array[i + 1]);
  73.                                 i = 99999;
  74.                                 break;
  75.                             }
  76.                             i += 3;
  77.                             array[i] = this.checkForSpecialCharacters(array[i]);
  78.                         }
  79.                         else
  80.                         {
  81.                             bool flag10 = text.Equals("$c") && array[i].Split(new char[]
  82.                             {
  83.                                 ' '
  84.                             }).Count<string>() > 1;
  85.                             if (flag10)
  86.                             {
  87.                                 double num = Convert.ToDouble(array[i].Split(new char[]
  88.                                 {
  89.                                     ' '
  90.                                 })[1]);
  91.                                 bool flag11 = Game1.random.NextDouble() > num;
  92.                                 if (flag11)
  93.                                 {
  94.                                     num2 = i;
  95.                                     i = num2 + 1;
  96.                                 }
  97.                                 else
  98.                                 {
  99.                                     this.dialogues.Add(array[i + 1]);
  100.                                     i += 2;
  101.                                 }
  102.                             }
  103.                             else
  104.                             {
  105.                                 bool flag12 = text.Equals("$q");
  106.                                 if (flag12)
  107.                                 {
  108.                                     bool flag13 = this.dialogues.Count<string>() > 0;
  109.                                     if (flag13)
  110.                                     {
  111.                                         List<string> list2;
  112.                                         int index2;
  113.                                         (list2 = this.dialogues)[index2 = this.dialogues.Count<string>() - 1] = list2[index2] + "{";
  114.                                     }
  115.                                     string[] array2 = array[i].Split(new char[]
  116.                                     {
  117.                                         ' '
  118.                                     });
  119.                                     string[] array3 = array2[1].Split(new char[]
  120.                                     {
  121.                                         '/'
  122.                                     });
  123.                                     bool flag14 = false;
  124.                                     for (int j = 0; j < array3.Count<string>(); j = num2 + 1)
  125.                                     {
  126.                                         bool flag15 = Game1.player.DialogueQuestionsAnswered.Contains(Convert.ToInt32(array3[j]));
  127.                                         if (flag15)
  128.                                         {
  129.                                             flag14 = true;
  130.                                             break;
  131.                                         }
  132.                                         num2 = j;
  133.                                     }
  134.                                     bool flag16 = flag14 && Convert.ToInt32(array3[0]) != -1;
  135.                                     if (flag16)
  136.                                     {
  137.                                         bool flag17 = !array2[2].Equals("null");
  138.                                         if (flag17)
  139.                                         {
  140.                                             array = array.Take(i).ToArray<string>().Concat(this.speaker.Dialogue[array2[2]].Split(new char[]
  141.                                             {
  142.                                                 '#'
  143.                                             })).ToArray<string>();
  144.                                             num2 = i;
  145.                                             i = num2 - 1;
  146.                                         }
  147.                                     }
  148.                                     else
  149.                                     {
  150.                                         this.isLastDialogueInteractive = true;
  151.                                     }
  152.                                 }
  153.                                 else
  154.                                 {
  155.                                     bool flag18 = text.Equals("$r");
  156.                                     if (flag18)
  157.                                     {
  158.                                         string[] array4 = array[i].Split(new char[]
  159.                                         {
  160.                                             ' '
  161.                                         });
  162.                                         bool flag19 = this.playerResponses == null;
  163.                                         if (flag19)
  164.                                         {
  165.                                             this.playerResponses = new List<Response>();
  166.                                         }
  167.                                         this.isLastDialogueInteractive = true;
  168.                                         this.playerResponses.Add(new Response(Convert.ToInt32(array4[1]), Convert.ToInt32(array4[2]), array4[3], array[i + 1]));
  169.                                         num2 = i;
  170.                                         i = num2 + 1;
  171.                                     }
  172.                                     else
  173.                                     {
  174.                                         bool flag20 = text.Equals("$p");
  175.                                         if (flag20)
  176.                                         {
  177.                                             string[] array5 = array[i].Split(new char[]
  178.                                             {
  179.                                                 ' '
  180.                                             });
  181.                                             string[] array6 = array[i + 1].Split(new char[]
  182.                                             {
  183.                                                 '|'
  184.                                             });
  185.                                             bool flag21 = false;
  186.                                             for (int k = 1; k < array5.Count<string>(); k = num2 + 1)
  187.                                             {
  188.                                                 bool flag22 = Game1.player.DialogueQuestionsAnswered.Contains(Convert.ToInt32(array5[1]));
  189.                                                 if (flag22)
  190.                                                 {
  191.                                                     flag21 = true;
  192.                                                     break;
  193.                                                 }
  194.                                                 num2 = k;
  195.                                             }
  196.                                             bool flag23 = flag21;
  197.                                             if (flag23)
  198.                                             {
  199.                                                 array = array6[0].Split(new char[]
  200.                                                 {
  201.                                                     '#'
  202.                                                 });
  203.                                                 i = -1;
  204.                                             }
  205.                                             else
  206.                                             {
  207.                                                 array[i + 1] = array[i + 1].Split(new char[]
  208.                                                 {
  209.                                                     '|'
  210.                                                 }).Last<string>();
  211.                                             }
  212.                                         }
  213.                                         else
  214.                                         {
  215.                                             bool flag24 = text.Equals("$d");
  216.                                             if (flag24)
  217.                                             {
  218.                                                 string[] array7 = array[i].Split(new char[]
  219.                                                 {
  220.                                                     ' '
  221.                                                 });
  222.                                                 string text3 = masterString.Substring(masterString.IndexOf('#') + 1);
  223.                                                 bool flag25 = false;
  224.                                                 string a;
  225.                                                 bool flag26 = (a = array7[1].ToLower()) != null;
  226.                                                 if (flag26)
  227.                                                 {
  228.                                                     bool flag27 = !(a == "joja");
  229.                                                     if (flag27)
  230.                                                     {
  231.                                                         bool flag28 = !(a == "cc") && !(a == "communitycenter");
  232.                                                         if (flag28)
  233.                                                         {
  234.                                                             bool flag29 = a == "bus";
  235.                                                             if (flag29)
  236.                                                             {
  237.                                                                 flag25 = Game1.player.mailReceived.Contains("ccVault");
  238.                                                             }
  239.                                                         }
  240.                                                         else
  241.                                                         {
  242.                                                             flag25 = Game1.isLocationAccessible("CommunityCenter");
  243.                                                         }
  244.                                                     }
  245.                                                     else
  246.                                                     {
  247.                                                         flag25 = Game1.isLocationAccessible("JojaMart");
  248.                                                     }
  249.                                                 }
  250.                                                 char c = text3.Contains('|') ? '|' : '#';
  251.                                                 bool flag30 = flag25;
  252.                                                 if (flag30)
  253.                                                 {
  254.                                                     array = new string[]
  255.                                                     {
  256.                                                         text3.Split(new char[]
  257.                                                         {
  258.                                                             c
  259.                                                         })[0]
  260.                                                     };
  261.                                                 }
  262.                                                 else
  263.                                                 {
  264.                                                     array = new string[]
  265.                                                     {
  266.                                                         text3.Split(new char[]
  267.                                                         {
  268.                                                             c
  269.                                                         })[1]
  270.                                                     };
  271.                                                 }
  272.                                                 num2 = i;
  273.                                                 i = num2 - 1;
  274.                                             }
  275.                                             else
  276.                                             {
  277.                                                 bool flag31 = text.Equals("$y");
  278.                                                 if (flag31)
  279.                                                 {
  280.                                                     this.quickResponse = true;
  281.                                                     this.isLastDialogueInteractive = true;
  282.                                                     bool flag32 = this.quickResponses == null;
  283.                                                     if (flag32)
  284.                                                     {
  285.                                                         this.quickResponses = new List<string>();
  286.                                                     }
  287.                                                     bool flag33 = this.playerResponses == null;
  288.                                                     if (flag33)
  289.                                                     {
  290.                                                         this.playerResponses = new List<Response>();
  291.                                                     }
  292.                                                     string text4 = array[i].Substring(array[i].IndexOf('\'') + 1);
  293.                                                     text4 = text4.Substring(0, text4.Length - 1);
  294.                                                     string[] array8 = text4.Split(new char[]
  295.                                                     {
  296.                                                         '_'
  297.                                                     });
  298.                                                     this.dialogues.Add(array8[0]);
  299.                                                     for (int l = 1; l < array8.Count<string>(); l += 2)
  300.                                                     {
  301.                                                         this.playerResponses.Add(new Response(-1, -1, null, Game1.parseText(array8[l])));
  302.                                                         this.quickResponses.Add(array8[l + 1].Replace("*", "#$b#"));
  303.                                                     }
  304.                                                 }
  305.                                                 else
  306.                                                 {
  307.                                                     bool flag34 = array[i].Contains("^");
  308.                                                     if (flag34)
  309.                                                     {
  310.                                                         bool isMale = Game1.player.IsMale;
  311.                                                         if (isMale)
  312.                                                         {
  313.                                                             this.dialogues.Add(array[i].Substring(0, array[i].IndexOf("^")));
  314.                                                         }
  315.                                                         else
  316.                                                         {
  317.                                                             this.dialogues.Add(array[i].Substring(array[i].IndexOf("^") + 1));
  318.                                                         }
  319.                                                     }
  320.                                                     else
  321.                                                     {
  322.                                                         this.dialogues.Add(array[i]);
  323.                                                     }
  324.                                                 }
  325.                                             }
  326.                                         }
  327.                                     }
  328.                                 }
  329.                             }
  330.                         }
  331.                     }
  332.                 }
  333.             }
  334.         }
  335.         num2 = i;
  336.     }
  337. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement