// makes a list of current bugs
        private async Task FindBugs(int bugID)
        {
            var BugAvil = await BugProcessorAvail.LoadBugAvil(bugID);

            if (BugAvil.AllYear == true)
            {
                bugNum.Add(bugID);
            }
        }
예제 #2
0
        // Creating a list of bugIDs of the bugs currently in season (for each hemisphere)
        // Starts check by if available all year, then narrowing down by each month it appears
        private async Task CurrentBug(int bugID)
        {
            var bugAvil = await BugProcessorAvail.LoadBugAvil(bugID);

            if (bugAvil.AllYear == true)
            {
                bugNum.Add(bugID);
            }
            else
            {
                if (player.GetHemisphere() == "North")
                {
                    if (bugAvil.MonthNorth.Length <= 2)
                    {
                        var bugMonth = months[Int32.Parse(bugAvil.MonthNorth) - 1];
                        if (bugMonth == Month)
                        {
                            bugNum.Add(bugID);
                        }
                    }
                    else if (bugAvil.MonthNorth.Length <= 5)
                    {
                        string[] dateArr = bugAvil.MonthNorth.Split('-');
                        if (Int32.Parse(dateArr[0]) < Int32.Parse(dateArr[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int j = Int32.Parse(dateArr[0]) - 1; j < Int32.Parse(dateArr[1]); j++)
                            {
                                bugMonths.Add(months[j]);
                            }
                            foreach (string m in bugMonths)
                            {
                                if (m == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArr[0]) > Int32.Parse(dateArr[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int k = Int32.Parse(dateArr[0]) - 1; k <= 11; k++)
                            {
                                bugMonths.Add(months[k]);
                            }
                            for (int l = 0; l < Int32.Parse(dateArr[1]); l++)
                            {
                                bugMonths.Add(months[l]);
                            }
                            foreach (string n in bugMonths)
                            {
                                if (n == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                    }
                    else if (bugAvil.MonthNorth.Length <= 8)
                    {
                        string[] multiMonths  = bugAvil.MonthNorth.Split(' ');
                        string[] dateArrFirst = multiMonths[0].Split('-');
                        if (Int32.Parse(dateArrFirst[0]) < Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int a = Int32.Parse(dateArrFirst[0]) - 1; a < Int32.Parse(dateArrFirst[1]); a++)
                            {
                                bugMonths.Add(months[a]);
                            }
                            foreach (string t in bugMonths)
                            {
                                if (t == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArrFirst[0]) > Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int p = Int32.Parse(dateArrFirst[0]) - 1; p <= 11; p++)
                            {
                                bugMonths.Add(months[p]);
                            }
                            for (int q = 0; q < Int32.Parse(dateArrFirst[1]); q++)
                            {
                                bugMonths.Add(months[q]);
                            }
                            foreach (string h in bugMonths)
                            {
                                if (h == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        if (months[Int32.Parse(multiMonths[2]) - 1] == Month)
                        {
                            bugNum.Add(bugID);
                        }
                    }
                    else if (bugAvil.MonthNorth.Length >= 9)
                    {
                        string[] multiMonths   = bugAvil.MonthNorth.Split(' ');
                        string[] dateArrFirst  = multiMonths[0].Split('-');
                        string[] dateArrSecond = multiMonths[2].Split('-');
                        if (Int32.Parse(dateArrFirst[0]) < Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int a = Int32.Parse(dateArrFirst[0]) - 1; a < Int32.Parse(dateArrFirst[1]); a++)
                            {
                                bugMonths.Add(months[a]);
                            }
                            foreach (string t in bugMonths)
                            {
                                if (t == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArrFirst[0]) > Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int p = Int32.Parse(dateArrFirst[0]) - 1; p <= 11; p++)
                            {
                                bugMonths.Add(months[p]);
                            }
                            for (int q = 0; q < Int32.Parse(dateArrFirst[1]); q++)
                            {
                                bugMonths.Add(months[q]);
                            }
                            foreach (string h in bugMonths)
                            {
                                if (h == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        if (Int32.Parse(dateArrSecond[0]) < Int32.Parse(dateArrSecond[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int b = Int32.Parse(dateArrSecond[0]) - 1; b < Int32.Parse(dateArrSecond[1]); b++)
                            {
                                bugMonths.Add(months[b]);
                            }
                            foreach (string y in bugMonths)
                            {
                                if (y == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArrSecond[0]) > Int32.Parse(dateArrSecond[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int c = Int32.Parse(dateArrSecond[0]) - 1; c <= 11; c++)
                            {
                                bugMonths.Add(months[c]);
                            }
                            for (int d = 0; d < Int32.Parse(dateArrSecond[1]); d++)
                            {
                                bugMonths.Add(months[d]);
                            }
                            foreach (string g in bugMonths)
                            {
                                if (g == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                    }
                }
                if (player.GetHemisphere() == "South")
                {
                    if (bugAvil.MonthSouth.Length <= 2)
                    {
                        var bugMonth = months[Int32.Parse(bugAvil.MonthSouth) - 1];
                        if (bugMonth == Month)
                        {
                            bugNum.Add(bugID);
                        }
                    }
                    else if (bugAvil.MonthSouth.Length <= 5)
                    {
                        string[] dateArr = bugAvil.MonthSouth.Split('-');
                        if (Int32.Parse(dateArr[0]) < Int32.Parse(dateArr[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int j = Int32.Parse(dateArr[0]) - 1; j < Int32.Parse(dateArr[1]); j++)
                            {
                                bugMonths.Add(months[j]);
                            }
                            foreach (string m in bugMonths)
                            {
                                if (m == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArr[0]) > Int32.Parse(dateArr[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int k = Int32.Parse(dateArr[0]) - 1; k <= 11; k++)
                            {
                                bugMonths.Add(months[k]);
                            }
                            for (int l = 0; l < Int32.Parse(dateArr[1]); l++)
                            {
                                bugMonths.Add(months[l]);
                            }
                            foreach (string n in bugMonths)
                            {
                                if (n == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                    }
                    else if (bugAvil.MonthSouth.Length <= 8)
                    {
                        string[] multiMonths  = bugAvil.MonthSouth.Split(' ');
                        string[] dateArrFirst = multiMonths[0].Split('-');
                        if (Int32.Parse(dateArrFirst[0]) < Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int a = Int32.Parse(dateArrFirst[0]) - 1; a < Int32.Parse(dateArrFirst[1]); a++)
                            {
                                bugMonths.Add(months[a]);
                            }
                            foreach (string t in bugMonths)
                            {
                                if (t == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArrFirst[0]) > Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int p = Int32.Parse(dateArrFirst[0]) - 1; p <= 11; p++)
                            {
                                bugMonths.Add(months[p]);
                            }
                            for (int q = 0; q < Int32.Parse(dateArrFirst[1]); q++)
                            {
                                bugMonths.Add(months[q]);
                            }
                            foreach (string h in bugMonths)
                            {
                                if (h == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        if (months[Int32.Parse(multiMonths[2]) - 1] == Month)
                        {
                            bugNum.Add(bugID);
                        }
                    }
                    else if (bugAvil.MonthSouth.Length >= 9)
                    {
                        string[] multiMonths   = bugAvil.MonthSouth.Split(' ');
                        string[] dateArrFirst  = multiMonths[0].Split('-');
                        string[] dateArrSecond = multiMonths[2].Split('-');
                        if (Int32.Parse(dateArrFirst[0]) < Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int a = Int32.Parse(dateArrFirst[0]) - 1; a < Int32.Parse(dateArrFirst[1]); a++)
                            {
                                bugMonths.Add(months[a]);
                            }
                            foreach (string t in bugMonths)
                            {
                                if (t == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArrFirst[0]) > Int32.Parse(dateArrFirst[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int p = Int32.Parse(dateArrFirst[0]) - 1; p <= 11; p++)
                            {
                                bugMonths.Add(months[p]);
                            }
                            for (int q = 0; q < Int32.Parse(dateArrFirst[1]); q++)
                            {
                                bugMonths.Add(months[q]);
                            }
                            foreach (string h in bugMonths)
                            {
                                if (h == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        if (Int32.Parse(dateArrSecond[0]) < Int32.Parse(dateArrSecond[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int b = Int32.Parse(dateArrSecond[0]) - 1; b < Int32.Parse(dateArrSecond[1]); b++)
                            {
                                bugMonths.Add(months[b]);
                            }
                            foreach (string y in bugMonths)
                            {
                                if (y == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                        else if (Int32.Parse(dateArrSecond[0]) > Int32.Parse(dateArrSecond[1]))
                        {
                            List <string> bugMonths = new List <string>();
                            for (int c = Int32.Parse(dateArrSecond[0]) - 1; c <= 11; c++)
                            {
                                bugMonths.Add(months[c]);
                            }
                            for (int d = 0; d < Int32.Parse(dateArrSecond[1]); d++)
                            {
                                bugMonths.Add(months[d]);
                            }
                            foreach (string g in bugMonths)
                            {
                                if (g == Month)
                                {
                                    bugNum.Add(bugID);
                                }
                            }
                        }
                    }
                }
            }
        }