예제 #1
0
        public frmShopEditor()
        {
            InitializeComponent();

            // Load item names
            for (int i = 0; i < itemNames.Length; i++)
            {
                itemNames[i] = TextItemNames.GetName(i);
            }

            // Draw the tab stuff
            for (int i = 0; i < 3; i++)
            {
                tabPage[i]         = new TabPage("Page " + (i + 1).ToString());
                tabPage[i].Padding = new System.Windows.Forms.Padding(3);
                tabPage[i].UseVisualStyleBackColor = true;
                tabPage[i].TabIndex = i;

                tabMain.TabPages.Add(tabPage[i]);

                // Draw the item stuff
                for (int j = 0; j < 10; j++)
                {
                    LinkLabel ll = new LinkLabel();

                    ll.AutoSize = true;
                    ll.Text     = "Item " + ((i * 10) + j + 1).ToString();
                    ll.Left     = 6;
                    ll.Top      = (j * 27) + 10;
                    ll.Tag      = ((i * 10) + j);

                    ll.LinkClicked += (s, e) =>
                    {
                        LinkLabel l     = s as LinkLabel;
                        int       index = (int)l.Tag;

                        ModuleArbiter.ShowSelect(typeof(frmItemEditor), cboItem[index].SelectedIndex);
                    };

                    tabPage[i].Controls.Add(ll);
                    lblItem[(i * 10) + j] = ll;

                    ComboBox c = new ComboBox();

                    Helpers.CheckFont(c);

                    for (int k = 0; k < itemNames.Length; k++)
                    {
                        c.Items.Add("[" + k.ToString("X2") + "] " + itemNames[k]);
                    }

                    c.Width         = 160;
                    c.DropDownStyle = ComboBoxStyle.DropDownList;
                    c.Left          = ll.Left + 50;
                    c.Top           = ll.Top - 3;

                    tabPage[i].Controls.Add(c);
                    cboItem[(i * 10) + j] = c;
                }
            }

            // Load the shop data
            ShopData.Init();
            string[] shopNames = Properties.Resources.shopnames.SplitN();
            loading = true;
            for (int i = 0; i < ShopData.Entries; i++)
            {
                cboShop.Items.Add("[" + i.ToString("X2") + "] " + shopNames[i]);
            }
            loading = false;
            cboShop.SelectedIndex = 0;
        }
예제 #2
0
        public frmItemEditor()
        {
            InitializeComponent();

            // Load item names
            for (int i = 0; i < itemNames.Length; i++)
            {
                itemNames[i] = TextItemNames.GetName(i);
            }

            // Draw the ailments stuff
            string[] weaknesses = Properties.Resources.weaknesses.SplitN();
            for (int i = 0; i < 11; i++)
            {
                Label l = new Label();

                l.AutoSize = true;
                l.Text     = weaknesses[i];
                l.Left     = 6;
                l.Top      = (i * 27) + 9;

                tabAilments.Controls.Add(l);
                lblAilment[i] = l;

                TextBox t = new TextBox();

                t.Width     = 64;
                t.Left      = l.Left + 96;
                t.Top       = (i * 27) + 7;
                t.MaxLength = 6;

                tabAilments.Controls.Add(t);
                txtAilment[i] = t;
            }

            // Draw the PSI stuff
            string[] psi = { "PK Love", "PK Fire", "PK Freeze", "PK Thunder", "Bomb" };
            for (int i = 0; i < 5; i++)
            {
                Label l = new Label();

                l.AutoSize = true;
                l.Text     = psi[i];
                l.Left     = 6;
                l.Top      = (i * 27) + 9;

                tabPsi.Controls.Add(l);
                lblPsi[i] = l;

                TextBox t = new TextBox();

                t.Width     = 64;
                t.Left      = l.Left + 96;
                t.Top       = (i * 27) + 7;
                t.MaxLength = 4;

                tabPsi.Controls.Add(t);
                txtPsi[i] = t;
            }

            // Draw the equipper stuff
            equippers = Properties.Resources.equippernames.SplitN();
            for (int i = 0; i < 8; i++)
            {
                CheckBox cb = new CheckBox();

                cb.AutoSize = true;
                cb.Text     = equippers[i] + " can equip";
                cb.Left     = lblItemType.Left + 5;
                cb.Top      = lblHp.Top + (i * 26);

                tabBasic.Controls.Add(cb);
                chkEquip[i] = cb;
            }

            // Item types
            itemTypes = Properties.Resources.itemtypes.SplitN();
            cboItemType.Items.AddRange(itemTypes);

            Helpers.CheckFont(cboItem);
            Helpers.CheckFont(txtName);
            Helpers.CheckFont(txtDescription);
            cboItem.JapaneseSearch = M3Rom.Version == RomVersion.Japanese;

            // Load the item data
            ItemData.Init();

            loading = true;
            for (int i = 0; i < ItemData.Entries; i++)
            {
                cboItem.Items.Add("[" + i.ToString("X2") + "] " + itemNames[i]);
            }
            loading = false;
            cboItem.SelectedIndex = 0;
        }
