Exemple #1
0
        private void SetObjects()
        {
            mapIdNum1.Maximum = TreasureCalc.max_MapCell;
            mapIdNum2.Maximum = TreasureCalc.max_MapCell;
            mapIdNum3.Maximum = TreasureCalc.max_MapCell * TreasureCalc.max_MapCell - 1;

            for (int i = 0; i < TreasureCalc.max_IslandLevel + 1; i++)
            {
                comboBox1.Items.Add(i);
                comboBox5.Items.Add(i);
            }
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            comboBox5.SelectedIndex = 0;

            favoList = TreasureCalc.TryReadFile(dirName + favoListName);
            UI_SetFavoList();
            charList = TreasureCalc.TryReadFile(dataDirName + charListName);

            radioButtons1 = new RadioButton[] {
                radioButton0, radioButton1, radioButton2, radioButton3, radioButton7
            };
            radioButtons2 = new RadioButton[] {
                radioButton4, radioButton5, radioButton6
            };
        }
Exemple #2
0
        private int[][] GetSearchValue(int value)
        {
            if (value == 0)
            {
                return(null);
            }
            int          count = listBox1.Items.Count;
            List <int[]> vs    = new List <int[]>();

            for (int i = 0; i < count; i++)
            {
                string str = listBox1.Items[i].ToString();
                if (str == "")
                {
                    continue;
                }
                string[] strs = str.Split(',');
                int[]    v    = new int[strs.Length];
                v[0] = GetItemId(strs[0]);
                if (strs.Length >= 2)
                {
                    v[1] = TreasureCalc.IntParse(strs[1]);
                }
                for (int j = 2; j < strs.Length; j++)
                {
                    v[j] = GetEnchantId(strs[j]);
                }
                vs.Add(v);
            }

            return(vs.ToArray());;
        }
Exemple #3
0
        public Form1()
        {
            try
            {
                this.FormClosed  += Form1_FormClosed;
                this.FormClosing += Form1_FormClosing;
                InitializeComponent();
                dirName     = Application.StartupPath + "\\";
                dataDirName = dirName + dataFolderName + "\\";
                TreasureCalc.SetMaxData();
                TreasureCalc.SetDatas();
                SetObjects();
                SetMapIds();
                SetDungeonIds();
                SetTreBoxList();
                SetTreDunBoxList();
                ShowNonFile();
            }
            catch (Exception ex) { ErrorEvent("初期化に失敗しました", ex); }

            try
            {
                ReadIni();
            }
            catch (Exception ex) { ErrorEvent("iniの読み込みに失敗しました", ex); }
        }
Exemple #4
0
        private void SetMapIds()
        {
            string[] texts = TreasureCalc.TryReadFile(dataDirName + mapIdListName);
            if (texts == null)
            {
                return;
            }
            int[][] vs = new int[texts.Length][];

            for (int i = 0; i < texts.Length; i++)
            {
                if (texts[i] == "")
                {
                    continue;
                }
                string[] strs = texts[i].Split(',');
                vs[i] = new int[strs.Length];
                for (int j = 0; j < strs.Length; j++)
                {
                    vs[i][j] = TreasureCalc.IntParse(strs[j]);
                }
            }

            mapIds = vs;
        }
Exemple #5
0
        private void SetDungeonIds()
        {
            string[] texts = TreasureCalc.TryReadFile(dataDirName + dungeonListName);
            if (texts == null)
            {
                return;
            }
            List <int>[] vs = new List <int> [texts.Length];

            for (int i = 0; i < texts.Length; i++)
            {
                if (texts[i] == "")
                {
                    continue;
                }
                string[] strs = texts[i].Split(',');
                vs[i] = new List <int>();
                for (int j = 0; j < strs.Length; j++)
                {
                    vs[i].Add(TreasureCalc.IntParse(strs[j]));
                }
            }

            dungeonIds = vs;
        }
Exemple #6
0
        private void SetRadioButtonChecked(RadioButton[] radio, string str)
        {
            int id = TreasureCalc.IntParse(str);

            if (id < radio.Length)
            {
                radio[id].Checked = true;
            }
        }
Exemple #7
0
        private void SetcomboBoxSelected(ComboBox combo, string str)
        {
            int index = TreasureCalc.IntParse(str);
            int count = combo.Items.Count - 1;

            if (index > count)
            {
                index = count;
            }
            combo.SelectedIndex = index;
        }
Exemple #8
0
        private void WorldSeed_TextChanged(object sender, EventArgs e)
        {
            string text = worldSeedText.Text;

            if (text.Length >= 1 && !changeFlag)
            {
                changeFlag         = true;
                worldSeedNum.Value = TreasureCalc.GetServerSeed(text[0]);
                changeFlag         = false;
            }
        }
Exemple #9
0
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
                Encoding enc = Encoding.GetEncoding("shift_jis");
                string   str = textBox1.Text;

                if (str.Length >= 1 && !IsUnicode(str))
                {
                    int      cnt   = 0;
                    int      count = 0;
                    string[] strs  = new string[255];
                    int      i     = GetStrToNum(str);

                    while (count < 255 && cnt < 10000)
                    {
                        cnt++;
                        byte[] data = BitConverter.GetBytes(i);
                        string s    = enc.GetString(data);
                        int    seed = TreasureCalc.GetServerSeed(s[0]);

                        if (strs[seed] == null)
                        {
                            strs[seed] = "" + s[0];
                            count++;
                        }
                        i += cnt % 256 == 0 ? 1 : 0x100;

                        //if ((seed == 177 && s[0] != '・'))
                        //{
                        //    MessageBox.Show("seed:" + seed + " : " + s);
                        //}
                    }

                    if (count != 255)
                    {
                        Close();
                        MessageBox.Show("失敗!" + count);
                        return;
                    }

                    string fileName = Form1.dirName + Form1.charListName;
                    File.WriteAllLines(fileName, strs);
                    Close();
                    MessageBox.Show("完了!");
                }
            }
            catch (Exception ex)
            {
                Close();
                Form1.ErrorEvent("エラーが発生しました", ex);
            }
        }
