Esempio n. 1
0
        //Random Encounters
        private void initRandEnctrs()
        {
            Table_Manager tm = new Table_Manager();

            tm.setTable(test.rom, 0xEDACC, 0x1C);
            tm.setPanel(tabControl1.SelectedTab);            //tabPage8);
            tabPage8.Text = "Encounters";

            List <int> items = new List <int>();

            //ListBox lstb = tm.doTableListbox();
            for (int ind3 = 0; ind3 < 0x6E; ind3++)
            {
                int ind2 = Bits.getInt16(test.rom, 0xEDACC + 4 + ind3 * 0x1C);
                int ind  = Bits.getInt16(test.rom, 0x12CE7C + ind2 * 0x18);
                //StringBuilder str = new StringBuilder(0x200);
                //str.Append((ind3).ToString().PadLeft(3, ' ') + "|");
                //items.Add((ind3).ToString().PadLeft(3, ' ') + "|" + getTextStrShort(1068 + ind));
                items.Add(1068 + ind);
            }
            tm.doTableListbox(txt, items);             //items);

            int pnlx = tabPage8.Width / 2 - 150 + 100 + 25;
            int pnly = tabPage8.Height / 2 - 125;

            tm.doLabel(pnlx, pnly, "Frequency");
            tm.doNud(pnlx, pnly + 20, 0, 16);
            tm.doLabel(pnlx + 200, pnly, "Target Level");
            tm.doNud(pnlx + 200, pnly + 20, 2, 16);


            tm.doLabel(pnlx, pnly + 60, "Group");
            tm.doLabel(pnlx + 200, pnly + 60, "Rate");
            String[] enGroups = new String[660];
            for (int ind2 = 0; ind2 < 660; ind2++)
            {
                enGroups[ind2] = ind2.ToString().PadLeft(3, ' ') + "|" + Bits.getTextShort(txt, 1068 + Bits.getInt16(test.rom, 0x12CE7C + ind2 * 0x18));
            }
            tm.doCombo(pnlx, pnly + 80, Bits.textToBytes(enGroups), Bits.numList(660), 4, 16);
            tm.doCombo(pnlx, pnly + 100, Bits.textToBytes(enGroups), Bits.numList(660), 6, 16);
            tm.doCombo(pnlx, pnly + 120, Bits.textToBytes(enGroups), Bits.numList(660), 8, 16);
            tm.doCombo(pnlx, pnly + 140, Bits.textToBytes(enGroups), Bits.numList(660), 10, 16);
            tm.doCombo(pnlx, pnly + 160, Bits.textToBytes(enGroups), Bits.numList(660), 12, 16);
            tm.doCombo(pnlx, pnly + 180, Bits.textToBytes(enGroups), Bits.numList(660), 14, 16);
            tm.doCombo(pnlx, pnly + 200, Bits.textToBytes(enGroups), Bits.numList(660), 16, 16);
            tm.doCombo(pnlx, pnly + 220, Bits.textToBytes(enGroups), Bits.numList(660), 18, 16);

            tm.doNud(pnlx + 200, pnly + 80, 20, 8);
            tm.doNud(pnlx + 200, pnly + 100, 21, 8);
            tm.doNud(pnlx + 200, pnly + 120, 22, 8);
            tm.doNud(pnlx + 200, pnly + 140, 23, 8);
            tm.doNud(pnlx + 200, pnly + 160, 24, 8);
            tm.doNud(pnlx + 200, pnly + 180, 25, 8);
            tm.doNud(pnlx + 200, pnly + 200, 26, 8);
            tm.doNud(pnlx + 200, pnly + 220, 27, 8);

            //lstb.SelectedIndex = 0;
        }
Esempio n. 2
0
        private void okClick(object sender, EventArgs e)
        {
            lpnl.Hide();
            curList.Focus();
            //int i = ctrls.IndexOf((ButtonL)curList);
            //int value = (int)((ListView)sl2.lv)..SelectedIndex;
            if (sl2.lv.SelectedIndices.Count != 1)
            {
                return;
            }
            int value = sl2.sItems[sl2.lv.SelectedIndices[0]];

            for (int j = 0; j < bits; j += 8)
            {
                buf[addr + (j >> 3)] = (byte)value;
                value >>= 8;
            }
            value = Bits.getBits(buf, addr, bits);
            Text  = Bits.getTextShort(txt, items[value]);           //itemsL[value].ToString();
        }
