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

            BaseBoat m_Boat = m_Player.BoatOccupied;

            if (m_Boat != null)
            {
                if (m_Boat.Deleted || m_Boat.m_SinkTimer != null)
                {
                    m_Boat = null;
                }
            }

            bool closeGump = true;

            int minorActionCount = 0;
            int epicActionCount  = 0;

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

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

            switch (info.ButtonID)
            {
            //Forward
            case 1:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveForward(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveForward(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Forward Right
            case 2:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveForwardRight(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveForwardRight(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Right
            case 3:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveRight(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveRight(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Backwards Right
            case 4:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveBackwardRight(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveBackwardRight(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Backward
            case 5:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveBackward(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveBackward(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Backwards Left
            case 6:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveBackwardLeft(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveBackwardLeft(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Left
            case 7:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveLeft(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveLeft(m_Player);
                    }
                }

                closeGump = false;
                break;

            //Forward Left
            case 8:
                if (m_Boat != null)
                {
                    if (m_Player.m_ShipControlSettings.m_MovementMode == MovementMode.Full)
                    {
                        BaseBoat.StartMoveForwardLeft(m_Player);
                    }

                    else
                    {
                        BaseBoat.OneMoveForwardLeft(m_Player);
                    }
                }

                closeGump = false;
                break;

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

                closeGump = false;
                break;

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

                closeGump = false;
                break;

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

                closeGump = false;
                break;

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

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

                m_Player.m_ShipControlSettings.m_MovementMode = (MovementMode)currentMovementMode;

                closeGump = false;
                break;

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

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

                m_Player.m_ShipControlSettings.m_MovementMode = (MovementMode)currentMovementMode;

                closeGump = false;
                break;

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

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

                m_Player.m_ShipControlSettings.m_ShipAction = (ShipAction)currentShipAction;

                closeGump = false;
                break;

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

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

                m_Player.m_ShipControlSettings.m_ShipAction = (ShipAction)currentShipAction;

                closeGump = false;
                break;

            //Activate Ship Action
            case 16:
                switch (m_Player.m_ShipControlSettings.m_ShipAction)
                {
                case ShipAction.RaiseAnchor:
                    if (m_Boat != null)
                    {
                        if (m_Boat.IsCoOwner(m_Player) || m_Boat.IsOwner(m_Player))
                        {
                            BaseBoat.RaiseAnchor(m_Player);
                        }
                    }
                    break;

                case ShipAction.LowerAnchor:
                    if (m_Boat != null)
                    {
                        if (m_Boat.IsCoOwner(m_Player) || m_Boat.IsOwner(m_Player))
                        {
                            BaseBoat.LowerAnchor(m_Player);
                        }
                    }
                    break;

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

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

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

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

                case ShipAction.Dock:
                    if (m_Boat != null)
                    {
                        if (m_Boat.IsOwner(m_Player))
                        {
                            m_Boat.BeginDryDock(m_Player);
                        }
                    }
                    break;

                case ShipAction.ClearDeck:
                    //TEST: Finish
                    break;

                case ShipAction.DividePlunder:
                    if (m_Boat != null)
                    {
                        if (m_Boat.IsOwner(m_Player))
                        {
                            m_Boat.BeginDivideThePlunder(m_Player);
                        }
                    }
                    break;

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

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

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

                closeGump = false;
                break;

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

                closeGump = false;
                break;

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

                closeGump = false;
                break;

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

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

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

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

                closeGump = false;
                break;

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

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

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

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

                closeGump = false;
                break;

            //Minor Ability: Previous
            case 21:
                if (m_Boat != null)
                {
                }

                closeGump = false;
                break;

            //Minor Ability: Next
            case 22:
                if (m_Boat != null)
                {
                }

                closeGump = false;
                break;

            //Minor Ability: Activate
            case 23:
                if (m_Boat != null)
                {
                }

                closeGump = false;
                break;

            //Epic Ability: Previous
            case 24:
                if (m_Boat != null)
                {
                }

                closeGump = false;
                break;

            //Epic Ability: Next
            case 25:
                if (m_Boat != null)
                {
                }

                closeGump = false;
                break;

            //Epic Ability: Activate
            case 26:
                if (m_Boat != null)
                {
                }

                closeGump = false;
                break;

            //Collapse + Expand
            case 27:
                m_Player.m_ShipControlSettings.m_CollapseMode = !m_Player.m_ShipControlSettings.m_CollapseMode;

                closeGump = false;
                break;

            //Ship Selection
            case 28:
                BaseBoat.ShipSelection(m_Player);

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(BoatHotbarGump));
                m_Player.SendGump(new BoatHotbarGump(m_Player));
            }
        }