Beispiel #1
0
        public static void CheckNight()
        {
            var flag = false;

            if (BirthdayParty.GenuineParty)
            {
                flag = true;
                BirthdayParty.GenuineParty = false;
                BirthdayParty.CelebratingNPCs.Clear();
            }

            if (BirthdayParty.ManualParty)
            {
                flag = true;
                BirthdayParty.ManualParty = false;
            }

            if (!flag)
            {
                return;
            }
            var color = new Color((int)byte.MaxValue, 0, 160);

            WorldGen.BroadcastText(NetworkText.FromKey(Lang.misc[99].Key), color);
        }
 public static void UpdateTime()
 {
     if (BirthdayParty._wasCelebrating != BirthdayParty.PartyIsUp)
     {
         if (Main.netMode != 1 && BirthdayParty.CelebratingNPCs.Count > 0)
         {
             for (int i = 0; i < BirthdayParty.CelebratingNPCs.Count; i++)
             {
                 NPC nPC = Main.npc[BirthdayParty.CelebratingNPCs[i]];
                 if (!nPC.active || !nPC.townNPC || nPC.type == 37 || nPC.type == 453 || nPC.aiStyle == 0)
                 {
                     BirthdayParty.CelebratingNPCs.RemoveAt(i);
                 }
             }
             if (BirthdayParty.CelebratingNPCs.Count == 0)
             {
                 BirthdayParty.GenuineParty = false;
                 if (!BirthdayParty.ManualParty)
                 {
                     Color color = new Color(255, 0, 160);
                     WorldGen.BroadcastText(Lang.misc[99], color);
                     NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                 }
             }
         }
     }
     BirthdayParty._wasCelebrating = BirthdayParty.PartyIsUp;
 }
Beispiel #3
0
        public static void CheckNight()
        {
            bool flag = false;

            if (BirthdayParty.GenuineParty)
            {
                flag = true;
                BirthdayParty.GenuineParty = false;
                BirthdayParty.CelebratingNPCs.Clear();
            }
            if (BirthdayParty.ManualParty)
            {
                flag = true;
                BirthdayParty.ManualParty = false;
            }
            if (!flag)
            {
                return;
            }
            Color color;

            // ISSUE: explicit reference operation
            ((Color)@color).\u002Ector((int)byte.MaxValue, 0, 160);
            WorldGen.BroadcastText(NetworkText.FromKey(Lang.misc[99].Key), color);
        }
Beispiel #4
0
        public static void UpdateTime()
        {
            if (BirthdayParty._wasCelebrating != BirthdayParty.PartyIsUp)
            {
                if (Main.netMode != 2)
                {
                    if (BirthdayParty.PartyIsUp)
                    {
                        SkyManager.Instance.Activate("Party", new Vector2());
                    }
                    else
                    {
                        SkyManager.Instance.Deactivate("Party");
                    }
                }

                if (Main.netMode != 1 && BirthdayParty.CelebratingNPCs.Count > 0)
                {
                    for (var index = 0; index < BirthdayParty.CelebratingNPCs.Count; ++index)
                    {
                        var npc = Main.npc[BirthdayParty.CelebratingNPCs[index]];
                        if (!npc.active || !npc.townNPC || (npc.type == 37 || npc.type == 453) || npc.aiStyle == 0)
                        {
                            BirthdayParty.CelebratingNPCs.RemoveAt(index);
                        }
                    }

                    if (BirthdayParty.CelebratingNPCs.Count == 0)
                    {
                        BirthdayParty.GenuineParty = false;
                        if (!BirthdayParty.ManualParty)
                        {
                            var color = new Color((int)byte.MaxValue, 0, 160);
                            WorldGen.BroadcastText(NetworkText.FromKey(Lang.misc[99].Key), color);
                            NetMessage.SendData(7, -1, -1, (NetworkText)null, 0, 0.0f, 0.0f, 0.0f, 0, 0, 0);
                        }
                    }
                }
            }

            BirthdayParty._wasCelebrating = BirthdayParty.PartyIsUp;
        }
