private void cmbAnimation_SelectedIndexChanged(object sender, EventArgs e)
        {
            mEditorItem.Animations[lstAnimations.SelectedIndex].AnimationId =
                AnimationBase.IdFromList(cmbAnimation.SelectedIndex - 1);

            UpdateAnimations();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            mMyCommand.AnimationId = AnimationBase.IdFromList(cmbAnimation.SelectedIndex);
            switch (cmbConditionType.SelectedIndex)
            {
            case 0:     //Tile Spawn
                mMyCommand.EntityId = Guid.Empty;
                mMyCommand.MapId    = MapList.OrderedMaps[cmbMap.SelectedIndex].MapId;
                mMyCommand.X        = (sbyte)nudWarpX.Value;
                mMyCommand.Y        = (sbyte)nudWarpY.Value;
                mMyCommand.Dir      = (byte)cmbDirection.SelectedIndex;

                break;

            case 1:     //On/Around Entity Spawn
                mMyCommand.MapId = Guid.Empty;
                if (cmbEntities.SelectedIndex == 0 || cmbEntities.SelectedIndex == -1)
                {
                    mMyCommand.EntityId = Guid.Empty;
                }
                else
                {
                    mMyCommand.EntityId = mCurrentMap.LocalEvents.Keys.ToList()[cmbEntities.SelectedIndex - 1];
                }

                mMyCommand.X = (sbyte)mSpawnX;
                mMyCommand.Y = (sbyte)mSpawnY;
                if (chkRelativeLocation.Checked && chkRotateDirection.Checked)
                {
                    mMyCommand.Dir = 3;

                    //0 does not adhere to direction, 1 is Spawning Relative to Direction, 2 is Rotating Relative to Direction, and 3 is both.
                }
                else if (chkRelativeLocation.Checked)
                {
                    mMyCommand.Dir = 1;

                    //0 does not adhere to direction, 1 is Spawning Relative to Direction, 2 is Rotating Relative to Direction, and 3 is both.
                }
                else if (chkRotateDirection.Checked)
                {
                    mMyCommand.Dir = 2;

                    //0 does not adhere to direction, 1 is Spawning Relative to Direction, 2 is Rotating Relative to Direction, and 3 is both.
                }
                else
                {
                    mMyCommand.Dir = 0;

                    //0 does not adhere to direction, 1 is Spawning Relative to Direction, 2 is Rotating Relative to Direction, and 3 is both.
                }

                break;
            }

            mEventEditor.FinishCommandEdit();
        }
Esempio n. 3
0
        public void PlaceAttribute(MapBase tmpMap, int x, int y)
        {
            if (rbBlocked.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Blocked);
            }
            else if (rbItem.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Item);
                ((MapItemAttribute)tmpMap.Attributes[x, y]).ItemId =
                    ItemBase.IdFromList(cmbItemAttribute.SelectedIndex);

                ((MapItemAttribute)tmpMap.Attributes[x, y]).Quantity = (int)nudItemQuantity.Value;
            }
            else if (rbZDimension.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.ZDimension);
                ((MapZDimensionAttribute)tmpMap.Attributes[x, y]).GatewayTo    = GetEditorDimensionGateway();
                ((MapZDimensionAttribute)tmpMap.Attributes[x, y]).BlockedLevel = GetEditorDimensionBlock();
            }
            else if (rbNPCAvoid.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.NpcAvoid);
            }
            else if (rbWarp.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Warp);
                ((MapWarpAttribute)tmpMap.Attributes[x, y]).MapId =
                    MapList.OrderedMaps[cmbWarpMap.SelectedIndex].MapId;

                ((MapWarpAttribute)tmpMap.Attributes[x, y]).X         = (byte)nudWarpX.Value;
                ((MapWarpAttribute)tmpMap.Attributes[x, y]).Y         = (byte)nudWarpY.Value;
                ((MapWarpAttribute)tmpMap.Attributes[x, y]).Direction = (WarpDirection)cmbDirection.SelectedIndex;
            }
            else if (rbSound.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Sound);
                ((MapSoundAttribute)tmpMap.Attributes[x, y]).Distance = (byte)nudSoundDistance.Value;
                ((MapSoundAttribute)tmpMap.Attributes[x, y]).File     = TextUtils.SanitizeNone(cmbMapAttributeSound.Text);
            }
            else if (rbResource.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Resource);
                ((MapResourceAttribute)tmpMap.Attributes[x, y]).ResourceId =
                    ResourceBase.IdFromList(cmbResourceAttribute.SelectedIndex);

                if (rbLevel1.Checked)
                {
                    ((MapResourceAttribute)tmpMap.Attributes[x, y]).SpawnLevel = 0;
                }
                else
                {
                    ((MapResourceAttribute)tmpMap.Attributes[x, y]).SpawnLevel = 1;
                }
            }
            else if (rbAnimation.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Animation);
                ((MapAnimationAttribute)tmpMap.Attributes[x, y]).AnimationId =
                    AnimationBase.IdFromList(cmbAnimationAttribute.SelectedIndex);
            }
            else if (rbGrappleStone.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.GrappleStone);
            }
            else if (rbSlide.Checked)
            {
                tmpMap.Attributes[x, y] = MapAttribute.CreateAttribute(MapAttributes.Slide);
                ((MapSlideAttribute)tmpMap.Attributes[x, y]).Direction = (byte)cmbSlideDir.SelectedIndex;
            }
        }
 private void btnOkay_Click(object sender, EventArgs e)
 {
     mMyAction.AnimationId = AnimationBase.IdFromList(cmbAnimation.SelectedIndex - 1);
     mRouteDesigner.Controls.Remove(this);
 }