Exemple #10
0
        public TreasureBoxData(string[] strs, string memo)
        {
            Id      = TreasureCalc.IntParse(strs[0]);
            Rarity  = GetTreBoxRarity(strs[1]);
            PosHash = TreasureCalc.IntParse(strs[2]);
            string format = "{0:#.##}";

            X     = String.Format(format, strs[3]);
            Y     = String.Format(format, strs[4]);
            Z     = String.Format(format, strs[5]);
            Spawn = strs[6];
            Memo  = memo;
        }
Exemple #11
0
 public EnchantData(string[] strs)
 {
     if (strs.Length < 6)
     {
         strs = new string[6];
     }
     Id = TreasureCalc.IntParse(strs[0]);
     Name = strs[1];
     RarityType = strs[2];
     Rarity = TreasureCalc.IntParse(strs[3]);
     IsDrop = strs[4] == "0";
     Prob = TreasureCalc.IntParse(strs[5]);
 }
Exemple #12
0
 public ItemData(string[] strs)
 {
     if (strs.Length < 6)
     {
         strs = new string[6];
     }
     Id         = TreasureCalc.IntParse(strs[0]);
     Name       = strs[1];
     Type       = strs[2];
     RarityType = strs[3];
     Rarity     = TreasureCalc.IntParse(strs[4]);
     Prob       = TreasureCalc.IntParse(strs[5]);
     Enchant    = null;
 }
Exemple #13
0
        private void SetEditMode()
        {
            string str = "" + form1_ListBox.Items[form1_ListBox.SelectedIndex];

            string[] strs = str.Split(',');

            comboBox1.Text = strs[0];
            int index = TreasureCalc.IntParse(strs[1]) + 1;

            if (index < 5)
            {
                comboBox3.SelectedIndex = index;
            }

            for (int i = 2; i < strs.Length; i++)
            {
                listBox1.Items.Add(strs[i]);
            }
        }
Exemple #14
0
        private void ReadIni()
        {
            string fileName = dirName + iniName;

            if (File.Exists(fileName))
            {
                string[] strs = File.ReadAllLines(fileName, Encoding.UTF8);
                if (strs.Length < 17)
                {
                    return;
                }

                checkBox1.Checked  = strs[0] == "True";
                checkBox2.Checked  = strs[1] == "True";
                checkBox3.Checked  = strs[2] == "True";
                worldSeedText.Text = strs[3];
                mapIdNum3.Text     = strs[4];
                SetRadioButtonChecked(radioButtons1, strs[5]);
                SetRadioButtonChecked(radioButtons2, strs[6]);
                SetcomboBoxSelected(comboBox1, strs[7]);
                SetcomboBoxSelected(comboBox2, strs[8]);
                SetcomboBoxSelected(comboBox3, strs[9]);
                numericUpDown1.Text = strs[10];
                numericUpDown2.Text = strs[11];
                SetcomboBoxSelected(comboBox4, strs[12]);
                SetcomboBoxSelected(comboBox5, strs[13]);
                checkBox4.Checked         = strs[14] == "True";
                numericUpDown3.Text       = strs[15];
                numericUpDown4.Text       = strs[16];
                tabControl1.SelectedIndex = strs[17] == "1" ? 1 : 0;

                fileName = dirName + searchListName;
                if (!File.Exists(fileName))
                {
                    return;
                }

                string[] texts = TreasureCalc.TryReadFile(fileName);
                SetSearchText(texts);
            }
        }
Exemple #15
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);
        }
Exemple #16
0
 public TreasureBoxData(string[] strs)
 {
     PosHash = TreasureCalc.IntParse(strs[0]);
     Memo    = strs[1];
 }
Exemple #17
0
        private void Search2()
        {
            List <TreasureData2> mDatas = new List <TreasureData2>();
            int itemCount   = 10;
            int islandLevel = comboBox5.SelectedIndex;
            int radioValue  = GetRadioButtonChecked(radioButtons2);

            int[][] searchValue = GetSearchValue(radioValue);
            int     iValue = 0, iLength;

            int[] jValue    = mapIds[islandLevel];
            int   syouhi    = (int)numericUpDown3.Value;
            int   sMaxCount = (int)numericUpDown4.Value;
            int   maxCount  = (int)numericUpDown2.Value;
            int   count     = 0;
            bool  isAnd     = radioValue == 1;

            if (islandLevel < TreasureCalc.max_IslandLevel)
            {
                islandLevel++;
            }

            if (checkBox1.Checked && checkBox2.Checked)
            {
                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++)
                {
                    ItemData[] items;
                    int        seed      = i + jValue[j];
                    int        randCount = syouhi;

                    UnityEngine.Random.InitState(seed);
                    TreasureCalc.RandSyouhi(syouhi);

                    for (int k = 0; k < sMaxCount; k++)
                    {
                        items = TreasureCalc.GetMerchantItem(islandLevel, itemCount);

                        if (Search_IsHit(items, searchValue, isAnd))
                        {
                            for (int m = 0; m < itemCount; m++)
                            {
                                mDatas.Add(new TreasureData2(islandLevel, seed, i, jValue[j], k + 1, 0, items[m]));
                            }
                            count += itemCount;
                            if (count >= maxCount)
                            {
                                i = iLength;
                                j = jValue.Length;
                                break;
                            }
                        }
                    }
                }
            }

            Form_Result2 form = new Form_Result2(mDatas, radioValue);

            form.Show();
        }
Exemple #18
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();
        }