Esempio n. 3
0
        //private void comboChanged(object sender, EventArgs e)
        //{
        //	int i = ctrls.IndexOf((ComboBox)sender);
        //	int value = (int)((ComboBox)sender).SelectedIndex;
        //	for (int j = 0; j < bits[i]; j += 8)
        //	{
        //		buf[entryAddr + offsets[i] + (j >> 3)] = (byte)value;
        //		value >>= 8;
        //	}
        //}

        private void comboKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            //base.comboKeyDown(e);
            //base.OnKeyDown(e);
            //e..Handled = true;
            int value = Bits.getBits(buf, addr, bits);

            switch (e.KeyCode)
            {
            //case Keys.Left:
            //case Keys.Right:
            case Keys.Up:
                if (value <= 0)
                {
                    break;
                }
                Bits.setBits(buf, addr, bits, --value);
                Text = Bits.getTextShort(txt, sl2.mItems[sl2.sItems[value]]);                         //itemsL[value].ToString();
                break;

            case Keys.Down:
                if (value >= items.Count() - 1)
                {
                    break;
                }
                Bits.setBits(buf, addr, bits, ++value);
                Text = Bits.getTextShort(txt, sl2.mItems[sl2.sItems[value]]);                         //itemsL[value].ToString();
                break;
            }
            //int value = (int)((ComboBox)sender).SelectedIndex;
            //for (int j = 0; j < bits[i]; j += 8)
            //{
            //	buf[entryAddr + offsets[i] + (j >> 3)] = (byte)value;
            //	value >>= 8;
            //}
        }