Esempio n. 5
0
 private void cmbAttackAnimation_SelectedIndexChanged(object sender, EventArgs e)
 {
     mEditorItem.AttackAnimation =
         AnimationBase.Get(AnimationBase.IdFromList(cmbAttackAnimation.SelectedIndex - 1));
 }
        public MapAttribute CreateAttribute()
        {
            var attributeType = SelectedMapAttributeType;
            var attribute     = MapAttribute.CreateAttribute(attributeType);

            switch (SelectedMapAttributeType)
            {
            case MapAttributes.Walkable:
            case MapAttributes.Blocked:
            case MapAttributes.GrappleStone:
            case MapAttributes.NpcAvoid:
                break;

            case MapAttributes.Item:
                var itemAttribute = attribute as MapItemAttribute;
                itemAttribute.ItemId   = ItemBase.IdFromList(cmbItemAttribute.SelectedIndex);
                itemAttribute.Quantity = (int)nudItemQuantity.Value;
                break;

            case MapAttributes.ZDimension:
                var zDimensionAttribute = attribute as MapZDimensionAttribute;
                zDimensionAttribute.GatewayTo    = GetEditorDimensionGateway();
                zDimensionAttribute.BlockedLevel = GetEditorDimensionBlock();
                break;

            case MapAttributes.Warp:
                var warpAttribute = attribute as MapWarpAttribute;
                warpAttribute.MapId     = MapList.OrderedMaps[cmbWarpMap.SelectedIndex].MapId;
                warpAttribute.X         = (byte)nudWarpX.Value;
                warpAttribute.Y         = (byte)nudWarpY.Value;
                warpAttribute.Direction = (WarpDirection)cmbDirection.SelectedIndex;
                break;

            case MapAttributes.Sound:
                var soundAttribute = attribute as MapSoundAttribute;
                soundAttribute.Distance     = (byte)nudSoundDistance.Value;
                soundAttribute.File         = TextUtils.SanitizeNone(cmbMapAttributeSound.Text);
                soundAttribute.LoopInterval = (int)nudSoundLoopInterval.Value;
                break;

            case MapAttributes.Resource:
                var resourceAttribute = attribute as MapResourceAttribute;
                resourceAttribute.ResourceId = ResourceBase.IdFromList(cmbResourceAttribute.SelectedIndex);
                resourceAttribute.SpawnLevel = (byte)(rbLevel1.Checked ? 0 : 1);
                break;

            case MapAttributes.Animation:
                var animationAttribute = attribute as MapAnimationAttribute;
                animationAttribute.AnimationId = AnimationBase.IdFromList(cmbAnimationAttribute.SelectedIndex);
                break;

            case MapAttributes.Slide:
                var slideAttribute = attribute as MapSlideAttribute;
                slideAttribute.Direction = (byte)cmbSlideDir.SelectedIndex;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(SelectedMapAttributeType), @"The currently selected attribute type has not been fully implemented.");
            }

            return(attribute);
        }