Beispiel #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Player == null)
            {
                return;
            }
            if (m_ShipHotbarGumpObject == null)
            {
                return;
            }

            BaseShip m_Ship = m_Player.ShipOccupied;

            if (m_Ship != null)
            {
                if (m_Ship.Deleted)
                {
                    m_Ship = null;
                }
            }

            bool closeGump = true;

            int currentMovementMode;
            int movementModeCount = Enum.GetNames(typeof(MovementMode)).Length;

            int currentShipAction;
            int shipActionCount = Enum.GetNames(typeof(ShipAction)).Length;

            switch (info.ButtonID)
            {
                #region Directions

            //Forward
            case 1:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveForward(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveForward(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Forward Right
            case 2:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveForwardRight(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveForwardRight(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Right
            case 3:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveRight(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveRight(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Backwards Right
            case 4:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveBackwardRight(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveBackwardRight(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Backward
            case 5:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveBackward(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveBackward(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Backwards Left
            case 6:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveBackwardLeft(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveBackwardLeft(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Left
            case 7:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveLeft(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveLeft(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Forward Left
            case 8:
                if (m_Ship != null)
                {
                    if (m_ShipHotbarGumpObject.m_MovementMode == MovementMode.Full)
                    {
                        BaseShip.StartMoveForwardLeft(m_Player);
                    }

                    else
                    {
                        BaseShip.OneMoveForwardLeft(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Turn Left
            case 9:
                if (m_Ship != null)
                {
                    BaseShip.StartTurnLeft(m_Player);
                }

                closeGump = false;
                break;

            //Stop
            case 10:
                if (m_Ship != null)
                {
                    BaseShip.Stop(m_Player);
                }

                closeGump = false;
                break;

            //Turn Right
            case 11:
                if (m_Ship != null)
                {
                    BaseShip.StartTurnRight(m_Player);
                }

                closeGump = false;
                break;

                #endregion

            //Previous Movement Mode
            case 12:
                currentMovementMode = (int)m_ShipHotbarGumpObject.m_MovementMode;
                currentMovementMode--;

                if (currentMovementMode < 0)
                {
                    currentMovementMode = movementModeCount - 1;
                }

                m_ShipHotbarGumpObject.m_MovementMode = (MovementMode)currentMovementMode;

                closeGump = false;
                break;

            //Next Movement Mode
            case 13:
                currentMovementMode = (int)m_ShipHotbarGumpObject.m_MovementMode;
                currentMovementMode++;

                if (currentMovementMode > movementModeCount - 1)
                {
                    currentMovementMode = 0;
                }

                m_ShipHotbarGumpObject.m_MovementMode = (MovementMode)currentMovementMode;

                closeGump = false;
                break;

            //Previous Ship Action
            case 14:
                currentShipAction = (int)m_ShipHotbarGumpObject.m_ShipAction;
                currentShipAction--;

                if (currentShipAction < 0)
                {
                    currentShipAction = shipActionCount - 1;
                }

                m_ShipHotbarGumpObject.m_ShipAction = (ShipAction)currentShipAction;

                closeGump = false;
                break;

            //Next Ship Action
            case 15:
                currentShipAction = (int)m_ShipHotbarGumpObject.m_ShipAction;
                currentShipAction++;

                if (currentShipAction > shipActionCount - 1)
                {
                    currentShipAction = 0;
                }

                m_ShipHotbarGumpObject.m_ShipAction = (ShipAction)currentShipAction;

                closeGump = false;
                break;

            //Activate Ship Action
            case 16:
                switch (m_ShipHotbarGumpObject.m_ShipAction)
                {
                case ShipAction.RaiseAnchor:
                    if (m_Ship != null)
                    {
                        BaseShip.RaiseAnchor(m_Player);
                    }
                    break;

                case ShipAction.LowerAnchor:
                    if (m_Ship != null)
                    {
                        BaseShip.LowerAnchor(m_Player);
                    }
                    break;

                case ShipAction.Embark:
                    BaseShip.TargetedEmbark(m_Player);
                    break;

                case ShipAction.EmbarkFollowers:
                    BaseShip.TargetedEmbarkFollowers(m_Player);
                    break;

                case ShipAction.Disembark:
                    if (m_Ship != null)
                    {
                        m_Ship.Disembark(m_Player);
                    }
                    break;

                case ShipAction.DisembarkFollowers:
                    if (m_Ship != null)
                    {
                        m_Ship.DisembarkFollowers(m_Player);
                    }
                    break;

                case ShipAction.Dock:
                    if (m_Ship != null)
                    {
                        m_Ship.DryDockCommand(m_Player);
                    }
                    break;

                case ShipAction.ClearDeck:
                    if (m_Ship != null)
                    {
                        m_Ship.ClearTheDeckCommand(m_Player);
                    }
                    break;

                case ShipAction.AddFriend:
                    if (m_Ship != null)
                    {
                        m_Ship.AddFriendCommand(m_Player);
                    }
                    break;

                case ShipAction.AddCoOwner:
                    if (m_Ship != null)
                    {
                        m_Ship.AddCoOwnerCommand(m_Player);
                    }
                    break;

                case ShipAction.ThrowTargetOverboard:
                    if (m_Ship != null)
                    {
                        m_Ship.ThrowOverboardCommand(m_Player);
                    }
                    break;
                }

                closeGump = false;
                break;

            //Fire Left Cannons
            case 17:
                if (m_Ship != null)
                {
                    if (m_Ship.IsCoOwner(m_Player) || m_Ship.IsOwner(m_Player))
                    {
                        BaseShip.FireCannons(m_Player, true);
                    }
                }

                closeGump = false;
                break;

            //Fire Right Cannons
            case 18:
                if (m_Ship != null)
                {
                    if (m_Ship.IsCoOwner(m_Player) || m_Ship.IsOwner(m_Player))
                    {
                        BaseShip.FireCannons(m_Player, false);
                    }
                }

                closeGump = false;
                break;

            //Targeting Mode: Previous
            case 19:
                if (m_Ship != null)
                {
                    if (m_Ship.IsCoOwner(m_Player) || m_Ship.IsOwner(m_Player))
                    {
                        switch (m_Ship.m_TargetingMode)
                        {
                        case TargetingMode.Random: m_Ship.SetTargetingMode(TargetingMode.Guns); break;

                        case TargetingMode.Hull: m_Ship.SetTargetingMode(TargetingMode.Random); break;

                        case TargetingMode.Sails: m_Ship.SetTargetingMode(TargetingMode.Hull); break;

                        case TargetingMode.Guns: m_Ship.SetTargetingMode(TargetingMode.Sails); break;
                        }
                    }
                }

                closeGump = false;
                break;

            //Targeting Mode: Next
            case 20:
                if (m_Ship != null)
                {
                    if (m_Ship.IsCoOwner(m_Player) || m_Ship.IsOwner(m_Player))
                    {
                        switch (m_Ship.m_TargetingMode)
                        {
                        case TargetingMode.Random: m_Ship.SetTargetingMode(TargetingMode.Hull); break;

                        case TargetingMode.Hull: m_Ship.SetTargetingMode(TargetingMode.Sails); break;

                        case TargetingMode.Sails: m_Ship.SetTargetingMode(TargetingMode.Guns); break;

                        case TargetingMode.Guns: m_Ship.SetTargetingMode(TargetingMode.Random); break;
                        }
                    }
                }

                closeGump = false;
                break;

            //Minor Ability Activate
            case 21:
                if (m_Ship != null)
                {
                    m_Ship.ActivateMinorAbility(m_Player);
                }

                closeGump = false;
                break;

            //Major Ability Activate
            case 22:
                if (m_Ship != null)
                {
                    m_Ship.ActivateMajorAbility(m_Player);
                }

                closeGump = false;
                break;

            //Epic Ability Activate
            case 23:
                if (m_Ship != null)
                {
                    m_Ship.ActivateEpicAbility(m_Player);
                }

                closeGump = false;
                break;

            //Collapse + Expand
            case 24:
                m_ShipHotbarGumpObject.m_CollapseMode = !m_ShipHotbarGumpObject.m_CollapseMode;

                closeGump = false;
                break;

            //Display Mode: Next
            case 26:
                switch (m_ShipHotbarGumpObject.m_DisplayMode)
                {
                case DisplayModeType.Stats: m_ShipHotbarGumpObject.m_DisplayMode = DisplayModeType.StatsAbilities; break;

                case DisplayModeType.StatsAbilities: m_ShipHotbarGumpObject.m_DisplayMode = DisplayModeType.StatsAbilitiesNavigator; break;

                case DisplayModeType.StatsAbilitiesNavigator: m_ShipHotbarGumpObject.m_DisplayMode = DisplayModeType.StatsNavigator; break;

                case DisplayModeType.StatsNavigator: m_ShipHotbarGumpObject.m_DisplayMode = DisplayModeType.Navigator; break;

                case DisplayModeType.Navigator: m_ShipHotbarGumpObject.m_DisplayMode = DisplayModeType.Stats; break;
                }

                closeGump = false;
                break;

            //Ship Gump
            case 27:
                BaseShip.ShipSelection(m_Player);

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(ShipHotbarGump));
                m_Player.SendGump(new ShipHotbarGump(m_Player, m_ShipHotbarGumpObject));
            }
        }