Esempio n. 4
0
        public override void load(TabControl tabControl1)
        {
            Table_Manager tm = new Table_Manager();

            tm.setTable(test.rom, 0xC15F4, 0x54);
            tm.setPanel(tabControl1.SelectedTab);            // tabPage5);
            int w = tabControl1.SelectedTab.Width;
            int h = tabControl1.SelectedTab.Height;

            //class Type Labels
            //List<int> ctlbl = new List<int>();
            //Shouldn't need more than 256 types if not doing code hacks to increase the number of classes. (e.g. Class index is saved in 8-bit.)
            //var ctlbl = Enumerable.Repeat(0, 256).ToList(); //If using a List.
            var ct = new int[0x100];

            for (int i = 2915 - 2915; i < 3159 - 2915; i++)
            {
                int n = Bits.getInt32(test.rom, 0xC15F4 + i * 0x54);
                if (n >= 0x100)
                {
                    continue;
                }
                if (ct[n] == 0)                 //{ }
                {
                    ct[n] = 2915 + i;
                }
            }
            var ctstr = new string[0x100];            //new List<String>();//

            for (int i = 0; i < 0x100; i++)           //{ }
            {
                if (ct[i] != 0)
                {
                    ctstr[i] = (i.ToString().PadLeft(3, ' ') + "|" + Bits.getTextShort(txt, ct[i]));
                }
                else
                {
                    ct[i]    = -1;
                    ctstr[i] = i.ToString().PadLeft(3, ' ') + "|";
                }
            }

            //2915
            //List<String> items = new List<String>();
            //for (int i = 2915; i < 3159; i++)
            //{
            //	items.Add((i - 2915).ToString().PadLeft(3, ' ') + "|" + getTextStrShort(i));
            //}
            List <int> items = new List <int>();

            for (int i = 0; i < 3159 - 2915; i++)
            {
                items.Add(2915 + i);
            }
            tm.doTableListbox(txt, items);            // items);

            int pnlx = w / 2 - 200 + 100 + 25;
            int pnly = 20 + 100;            // tabPage8.Height / 2 - 125;

            pnly += 20;
            tm.doNamebox(pnlx, pnly - 30, txt, 2915);

            String[] psyNames = new String[734];
            for (int ind2 = 0; ind2 < 734; ind2++)
            {
                psyNames[ind2] = ind2.ToString().PadLeft(3, ' ') + "|" + Bits.getTextShort(txt, 1447 + ind2);
            }

            Label fi = tm.doLabel(pnlx, pnly, "Class Type");

            //tm.doNud(pnlx + 100, pnly, 0, 32);
            tm.doCombo(pnlx + 100, pnly, txt, ct.ToList(), 0, 32);
            pnly -= 30;
            //fi = tm.doLabel(pnlx, pnly + 60, "Elemental Level Requirements");
            //fi.Width = 500;
            string[] eNames = { "Venus", "Mercury", "Mars", "Jupiter" };
            for (int i = 0; i < 4; i++)
            {
                tm.doLabel(pnlx + i * 100, pnly + 60, eNames[i] + " Lv.");
                tm.doNud(pnlx + i * 100, pnly + 80, 4 + i, 8);
            }

            string[] percents = new string[0x100];
            for (int i = 0; i < 0x100; i++)
            {
                percents[i] = (i * 10) + "%";
            }
            pnlx -= 50;
            tm.doLabel(pnlx, pnly + 200 - 80, "HP:");
            Control combo = tm.doCombo(pnlx + 80, pnly + 200 - 80, Bits.textToBytes(percents), Bits.numList(0x100), 0x8, 8);

            combo.Width = 70;
            tm.doLabel(pnlx, pnly + 200 - 60, "PP:");
            combo       = tm.doCombo(pnlx + 80, pnly + 200 - 60, Bits.textToBytes(percents), Bits.numList(0x100), 0x9, 8);
            combo.Width = 70;

            tm.doLabel(pnlx + 150 + 10, pnly + 200 - 80, "Attack:");
            combo       = tm.doCombo(pnlx + 150 + 80 + 10, pnly + 200 - 80, Bits.textToBytes(percents), Bits.numList(0x100), 0xA, 8);
            combo.Width = 70;
            tm.doLabel(pnlx + 150 + 10, pnly + 200 - 60, "Defense:");
            combo       = tm.doCombo(pnlx + 150 + 80 + 10, pnly + 200 - 60, Bits.textToBytes(percents), Bits.numList(0x100), 0xB, 8);
            combo.Width = 70;

            tm.doLabel(pnlx + 300 + 20, pnly + 200 - 80, "Agility:");
            combo       = tm.doCombo(pnlx + 300 + 80 + 20, pnly + 200 - 80, Bits.textToBytes(percents), Bits.numList(0x100), 0xC, 8);
            combo.Width = 70;
            tm.doLabel(pnlx + 300 + 20, pnly + 200 - 60, "Luck:");
            combo       = tm.doCombo(pnlx + 300 + 80 + 20, pnly + 200 - 60, Bits.textToBytes(percents), Bits.numList(0x100), 0xD, 8);
            combo.Width = 70;

            pnlx += 50;
            tm.doLabel(pnlx - 50, pnly + 200 - 20, "Level");
            tm.doLabel(pnlx + 60 - 50, pnly + 200 - 20, "Ability");
            for (int i = 0; i < 8; i++)
            {
                Control lv = tm.doNud(pnlx - 50, pnly + 200 + i * 20, 0x10 + 2 + i * 4, 8);
                lv.Width = 60;
                tm.doCombo(pnlx + 60 - 50, pnly + 200 + i * 20, Bits.textToBytes(psyNames), Bits.numList(734), 0x10 + 0 + i * 4, 16);
            }
            tm.doLabel(pnlx + 200, pnly + 200 - 20, "Level");
            tm.doLabel(pnlx + 60 + 200, pnly + 200 - 20, "Ability");
            for (int i = 0; i < 8; i++)
            {
                Control lv = tm.doNud(pnlx + 200, pnly + 200 + i * 20, 0x10 + 2 + (8 + i) * 4, 8);
                lv.Width = 60;
                tm.doCombo(pnlx + 60 + 200, pnly + 200 + i * 20, Bits.textToBytes(psyNames), Bits.numList(734), 0x10 + 0 + (8 + i) * 4, 16);
            }
            Label lbl = tm.doLabel(pnlx, pnly + 370, "Effect Weaknesses (+25% chance for non-flat effects.)");

            lbl.Width = 400;
            for (int i = 0; i < 3; i++)
            {
                tm.doNud(pnlx + i * 100, pnly + 390, 0x50 + i, 8);
            }
            pnly = 0;             //pnly -= 110;
            //pnlx += 5;
            //Class Type Chart
            Table_Manager tm2 = new Table_Manager();

            tm2.setTable(test.rom, 0xC6604, 0x40);
            tm2.setPanel(tabControl1.SelectedTab);             //tabPage5);
            for (int i = 0; i < 4; i++)
            {
                tm2.doLabel(pnlx + (i * 115), pnly, eNames[i]);
            }
            for (int j = 0; j < 4; j++)
            {
                tm2.doLabel(pnlx - 70, pnly + j * 20 + 20, eNames[j]);
            }
            pnly += 20;
            //for (int j = 0; j < 4; j++)
            //	for (int i = 0; i < 4; i++)
            //		tm2.doNud(pnlx + (i * 100), pnly + j * 20, (j * 4 + i) * 4, 32);
            for (int j = 0; j < 4; j++)
            {
                for (int i = 0; i < 4; i++)
                {
                    Control ctrl = tm2.doCombo(pnlx + (i * 115), pnly + j * 20, txt, ct.ToList(), (j * 4 + i) * 4, 32);
                    ctrl.Width = 115;
                }
            }
            tm2.loadEntry(null, null);
        }