Beispiel #5
0
        public static void CheckNight()
        {
            bool flag = false;

            if (GenuineParty)
            {
                flag         = true;
                GenuineParty = false;
                CelebratingNPCs.Clear();
            }
            if (ManualParty)
            {
                flag        = true;
                ManualParty = false;
            }
            if (flag)
            {
                WorldGen.BroadcastText(color: new Color(255, 0, 160), text: NetworkText.FromKey(Lang.misc[99].Key));
            }
        }
        public static void CheckNight()
        {
            bool flag = false;

            if (BirthdayParty.GenuineParty)
            {
                flag = true;
                BirthdayParty.GenuineParty = false;
                BirthdayParty.CelebratingNPCs.Clear();
            }
            if (BirthdayParty.ManualParty)
            {
                flag = true;
                BirthdayParty.ManualParty = false;
            }
            if (flag)
            {
                Color color = new Color(255, 0, 160);
                WorldGen.BroadcastText(Lang.misc[99], color);
            }
        }
Beispiel #7
0
 // Token: 0x0600121F RID: 4639 RVA: 0x004121D4 File Offset: 0x004103D4
 public static void UpdateTime()
 {
     if (BirthdayParty._wasCelebrating != BirthdayParty.PartyIsUp)
     {
         if (Main.netMode != 2)
         {
             if (BirthdayParty.PartyIsUp)
             {
                 SkyManager.Instance.Activate("Party", default(Vector2), new object[0]);
             }
             else
             {
                 SkyManager.Instance.Deactivate("Party", new object[0]);
             }
         }
         if (Main.netMode != 1 && BirthdayParty.CelebratingNPCs.Count > 0)
         {
             for (int i = 0; i < BirthdayParty.CelebratingNPCs.Count; i++)
             {
                 NPC nPC = Main.npc[BirthdayParty.CelebratingNPCs[i]];
                 if (!nPC.active || !nPC.townNPC || nPC.type == 37 || nPC.type == 453 || nPC.aiStyle == 0)
                 {
                     BirthdayParty.CelebratingNPCs.RemoveAt(i);
                 }
             }
             if (BirthdayParty.CelebratingNPCs.Count == 0)
             {
                 BirthdayParty.GenuineParty = false;
                 if (!BirthdayParty.ManualParty)
                 {
                     Color color = new Color(255, 0, 160);
                     WorldGen.BroadcastText(NetworkText.FromKey(Lang.misc[99].Key, new object[0]), color);
                     NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0);
                 }
             }
         }
     }
     BirthdayParty._wasCelebrating = BirthdayParty.PartyIsUp;
 }