예제 #3
0
        public frmEnemyEditor()
        {
            InitializeComponent();

            this.Invalidate();

            Helpers.CheckFont(cboMusicSwirl);
            Helpers.CheckFont(cboMusicBattle);
            Helpers.CheckFont(cboMusicWin);
            Helpers.CheckFont(cboTextDeath);
            Helpers.CheckFont(cboTextEncounter);
            Helpers.CheckFont(cboEnemy);
            Helpers.CheckFont(txtName);
            Helpers.CheckFont(txtShortName);
            Helpers.CheckFont(txtDescription);
            cboEnemy.JapaneseSearch = M3Rom.Version == RomVersion.Japanese;
            txtShortName.ReadOnly   = M3Rom.Version != RomVersion.English;

            // Load item names
            for (int i = 0; i < itemNames.Length; i++)
            {
                itemNames[i] = TextItemNames.GetName(i);
            }

            // Load the enemy names
            for (int i = 0; i < enemyNames.Length; i++)
            {
                enemyNames[i] = TextEnemyNames.GetName(i);
            }

            // Load the enemy short names
            if (M3Rom.Version == RomVersion.English)
            {
                enemyShortNames = new string[TextEnemyShortNames.Entries];
                for (int i = 0; i < enemyShortNames.Length; i++)
                {
                    enemyShortNames[i] = TextEnemyShortNames.GetName(i);
                }
            }
            else
            {
                txtShortName.Enabled = false;
            }

            // Load the music names
            for (int i = 0; i < musicNames.Length; i++)
            {
                musicNames[i] = TextMusicNames.GetName(i);
                string str = "[" + i.ToString("X2") + "] " + musicNames[i];
                cboMusicSwirl.Items.Add(str);
                cboMusicBattle.Items.Add(str);
                cboMusicWin.Items.Add(str);
            }

            // Load the action names
            for (int i = 0; i < actions.Length; i++)
            {
                actions[i] = TextBattle.GetText(ActionTable.Actions[i].Data[0x12]);
            }

            // Load the battle text
            for (int i = 0; i < battletext.Length; i++)
            {
                battletext[i] = TextBattle.GetText(i);
                if (i < 0x100)
                {
                    string strb = "[" + i.ToString("X2") + "] " + battletext[i];
                    cboTextEncounter.Items.Add(strb);
                    cboTextDeath.Items.Add(strb);
                }
            }

            // Load the background list
            loading2 = true;
            for (int i = 0; i < GfxBattleBg.MasterEntries; i++)
            {
                cboBg.Items.Add(i.ToString("X2"));
            }
            loading2 = false;

            // Draw the weakness stuff
            string[] weaknesses = Properties.Resources.weaknesses.SplitN();
            for (int i = 0; i < 20; i++)
            {
                int colWidth = ((tabWeaknesses.ClientSize.Width - 12) / 2);

                Label l = new Label();

                l.AutoSize = true;
                l.Text     = weaknesses[i];
                l.Left     = ((i / 10) * colWidth) + 6;
                l.Top      = ((i % 10) * 27) + 9;

                tabWeaknesses.Controls.Add(l);
                lblWeakness[i] = l;

                TextBox t = new TextBox();

                t.Width     = 64;
                t.Left      = l.Left + 96;
                t.Top       = ((i % 10) * 27) + 7;
                t.MaxLength = 5;

                tabWeaknesses.Controls.Add(t);
                txtWeakness[i] = t;
            }

            // Draw item stuff
            int vBase = txtDp.Top + 39;

            for (int i = 0; i < 3; i++)
            {
                LinkLabel l1 = new LinkLabel();

                l1.AutoSize = true;
                l1.Text     = "Item " + (i + 1).ToString();
                l1.Left     = 6;
                l1.Top      = vBase + 2;
                l1.Tag      = i;

                l1.LinkClicked += (s, e) =>
                {
                    LinkLabel ll    = s as LinkLabel;
                    int       index = (int)ll.Tag;

                    ModuleArbiter.ShowSelect(typeof(frmItemEditor), cboItem[index].SelectedIndex);
                };

                tabBasic.Controls.Add(l1);
                lblItem[i] = l1;

                ComboBox c = new ComboBox();

                Helpers.CheckFont(c);

                for (int j = 0; j < itemNames.Length; j++)
                {
                    c.Items.Add("[" + j.ToString("X2") + "] " + itemNames[j]);
                }

                c.Width         = 160;
                c.DropDownStyle = ComboBoxStyle.DropDownList;
                c.Left          = txtDp.Left;
                c.Top           = vBase;

                tabBasic.Controls.Add(c);
                cboItem[i] = c;

                vBase += 27;

                Label l2 = new Label();
                l2.AutoSize = true;
                l2.Text     = l1.Text + " %";
                l2.Left     = 6;
                l2.Top      = vBase + 2;

                tabBasic.Controls.Add(l2);
                lblItemChance[i] = l2;

                TextBox t = new TextBox();
                t.Width = 96;
                t.Left  = txtDp.Left;
                t.Top   = vBase;

                tabBasic.Controls.Add(t);
                txtItemChance[i] = t;

                vBase += 27;
            }

            // Draw the action stuff
            vBase = cboTextDeath.Top + 39;
            for (int i = 0; i < 8; i++)
            {
                Label l = new Label();

                l.AutoSize = true;
                l.Text     = "Action " + (i + 1).ToString();
                l.Left     = 6;
                l.Top      = vBase + 2;

                tabBattle.Controls.Add(l);
                lblAction[i] = l;

                ComboBox c = new ComboBox();

                Helpers.CheckFont(c);
                for (int j = 0; j < actions.Length; j++)
                {
                    c.Items.Add("[" + j.ToString("X3") + "] " + actions[j].Replace(Environment.NewLine, " "));
                }

                c.Width         = 320;
                c.DropDownStyle = ComboBoxStyle.DropDownList;
                c.Left          = txtMusicWin.Left;
                c.Top           = vBase;

                tabBattle.Controls.Add(c);
                cboAction[i] = c;

                vBase += 27;
            }

            // Load enemy data
            EnemyData.Init();

            loading = true;
            for (int i = 0; i < EnemyData.Entries; i++)
            {
                cboEnemy.Items.Add("[" + i.ToString("X2") + "] " + enemyNames[i]);
            }
            loading = false;
            cboEnemy.SelectedIndex = 0;
        }