Esempio n. 5
0
 private void lv_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (sItems == null)
     {
         e.Item = new ListViewItem("null");
         return;
     }
     if (sItems[e.ItemIndex] == -1)
     {
         e.Item = new ListViewItem("null2");
         return;
     }
     //e.Item = new ListViewItem(mItems[sItems[e.ItemIndex]]);
     e.Item = new ListViewItem((sItems[e.ItemIndex]).ToString().PadLeft(5, ' ') + "|" + Bits.getTextShort(txt, mItems[sItems[e.ItemIndex]]));
 }
Esempio n. 6
0
        public void initForgeTable()
        {
            Table_Manager tm = new Table_Manager();

            tm.setTable(test.rom, 0x10CC34, 0x24);
            tm.setPanel(tabControl1.SelectedTab);            //tabPage6);
            tabPage6.Text = "Forge";

            //ListBox lstb = tm.doTableListbox();
            ////607
            int        ind3  = 0;
            List <int> items = new List <int>();

            while (true)             //for (int ind3 = 0; ind3 < 0x14; ind3++)
            {
                //int ind2 = Bits.getInt16(test.rom, 0xEDACC + 4 + ind3 * 0x1C);
                int ind = Bits.getInt16(test.rom, 0x10CC34 + ind3 * 0x24);
                if (ind == 0xFFFF)
                {
                    break;
                }
                //StringBuilder str = new StringBuilder(0x200);
                //str.Append((ind3).ToString().PadLeft(3, ' ') + "|");
                //items.Add((ind3).ToString().PadLeft(3, ' ') + "|" + getTextStrShort(607 + ind));
                items.Add(607 + ind);
                ind3++;
            }
            tm.doTableListbox(txt, items);            // items);
            String[] itemNames = new String[461];
            for (int ind2 = 0; ind2 < 461; ind2++)
            {
                itemNames[ind2] = ind2.ToString().PadLeft(3, ' ') + "|" + Bits.getTextShort(txt, 607 + ind2);
            }
            int   pnlx = tabPage8.Width / 2 - 150 + 100 + 25;
            int   pnly = tabPage8.Height / 2 - 125;
            Label fi   = tm.doLabel(pnlx, pnly, "Forgeable Item");

            //fi.Width = 200;
            tm.doCombo(pnlx, pnly + 20, Bits.textToBytes(itemNames), Bits.numList(461), 0, 16);
            tm.doLabel(pnlx + 200, pnly, "Just text?");
            String[] text = { "Processed", "Rusted" };
            tm.doCombo(pnlx + 200, pnly + 20, Bits.textToBytes(text), Bits.numList(2), 2, 16);
            //fi.Width = 200;
            //tm.doNud(pnlx+ 200, pnly + 20, 2, 16);

            tm.doLabel(pnlx, pnly + 60, "Item");
            tm.doLabel(pnlx + 200, pnly + 60, "Rate");

            tm.doCombo(pnlx, pnly + 80, Bits.textToBytes(itemNames), Bits.numList(461), 4, 16);
            tm.doCombo(pnlx, pnly + 100, Bits.textToBytes(itemNames), Bits.numList(461), 6, 16);
            tm.doCombo(pnlx, pnly + 120, Bits.textToBytes(itemNames), Bits.numList(461), 8, 16);
            tm.doCombo(pnlx, pnly + 140, Bits.textToBytes(itemNames), Bits.numList(461), 10, 16);
            tm.doCombo(pnlx, pnly + 160, Bits.textToBytes(itemNames), Bits.numList(461), 12, 16);
            tm.doCombo(pnlx, pnly + 180, Bits.textToBytes(itemNames), Bits.numList(461), 14, 16);
            tm.doCombo(pnlx, pnly + 200, Bits.textToBytes(itemNames), Bits.numList(461), 16, 16);
            tm.doCombo(pnlx, pnly + 220, Bits.textToBytes(itemNames), Bits.numList(461), 18, 16);

            tm.doNud(pnlx + 200, pnly + 80, 20, 16);
            tm.doNud(pnlx + 200, pnly + 100, 22, 16);
            tm.doNud(pnlx + 200, pnly + 120, 24, 16);
            tm.doNud(pnlx + 200, pnly + 140, 26, 16);
            tm.doNud(pnlx + 200, pnly + 160, 28, 16);
            tm.doNud(pnlx + 200, pnly + 180, 30, 16);
            tm.doNud(pnlx + 200, pnly + 200, 32, 16);
            tm.doNud(pnlx + 200, pnly + 220, 34, 16);

            //lstb.SelectedIndex = 0;
        }