Beispiel #8
0
 public static void UpdateTime()
 {
     if (_wasCelebrating != PartyIsUp)
     {
         if (Main.netMode != 2)
         {
             if (PartyIsUp)
             {
                 SkyManager.Instance.Activate("Party", default(Vector2));
             }
             else
             {
                 SkyManager.Instance.Deactivate("Party");
             }
         }
         if (Main.netMode != 1 && CelebratingNPCs.Count > 0)
         {
             for (int i = 0; i < CelebratingNPCs.Count; i++)
             {
                 if (!CanNPCParty(Main.npc[CelebratingNPCs[i]]))
                 {
                     CelebratingNPCs.RemoveAt(i);
                 }
             }
             if (CelebratingNPCs.Count == 0)
             {
                 GenuineParty = false;
                 if (!ManualParty)
                 {
                     WorldGen.BroadcastText(color: new Color(255, 0, 160), text: NetworkText.FromKey(Lang.misc[99].Key));
                     NetMessage.SendData(7);
                 }
             }
         }
     }
     _wasCelebrating = PartyIsUp;
 }
        private static void NaturalAttempt()
        {
            if (BirthdayParty.PartyDaysOnCooldown > 0)
            {
                BirthdayParty.PartyDaysOnCooldown--;
                return;
            }
            if (Main.rand.Next(10) != 0)
            {
                return;
            }
            List <NPC> list = new List <NPC>();

            for (int l = 0; l < 200; l++)
            {
                NPC nPC = Main.npc[l];
                if (nPC.active && nPC.townNPC && nPC.type != 37 && nPC.type != 453 && nPC.aiStyle != 0)
                {
                    list.Add(nPC);
                }
            }
            if (list.Count < 5)
            {
                return;
            }
            BirthdayParty.GenuineParty        = true;
            BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
            BirthdayParty.CelebratingNPCs.Clear();
            List <int> list2 = new List <int>();
            int        num   = 1;

            if (Main.rand.Next(5) == 0 && list.Count > 12)
            {
                num = 3;
            }
            else if (Main.rand.Next(3) == 0)
            {
                num = 2;
            }
            list = (from i in list
                    orderby Main.rand.Next()
                    select i).ToList <NPC>();
            for (int j = 0; j < num; j++)
            {
                list2.Add(j);
            }
            for (int k = 0; k < list2.Count; k++)
            {
                BirthdayParty.CelebratingNPCs.Add(list[list2[k]].whoAmI);
            }
            Color color = new Color(255, 0, 160);

            if (BirthdayParty.CelebratingNPCs.Count == 3)
            {
                WorldGen.BroadcastText(string.Concat(new string[]
                {
                    Lang.misc[96],
                    Main.npc[BirthdayParty.CelebratingNPCs[0]].displayName,
                    ", ",
                    Main.npc[BirthdayParty.CelebratingNPCs[1]].displayName,
                    " & ",
                    Main.npc[BirthdayParty.CelebratingNPCs[2]].displayName,
                    Lang.misc[98]
                }), color);
                return;
            }
            if (BirthdayParty.CelebratingNPCs.Count == 2)
            {
                WorldGen.BroadcastText(string.Concat(new string[]
                {
                    Lang.misc[96],
                    Main.npc[BirthdayParty.CelebratingNPCs[0]].displayName,
                    " & ",
                    Main.npc[BirthdayParty.CelebratingNPCs[1]].displayName,
                    Lang.misc[98]
                }), color);
                return;
            }
            WorldGen.BroadcastText(Lang.misc[96] + Main.npc[BirthdayParty.CelebratingNPCs[0]].displayName + Lang.misc[97], color);
        }
Beispiel #10
0
        // Token: 0x0600121C RID: 4636 RVA: 0x00411EC8 File Offset: 0x004100C8
        private static void NaturalAttempt()
        {
            if (Main.netMode == 1)
            {
                return;
            }
            if (BirthdayParty.PartyDaysOnCooldown > 0)
            {
                BirthdayParty.PartyDaysOnCooldown--;
                return;
            }
            if (Main.rand.Next(10) != 0)
            {
                return;
            }
            List <NPC> list = new List <NPC>();

            for (int i = 0; i < 200; i++)
            {
                NPC nPC = Main.npc[i];
                if (nPC.active && nPC.townNPC && nPC.type != 37 && nPC.type != 453 && nPC.aiStyle != 0)
                {
                    list.Add(nPC);
                }
            }
            if (list.Count < 5)
            {
                return;
            }
            BirthdayParty.GenuineParty        = true;
            BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
            BirthdayParty.CelebratingNPCs.Clear();
            List <int> list2 = new List <int>();
            int        num   = 1;

            if (Main.rand.Next(5) == 0 && list.Count > 12)
            {
                num = 3;
            }
            else if (Main.rand.Next(3) == 0)
            {
                num = 2;
            }
            IEnumerable <NPC> arg_10B_0 = list;

            list = arg_10B_0.OrderBy((i) => { return(Main.rand.Next()); }).ToList <NPC>();
            for (int j = 0; j < num; j++)
            {
                list2.Add(j);
            }
            for (int k = 0; k < list2.Count; k++)
            {
                BirthdayParty.CelebratingNPCs.Add(list[list2[k]].whoAmI);
            }
            Color color = new Color(255, 0, 160);

            if (BirthdayParty.CelebratingNPCs.Count == 3)
            {
                WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_3", new object[]
                {
                    Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(),
                    Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName(),
                    Main.npc[BirthdayParty.CelebratingNPCs[2]].GetGivenOrTypeNetName()
                }), color);
                return;
            }
            if (BirthdayParty.CelebratingNPCs.Count == 2)
            {
                WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_2", new object[]
                {
                    Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(),
                    Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName()
                }), color);
                return;
            }
            WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_1", new object[]
            {
                Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName()
            }), color);
        }
