Exemplo n.º 1
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            int BotId = Packet.PopInt();

            if (BotId == 0)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser BotUser = null;

            if (!Room.GetRoomUserManager().TryGetBot(BotId, out BotUser))
            {
                return;
            }

            if (Session.GetHabbo().Id != BotUser.BotData.ownerID && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override"))
            {
                Session.SendWhisper("Você só pode pegar seus próprios bots!");
                return;
            }

            if (BotUser.GetBotRoleplay() == null)
            {
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", BotId);
                    dbClient.RunQuery();
                }

                Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y));

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
            }
            else
            {
                Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y));

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                RoleplayBotManager.EjectDeployedBot(BotUser, Room, true);
            }
        }
Exemplo n.º 2
0
        public bool AbortHandler(params object [] Params)
        {
            Room Room = this.InteractingBot.DRoom;

            RoleplayBotManager.EjectDeployedBot(this.InteractingBot.DRoomUser, Room);
            this.InteractingBot.Invisible = true;
            this.Active = false;

            return(true);
        }
Exemplo n.º 3
0
        private void ClearMafiaBots()
        {
            lock (this.MafiaBots)
            {
                if (this.MafiaBots.Count > 0)
                {
                    foreach (RoomUser User in this.MafiaBots.Values)
                    {
                        if (User == null)
                        {
                            continue;
                        }

                        RoleplayBotManager.EjectDeployedBot(User, User.GetRoom(), false);
                    }

                    this.MafiaBots.Clear();
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Stops the delivery bot
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.CachedBot == null || base.CachedBot.DRoomUser == null || base.CachedBot.DRoom == null)
                {
                    base.EndTimer();
                    return;
                }

                Item Item = (Item)Params[0];

                if (Item != null)
                {
                    var Point = new Point(Item.GetX, Item.GetY);
                    if (base.CachedBot.DRoomUser.Coordinate != Point)
                    {
                        return;
                    }

                    Item.ExtraData = "2";
                    Item.UpdateState(false, true);
                    Item.RequestUpdate(2, true);
                }


                RoleplayBotManager.EjectDeployedBot(base.CachedBot.DRoomUser, base.CachedBot.DRoom);
                base.CachedBot.Invisible = true;

                base.EndTimer();
            }
            catch
            {
                base.EndTimer();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Disposes of the roleplay bots instance
        /// </summary>
        public void Dispose()
        {
            if (DRoomUser != null)
            {
                if (DRoomUser.GetBotRoleplayAI() != null)
                {
                    DRoomUser.GetBotRoleplayAI().StopActivities();
                }

                RoleplayBotManager.EjectDeployedBot(this.DRoomUser, this.DRoom, false);
            }

            Id                 = 0;
            Name               = null;
            Figure             = null;
            Gender             = null;
            Motto              = null;
            VirtualId          = 0;
            MaxHealth          = 0;
            CurHealth          = 0;
            Strength           = 0;
            Level              = 0;
            SpawnId            = 0;
            OriginalId         = 0;
            Deployed           = false;
            Dead               = false;
            Jailed             = false;
            X                  = 0;
            Y                  = 0;
            oX                 = 0;
            oY                 = 0;
            Z                  = 0;
            oZ                 = 0;
            SpawnRot           = 0;
            RoomBotInstance    = null;
            HabboInstance      = null;
            Responses          = null;
            UserFollowing      = null;
            UserAttacking      = null;
            Attacking          = false;
            Roaming            = false;
            Following          = false;
            RoamBot            = false;
            RoamCityBot        = false;
            AddableBot         = false;
            Invisible          = false;
            TeleporterEntering = null;
            TeleporterExiting  = null;
            LastTeleport       = null;
            Teleporting        = false;
            Teleported         = false;
            FollowCooldown     = 0;
            AttackCooldown     = 0;
            RoamCooldown       = 0;
            LookCooldown       = 0;

            RoamInterval   = 0;
            AttackInterval = 0;
            FollowInterval = 0;

            RoomStayInterval = 0;
            RoomStayTime     = 0;
            AIType           = 0;

            TimerManager.EndAllTimers();
            TimerManager = null;

            CooldownManager.EndAllCooldowns();
            CooldownManager = null;

            this.RoomBotInstance.Dispose();
        }