コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            mEditorItem.Spells.Add(SpellBase.IdFromList(cmbSpell.SelectedIndex));
            var n = lstSpells.SelectedIndex;

            lstSpells.Items.Clear();
            for (var i = 0; i < mEditorItem.Spells.Count; i++)
            {
                lstSpells.Items.Add(SpellBase.GetName(mEditorItem.Spells[i]));
            }

            lstSpells.SelectedIndex = n;
        }
コード例 #2
0
        private static string GetCommandText(ChangeSpellsCommand command, MapInstance map)
        {
            if (command.Add)
            {
                return(Strings.EventCommandList.changespells.ToString(
                           Strings.EventCommandList.teach.ToString(SpellBase.GetName(command.SpellId))
                           ));
            }

            return(Strings.EventCommandList.changespells.ToString(
                       Strings.EventCommandList.forget.ToString(SpellBase.GetName(command.SpellId))
                       ));
        }
コード例 #3
0
        private void cmbSpell_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstSpells.SelectedIndex > -1 && lstSpells.SelectedIndex < mEditorItem.Spells.Count)
            {
                mEditorItem.Spells[lstSpells.SelectedIndex] = SpellBase.IdFromList(cmbSpell.SelectedIndex);
            }

            var n = lstSpells.SelectedIndex;

            lstSpells.Items.Clear();
            for (var i = 0; i < mEditorItem.Spells.Count; i++)
            {
                lstSpells.Items.Add(SpellBase.GetName(mEditorItem.Spells[i]));
            }

            lstSpells.SelectedIndex = n;
        }
コード例 #4
0
        private void UpdateEditor()
        {
            if (mEditorItem != null)
            {
                pnlContainer.Show();

                txtName.Text            = mEditorItem.Name;
                cmbFolder.Text          = mEditorItem.Folder;
                cmbSprite.SelectedIndex = cmbSprite.FindString(TextUtils.NullToNone(mEditorItem.Sprite));
                nudLevel.Value          = mEditorItem.Level;
                nudSpawnDuration.Value  = mEditorItem.SpawnDuration;

                //Behavior
                chkAggressive.Checked = mEditorItem.Aggressive;
                if (mEditorItem.Aggressive)
                {
                    btnAttackOnSightCond.Text = Strings.NpcEditor.dontattackonsightconditions;
                }
                else
                {
                    btnAttackOnSightCond.Text = Strings.NpcEditor.attackonsightconditions;
                }

                nudSightRange.Value          = mEditorItem.SightRange;
                cmbMovement.SelectedIndex    = Math.Min(mEditorItem.Movement, cmbMovement.Items.Count - 1);
                chkSwarm.Checked             = mEditorItem.Swarm;
                nudFlee.Value                = mEditorItem.FleeHealthPercentage;
                chkFocusDamageDealer.Checked = mEditorItem.FocusHighestDamageDealer;

                //Common Events
                cmbOnDeathEventKiller.SelectedIndex = EventBase.ListIndex(mEditorItem.OnDeathEventId) + 1;
                cmbOnDeathEventParty.SelectedIndex  = EventBase.ListIndex(mEditorItem.OnDeathPartyEventId) + 1;

                nudStr.Value            = mEditorItem.Stats[(int)Stats.Attack];
                nudMag.Value            = mEditorItem.Stats[(int)Stats.AbilityPower];
                nudDef.Value            = mEditorItem.Stats[(int)Stats.Defense];
                nudMR.Value             = mEditorItem.Stats[(int)Stats.MagicResist];
                nudSpd.Value            = mEditorItem.Stats[(int)Stats.Speed];
                nudHp.Value             = mEditorItem.MaxVital[(int)Vitals.Health];
                nudMana.Value           = mEditorItem.MaxVital[(int)Vitals.Mana];
                nudExp.Value            = mEditorItem.Experience;
                chkAttackAllies.Checked = mEditorItem.AttackAllies;
                chkEnabled.Checked      = mEditorItem.NpcVsNpcEnabled;

                //Combat
                nudDamage.Value                      = mEditorItem.Damage;
                nudCritChance.Value                  = mEditorItem.CritChance;
                nudCritMultiplier.Value              = (decimal)mEditorItem.CritMultiplier;
                nudScaling.Value                     = mEditorItem.Scaling;
                cmbDamageType.SelectedIndex          = mEditorItem.DamageType;
                cmbScalingStat.SelectedIndex         = mEditorItem.ScalingStat;
                cmbAttackAnimation.SelectedIndex     = AnimationBase.ListIndex(mEditorItem.AttackAnimationId) + 1;
                cmbAttackSpeedModifier.SelectedIndex = mEditorItem.AttackSpeedModifier;
                nudAttackSpeedValue.Value            = mEditorItem.AttackSpeedValue;

                //Regen
                nudHpRegen.Value = mEditorItem.VitalRegen[(int)Vitals.Health];
                nudMpRegen.Value = mEditorItem.VitalRegen[(int)Vitals.Mana];

                // Add the spells to the list
                lstSpells.Items.Clear();
                for (var i = 0; i < mEditorItem.Spells.Count; i++)
                {
                    if (mEditorItem.Spells[i] != Guid.Empty)
                    {
                        lstSpells.Items.Add(SpellBase.GetName(mEditorItem.Spells[i]));
                    }
                    else
                    {
                        lstSpells.Items.Add(Strings.General.none);
                    }
                }

                if (lstSpells.Items.Count > 0)
                {
                    lstSpells.SelectedIndex = 0;
                    cmbSpell.SelectedIndex  = SpellBase.ListIndex(mEditorItem.Spells[lstSpells.SelectedIndex]);
                }

                cmbFreq.SelectedIndex = mEditorItem.SpellFrequency;

                // Add the aggro NPC's to the list
                lstAggro.Items.Clear();
                for (var i = 0; i < mEditorItem.AggroList.Count; i++)
                {
                    if (mEditorItem.AggroList[i] != Guid.Empty)
                    {
                        lstAggro.Items.Add(NpcBase.GetName(mEditorItem.AggroList[i]));
                    }
                    else
                    {
                        lstAggro.Items.Add(Strings.General.none);
                    }
                }

                UpdateDropValues();

                DrawNpcSprite();
                if (mChanged.IndexOf(mEditorItem) == -1)
                {
                    mChanged.Add(mEditorItem);
                    mEditorItem.MakeBackup();
                }
            }
            else
            {
                pnlContainer.Hide();
            }

            UpdateToolStripItems();
        }