예제 #4
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            int      index = cboItem.SelectedIndex;
            ItemData id    = ItemData.Items[index];

            loading = true;

            TextItemNames.SetName(index, txtName.Text);
            string newName = TextItemNames.GetName(index);

            itemNames[index]     = newName;
            cboItem.Items[index] = "";
            cboItem.Items[index] = "[" + index.ToString("X2") + "] " + newName;

            loading = false;

            // Sell
            try
            {
                id.Sell = ushort.Parse(txtSell.Text);
            }
            catch
            {
                HighlightControl(txtSell);
                return;
            }

            // HP
            try
            {
                id.Hp = int.Parse(txtHp.Text);
            }
            catch
            {
                HighlightControl(txtHp);
                return;
            }

            // PP
            try
            {
                id.Pp = short.Parse(txtPp.Text);
            }
            catch
            {
                HighlightControl(txtPp);
                return;
            }

            // Offense
            try
            {
                id.Off = sbyte.Parse(txtOff.Text);
            }
            catch
            {
                HighlightControl(txtOff);
                return;
            }

            // Defense
            try
            {
                id.Def = sbyte.Parse(txtDef.Text);
            }
            catch
            {
                HighlightControl(txtDef);
                return;
            }

            // IQ
            try
            {
                id.Iq = sbyte.Parse(txtIq.Text);
            }
            catch
            {
                HighlightControl(txtIq);
                return;
            }

            // Speed
            try
            {
                id.Speed = sbyte.Parse(txtSpeed.Text);
            }
            catch
            {
                HighlightControl(txtSpeed);
                return;
            }

            // HP1
            try
            {
                id.Hp1 = ushort.Parse(txtHp1.Text);
            }
            catch
            {
                HighlightControl(txtHp1);
                return;
            }

            // HP2
            try
            {
                id.Hp2 = ushort.Parse(txtHp2.Text);
            }
            catch
            {
                HighlightControl(txtHp2);
                return;
            }

            // Item type
            id.ItemType = (byte)cboItemType.SelectedIndex;

            // Key item
            id.KeyItem = chkKeyItem.Checked;

            // Equip
            id.EquipOwner = 0;
            for (int i = 0; i < 8; i++)
            {
                if (chkEquip[i].Checked)
                {
                    id.EquipOwner |= (byte)(1 << i);
                }
            }

            // Ailment protection
            for (int i = 0; i < 11; i++)
            {
                try
                {
                    id.ProtectionAilment[i] = short.Parse(txtAilment[i].Text);
                }
                catch
                {
                    HighlightControl(txtAilment[i]);
                    return;
                }
            }

            // PSI protection
            for (int i = 0; i < 5; i++)
            {
                try
                {
                    id.ProtectionPsi[i] = sbyte.Parse(txtPsi[i].Text);
                }
                catch
                {
                    HighlightControl(txtPsi[i]);
                    return;
                }
            }

            // Save changes
            id.Save();

            // Refresh
            cboItem_SelectedIndexChanged(null, null);
        }