private void lstSpells_SelectedIndexChanged(object sender, EventArgs e) { if (lstSpells.SelectedIndex > -1) { cmbSpell.SelectedIndex = SpellBase.ListIndex(mEditorItem.Spells[lstSpells.SelectedIndex]); } }
public EventCommandChangeSpells(ChangeSpellsCommand refCommand, EventPage refPage, FrmEvent editor) { InitializeComponent(); mMyCommand = refCommand; mEventEditor = editor; mCurrentPage = refPage; InitLocalization(); cmbSpell.Items.Clear(); cmbSpell.Items.AddRange(SpellBase.Names); cmbAction.SelectedIndex = refCommand.Add ? 0 : 1; cmbSpell.SelectedIndex = SpellBase.ListIndex(mMyCommand.SpellId); }
private void UpdateEditor() { if (mEditorItem != null) { pnlContainer.Show(); txtName.Text = mEditorItem.Name; cmbFolder.Text = mEditorItem.Folder; nudSpeed.Value = mEditorItem.Speed; nudSpawn.Value = mEditorItem.Delay; nudAmount.Value = mEditorItem.Quantity; nudRange.Value = mEditorItem.Range; cmbSpell.SelectedIndex = SpellBase.ListIndex(mEditorItem.SpellId) + 1; nudKnockback.Value = mEditorItem.Knockback; chkIgnoreMapBlocks.Checked = mEditorItem.IgnoreMapBlocks; chkIgnoreActiveResources.Checked = mEditorItem.IgnoreActiveResources; chkIgnoreInactiveResources.Checked = mEditorItem.IgnoreExhaustedResources; chkIgnoreZDimensionBlocks.Checked = mEditorItem.IgnoreZDimension; chkGrapple.Checked = mEditorItem.GrappleHook; chkPierce.Checked = mEditorItem.PierceTarget; cmbItem.SelectedIndex = ItemBase.ListIndex(mEditorItem.AmmoItemId) + 1; nudConsume.Value = mEditorItem.AmmoRequired; if (lstAnimations.SelectedIndex < 0) { lstAnimations.SelectedIndex = 0; } UpdateAnimationData(0); lstAnimations.SelectedIndex = 0; Render(); if (mChanged.IndexOf(mEditorItem) == -1) { mChanged.Add(mEditorItem); mEditorItem.MakeBackup(); } } else { pnlContainer.Hide(); } UpdateToolStripItems(); }
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(); }
private void SetupFormValues(KnowsSpellCondition condition) { cmbSpell.SelectedIndex = SpellBase.ListIndex(condition.SpellId); }
private void RefreshExtendedData() { grpConsumable.Visible = false; grpSpell.Visible = false; grpEquipment.Visible = false; grpEvent.Visible = false; grpBags.Visible = false; if ((int)mEditorItem.ItemType != cmbType.SelectedIndex) { mEditorItem.Consumable.Type = ConsumableType.Health; mEditorItem.Consumable.Value = 0; mEditorItem.TwoHanded = false; mEditorItem.EquipmentSlot = 0; mEditorItem.Effect.Type = EffectType.None; mEditorItem.Effect.Percentage = 0; mEditorItem.SlotCount = 0; mEditorItem.Damage = 0; mEditorItem.Tool = -1; mEditorItem.Spell = null; mEditorItem.Event = null; } if (cmbType.SelectedIndex == (int)ItemTypes.Consumable) { cmbConsume.SelectedIndex = (int)mEditorItem.Consumable.Type; nudInterval.Value = mEditorItem.Consumable.Value; nudIntervalPercentage.Value = mEditorItem.Consumable.Percentage; grpConsumable.Visible = true; } else if (cmbType.SelectedIndex == (int)ItemTypes.Spell) { cmbTeachSpell.SelectedIndex = SpellBase.ListIndex(mEditorItem.SpellId) + 1; chkQuickCast.Checked = mEditorItem.QuickCast; chkDestroy.Checked = mEditorItem.DestroySpell; grpSpell.Visible = true; } else if (cmbType.SelectedIndex == (int)ItemTypes.Event) { cmbEvent.SelectedIndex = EventBase.ListIndex(mEditorItem.EventId) + 1; grpEvent.Visible = true; } else if (cmbType.SelectedIndex == (int)ItemTypes.Equipment) { grpEquipment.Visible = true; if (mEditorItem.EquipmentSlot < -1 || mEditorItem.EquipmentSlot >= cmbEquipmentSlot.Items.Count) { mEditorItem.EquipmentSlot = 0; } cmbEquipmentSlot.SelectedIndex = mEditorItem.EquipmentSlot; cmbEquipmentBonus.SelectedIndex = (int)mEditorItem.Effect.Type; } else if (cmbType.SelectedIndex == (int)ItemTypes.Bag) { // Cant have no space or negative space. mEditorItem.SlotCount = Math.Max(1, mEditorItem.SlotCount); grpBags.Visible = true; nudBag.Value = mEditorItem.SlotCount; } mEditorItem.ItemType = (ItemTypes)cmbType.SelectedIndex; }