Beispiel #11
0
 private static void NaturalAttempt()
 {
     if (Main.netMode == 1)
     {
         return;
     }
     if (BirthdayParty.PartyDaysOnCooldown > 0)
     {
         --BirthdayParty.PartyDaysOnCooldown;
     }
     else
     {
         if (Main.rand.Next(10) != 0)
         {
             return;
         }
         List <NPC> npcList1 = new List <NPC>();
         for (int index = 0; index < 200; ++index)
         {
             NPC npc = Main.npc[index];
             if (npc.active && npc.townNPC && (npc.type != 37 && npc.type != 453) && npc.aiStyle != 0)
             {
                 npcList1.Add(npc);
             }
         }
         if (npcList1.Count < 5)
         {
             return;
         }
         BirthdayParty.GenuineParty        = true;
         BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
         BirthdayParty.CelebratingNPCs.Clear();
         List <int> intList = new List <int>();
         int        num     = 1;
         if (Main.rand.Next(5) == 0 && npcList1.Count > 12)
         {
             num = 3;
         }
         else if (Main.rand.Next(3) == 0)
         {
             num = 2;
         }
         List <NPC> npcList2 = npcList1;
         // ISSUE: reference to a compiler-generated field
         if (BirthdayParty.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate1 == null)
         {
             // ISSUE: reference to a compiler-generated field
             // ISSUE: method pointer
             BirthdayParty.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate1 = new Func <NPC, int>((object)null, __methodptr(\u003CNaturalAttempt\u003Eb__0));
         }
         // ISSUE: reference to a compiler-generated field
         Func <NPC, int> anonymousMethodDelegate1 = BirthdayParty.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate1;
         List <NPC>      list = ((IEnumerable <NPC>)Enumerable.OrderBy <NPC, int>((IEnumerable <M0>)npcList2, (Func <M0, M1>)anonymousMethodDelegate1)).ToList <NPC>();
         for (int index = 0; index < num; ++index)
         {
             intList.Add(index);
         }
         for (int index = 0; index < intList.Count; ++index)
         {
             BirthdayParty.CelebratingNPCs.Add(list[intList[index]].whoAmI);
         }
         Color color;
         // ISSUE: explicit reference operation
         ((Color)@color).\u002Ector((int)byte.MaxValue, 0, 160);
         if (BirthdayParty.CelebratingNPCs.Count == 3)
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_3", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[2]].GetGivenOrTypeNetName()), color);
         }
         else if (BirthdayParty.CelebratingNPCs.Count == 2)
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_2", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName()), color);
         }
         else
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_1", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName()), color);
         }
     }
 }
