Exemplo n.º 1
0
        public void StartHandler(Handlers Handler, out IBotHandler HandlerOut, params object[] Params)
        {
            HandlerOut = null;

            #region Null checks
            if (this == null)
            {
                return;
            }
            if (this.DRoomUser == null)
            {
                return;
            }

            Room Room = this.DRoom;

            if (Room == null)
            {
                return;
            }
            #endregion

            if (this.ActiveHandlers.ContainsKey(Handler))
            {
                IBotHandler I;
                this.ActiveHandlers.TryRemove(Handler, out I);
            }


            switch (Handler)
            {
            case Handlers.TELEPORT:
                HandlerOut       = new TeleportHandler(this, (Item)Params[0]);
                this.Teleporting = true;
                break;

            case Handlers.ATTACK:
                HandlerOut     = new AttackHandler(this, (GameClient)Params[0]);
                this.Attacking = true;
                break;

            case Handlers.DELIVERY:
                HandlerOut = new DeliveryHandler(this);
                break;

            case Handlers.FOODSERVE:
                HandlerOut = new FoodServeHandler(this, (GameClient)Params[0], (Food.Food)Params[1], (Point)Params[2], (Point)Params[3]);
                break;

            default:

                break;
            }

            this.ActiveHandlers.TryAdd(Handler, HandlerOut);
        }
Exemplo n.º 2
0
        public override bool UseItem(Player player)
        {
            TeleportHandler.MainTeleport();

            //if (Subworld.IsActive<Ship.ShipSubworld>())
            //{
            //    Subworld.Enter(planetArray[SelectedPlanet].EntryString);
            //}
            //else
            //{
            //    Subworld.Enter<Ship.ShipSubworld>();
            //}
            return(true);
        }
Exemplo n.º 3
0
        public bool CanTeleport(UUID userID)
        {
            TeleportHandler handler = OnTeleport;

            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
                foreach (TeleportHandler h in list)
                {
                    if (h(userID, m_scene) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Check to see whether the user is actually in this region
        /// and then figure out if they can be where they want to be
        /// </summary>
        /// <param name="userID">The user who is teleporting (can be either incoming from a remote region, or a local teleport)</param>
        /// <param name="Position">The position the user has requested</param>
        /// <param name="newPosition">The position the user is going to get</param>
        /// <param name="reason">If the check fails, this will tell why</param>
        /// <returns>Whether this user can teleport into/around this region</returns>
        public bool AllowedIncomingTeleport(UUID userID, Vector3 Position, out Vector3 newPosition, out string reason)
        {
            newPosition = Position;
            reason      = "";
            TeleportHandler handler = OnAllowedIncomingTeleport;

            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
                foreach (TeleportHandler h in list)
                {
                    if (h(userID, m_scene, Position, out newPosition, out reason) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 5
0
 public void SetTeleporterHandlerRef(TeleportHandler tpHand)
 {
     teleportHandler = tpHand;
 }