Пример #1
0
        private List <TreasureBoxData> GetAllDunTreBox(int rarity)
        {
            List <TreasureBoxData> list = new List <TreasureBoxData>();
            int  index  = comboBox1.SelectedIndex;
            bool isZero = index == 0;

            for (int i = 0; i < treDunBoxList.Length; i++)
            {
                for (int j = 0; j < treDunBoxList[i].Length; j++)
                {
                    TreasureBoxData treBox = treDunBoxList[i][j];
                    if (rarity == treBox.Rarity)
                    {
                        if (isZero)
                        {
                            Double.TryParse(treBox.Y, out double y);
                            if (y < -25000)
                            {
                                continue;
                            }
                        }

                        if (dungeonIds[index].IndexOf(treBox.Id) >= 0)
                        {
                            list.Add(treBox);
                        }
                    }
                }
            }

            return(list);
        }
Пример #2
0
        private TreasureBoxData[] GetFavoListTreBoxs()
        {
            TreasureBoxData[] treBoxs = new TreasureBoxData[favoList.Length];
            for (int i = 0; i < favoList.Length; i++)
            {
                string[] strs = new string[2];
                if (favoList[i] == "")
                {
                    treBoxs[i] = new TreasureBoxData();
                    continue;
                }
                string[] s = favoList[i].Split(',');
                if (s.Length < 2)
                {
                    strs[1] = "";
                }
                else
                {
                    strs[1] = s[1];
                }
                strs[0]    = s[0];
                treBoxs[i] = new TreasureBoxData(strs);
            }

            return(treBoxs);
        }
Пример #3
0
        private TreasureBoxData[] GetTreList(int value, int rarity)
        {
            TreasureBoxData[] treBoxs;
            if (value == 0)
            {
                List <TreasureBoxData> list = GetAllTreBox(rarity);
                list.AddRange(GetAllDunTreBox(rarity));
                treBoxs = list.ToArray();
            }
            else if (value == 1)
            {
                treBoxs = GetFavoListTreBoxs();
            }
            else if (value == 2)
            {
                treBoxs = GetIslandTreBox(rarity);
            }
            else if (value == 4)
            {
                treBoxs = GetDungeonTreBox(rarity);
            }
            else
            {
                treBoxs = new TreasureBoxData[] { new TreasureBoxData((int)numericUpDown1.Value) };
            }

            return(treBoxs);
        }
Пример #4
0
 public TreasureBoxData(TreasureBoxData treBox, string memo)
 {
     Id        = treBox.Id;
     Rarity    = treBox.Rarity;
     PosHash   = treBox.PosHash;
     X         = treBox.X;
     Y         = treBox.Y;
     Z         = treBox.Z;
     Spawn     = treBox.Spawn;
     Index     = treBox.Index;
     IsDungeon = treBox.IsDungeon;
     Memo      = memo;
 }
Пример #5
0
        private List <TreasureBoxData> GetAllTreBox(int rarity)
        {
            List <TreasureBoxData> list = new List <TreasureBoxData>();
            bool isZero = comboBox1.SelectedIndex == 0;

            for (int i = 0; i < treBoxList.Length; i++)
            {
                for (int j = 0; j < treBoxList[i].Length; j++)
                {
                    TreasureBoxData treBox = treBoxList[i][j];
                    if (rarity == treBox.Rarity)
                    {
                        if (isZero == (treBox.Id == 8))
                        {
                            list.Add(treBox);
                        }
                    }
                }
            }

            return(list);
        }
Пример #6
0
        private TreasureBoxData GetIsDungeonMemo(TreasureBoxData treBox, int seed, bool isZero)
        {
            string memo = "";

            if (isZero)
            {
                UnityEngine.Random.InitState(seed);
                int rand = UnityEngine.Random.Range(0, 2);
                if (rand == treBox.Index)
                {
                    return(null);
                }
            }
            else
            {
                for (int m = 3; m <= 5; m++)
                {
                    UnityEngine.Random.InitState(seed);
                    int rand = UnityEngine.Random.Range(0, m);
                    if (rand != treBox.Index && m > treBox.Index)
                    {
                        memo += "" + m;
                    }
                }

                if (memo == "")
                {
                    return(null);
                }
                if (memo == "345")
                {
                    memo = "All";
                }
                memo += "-";
            }

            return(new TreasureBoxData(treBox, treBox.Index + "-" + memo + treBox.Memo));
        }