Beispiel #12
0
 private static void NaturalAttempt()
 {
     if (Main.netMode == 1 || !NPC.AnyNPCs(208))
     {
         return;
     }
     if (PartyDaysOnCooldown > 0)
     {
         PartyDaysOnCooldown--;
     }
     else
     {
         if (Main.rand.Next(10) != 0)
         {
             return;
         }
         List <NPC> list = new List <NPC>();
         for (int j = 0; j < 200; j++)
         {
             NPC nPC = Main.npc[j];
             if (CanNPCParty(nPC))
             {
                 list.Add(nPC);
             }
         }
         if (list.Count >= 5)
         {
             GenuineParty        = true;
             PartyDaysOnCooldown = Main.rand.Next(5, 11);
             NPC.freeCake        = true;
             CelebratingNPCs.Clear();
             List <int> list2 = new List <int>();
             int        num   = 1;
             if (Main.rand.Next(5) == 0 && list.Count > 12)
             {
                 num = 3;
             }
             else if (Main.rand.Next(3) == 0)
             {
                 num = 2;
             }
             list = list.OrderBy((NPC i) => Main.rand.Next()).ToList();
             for (int k = 0; k < num; k++)
             {
                 list2.Add(k);
             }
             for (int l = 0; l < list2.Count; l++)
             {
                 CelebratingNPCs.Add(list[list2[l]].whoAmI);
             }
             Color color = new Color(255, 0, 160);
             if (CelebratingNPCs.Count == 3)
             {
                 WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_3", Main.npc[CelebratingNPCs[0]].GetGivenOrTypeNetName(), Main.npc[CelebratingNPCs[1]].GetGivenOrTypeNetName(), Main.npc[CelebratingNPCs[2]].GetGivenOrTypeNetName()), color);
             }
             else if (CelebratingNPCs.Count == 2)
             {
                 WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_2", Main.npc[CelebratingNPCs[0]].GetGivenOrTypeNetName(), Main.npc[CelebratingNPCs[1]].GetGivenOrTypeNetName()), color);
             }
             else
             {
                 WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_1", Main.npc[CelebratingNPCs[0]].GetGivenOrTypeNetName()), color);
             }
             NetMessage.SendData(7);
         }
     }
 }
Beispiel #13
0
 private static void NaturalAttempt()
 {
     if (Main.netMode == 1 || !NPC.AnyNPCs(208))
     {
         return;
     }
     if (BirthdayParty.PartyDaysOnCooldown > 0)
     {
         --BirthdayParty.PartyDaysOnCooldown;
     }
     else
     {
         if (Main.rand.Next(10) != 0)
         {
             return;
         }
         List <NPC> source = new List <NPC>();
         for (int index = 0; index < 200; ++index)
         {
             NPC n = Main.npc[index];
             if (BirthdayParty.CanNPCParty(n))
             {
                 source.Add(n);
             }
         }
         if (source.Count < 5)
         {
             return;
         }
         BirthdayParty.GenuineParty        = true;
         BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
         NPC.freeCake = true;
         BirthdayParty.CelebratingNPCs.Clear();
         List <int> intList = new List <int>();
         int        num     = 1;
         if (Main.rand.Next(5) == 0 && source.Count > 12)
         {
             num = 3;
         }
         else if (Main.rand.Next(3) == 0)
         {
             num = 2;
         }
         List <NPC> list = source.OrderBy <NPC, int>((Func <NPC, int>)(i => Main.rand.Next())).ToList <NPC>();
         for (int index = 0; index < num; ++index)
         {
             intList.Add(index);
         }
         for (int index = 0; index < intList.Count; ++index)
         {
             BirthdayParty.CelebratingNPCs.Add(list[intList[index]].whoAmI);
         }
         Color color = new Color((int)byte.MaxValue, 0, 160);
         if (BirthdayParty.CelebratingNPCs.Count == 3)
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_3", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[2]].GetGivenOrTypeNetName()), color);
         }
         else if (BirthdayParty.CelebratingNPCs.Count == 2)
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_2", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName()), color);
         }
         else
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_1", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName()), color);
         }
         NetMessage.SendData(7, -1, -1, (NetworkText)null, 0, 0.0f, 0.0f, 0.0f, 0, 0, 0);
     }
 }
