Пример #1
0
        public virtual void OnTimerTick()
        {
            if (IsNull())
            {
                return;
            }

            #region Teleporting
            if (this.GetBotRoleplay().Teleporting)
            {
                if (this.GetBotRoleplay().ActiveHandlers.ContainsKey(Handlers.TELEPORT))
                {
                    IBotHandler Teleport = this.GetBotRoleplay().ActiveHandlers[Handlers.TELEPORT];
                    if (Teleport.Active)
                    {
                        Teleport.ExecuteHandler();
                        return;
                    }
                }
                else
                {
                    this.GetBotRoleplay().Teleporting = false;
                }

                return;
            }
            #endregion

            #region Roaming
            if (this.GetBotRoleplay().RoamBot)
            {
                this.GetBotRoleplay().HandleRoaming();
            }
            #endregion
        }
Пример #2
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);
        }
Пример #3
0
        public bool TryGetHandler(Handlers Handler, out IBotHandler HandlerOut)
        {
            HandlerOut = null;

            if (this.ActiveHandlers == null)
            {
                return(false);
            }
            if (!this.ActiveHandlers.ContainsKey(Handler))
            {
                return(false);
            }

            HandlerOut = this.ActiveHandlers[Handler];

            return(true);
        }
Пример #4
0
        private bool ReturnAttackHandler(out IBotHandler AttackInstance)
        {
            AttackInstance = null;
            if (this.GetBotRoleplay() == null)
            {
                return(false);
            }
            if (this.GetBotRoleplay().ActiveHandlers == null)
            {
                return(false);
            }
            if (!this.GetBotRoleplay().ActiveHandlers.ContainsKey(Handlers.ATTACK))
            {
                return(false);
            }

            AttackInstance = this.GetBotData().ActiveHandlers[Handlers.ATTACK];

            return(true);
        }
Пример #5
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length < 3)
            {
                Session.SendWhisper("Comando inválido! Use :botacao <bot> <ação>");
                return;
            }

            string BotName   = Convert.ToString(Params[1]);
            string BotAction = Convert.ToString(Params[2]);

            RoomUser Bot = Room.GetRoomUserManager().GetBotByName(BotName);

            if (Bot == null)
            {
                Session.SendWhisper("Este bot é nulo", 1);
                return;
            }

            IBotHandler Handler = null;

            switch (BotAction.ToLower())
            {
            case "teleport":
            case "teleportar":
                object[] Parameters = { Bot.GetBotRoleplay().GetRandomTeleport() };
                Bot.GetBotRoleplay().StartHandler(Handlers.TELEPORT, out Handler, Parameters);
                break;

            default:
                Session.SendWhisper("Ação inválida!", 1);
                break;
            }

            return;
        }
Пример #6
0
 public BotUpdateController(IBotHandler botHandler, IBot bot)
 {
     this.botHandler = botHandler;
     this.bot        = bot;
 }