Пример #7
0
        private TreasureBoxData[] SetTreBoxList_Sub(string fileName)
        {
            string[] strs = TreasureCalc.TryReadFile(fileName);
            if (strs == null)
            {
                return(null);
            }
            TreasureBoxData[] treBoxs = new TreasureBoxData[strs.Length];
            string            name    = Path.GetFileNameWithoutExtension(fileName);

            for (int i = 0; i < strs.Length; i++)
            {
                if (strs[i] == "" || strs[i] == null)
                {
                    treBoxs[i] = new TreasureBoxData();
                    continue;
                }
                string[] s = strs[i].Split(',');
                if (s.Length < 7)
                {
                    treBoxs[i] = new TreasureBoxData();
                    continue;
                }

                if (Double.TryParse(s[4], out double y) && y < -5000)
                {
                    int index = (int)((y + 5000) / -10000);
                    treBoxs[i] = new TreasureBoxData(s, name, index);
                }
                else
                {
                    treBoxs[i] = new TreasureBoxData(s, name);
                }
            }

            return(treBoxs);
        }
Пример #8
0
        private void Search()
        {
            List <TreasureData> treDatas = new List <TreasureData>();
            int  islandLevel             = comboBox1.SelectedIndex;
            int  treType     = comboBox2.SelectedIndex;
            int  radioValue1 = GetRadioButtonChecked(radioButtons1);
            int  radioValue2 = GetRadioButtonChecked(radioButtons2);
            bool isAnd       = radioValue2 == 1;
            bool isAll       = false;

            TreasureBoxData[] treBoxs = GetTreList(radioValue1, treType);
            int[][]           searchValue = GetSearchValue(radioValue2);
            int iValue = 0, iLength;

            int[] jValue = mapIds[islandLevel];
            int   maxCount = (int)numericUpDown2.Value;
            int   count = 0;
            bool  isZero = islandLevel == 0;

            if (checkBox1.Checked && checkBox2.Checked)
            {
                isAll = true;
                int min = jValue[0];
                int max = jValue[jValue.Length - 1];
                iLength = max - min + 255;
                jValue  = new int[] { min };
            }
            else
            {
                if (checkBox1.Checked)
                {
                    iLength = 255;
                }
                else
                {
                    iValue  = (int)worldSeedNum.Value;
                    iLength = iValue + 1;
                }
                if (!checkBox2.Checked)
                {
                    jValue = new int[] { (int)mapIdNum3.Value };
                }
            }

            for (int j = 0; j < jValue.Length; j++)
            {
                for (int i = iValue; i < iLength; i++)
                {
                    for (int k = 0; k < treBoxs.Length; k++)
                    {
                        int             seed   = i + jValue[j];
                        TreasureBoxData treBox = treBoxs[k];
                        ItemData[]      items  = TreasureCalc.GetTreasureItem(islandLevel, seed + treBox.PosHash, treType);

                        if (Search_IsHit(items, searchValue, isAnd))
                        {
                            int wSeed, iId;
                            if (isAll)
                            {
                                iId   = GetSeedToId(seed, islandLevel);
                                wSeed = seed - iId;
                            }
                            else
                            {
                                wSeed = i;
                                iId   = jValue[j];
                            }

                            if (treBox.IsDungeon && treBox.Id != 9)
                            {
                                TreasureBoxData tre = GetIsDungeonMemo(treBox, seed, isZero);
                                if (tre == null)
                                {
                                    continue;
                                }
                                treBox = tre;
                            }

                            TreasureData treData = new TreasureData(islandLevel, seed, wSeed, iId, treType, treBox, items, radioValue1);
                            treDatas.Add(treData);

                            count++;
                            if (count >= maxCount)
                            {
                                i = iLength;
                                j = jValue.Length;
                                break;
                            }
                        }
                    }
                }
            }

            Form_Result form = new Form_Result(treDatas, radioValue1);

            form.Show();
        }