Beispiel #14
0
 private static void NaturalAttempt()
 {
     if (Main.netMode == 1)
     {
         return;
     }
     if (BirthdayParty.PartyDaysOnCooldown > 0)
     {
         --BirthdayParty.PartyDaysOnCooldown;
     }
     else
     {
         if (Main.rand.Next(10) != 0)
         {
             return;
         }
         List <NPC> source = new List <NPC>();
         for (int index = 0; index < 200; ++index)
         {
             NPC npc = Main.npc[index];
             if (npc.active && npc.townNPC && (npc.type != 37 && npc.type != 453) && npc.aiStyle != 0)
             {
                 source.Add(npc);
             }
         }
         if (source.Count < 5)
         {
             return;
         }
         BirthdayParty.GenuineParty        = true;
         BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
         BirthdayParty.CelebratingNPCs.Clear();
         List <int> intList = new List <int>();
         int        num     = 1;
         if (Main.rand.Next(5) == 0 && source.Count > 12)
         {
             num = 3;
         }
         else if (Main.rand.Next(3) == 0)
         {
             num = 2;
         }
         List <NPC> list = source.OrderBy <NPC, int>((Func <NPC, int>)(i => Main.rand.Next())).ToList <NPC>();
         for (int index = 0; index < num; ++index)
         {
             intList.Add(index);
         }
         for (int index = 0; index < intList.Count; ++index)
         {
             BirthdayParty.CelebratingNPCs.Add(list[intList[index]].whoAmI);
         }
         Color color;
         // ISSUE: explicit reference operation
         ((Color)@color).\u002Ector((int)byte.MaxValue, 0, 160);
         if (BirthdayParty.CelebratingNPCs.Count == 3)
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_3", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[2]].GetGivenOrTypeNetName()), color);
         }
         else if (BirthdayParty.CelebratingNPCs.Count == 2)
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_2", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object)Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName()), color);
         }
         else
         {
             WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_1", (object)Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName()), color);
         }
     }
 }
Beispiel #15
0
 private static void NaturalAttempt()
 {
     if (Main.netMode == 1)
     {
         return;
     }
     if (BirthdayParty.PartyDaysOnCooldown > 0)
     {
         --BirthdayParty.PartyDaysOnCooldown;
     }
     else
     {
         if (Main.rand.Next(10) != 0)
         {
             return;
         }
         List <NPC> source = new List <NPC>();
         for (int index = 0; index < 200; ++index)
         {
             NPC npc = Main.npc[index];
             if (npc.active && npc.townNPC && (npc.type != 37 && npc.type != 453) && npc.aiStyle != 0)
             {
                 source.Add(npc);
             }
         }
         if (source.Count < 5)
         {
             return;
         }
         BirthdayParty.GenuineParty        = true;
         BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
         BirthdayParty.CelebratingNPCs.Clear();
         List <int> intList = new List <int>();
         int        num     = 1;
         if (Main.rand.Next(5) == 0 && source.Count > 12)
         {
             num = 3;
         }
         else if (Main.rand.Next(3) == 0)
         {
             num = 2;
         }
         List <NPC> list = source.OrderBy <NPC, int>((Func <NPC, int>)(i => Main.rand.Next())).ToList <NPC>();
         for (int index = 0; index < num; ++index)
         {
             intList.Add(index);
         }
         for (int index = 0; index < intList.Count; ++index)
         {
             BirthdayParty.CelebratingNPCs.Add(list[intList[index]].whoAmI);
         }
         Color color = new Color((int)byte.MaxValue, 0, 160);
         if (BirthdayParty.CelebratingNPCs.Count == 3)
         {
             WorldGen.BroadcastText(Lang.misc[96] + Main.npc[BirthdayParty.CelebratingNPCs[0]].displayName + ", " + Main.npc[BirthdayParty.CelebratingNPCs[1]].displayName + " & " + Main.npc[BirthdayParty.CelebratingNPCs[2]].displayName + Lang.misc[98], color);
         }
         else if (BirthdayParty.CelebratingNPCs.Count == 2)
         {
             WorldGen.BroadcastText(Lang.misc[96] + Main.npc[BirthdayParty.CelebratingNPCs[0]].displayName + " & " + Main.npc[BirthdayParty.CelebratingNPCs[1]].displayName + Lang.misc[98], color);
         }
         else
         {
             WorldGen.BroadcastText(Lang.misc[96] + Main.npc[BirthdayParty.CelebratingNPCs[0]].displayName + Lang.misc[97], color);
         }
     }
 }