Esempio n. 7
0
        public void loadEntry(object sender, EventArgs e)
        {
            int srcEntry   = 0;
            int entryAddr2 = entryAddr;

            if (sender != null)
            {
                ListView lv = ((ListView)sender);
                if (lv.SelectedIndices.Count != 1)
                {
                    return;
                }
                srcEntry   = sl.sItems[lv.SelectedIndices[0]];              //sortList[lv.SelectedIndices[0]];
                entryAddr2 = baseAddr + srcEntry * entryLen;

                //I want copy/paste entire entries functionality! Yay!
                if (entryAddr != 0)                 //Ensuring that there is an item to copy. Also prevents CtrL+Shift form load bug because an item is selected on form load.
                {
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                        {
                            for (int i = 0; i < entryLen; i++)
                            {
                                buf[entryAddr2 + i] = buf[entryAddr + i];
                            }
                        }
                    }
                }
                if (entryLen != 0)                 // Entry length is "0" for text editor at present.
                {
                    cntAddr.Text = (0x8000000 | entryAddr2).ToString("X8");
                }
            }
            else
            {
                entryAddr = baseAddr;
            }
            //int ind = ((ListBox)pnl.Controls[0]).SelectedIndex;
            //int addr = 0xEDACC + ind * 0x1C;
            //pnl.Controls[1].Text = (0x8000000 | addr).ToString("X8");
            for (int i = 0; i < nuds.Count; i++)
            {
                nuds[i].addr  = nuds[i].addr - entryAddr + entryAddr2;
                nuds[i].Value = Bits.getBits(nuds[i].buf, nuds[i].addr, nuds[i].bits);                 //nuds[i].getData();
            }
            for (int i = 0; i < butls.Count; i++)
            {
                butls[i].addr = butls[i].addr - entryAddr + entryAddr2;
                butls[i].Text = Bits.getTextShort(butls[i].txt, butls[i].items[Bits.getBits(butls[i].buf, butls[i].addr, butls[i].bits)]);
                //butls[i].itemsL[Bits.getBits(butls[i].buf, butls[i].addr, butls[i].bits)].ToString();
                //butls[i].Text = Bits.getTextLong(txt, Bits.getBits(butls[i].buf, butls[i].addr, butls[i].bits));
            }
            for (int i = 0; i < dtbs.Count; i++)
            {
                dtbs[i].theIndex = dtbs[i].baseIndex + srcEntry;
                dtbs[i].tbx.Text = Bits.getTextLong(dtbs[i].txt, dtbs[i].theIndex);
            }
            entryAddr = entryAddr2;
            //for (int i = 0; i < ctrls.Count; i++)
            //{
            //	if (ctrls[i].GetType() == typeof(ComboBox))
            //	{
            //		((ComboBox)ctrls[i]).SelectedIndex = Bits.getBits(buf, entryAddr + offsets[i], bits[i]);
            //	}
            //	if (ctrls[i].GetType() == typeof(ButtonL))
            //	{
            //		((ButtonL)ctrls[i]).Text = itemsL[i][Bits.getBits(buf, entryAddr + offsets[i], bits[i])].ToString();
            //	}
            //	if (ctrls[i].GetType() == typeof(TextBox))
            //	{
            //		((TextBox)ctrls[i]).Text = Bits.getTextLong(txt, theIndex + srcEntry);
            //	}
            //}
        }