Ejemplo n.º 1
0
        internal void OnUserWalk(RoomUser user)
        {
            if (user == null) return;

            foreach (RoomItem roomItem in _pucks.Values)
            {
                int differenceX = user.X - roomItem.X;
                int differenceY = user.Y - roomItem.Y;

                if (differenceX > 1 || differenceX < -1 || differenceY > 1 || differenceY < -1)
                    continue;
                int newX = differenceX*-1 + roomItem.X;
                int newY = differenceY*-1 + roomItem.Y;

                if (roomItem.InteractingBallUser == user.UserId && _room.GetGameMap().ValidTile(newX, newY))
                {
                    roomItem.InteractingBallUser = 0;
                    MovePuck(roomItem, user.GetClient(), user.Coordinate, roomItem.Coordinate, 6, user.Team);
                }
                else if (_room.GetGameMap().ValidTile(newX, newY))
                    MovePuck(roomItem, user.GetClient(), newX, newY, user.Team);
            }

            if (IsBanzaiActive)
                HandleBanzaiTiles(user.Coordinate, user.Team, user);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Delivers the random pinata item.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="room">The room.</param>
        /// <param name="item">The item.</param>
        internal void DeliverRandomPinataItem(RoomUser user, Room room, RoomItem item)
        {
            if (room == null || item == null || item.GetBaseItem().InteractionType != Interaction.Pinata ||
                !Pinatas.ContainsKey(item.GetBaseItem().ItemId))
                return;

            PinataItem pinataItem;
            Pinatas.TryGetValue(item.GetBaseItem().ItemId, out pinataItem);

            if (pinataItem == null || pinataItem.Rewards.Count < 1)
                return;

            item.RefreshItem();

            //@TODO :: KESSILER, now PINATA DOESNT WORK. MUST CREATE SOLUTION LATER.

            //item.BaseName = pinataItem.Rewards[new Random().Next((pinataItem.Rewards.Count - 1))];

            item.ExtraData = string.Empty;
            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id, false);

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(
                    $"UPDATE items_rooms SET item_name='{item.BaseName}', extra_data='' WHERE id='{item.Id}'");

            if (!room.GetRoomItemHandler().SetFloorItem(user.GetClient(), item, item.X, item.Y, 0, true, false, true))
                user.GetClient().GetHabbo().GetInventoryComponent().AddItem(item);
        }
Ejemplo n.º 3
0
        internal void OnUserWalk(RoomUser User)
        {
            if (User == null)
                return;
            foreach (RoomItem item in pucks.Values)
            {
                int differenceX = User.X - item.GetX;
                int differenceY = User.Y - item.GetY;

                if (differenceX <= 1 && differenceX >= -1 && differenceY <= 1 && differenceY >= -1)
                {
                    int NewX = differenceX * -1;
                    int NewY = differenceY * -1;

                    NewX = NewX + item.GetX;
                    NewY = NewY + item.GetY;

                    if (item.interactingBallUser == User.userID && room.GetGameMap().ValidTile(NewX, NewY))
                    {
                        item.interactingBallUser = 0;

                        MovePuck(item, User.GetClient(), User.Coordinate, item.Coordinate, 6, User.team);
                    }
                    else if (room.GetGameMap().ValidTile(NewX, NewY))
                    {
                        MovePuck(item, User.GetClient(), NewX, NewY, User.team);
                    }
                }
            }

            if (banzaiStarted)
            {
                HandleBanzaiTiles(User.Coordinate, User.team, User);
            }
        }
Ejemplo n.º 4
0
		internal void AddPointToTeam(Team team, int points, RoomUser user)
		{
			int num = checked(this.TeamPoints[(int)team] += points);
			if (num < 0)
			{
				num = 0;
			}
			this.TeamPoints[(int)team] = num;
			if (this.OnScoreChanged != null)
			{
				this.OnScoreChanged(null, new TeamScoreChangedArgs(num, team, user));
			}
			foreach (RoomItem current in this.GetFurniItems(team).Values)
			{
				if (!GameManager.isSoccerGoal(current.GetBaseItem().InteractionType))
				{
					current.ExtraData = this.TeamPoints[(int)team].ToString();
					current.UpdateState();
				}
			}

            room.GetWiredHandler().ExecuteWired(WiredItemType.TriggerScoreAchieved, new object[]
							{
								user
							});
		}
Ejemplo n.º 5
0
Archivo: Kick.cs Proyecto: BjkGkh/R106
     public bool WiredConditionsMet(RoomUser user, Room theRoom)
     {
         if (handler.conditionHandler != null)
             return handler.conditionHandler.AllowsHandling(item.GetX, item.GetY, user, theRoom);
 
         return true;
     }
Ejemplo n.º 6
0
 internal RoomBot(uint BotId, uint OwnerId, UInt32 RoomId, AIType AiType, string WalkingMode, string Name, string Motto, string Look,
     int X, int Y, double Z, int Rot, int minX, int minY, int maxX, int maxY, ref List<RandomSpeech> Speeches, 
     ref List<BotResponse> Responses, string Gender, int Dance)
 {
     this.OwnerId = OwnerId;
     this.BotId = BotId;
     this.RoomId = RoomId;
     this.AiType = AiType;
     this.WalkingMode = WalkingMode;
     this.Name = Name;
     this.Motto = Motto;
     this.Look = Look;
     this.X = X;
     this.Y = Y;
     this.Z = Z;
     this.Rot = Rot;
     this.minX = minX;
     this.minY = minY;
     this.maxX = maxX;
     this.maxY = maxY;
     this.Gender = Gender.ToUpper();
     this.VirtualId = -1;
     this.RoomUser = null;
     this.DanceId = Dance;
     this.RandomSpeech = Speeches;
     this.Responses = Responses;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Delivers the random pinata item.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="room">The room.</param>
        /// <param name="item">The item.</param>
        internal void DeliverRandomPinataItem(RoomUser user, Room room, RoomItem item)
        {
            if (room == null || item == null || item.GetBaseItem().InteractionType != Interaction.Pinata || !Pinatas.ContainsKey(item.GetBaseItem().ItemId))
                return;

            PinataItem pinataItem;
            Pinatas.TryGetValue(item.GetBaseItem().ItemId, out pinataItem);

            if (pinataItem == null || pinataItem.Rewards.Count < 1)
                return;

            item.RefreshItem();
            item.BaseItem = pinataItem.Rewards[new Random().Next((pinataItem.Rewards.Count - 1))];

            item.ExtraData = string.Empty;
            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id, false);
            using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.RunFastQuery(string.Format("UPDATE items_rooms SET base_item='{0}', extra_data='' WHERE id='{1}'", item.BaseItem, item.Id));
                queryReactor.RunQuery();
            }

            if (!room.GetRoomItemHandler().SetFloorItem(user.GetClient(), item, item.X, item.Y, 0, true, false, true))
                user.GetClient().GetHabbo().GetInventoryComponent().AddItem(item);
        }
Ejemplo n.º 8
0
		public PetBot(int int_4)
		{
            this.SpeechTimer = new Random((int_4 ^ 2) + DateTime.Now.Millisecond).Next(25, 60);
            this.ActionTimer = new Random((int_4 ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
            this.FollowType = FollowType.None;
            this.FollowUser = null;
		}
Ejemplo n.º 9
0
        public void OnUserWalk(GameClient session, RoomItem item, RoomUser user)
        {
            if (session == null || item == null || user == null) return;

            var distance = PathFinder.GetDistance(user.X, user.Y, item.X, item.Y);
            if (distance > 0 || user.GoalX == 0 && user.GoalY == 0) return;

            // Logic moved to Gamemap.cs

            /*item.ExtraData = "0";
            item.UpdateState(false, true);
            item.InteractingUser = user.UserId;

            if (user.GoalX != item.X || user.GoalY != item.Y) return;
            switch (user.RotBody)
            {
                case 3:
                case 4:
                case 5:
                    user.MoveTo(item.GetRoom()
                        .GetGameMap()
                        .CanWalk(item.SquareBehind.X, item.SquareBehind.Y, user.AllowOverride)
                        ? item.SquareBehind
                        : item.SquareInFront);
                    break;

                default:
                    user.MoveTo(item.GetRoom()
                        .GetGameMap()
                        .CanWalk(item.SquareInFront.X, item.SquareInFront.Y, user.AllowOverride)
                        ? item.SquareInFront
                        : item.SquareBehind);
                    break;
            }*/
        }
Ejemplo n.º 10
0
 private static void ActivateShield(RoomUser user)
 {
     int Effect = (int)user.team + 48;
     user.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2(Effect, true);
     user.shieldActive = true;
     user.shieldCounter += 10;
 }
Ejemplo n.º 11
0
 internal void OnUserWalk(RoomUser User)
 {
     if (User == null)
         return;
     foreach (RoomItem roomItem in this.pucks.Values)
     {
         int num1 = checked(User.X - roomItem.GetX);
         int num2 = checked(User.Y - roomItem.GetY);
         if (num1 <= 1 && num1 >= -1 && num2 <= 1 && num2 >= -1)
         {
             int num3 = checked(num1 * -1);
             int num4 = checked(num2 * -1);
             int num5 = checked(num3 + roomItem.GetX);
             int num6 = checked(num4 + roomItem.GetY);
             if ((int)roomItem.interactingBallUser == (int)User.UserID && this.room.GetGameMap().ValidTile(num5, num6))
             {
                 roomItem.interactingBallUser = 0U;
                 this.MovePuck(roomItem, User.GetClient(), User.Coordinate, roomItem.Coordinate, 6, User.team);
             }
             else if (this.room.GetGameMap().ValidTile(num5, num6))
                 this.MovePuck(roomItem, User.GetClient(), num5, num6, User.team);
         }
     }
     if (!this.banzaiStarted)
         return;
     this.HandleBanzaiTiles(User.Coordinate, User.team, User);
 }
Ejemplo n.º 12
0
        internal void OnUserWalk(RoomUser User)
        {
            if (User == null)
                return;
            foreach (RoomItem item in balls.Values)
            {
                int differenceX = User.X - item.GetX;
                int differenceY = User.Y - item.GetY;

                if (differenceX <= 1 && differenceX >= -1 && differenceY <= 1 && differenceY >= -1)
                {
                    int NewX = differenceX * -1;
                    int NewY = differenceY * -1;

                    NewX = NewX + item.GetX;
                    NewY = NewY + item.GetY;

                    if (item.interactingBallUser == User.userID && item.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                    {
                        item.interactingBallUser = 0;
                        MoveBall(item, User.GetClient(), User.Coordinate, item.Coordinate, 6);
                    }
                    else if (item.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                    {
                        MoveBall(item, User.GetClient(), NewX, NewY);
                    }
                }
            }
        }
Ejemplo n.º 13
0
 public bool AllowsExecution(RoomUser user, Room theRoom)
 {
     GenericTriggerWithModes.DoAnimation(this.item);
     int coord = 0;
     Gamemap map = theRoom.GetGameMap();
     Dictionary<int, ThreeDCoord> points;
     bool userInLoop;
     foreach (RoomItem item in items)
     {
         userInLoop = false;
         points = Gamemap.GetAffectedTiles(item.GetBaseItem().Length, item.GetBaseItem().Width, item.GetX, item.GetY, item.Rot);
         foreach (ThreeDCoord coor in points.Values)
         {
             coord = TextHandling.CombineXYCoord(coor.X, coor.Y);
             if (map.GetRoomUsers(coord).Count != 0)
             {
                 userInLoop = true;
                 break;
             }
         }
         if (!userInLoop)
             return false;
         
     }
     return true;
 }
Ejemplo n.º 14
0
 internal void Init(Int32 pBaseId, Int32 pRoomUserId, UInt32 pRoomId, RoomUser user, Room room)
 {
     this.BaseId = pBaseId;
     this.RoomUserId = pRoomUserId;
     this.RoomId = pRoomId;
     this.roomUser = user;
     this.room = room;
 }
        /// <summary>
        /// Joins the room.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="room">The room.</param>
        /// <returns></returns>
        /// Permite a un usuario en sesión ingresar a una sala,
        /// si el usuario en sesión no está autentificado, se lanzará una
        /// excepción de seguridad
        /// *
        /// <remarks>TODO: Pruebas unitarias para este método.</remarks>
        public IOperationResult<IRoomUser> JoinRoom(IUserSession session, IRoom room)
        {
            RoomUser rUser = new RoomUser(session, room);
              this.roomsUserLists[room].Add(rUser);
              messaging.Publish(room, Tuple.Create(session, RoomAction.Join));

              return new OperationResult<IRoomUser>(ResultValue.Success, "", rUser);
        }
Ejemplo n.º 16
0
 private bool canBeTriggered(string message, RoomUser userSaying)
 {
     if (WiredConditionsMet(userSaying, item.Room))
     {
         return message.ToLower() == triggerMessage.ToLower();
     }
     return false;
 }
Ejemplo n.º 17
0
 public InvokedChatMessage(RoomUser user, string message, bool shout, int colour, int count)
 {
     this.user = user;
     this.message = message;
     this.shout = shout;
     this.ColourType = colour;
     this.count = count;
 }
Ejemplo n.º 18
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="InvokedChatMessage" /> struct.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="message">The message.</param>
 /// <param name="shout">if set to <c>true</c> [shout].</param>
 /// <param name="colour">The colour.</param>
 /// <param name="count">The count.</param>
 public InvokedChatMessage(RoomUser user, string message, bool shout, int colour, int count)
 {
     User = user;
     Message = message;
     Shout = shout;
     ColourType = colour;
     Count = count;
 }
Ejemplo n.º 19
0
		internal void Init(uint pBaseId, int pRoomUserId, uint pRoomId, RoomUser user, Room room)
		{
			this.BaseId = pBaseId;
			this.RoomUserId = pRoomUserId;
			this.RoomId = pRoomId;
			this.roomUser = user;
			this.room = room;
		}
Ejemplo n.º 20
0
        public bool AllowsExecution(RoomUser user)
        {
            if (room.lastTimerReset == null)
                return false;

            TimeSpan sinceTimerReset = DateTime.Now - room.lastTimerReset;
            return (sinceTimerReset.TotalSeconds > timeout);
        }
Ejemplo n.º 21
0
 /// <summary>
 ///     Initializes the specified base identifier.
 /// </summary>
 /// <param name="baseId">The base identifier.</param>
 /// <param name="roomUserId">The room user identifier.</param>
 /// <param name="roomId">The room identifier.</param>
 /// <param name="user">The user.</param>
 /// <param name="room">The room.</param>
 internal void Init(uint baseId, int roomUserId, uint roomId, RoomUser user, Room room)
 {
     BaseId = baseId;
     _roomUserId = roomUserId;
     _roomId = roomId;
     _roomUser = user;
     _room = room;
 }
Ejemplo n.º 22
0
 internal override void OnUserChat(RoomUser user, string text, bool shout)
 {
     if (!_unit.GetRoom().CheckRights(user.GetClient(), true))
         return;
     if (text == "yes")
     {
     }
 }
Ejemplo n.º 23
0
 public bool AllowsExecution(RoomUser user)
 {
     if (room.lastTimerReset == null)
         return false;
     item.GetRoom().GetWiredHandler().OnEvent(item.Id);
     TimeSpan sinceTimerReset = DateTime.Now - room.lastTimerReset;
     return (sinceTimerReset.TotalSeconds < timeout);
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Disposes this instance.
        /// </summary>
        internal void Dispose()
        {
            _room = null;
            _roomUser = null;
            _roomId = 0;
            _roomUserId = 0;

            GC.SuppressFinalize(this);
        }
Ejemplo n.º 25
0
        public bool AllowsExecution(RoomUser user, Room theRoom)
        {
            GenericTriggerWithModes.DoAnimation(this.item);
            if (room.lastTimerReset == null)
                return false;

            TimeSpan sinceTimerReset = DateTime.Now - room.lastTimerReset;
            return (sinceTimerReset.TotalSeconds < timeout);
        }
Ejemplo n.º 26
0
 public bool AllowsExecution(RoomUser user)
 {
     foreach (RoomItem item in items)
     {
         if (item.Coordinate == user.Coordinate)
             return true;
     }
     return false;
 }
Ejemplo n.º 27
0
 public void OnUserWalk(GameClient session, RoomItem item, RoomUser user)
 {
     if (item == null || user == null) return;
     var data = item.ExtraData.Split(Convert.ToChar(9));
     if (item.ExtraData == "" || data.Length < 4) return;
     var message = new ServerMessage(LibraryParser.OutgoingRequest("InternalLinkMessageComposer"));
     message.AppendString(data[3]);
     session.SendMessage(message);
 }
Ejemplo n.º 28
0
        public bool AllowsExecution(RoomUser user)
        {
            foreach (RoomItem item in items)
            {
                if (item.ExtraData != item.originalExtraData || item.Coordinate != item.GetPlacementPosition())
                    return false;
            }

            return true;
        }
Ejemplo n.º 29
0
 public bool AllowsExecution(RoomUser user)
 {
     foreach (RoomItem item in items)
     {
         if (item.ExtraData != item.originalExtraData || item.Coordinate != item.GetPlacementPosition())
             return false;
     }
     this.item.GetRoom().GetWiredHandler().OnEvent(this.item.Id);
     return true;
 }
Ejemplo n.º 30
0
        public WhisperComposer(RoomUser User, string Text, int Emotion, int Colour)
            : base(ServerPacketHeader.WhisperMessageComposer)
        {
            base.WriteInteger(User.VirtualId);
            base.WriteString(Text);
            base.WriteInteger(Emotion);
            base.WriteInteger(Colour);

            base.WriteInteger(0);
            base.WriteInteger(-1);
        }
Ejemplo n.º 31
0
 public bool StartTrade(RoomUser Player1, RoomUser Player2, out Trade Trade)
 {
     this._currentId++;
     Trade = new Trade(this._currentId, Player1, Player2, _instance);
     return(this._activeTrades.TryAdd(this._currentId, Trade));
 }
Ejemplo n.º 32
0
 public abstract void OnUserShout(RoomUser User, string Message);
Ejemplo n.º 33
0
 public abstract void OnUserEnterRoom(RoomUser User);
Ejemplo n.º 34
0
 public InvokedChatMessage(RoomUser user, string message, bool shout)
 {
     this.user    = user;
     this.message = message;
     this.shout   = shout;
 }
Ejemplo n.º 35
0
        public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            if (!Room.GetGameMap().ValidTile(User.X + 2, User.Y + 2) && !Room.GetGameMap().ValidTile(User.X + 1, User.Y + 1))
            {
                Session.SendWhisper("Oops, cannot lay down here - try elsewhere!");
                return;
            }

            if (User.Statusses.ContainsKey("sit") || User.isSitting || User.RidingHorse || User.IsWalking)
            {
                return;
            }

            if (Session.GetHabbo().Effects().CurrentEffect > 0)
            {
                Session.GetHabbo().Effects().ApplyEffect(0);
            }

            if (!User.Statusses.ContainsKey("lay"))
            {
                if ((User.RotBody % 2) == 0)
                {
                    if (User == null)
                    {
                        return;
                    }

                    try
                    {
                        User.Statusses.Add("lay", "1.0 null");
                        User.Z           -= 0.35;
                        User.isLying      = true;
                        User.UpdateNeeded = true;
                    }
                    catch { }
                }
                else
                {
                    User.RotBody--;//
                    User.Statusses.Add("lay", "1.0 null");
                    User.Z           -= 0.35;
                    User.isLying      = true;
                    User.UpdateNeeded = true;
                }
            }
            else
            {
                User.Z += 0.35;
                User.Statusses.Remove("lay");
                User.Statusses.Remove("1.0");
                User.isLying      = false;
                User.UpdateNeeded = true;
            }
        }
Ejemplo n.º 36
0
 public TradeUser(RoomUser user)
 {
     _user         = user;
     _accepted     = false;
     _offeredItems = new Dictionary <int, Item>();
 }
Ejemplo n.º 37
0
 private bool veryficball(RoomUser user, int actualx, int nexx, int actualy, int nexy)
 {
     return(PathFinder.CalculateRotation(user.X, user.Y, actualx, actualy) == user.RotBody);
 }
Ejemplo n.º 38
0
        public void ProcessItems()
        {
            List <Item> UserOne = Users[0].OfferedItems.Values.ToList();
            List <Item> UserTwo = Users[1].OfferedItems.Values.ToList();

            RoomUser RoomUserOne = Users[0].RoomUser;
            RoomUser RoomUserTwo = Users[1].RoomUser;

            string logUserOne = "";
            string logUserTwo = "";

            if (RoomUserOne == null || RoomUserOne.GetClient() == null || RoomUserOne.GetClient().GetHabbo() == null || RoomUserOne.GetClient().GetHabbo().GetInventoryComponent() == null)
            {
                return;
            }

            if (RoomUserTwo == null || RoomUserTwo.GetClient() == null || RoomUserTwo.GetClient().GetHabbo() == null || RoomUserTwo.GetClient().GetHabbo().GetInventoryComponent() == null)
            {
                return;
            }

            foreach (Item Item in UserOne)
            {
                Item I = RoomUserOne.GetClient().GetHabbo().GetInventoryComponent().GetItem(Item.Id);

                if (I == null)
                {
                    SendPacket(new BroadcastMessageAlertComposer("Error! Trading Failed!"));
                    return;
                }
            }

            foreach (Item Item in UserTwo)
            {
                Item I = RoomUserTwo.GetClient().GetHabbo().GetInventoryComponent().GetItem(Item.Id);

                if (I == null)
                {
                    SendPacket(new BroadcastMessageAlertComposer("Error! Trading Failed!"));
                    return;
                }
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                foreach (Item Item in UserOne)
                {
                    logUserOne += Item.Id + ";";
                    RoomUserOne.GetClient().GetHabbo().GetInventoryComponent().RemoveItem(Item.Id);
                    if (Item.Data.InteractionType == InteractionType.EXCHANGE && PlusEnvironment.GetSettingsManager().TryGetValue("trading.auto_exchange_redeemables") == "1")
                    {
                        RoomUserTwo.GetClient().GetHabbo().Credits += Item.Data.BehaviourData;
                        RoomUserTwo.GetClient().SendPacket(new CreditBalanceComposer(RoomUserTwo.GetClient().GetHabbo().Credits));

                        dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @id LIMIT 1");
                        dbClient.AddParameter("id", Item.Id);
                        dbClient.RunQuery();
                    }
                    else
                    {
                        if (RoomUserTwo.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item))
                        {
                            RoomUserTwo.GetClient().SendPacket(new FurniListAddComposer(Item));
                            RoomUserTwo.GetClient().SendPacket(new FurniListNotificationComposer(Item.Id, 1));

                            dbClient.SetQuery("UPDATE `items` SET `user_id` = @user WHERE id=@id LIMIT 1");
                            dbClient.AddParameter("user", RoomUserTwo.UserId);
                            dbClient.AddParameter("id", Item.Id);
                            dbClient.RunQuery();
                        }
                    }
                }

                foreach (Item Item in UserTwo)
                {
                    logUserTwo += Item.Id + ";";
                    RoomUserTwo.GetClient().GetHabbo().GetInventoryComponent().RemoveItem(Item.Id);
                    if (Item.Data.InteractionType == InteractionType.EXCHANGE && PlusEnvironment.GetSettingsManager().TryGetValue("trading.auto_exchange_redeemables") == "1")
                    {
                        RoomUserOne.GetClient().GetHabbo().Credits += Item.Data.BehaviourData;
                        RoomUserOne.GetClient().SendPacket(new CreditBalanceComposer(RoomUserOne.GetClient().GetHabbo().Credits));

                        dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @id LIMIT 1");
                        dbClient.AddParameter("id", Item.Id);
                        dbClient.RunQuery();
                    }
                    else
                    {
                        if (RoomUserOne.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item))
                        {
                            RoomUserOne.GetClient().SendPacket(new FurniListAddComposer(Item));
                            RoomUserOne.GetClient().SendPacket(new FurniListNotificationComposer(Item.Id, 1));

                            dbClient.SetQuery("UPDATE `items` SET `user_id` = @user WHERE id=@id LIMIT 1");
                            dbClient.AddParameter("user", RoomUserOne.UserId);
                            dbClient.AddParameter("id", Item.Id);
                            dbClient.RunQuery();
                        }
                    }
                }

                dbClient.SetQuery("INSERT INTO `logs_client_trade` VALUES(null, @1id, @2id, @1items, @2items, UNIX_TIMESTAMP())");
                dbClient.AddParameter("1id", RoomUserOne.UserId);
                dbClient.AddParameter("2id", RoomUserTwo.UserId);
                dbClient.AddParameter("1items", logUserOne);
                dbClient.AddParameter("2items", logUserTwo);
                dbClient.RunQuery();
            }
        }
Ejemplo n.º 39
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null || !session.GetHabbo().InRoom)
            {
                return;
            }

            Room room = session.GetHabbo().CurrentRoom;

            if (room == null)
            {
                return;
            }

            RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (user == null)
            {
                return;
            }

            string message = StringCharFilter.Escape(packet.PopString());

            if (message.Length > 100)
            {
                message = message.Substring(0, 100);
            }

            int colour = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(colour, out ChatStyle style) || style.RequiredRight.Length > 0 && !session.GetHabbo().GetPermissions().HasRight(style.RequiredRight))
            {
                colour = 0;
            }

            user.UnIdle();

            if (PlusEnvironment.GetUnixTimestamp() < session.GetHabbo().FloodTime&& session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (session.GetHabbo().TimeMuted > 0)
            {
                session.SendPacket(new MutedComposer(session.GetHabbo().TimeMuted));
                return;
            }

            if (!session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && room.CheckMute(session))
            {
                session.SendWhisper("Oops, you're currently muted.");
                return;
            }

            user.LastBubble = session.GetHabbo().CustomBubbleId == 0 ? colour : session.GetHabbo().CustomBubbleId;

            if (!session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                if (user.IncrementAndCheckFlood(out int muteTime))
                {
                    session.SendPacket(new FloodControlComposer(muteTime));
                    return;
                }
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(session.GetHabbo().Id, room.Id, message, UnixTimestamp.GetNow(), session.GetHabbo(), room));

            if (message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(session, message))
            {
                return;
            }

            if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(message))
            {
                session.GetHabbo().BannedPhraseCount++;
                if (session.GetHabbo().BannedPhraseCount >= Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("room.chat.filter.banned_phrases.chances")))
                {
                    PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.Username, session.GetHabbo().Username, "Spamming banned phrases (" + message + ")", PlusEnvironment.GetUnixTimestamp() + 78892200);
                    session.Disconnect();
                    return;
                }

                session.SendPacket(new ChatComposer(user.VirtualId, message, 0, colour));
                return;
            }

            if (!session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(message);
            }


            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.SocialChat);

            user.OnChat(user.LastBubble, message, false);
        }
Ejemplo n.º 40
0
        public void processCommand(String data)
        {
            GameClient Client = null;

            String header = data.Split(Convert.ToChar(1))[0];
            String param  = data.Split(Convert.ToChar(1))[1];

            string[] Params = param.ToString().Split(':');
            int      UserId, RoomId = 0;

            switch (header.ToLower())
            {
                #region User Related
                #region :reload_credits <UserID>
            case "reload_credits":
            {
                UserId = Convert.ToInt32(Params[0]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                int Credits = 0;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `credits` FROM `users` WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", UserId);
                    Credits = dbClient.getInteger();
                }

                Client.GetHabbo().Credits = Credits;
                Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
                break;
            }

                #endregion
                #region :reload_pixels <UserID>
            case "reload_pixels":
            {
                UserId = Convert.ToInt32(Params[0]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                int Pixels = 0;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `activity_points` FROM `users` WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", UserId);
                    Pixels = dbClient.getInteger();
                }

                Client.GetHabbo().Duckets = Pixels;
                Client.SendMessage(new HabboActivityPointNotificationComposer(Client.GetHabbo().Duckets, Pixels));
                break;
            }

                #endregion
                #region :reload_diamonds <UserID>
            case "reload_diamonds":
            {
                UserId = Convert.ToInt32(Params[0]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                int Diamonds = 0;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `vip_points` FROM `users` WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", UserId);
                    Diamonds = dbClient.getInteger();
                }

                Client.GetHabbo().Diamonds = Diamonds;
                Client.SendMessage(new HabboActivityPointNotificationComposer(Diamonds, 0, 5));
                break;
            }

                #endregion
                #region :reload_gotw <UserID>
            case "reload_gotw":
            {
                UserId = Convert.ToInt32(Params[0]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                int GOTWPoints = 0;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `gotw_points` FROM `users` WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", UserId);
                    GOTWPoints = dbClient.getInteger();
                }

                Client.GetHabbo().GOTWPoints = GOTWPoints;
                Client.SendMessage(new HabboActivityPointNotificationComposer(GOTWPoints, 0, 103));
                break;
            }

                #endregion
            case "moveto":
            {
                UserId = Convert.ToInt32(Params[0]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                Room     Testing = Client?.GetHabbo()?.CurrentRoom;
                RoomUser Testing2;
                if ((Testing2 = Testing?.GetRoomUserManager()?.GetRoomUserByHabbo(Client.GetHabbo().Username)) != null)
                {
                    Testing2.MoveTo(12, 12);
                }
                break;
            }

                #region :reload_user_rank userID
            case "reload_user_rank":
            {
                UserId = Convert.ToInt32(Params[0]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `rank` FROM `users` WHERE `id` = @userID LIMIT 1");
                    dbClient.AddParameter("userID", UserId);
                    Client.GetHabbo().Rank = dbClient.getInteger();
                }
                break;
            }

                #endregion
                #region :reload_user_vip userID
            case "reload_user_vip":
            {
                UserId = Convert.ToInt32(Params[0]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `rank_vip` FROM `users` WHERE `id` = @userID LIMIT 1");
                    dbClient.AddParameter("userID", UserId);
                    Client.GetHabbo().VIPRank = dbClient.getInteger();
                }
                break;
            }

                #endregion
                #region :reload_motto userID
            case "reload_motto":
            {
                UserId = Convert.ToInt32(Params[0]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `motto` FROM `users` WHERE `id` = @userID LIMIT 1");
                    dbClient.AddParameter("userID", UserId);
                    Client.GetHabbo().Motto = dbClient.getString();
                }

                if (Client.GetHabbo().InRoom)
                {
                    Room Room = Client.GetHabbo().CurrentRoom;
                    if (Room == null)
                    {
                        return;
                    }

                    RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
                    if (User == null || User.GetClient() == null)
                    {
                        return;
                    }

                    Room.SendMessage(new UserChangeComposer(User, false));
                }
                break;
            }

                #endregion
                #region :alert_user <userid> <message>
            case "alert":
            case "alert_user":
            {
                UserId = Convert.ToInt32(Params[0]);
                string alertMessage = Convert.ToString(Params[1]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                Client.SendMessage(new BroadcastMessageAlertComposer(alertMessage));
                break;
            }

                #endregion
                #region :reload_badges <UserID>
            case "update_badges":
            case "reload_badges":
            {
                UserId = Convert.ToInt32(Params[0]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);

                if (Client != null)
                {
                    if (Client.GetHabbo() != null)
                    {
                        Client.SendMessage(new BadgesComposer(Client));
                    }
                }
                break;
            }

                #endregion
                #region :givebadge <UserID> <badge>
            case "givebadge":
            {
                UserId = Convert.ToInt32(Params[0]);
                string badgeCode = Convert.ToString(Params[1]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);

                if (Client != null)
                {
                    if (Client.GetHabbo() != null)
                    {
                        Client.GetHabbo().GetBadgeComponent().GiveBadge(badgeCode, true, Client);
                    }
                }
                break;
            }

                #endregion
                #region :disconnect <username>
            case "disconnect":
            {
                try
                {
                    GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Convert.ToInt32(Params[0]));
                    if (TargetClient != null && TargetClient.GetConnection() != null)
                    {
                        TargetClient.GetConnection().Dispose();
                    }
                }
                catch
                {
                    string CurrentTime = DateTime.Now.ToString("HH:mm:ss" + " | ");
                    Console.WriteLine(CurrentTime + "» Fout tijdens disconnecten van een gebruiker via MUS");
                }
                return;
            }

                #endregion
                #region :reload_last_change userID
            case "reload_last_change":
            {
                UserId = Convert.ToInt32(Params[0]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `last_change` FROM `users` WHERE `id` = @userID LIMIT 1");
                    dbClient.AddParameter("userID", UserId);
                    Client.GetHabbo().LastNameChange = dbClient.getInteger();
                }
                break;
            }

                #endregion
                #region :goto <UserID> <RoomID>
            case "goto":
            {
                UserId = Convert.ToInt32(Params[0]);
                RoomId = Convert.ToInt32(Params[1]);

                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                if (!int.TryParse(Params[1], out RoomId))
                {
                    break;
                }
                else
                {
                    Room _room = QuasarEnvironment.GetGame().GetRoomManager().LoadRoom(RoomId);
                    if (_room == null)
                    {
                        Client.SendNotification("Failed to find the requested room!");
                    }
                    else
                    {
                        if (!Client.GetHabbo().InRoom)
                        {
                            Client.SendMessage(new RoomForwardComposer(_room.Id));
                        }
                        else
                        {
                            Client.GetHabbo().PrepareRoom(_room.Id, "");
                        }
                    }
                }
            }
            break;
                #endregion
                #endregion

                #region Fastfood
                #region :progress_achievement
            case "progress_achievement":
            {
                UserId = Convert.ToInt32(Params[0]);
                Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null)
                {
                    break;
                }

                string Achievement = Convert.ToString(Params[1]);
                int    Progress    = Convert.ToInt32(Params[2]);

                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Client, Achievement, Progress);
                break;
            }
                #endregion
                #endregion

                #region Settings related
                #region :reload_filter/:update_filter
            case "update_filter":
            case "reload_filter":
            case "recache_filter":
            case "refresh_filter":
            {
                QuasarEnvironment.GetGame().GetChatManager().GetFilter().InitWords();
                QuasarEnvironment.GetGame().GetChatManager().GetFilter().InitCharacters();
                break;
            }

                #endregion
                #region :reload_catalog/:reload_catalog
            case "update_catalog":
            case "reload_catalog":
            case "recache_catalog":
            case "refresh_catalog":
            case "update_catalogue":
            case "reload_catalogue":
            case "recache_catalogue":
            case "refresh_catalogue":
            {
                QuasarEnvironment.GetGame().GetCatalog().Init(QuasarEnvironment.GetGame().GetItemManager());
                QuasarEnvironment.GetGame().GetClientManager().SendMessage(new CatalogUpdatedComposer());
                break;
            }

                #endregion
                #region :reload_items/:update_items
            case "update_items":
            case "reload_items":
            case "recache_items":
            case "refresh_items":
            {
                QuasarEnvironment.GetGame().GetItemManager().Init();
                break;
            }

                #endregion
                #region :reload_navigator/:update_navigator
            case "update_navigator":
            case "reload_navigator":
            case "recache_navigator":
            case "refresh_navigator":
            {
                QuasarEnvironment.GetGame().GetNavigator().Init();
                break;
            }

                #endregion
                #region :reload_ranks/:update_ranks
            case "update_ranks":
            case "reload_ranks":
            case "recache_ranks":
            case "refresh_ranks":
            {
                QuasarEnvironment.GetGame().GetPermissionManager().Init();

                foreach (GameClient C in QuasarEnvironment.GetGame().GetClientManager().GetClients.ToList())
                {
                    if (C == null || C.GetHabbo() == null || C.GetHabbo().GetPermissions() == null)
                    {
                        continue;
                    }

                    C.GetHabbo().GetPermissions().Init(Client.GetHabbo());
                }
                break;
            }

                #endregion
                #region :reload_settings/:update_settings
            case "update_settings":
            case "reload_settings":
            case "recache_settings":
            case "refresh_settings":
            {
                QuasarEnvironment.ConfigData = new ConfigData();
                break;
            }

                #endregion
                #region :reload_quests/:update_quests
            case "reload_quests":
            case "update_quests":
            {
                QuasarEnvironment.GetGame().GetQuestManager().Init();
                break;
            }

                #endregion
                #region :reload_vouchers/:update_vouchers
            case "reload_vouchers":
            case "update_vouchers":
            {
                QuasarEnvironment.GetGame().GetCatalog().GetVoucherManager().Init();
                break;
            }

                #endregion
                #region :reload_bans/:update_bans
            case "update_bans":
            case "reload_bans":
            {
                QuasarEnvironment.GetGame().GetModerationManager().ReCacheBans();
                break;
            }
                #endregion
                #endregion


            //#region Camera related

            //    #region :add_preview <photo_id> <user_id> <created_at>
            //    case "add_preview":
            //    {
            //        int PhotoId = Convert.ToInt32(Params[0]);
            //        UserId = Convert.ToInt32(Params[1]);
            //        long CreatedAt = Convert.ToInt64(Params[2]);

            //        Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);

            //                    if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId < 1)
            //                           break;

            //        QuasarEnvironment.GetGame().GetCameraManager().AddPreview(new CameraPhotoPreview(PhotoId, UserId, CreatedAt));
            //                    break;
            //    }

            //    #endregion

            //    #endregion

            default:
            {
                string CurrentTime = DateTime.Now.ToString("HH:mm:ss" + " | ");
                Console.WriteLine(CurrentTime + "» Onbekende Mus-pakket: '" + header + "'");
                return;
            }
            }
            string CurrentTime1 = DateTime.Now.ToString("HH:mm:ss" + " | ");
            Console.WriteLine(CurrentTime1 + "» Mus-command gestuurd: '" + header + "'");
        }
Ejemplo n.º 41
0
        private void WriteUser(RoomUser User)
        {
            if (User.IsBot)
            {
                WriteInteger(User.BotAI.BaseId);
                WriteString(User.BotData.Name);
                WriteString(User.BotData.Motto);
                if (User.BotData.AiType == AIType.Pet || User.BotData.AiType == AIType.RolePlayPet)
                {
                    WriteString(User.BotData.Look.ToLower() + ((User.PetData.Saddle > 0) ? " 3 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 4 " + User.PetData.Saddle + " 0" : " 2 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + ""));
                }
                else
                {
                    WriteString(User.BotData.Look);
                }
                WriteInteger(User.VirtualId);
                WriteInteger(User.X);
                WriteInteger(User.Y);
                WriteString(TextHandling.GetString(User.Z));
                WriteInteger(2);
                WriteInteger(User.BotData.AiType == AIType.Pet || User.BotData.AiType == AIType.RolePlayPet ? 2 : 4);
                if (User.BotData.AiType == AIType.Pet || User.BotData.AiType == AIType.RolePlayPet)
                {
                    WriteInteger(User.PetData.Type);
                    WriteInteger(User.PetData.OwnerId);
                    WriteString(User.PetData.OwnerName);
                    WriteInteger(1);
                    WriteBoolean(User.PetData.Saddle > 0);
                    WriteBoolean(User.RidingHorse);
                    WriteInteger(0);
                    WriteInteger(0);
                    WriteString("");
                }
                else
                {
                    WriteString(User.BotData.Gender);
                    WriteInteger(User.BotData.OwnerId);
                    WriteString(User.BotData.OwnerName);
                    WriteInteger(6);
                    WriteShort(1);
                    WriteShort(2);
                    WriteShort(3);
                    WriteShort(4);
                    WriteShort(5);
                    WriteShort(6);
                }
            }
            else
            {
                if (User.GetClient() == null || User.GetClient().GetHabbo() == null)
                {
                    WriteInteger(0);
                    WriteString("");
                    WriteString("");
                    WriteString("");
                    WriteInteger(User.VirtualId);
                    WriteInteger(User.X);
                    WriteInteger(User.Y);
                    WriteString(TextHandling.GetString(User.Z));
                    WriteInteger(0);
                    WriteInteger(1);
                    WriteString("M");
                    WriteInteger(0);
                    WriteInteger(0);
                    WriteString("");

                    WriteString("");//Whats this?
                    WriteInteger(0);
                    WriteBoolean(false);
                }
                else
                {
                    Habbo Habbo = User.GetClient().GetHabbo();

                    Group Group = null;
                    if (Habbo != null)
                    {
                        if (Habbo.FavouriteGroupId > 0)
                        {
                            if (!ButterflyEnvironment.GetGame().GetGroupManager().TryGetGroup(Habbo.FavouriteGroupId, out Group))
                            {
                                Group = null;
                            }
                        }
                    }

                    if (User.transfbot)
                    {
                        WriteInteger(Habbo.Id);
                        WriteString(Habbo.Username);
                        WriteString("Beep beep.");
                        WriteString(Habbo.Look);
                        WriteInteger(User.VirtualId);
                        WriteInteger(User.X);
                        WriteInteger(User.Y);
                        WriteString(TextHandling.GetString(User.Z));
                        WriteInteger(0);
                        WriteInteger(4);

                        WriteString(Habbo.Gender);
                        WriteInteger(Habbo.Id);
                        WriteString(Habbo.Username);
                        WriteInteger(0);
                    }
                    else if (User.transformation)
                    {
                        WriteInteger(Habbo.Id);
                        WriteString(Habbo.Username);
                        WriteString(Habbo.Motto);
                        WriteString(User.transformationrace + " 2 2 -1 0 3 4 -1 0");

                        WriteInteger(User.VirtualId);
                        WriteInteger(User.X);
                        WriteInteger(User.Y);
                        WriteString(TextHandling.GetString(User.Z));
                        WriteInteger(4);
                        WriteInteger(2);
                        WriteInteger(0);
                        WriteInteger(Habbo.Id);
                        WriteString(Habbo.Username);
                        WriteInteger(1);
                        WriteBoolean(false);
                        WriteBoolean(false);
                        WriteInteger(0);
                        WriteInteger(0);
                        WriteString("");
                    }
                    else
                    {
                        WriteInteger(Habbo.Id);
                        WriteString(Habbo.Username);
                        WriteString(Habbo.Motto);
                        WriteString(Habbo.Look);
                        WriteInteger(User.VirtualId);
                        WriteInteger(User.X);
                        WriteInteger(User.Y);
                        WriteString(TextHandling.GetString(User.Z));
                        WriteInteger(0);
                        WriteInteger(1);
                        WriteString(Habbo.Gender.ToLower());

                        if (Group != null)
                        {
                            WriteInteger(Group.Id);
                            WriteInteger(0);
                            WriteString(Group.Name);
                        }
                        else
                        {
                            WriteInteger(0);
                            WriteInteger(0);
                            WriteString("");
                        }

                        WriteString("");//Whats this?
                        WriteInteger(Habbo.AchievementPoints);
                        WriteBoolean(false);
                    }
                }
            }
        }
Ejemplo n.º 42
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 2)
            {
                Session.SendWhisper("Digite o nome de usuário do membro da gangue que deseja curar!", 1);
                return;
            }

            Group     Gang     = GroupManager.GetGang(Session.GetRoleplay().GangId);
            GroupRank GangRank = GroupManager.GetGangRank(Session.GetRoleplay().GangId, Session.GetRoleplay().GangRank);

            if (Gang == null)
            {
                Session.SendWhisper("Você não faz parte de nenhum grupo!", 1);
                return;
            }

            if (Gang.Id <= 1000)
            {
                Session.SendWhisper("Você não faz parte de nenhum grupo!", 1);
                return;
            }

            if (!GroupManager.HasGangCommand(Session, "gheal"))
            {
                Session.SendWhisper("Você não possui um cargo alto o suficiente para usar esse comando!", 1);
                return;
            }

            if (Gang.MediPacks <= 0)
            {
                Session.SendWhisper("Sua gangue não tem mais pacotes de cura!", 1);
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                Session.SendWhisper("Desculpe, mas este usuário não pôde ser encontrado!", 1);
                return;
            }

            RoomUser RoomUser       = Session.GetRoomUser();
            RoomUser TargetRoomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);

            if (TargetRoomUser == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            if (TargetClient.GetRoleplay().CurHealth == TargetClient.GetRoleplay().MaxHealth)
            {
                Session.SendWhisper(TargetClient.GetHabbo().Username + " não precisa ser curado!", 1);
                return;
            }

            Point  ClientPos       = new Point(RoomUser.X, RoomUser.Y);
            Point  TargetClientPos = new Point(TargetRoomUser.X, TargetRoomUser.Y);
            double Distance        = RoleplayManager.GetDistanceBetweenPoints2D(ClientPos, TargetClientPos);

            if (Distance > 1)
            {
                Session.SendWhisper("Aproxime-se de " + TargetClient.GetHabbo().Username + " para curá-lo com um pacote médico!", 1);
                return;
            }

            Session.Shout("*Puxa um pacote médico e aplica alguns band-aid nas feridas de " + TargetClient.GetHabbo().Username + "'*", 4);
            Gang.MediPacks -= 1;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                dbClient.RunQuery("UPDATE `rp_gangs` SET `medipacks` = '" + Gang.MediPacks + "' WHERE `id` = '" + Gang.Id + "'");

            CryptoRandom Random     = new CryptoRandom();
            int          HealAmount = Random.Next(5, 16);

            new Thread(() =>
            {
                Thread.Sleep(3000);

                if (!TargetClient.GetRoleplay().IsDead)
                {
                    if (TargetRoomUser != null)
                    {
                        TargetRoomUser.ApplyEffect(23);
                    }

                    int NewHealth = TargetClient.GetRoleplay().CurHealth + HealAmount;

                    if (NewHealth > TargetClient.GetRoleplay().MaxHealth)
                    {
                        TargetClient.GetRoleplay().CurHealth = TargetClient.GetRoleplay().MaxHealth;
                    }
                    else
                    {
                        TargetClient.GetRoleplay().CurHealth = NewHealth;
                    }

                    TargetClient.SendWhisper(Session.GetHabbo().Username + " Os kits médicos começou a produzir efeito!", 1);
                }
            }).Start();
        }
Ejemplo n.º 43
0
        internal void OnUserWalk(RoomUser User)
        {
            if (User == null)
            {
                return;
            }
            foreach (RoomItem item in balls.Values)
            {
                int NewX        = 0;
                int NewY        = 0;
                int differenceX = User.X - item.GetX;
                int differenceY = User.Y - item.GetY;

                if (differenceX == 0 && differenceY == 0)
                {
                    //DEVOLVER HACIA ATRAS.

                    if (User.RotBody == 4)
                    {
                        NewX = User.X;
                        NewY = User.Y + 2;
                    }
                    else if (User.RotBody == 6)
                    {
                        NewX = User.X - 2;
                        NewY = User.Y;
                    }
                    else if (User.RotBody == 0)
                    {
                        NewX = User.X;
                        NewY = User.Y - 2;
                    }
                    else if (User.RotBody == 2)
                    {
                        NewX = User.X + 2;
                        NewY = User.Y;
                    }//DIAGONALES
                    else if (User.RotBody == 1)
                    {
                        NewX = User.X + 2;
                        NewY = User.Y - 2;
                    }
                    else if (User.RotBody == 7)
                    {
                        NewX = User.X - 2;
                        NewY = User.Y - 2;
                    }
                    else if (User.RotBody == 3)
                    {
                        NewX = User.X + 2;
                        NewY = User.Y + 2;
                    }
                    else if (User.RotBody == 5)
                    {
                        NewX = User.X - 2;
                        NewY = User.Y + 2;
                    }
                    if (!this.room.GetRoomItemHandler().CheckPosItem(User.GetClient(), item, NewX, NewY, item.Rot, false, false))
                    {
                        if (User.RotBody == 0)
                        {
                            NewX = User.X;
                            NewY = User.Y + 1;
                        }
                        else if (User.RotBody == 2)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y;
                        }
                        else if (User.RotBody == 4)
                        {
                            NewX = User.X;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 6)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y;
                        }
                        else if (User.RotBody == 5)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 3)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 7)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y + 1;
                        }
                        else if (User.RotBody == 1)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y + 1;
                        }
                    }
                }
                else if (differenceX <= 1 && differenceX >= -1 && differenceY <= 1 && differenceY >= -1 && veryficball(User, item.Coordinate.X, 0, item.Coordinate.Y, 0))
                {
                    NewX = differenceX * -1;
                    NewY = differenceY * -1;

                    NewX = NewX + item.GetX;
                    NewY = NewY + item.GetY;
                }

                if (item.interactingBallUser == User.UserID && item.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                {
                    item.interactingBallUser = 0;
                    MoveBall(item, User.GetClient(), User.Coordinate, item.Coordinate, 6, User);
                }
                else if (item.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                {
                    MoveBall(item, User.GetClient(), NewX, NewY, User);
                }
            }
        }
Ejemplo n.º 44
0
 public DanceComposer(RoomUser Avatar, int Dance)
     : base(ServerPacketHeader.DanceMessageComposer)
 {
     base.WriteInteger(Avatar.VirtualId);
     base.WriteInteger(Dance);
 }
Ejemplo n.º 45
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            string BotName = CommandManager.MergeParams(Params, 1);
            string Bubble  = CommandManager.MergeParams(Params, 2);

            long nowTime     = NeonEnvironment.CurrentTimeMillis();
            long timeBetween = nowTime - Session.GetHabbo()._lastTimeUsedHelpCommand;

            if (timeBetween < 60000 && Session.GetHabbo().Rank == 1)
            {
                Session.SendMessage(RoomNotificationComposer.SendBubble("abuse", "Espera al menos 1 minuto para volver a cambiar la burbuja de tu Bot.\n\nCompra la suscripción VIP de Keko haciendo click aquí para evitar esta espera.", "catalog/open/clubVIP"));
                return;
            }

            Session.GetHabbo()._lastTimeUsedHelpCommand = nowTime;

            if (Params.Length == 1)
            {
                Session.SendWhisper("No has introducido un nombre de bot válido.", 34);
                return;
            }

            RoomUser Bot = Room.GetRoomUserManager().GetBotByName(Params[1]);

            if (Bot == null)
            {
                Session.SendWhisper("No hay ningún bot llamado " + Params[1] + " en la sala.", 34);
                return;
            }

            if (Bot.BotData.ownerID != Session.GetHabbo().Id)
            {
                Session.SendWhisper("Estás cambiándole la burbuja a un bot que no es tuyo, crack, máquina, figura.", 34);
                return;
            }

            if (Bubble == "1" || Bubble == "23" || Bubble == "34" || Bubble == "37")
            {
                Session.SendWhisper("Estás colocando una burbuja prohibida.");
                return;
            }

            if (Params.Length == 2)
            {
                Session.SendWhisper("Uy, se te olvidó introducir una ID de la burbuja.", 34);
                return;
            }

            if (int.TryParse(Bubble, out int BubbleID))
            {
                using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots` SET `chat_bubble` =  '" + BubbleID + "' WHERE `name` =  '" + Bot.BotData.Name + "' AND  `room_id` =  '" + Session.GetHabbo().CurrentRoomId + "'");
                    Bot.Chat("Me acabas de colocar la burbuja " + BubbleID + ".", true, BubbleID);
                    Bot.BotData.ChatBubble = BubbleID;
                }
            }

            return;
        }
Ejemplo n.º 46
0
 private bool HandleFootballGameItems(Point ballItemCoord, RoomUser user)
 {
     foreach (RoomItem current in this.room.GetGameManager().GetItems(Team.red).Values)
     {
         foreach (ThreeDCoord current2 in current.GetAffectedTiles.Values)
         {
             if (current2.X == ballItemCoord.X && current2.Y == ballItemCoord.Y)
             {
                 this.room.GetGameManager().AddPointToTeam(Team.red, user);
                 ServerMessage serverMessage = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                 serverMessage.AppendInt32(user.VirtualId);
                 serverMessage.AppendInt32(1);
                 user.GetClient().GetHabbo().CurrentRoom.SendMessage(serverMessage);
                 bool flag   = true;
                 bool result = flag;
                 return(result);
             }
         }
     }
     foreach (RoomItem current3 in this.room.GetGameManager().GetItems(Team.green).Values)
     {
         foreach (ThreeDCoord current4 in current3.GetAffectedTiles.Values)
         {
             if (current4.X == ballItemCoord.X && current4.Y == ballItemCoord.Y)
             {
                 this.room.GetGameManager().AddPointToTeam(Team.green, user);
                 ServerMessage serverMessage = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                 serverMessage.AppendInt32(user.VirtualId);
                 serverMessage.AppendInt32(1);
                 user.GetClient().GetHabbo().CurrentRoom.SendMessage(serverMessage);
                 bool flag   = true;
                 bool result = flag;
                 return(result);
             }
         }
     }
     foreach (RoomItem current5 in this.room.GetGameManager().GetItems(Team.blue).Values)
     {
         foreach (ThreeDCoord current6 in current5.GetAffectedTiles.Values)
         {
             if (current6.X == ballItemCoord.X && current6.Y == ballItemCoord.Y)
             {
                 this.room.GetGameManager().AddPointToTeam(Team.blue, user);
                 ServerMessage serverMessage = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                 serverMessage.AppendInt32(user.VirtualId);
                 serverMessage.AppendInt32(1);
                 user.GetClient().GetHabbo().CurrentRoom.SendMessage(serverMessage);
                 bool flag   = true;
                 bool result = flag;
                 return(result);
             }
         }
     }
     foreach (RoomItem current7 in this.room.GetGameManager().GetItems(Team.yellow).Values)
     {
         foreach (ThreeDCoord current8 in current7.GetAffectedTiles.Values)
         {
             if (current8.X == ballItemCoord.X && current8.Y == ballItemCoord.Y)
             {
                 this.room.GetGameManager().AddPointToTeam(Team.yellow, user);
                 ServerMessage serverMessage = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                 serverMessage.AppendInt32(user.VirtualId);
                 serverMessage.AppendInt32(1);
                 user.GetClient().GetHabbo().CurrentRoom.SendMessage(serverMessage);
                 bool flag   = true;
                 bool result = flag;
                 return(result);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 47
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

            if (!RavenEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                return;
            }

            int BotId = Packet.PopInt();
            int X     = Packet.PopInt();
            int Y     = Packet.PopInt();

            if (!Room.GetGameMap().CanWalk(X, Y, false) || !Room.GetGameMap().ValidTile(X, Y))
            {
                Session.SendNotification("No puedes colocar al Bot aqui!");
                return;
            }

            Bot Bot = null;

            if (!Session.GetHabbo().GetInventoryComponent().TryGetBot(BotId, out Bot))
            {
                return;
            }

            int BotCount = 0;

            foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (User == null || User.IsPet || !User.IsBot)
                {
                    continue;
                }

                BotCount += 1;
            }

            if (BotCount >= 5 && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override"))
            {
                Session.SendNotification("Lo siento, solo son un maximo de 5 bot por sala!");
                return;
            }

            //TODO: Hmm, maybe not????
            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `bots` SET `room_id` = '" + Room.RoomId + "', `x` = @CoordX, `y` = @CoordY WHERE `id` = @BotId LIMIT 1");
                dbClient.AddParameter("BotId", Bot.Id);
                dbClient.AddParameter("CoordX", X);
                dbClient.AddParameter("CoordY", Y);
                dbClient.RunQuery();
            }

            List <RandomSpeech> BotSpeechList = new List <RandomSpeech>();

            //TODO: Grab data?
            DataRow GetData = null;

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `ai_type`,`rotation`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `id` = @BotId LIMIT 1");
                dbClient.AddParameter("BotId", Bot.Id);
                GetData = dbClient.getRow();

                dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @BotId");
                dbClient.AddParameter("BotId", Bot.Id);
                DataTable BotSpeech = dbClient.getTable();

                foreach (DataRow Speech in BotSpeech.Rows)
                {
                    BotSpeechList.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Bot.Id));
                }
            }

            RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(Bot.Id, Session.GetHabbo().CurrentRoomId, Convert.ToString(GetData["ai_type"]), Convert.ToString(GetData["walk_mode"]), Bot.Name, "", Bot.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, Bot.OwnerId, RavenEnvironment.EnumToBool(GetData["automatic_chat"].ToString()), Convert.ToInt32(GetData["speaking_interval"]), RavenEnvironment.EnumToBool(GetData["mix_sentences"].ToString()), Convert.ToInt32(GetData["chat_bubble"])), null);

            BotUser.Chat("¡Hola " + Session.GetHabbo().Username + "!", false, 0);

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


            Bot ToRemove = null;

            if (!Session.GetHabbo().GetInventoryComponent().TryRemoveBot(BotId, out ToRemove))
            {
                Console.WriteLine("Error whilst removing Bot: " + ToRemove.Id);
                return;
            }
            Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

            if (!BiosEmuThiago.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            int  ItemId = Packet.PopInt();
            Item Item   = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            int PetId = Packet.PopInt();

            RoomUser PetUser = null;

            if (!Room.GetRoomUserManager().TryGetPet(PetId, out PetUser))
            {
                return;
            }

            if (PetUser.PetData == null || PetUser.PetData.OwnerId != Session.GetHabbo().Id)
            {
                return;
            }

            //If the horse already had a saddle on his back, it will replace this current saddle, so we put back it on the inventory.
            if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_1 || Item.Data.InteractionType == InteractionType.HORSE_SADDLE_2)
            {
                if (PetUser.PetData.Saddle > 0)
                {
                    //Fetch the furniture Id for the pets current saddle.
                    int SaddleId = ItemUtility.GetSaddleId(PetUser.PetData.Saddle);
                    //Give the saddle back to the user.
                    ItemData ItemData = null;
                    if (!BiosEmuThiago.GetGame().GetItemManager().GetItem(SaddleId, out ItemData))
                    {
                        return;
                    }
                    Item NewSaddle = ItemFactory.CreateSingleItemNullable(ItemData, Session.GetHabbo(), "", "", 0, 0, 0);
                    if (NewSaddle != null)
                    {
                        Session.GetHabbo().GetInventoryComponent().TryAddItem(NewSaddle);
                        Session.SendMessage(new FurniListNotificationComposer(NewSaddle.Id, 1));
                        Session.SendMessage(new PurchaseOKComposer());
                        Session.SendMessage(new FurniListAddComposer(NewSaddle));
                        Session.SendMessage(new FurniListUpdateComposer());
                    }
                }
            }

            if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_1)
            {
                PetUser.PetData.Saddle = 9;
                using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots_petdata` SET `have_saddle` = '9' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1");
                    dbClient.runFastQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }

                //We only want to use this if we're successful.
                Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false);
            }
            else if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_2)
            {
                PetUser.PetData.Saddle = 10;
                using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots_petdata` SET `have_saddle` = '10' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1");
                    dbClient.runFastQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }

                //We only want to use this if we're successful.
                Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false);
            }
            else if (Item.Data.InteractionType == InteractionType.HORSE_HAIRSTYLE)
            {
                int DefaultHairType = 100;
                int HairType        = int.Parse(Item.GetBaseItem().ItemName.Split('_')[2]);
                if (HairType == 0)
                {
                    PetUser.PetData.PetHair = -1;
                }
                else
                {
                    PetUser.PetData.PetHair = DefaultHairType + HairType;
                }
                using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots_petdata` SET `pethair` = '" + PetUser.PetData.PetHair + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1");
                    dbClient.runFastQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }
                //We only want to use this if we're successful.
                Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false);
            }
            else if (Item.Data.InteractionType == InteractionType.HORSE_HAIR_DYE)
            {
                int DefaultHairDye = 48;
                int HairDye        = int.Parse(Item.GetBaseItem().ItemName.Split('_')[2]);
                if (HairDye == 1)
                {
                    PetUser.PetData.HairDye = 1;
                }
                else if (HairDye >= 13)
                {
                    PetUser.PetData.HairDye = DefaultHairDye + HairDye + 20;
                }
                else
                {
                    PetUser.PetData.HairDye = DefaultHairDye + HairDye;
                }
                using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots_petdata` SET `hairdye` = '" + PetUser.PetData.HairDye + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1");
                    dbClient.runFastQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }
                //We only want to use this if we're successful.
                Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false);
            }
            else if (Item.Data.InteractionType == InteractionType.HORSE_BODY_DYE)
            {
                int Race     = int.Parse(Item.GetBaseItem().ItemName.Split('_')[2]);
                int RaceType = (Race * 4) - 2;
                if (Race >= 13 && Race <= 18)
                {
                    RaceType = ((2 + Race) * 4) + 1;
                }
                if (Race == 0)
                {
                    RaceType = 0;
                }
                PetUser.PetData.Race = RaceType.ToString();
                using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots_petdata` SET `race` = '" + PetUser.PetData.Race + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1");
                    dbClient.runFastQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }
                //We only want to use this if we're successful.
                Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false);
            }

            //Update the Pet and the Pet figure information.
            Room.SendMessage(new UsersComposer(PetUser));
            Room.SendMessage(new PetHorseFigureInformationComposer(PetUser));
        }
Ejemplo n.º 49
0
 public UsersComposer(RoomUser User)
     : base(ServerPacketHeader.UsersMessageComposer)
 {
     WriteInteger(1);//1 avatar
     WriteUser(User);
 }
Ejemplo n.º 50
0
 internal void Dispose()
 {
     user    = null;
     message = null;
 }
Ejemplo n.º 51
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor dale una razon a los usuarios.");
                return;
            }

            string Message = CommandManager.MergeParams(Params, 1);

            foreach (RoomUser RoomUser in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (RoomUser == null || RoomUser.IsBot || RoomUser.GetClient() == null || RoomUser.GetClient().GetHabbo() == null || RoomUser.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool") || RoomUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id)
                {
                    continue;
                }

                RoomUser.GetClient().SendNotification("Usted ha sido expulsado por un moderador por la siguiente razon: " + Message);

                Room.GetRoomUserManager().RemoveUserFromRoom(RoomUser.GetClient(), true, false);
            }

            Session.SendWhisper("Expulso a todos correctamente");
        }
Ejemplo n.º 52
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to push.");
                return;
            }

            if (!Room.SPushEnabled && !Room.CheckRights(Session, true) && !Session.GetHabbo().GetPermissions().HasRight("room_override_custom_config"))
            {
                Session.SendWhisper("Oops, it appears that the room owner has disabled the ability to use the push command in here.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);

            if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Come on, surely you don't want to push yourself!");
                return;
            }

            if (TargetUser.TeleportEnabled)
            {
                Session.SendWhisper("Oops, you cannot push a user whilst they have their teleport mode enabled.");
                return;
            }

            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (ThisUser == null)
            {
                return;
            }

            if (!((Math.Abs(TargetUser.X - ThisUser.X) >= 2) || (Math.Abs(TargetUser.Y - ThisUser.Y) >= 2)))
            {
                if (TargetUser.SetX - 1 == Room.GetGameMap().Model.DoorX || TargetUser.SetY - 1 == Room.GetGameMap().Model.DoorY)
                {
                    Session.SendWhisper("Please don't push that user out of the room :(!");
                    return;
                }

                if (TargetUser.SetX - 2 == Room.GetGameMap().Model.DoorX || TargetUser.SetY - 2 == Room.GetGameMap().Model.DoorY)
                {
                    Session.SendWhisper("Please don't push that user out of the room :(!");
                    return;
                }

                if (TargetUser.SetX - 3 == Room.GetGameMap().Model.DoorX || TargetUser.SetY - 3 == Room.GetGameMap().Model.DoorY)
                {
                    Session.SendWhisper("Please don't push that user out of the room :(!");
                    return;
                }

                if (TargetUser.RotBody == 4)
                {
                    TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 3);
                }

                if (ThisUser.RotBody == 0)
                {
                    TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 3);
                }

                if (ThisUser.RotBody == 6)
                {
                    TargetUser.MoveTo(TargetUser.X - 3, TargetUser.Y);
                }

                if (ThisUser.RotBody == 2)
                {
                    TargetUser.MoveTo(TargetUser.X + 3, TargetUser.Y);
                }

                if (ThisUser.RotBody == 3)
                {
                    TargetUser.MoveTo(TargetUser.X + 3, TargetUser.Y);
                    TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 3);
                }

                if (ThisUser.RotBody == 1)
                {
                    TargetUser.MoveTo(TargetUser.X + 3, TargetUser.Y);
                    TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 3);
                }

                if (ThisUser.RotBody == 7)
                {
                    TargetUser.MoveTo(TargetUser.X - 3, TargetUser.Y);
                    TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 3);
                }

                if (ThisUser.RotBody == 5)
                {
                    TargetUser.MoveTo(TargetUser.X - 3, TargetUser.Y);
                    TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 3);
                }

                Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*super pushes " + Params[1] + "*", 0, ThisUser.LastBubble));
            }
            else
            {
                Session.SendWhisper("Oops, " + Params[1] + " is not close enough!");
            }
        }
Ejemplo n.º 53
0
 internal void AddPointToTeam(Team team, RoomUser user)
 {
     this.AddPointToTeam(team, 1, user);
 }
Ejemplo n.º 54
0
 public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRight)
 {
     if (Session != null)
     {
         RoomUser roomUserByHabbo = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);
         Room     room            = Item.GetRoom();
         if (Item.GetRoom().method_99(Item.GetX, Item.GetY, roomUserByHabbo.X, roomUserByHabbo.Y))
         {
             Item.GetRoom().method_10(roomUserByHabbo, Item);
             int num  = Item.GetX;
             int num2 = Item.GetY;
             Item.ExtraData = "11";
             if (roomUserByHabbo.RotBody == 4)
             {
                 num2--;
             }
             else
             {
                 if (roomUserByHabbo.RotBody == 0)
                 {
                     num2++;
                 }
                 else
                 {
                     if (roomUserByHabbo.RotBody == 6)
                     {
                         num++;
                     }
                     else
                     {
                         if (roomUserByHabbo.RotBody == 2)
                         {
                             num--;
                         }
                         else
                         {
                             if (roomUserByHabbo.RotBody == 3)
                             {
                                 num--;
                                 num2--;
                             }
                             else
                             {
                                 if (roomUserByHabbo.RotBody == 1)
                                 {
                                     num--;
                                     num2++;
                                 }
                                 else
                                 {
                                     if (roomUserByHabbo.RotBody == 7)
                                     {
                                         num++;
                                         num2++;
                                     }
                                     else
                                     {
                                         if (roomUserByHabbo.RotBody == 5)
                                         {
                                             num++;
                                             num2--;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             roomUserByHabbo.MoveTo(Item.GetX, Item.GetY);
             room.method_79(null, Item, num, num2, 0, false, true, true);
         }
     }
 }
Ejemplo n.º 55
0
        public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights)
        {
            if (Session == null || Session.GetHabbo() == null || Item == null)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (Actor == null)
            {
                return;
            }

            var tick = int.Parse(Item.ExtraData);

            if (tick < 23)
            {
                if (Actor.CurrentEffect == 27)
                {
                    if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) < 2)
                    {
                        RoomUser ThisUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);
                        Random   random   = new Random();
                        tick++;
                        Item.ExtraData = tick.ToString();
                        Item.UpdateState(true, true);
                        int    X = Item.GetX, Y = Item.GetY, Rot = Item.Rotation;
                        Double Z            = Item.GetZ;
                        int    randomNumber = random.Next(1, 9);
                        if (randomNumber == 1)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Contra ataque -Estilo Terra chão de água roxa- no(a) [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                            Session.GetHabbo().Effects().ApplyEffect(185);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Estou preso em um chão de água roxa*", 0, 6));
                            System.Threading.Thread.Sleep(3000);
                            Session.GetHabbo().Effects().ApplyEffect(27);
                        }
                        if (randomNumber == 2)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Contra ataque -Estilo Vacuo explosão de bombas- no(a) [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                            Session.GetHabbo().Effects().ApplyEffect(108);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*AIIIIIII Fui atingido por uma bomba*", 0, 6));
                            System.Threading.Thread.Sleep(3000);
                            Session.GetHabbo().Effects().ApplyEffect(27);
                        }
                        if (randomNumber == 3)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Contra ataque -Estilo Cura sugador de vida- no(a) [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                            Session.GetHabbo().Effects().ApplyEffect(23);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Minha vida esta sendo sugada!", 0, 6));
                            System.Threading.Thread.Sleep(3000);
                            Session.GetHabbo().Effects().ApplyEffect(27);
                            tick--;
                            tick--;
                            Item.ExtraData = tick.ToString();
                            Item.UpdateState(true, true);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Peguei 50% da vida do [" + ThisUser.GetUsername().ToString() + "] para me curar 2%", 0, 34));
                        }
                        if (randomNumber == 4)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Essa doeu [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                        }
                        if (randomNumber == 5)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Ate que você não é ruim [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                        }
                        if (randomNumber == 6)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Você ate que é forte, ate me lembra um antiga pessoa. [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                        }
                        if (randomNumber == 7)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Como ousar em mim enfrentar [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                        }
                        if (randomNumber == 8)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Ate que você não é ruim [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                        }
                        if (randomNumber == 9)
                        {
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Contra ataque -Estilo Cura sugador de vida- no(a) [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                            Session.GetHabbo().Effects().ApplyEffect(23);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Minha vida esta sendo sugada!", 0, 6));
                            System.Threading.Thread.Sleep(3000);
                            Session.GetHabbo().Effects().ApplyEffect(27);
                            tick--;
                            tick--;
                            tick--;
                            tick--;
                            tick--;
                            tick--;
                            tick--;
                            Item.ExtraData = tick.ToString();
                            Item.UpdateState(true, true);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Peguei 80% da vida do [" + ThisUser.GetUsername().ToString() + "] para me curar 10%", 0, 34));
                        }

                        if (tick == 19)
                        {
                            BiosEmuThiago.GetGame().GetPinataManager().ReceiveCrackableReward(Actor, Room, Item);
                            Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "[Boss] " + "Fui derrotado por um simples humano! WINS: [" + ThisUser.GetUsername().ToString() + "]", 0, 34));
                        }
                    }
                }
                else
                {
                    Session.SendWhisper("Ops, você não esta com os equipamentos de luta! digite o comando[:efeito 27] (fix By: Thiago Araujo)");
                    return;
                }
            }
        }
Ejemplo n.º 56
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            if (!Session.GetHabbo().CurrentRoom.CheckRights(Session, true))
            {
                return;
            }
            Room     room       = Session.GetHabbo().CurrentRoom;
            uint     id         = Event.PopWiredUInt();
            int      ActionType = Event.PopWiredInt32();
            RoomUser BotUser    = room.getBot(id);

            /*string Username = Event.PopFixedString();
             *
             * BotUser.RoomBot.Name = Username;
             * using(DatabaseClient dbClient = Essential.GetDatabase().GetClient())
             * {
             *  dbClient.AddParamWithValue("username", Username);
             *  dbClient.ExecuteQuery("UPDATE user_bots SET name=@username WHERE id=" + id);
             * }*/

            List <RandomSpeech> list  = new List <RandomSpeech>();
            List <BotResponse>  list2 = new List <BotResponse>();
            int     currentX          = BotUser.X;
            int     currentY          = BotUser.Y;
            int     currentRot        = BotUser.BodyRotation;
            double  currentH          = BotUser.double_0;
            UserBot bot = null;

            switch (ActionType)
            {
            case 1:
                string Look = Session.GetHabbo().Figure;
                BotUser.RoomBot.Look = Look;
                room.method_6(BotUser.VirtualId, false);
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("look", Look);
                    dbClient.ExecuteQuery("UPDATE user_bots SET look=@look WHERE id=" + id);
                    bot = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + id));
                }
                room.AddBotToRoom(new RoomBot(id, Session.GetHabbo().CurrentRoomId, AIType.UserBot, "freeroam", BotUser.RoomBot.Name, BotUser.RoomBot.Motto, Look, currentX, currentY, 0, currentRot, 0, 0, 0, 0, ref list, ref list2, 0), bot);
                break;

            case 2:
                string   Data = Event.PopFixedString();
                DataRow  BotData;
                string[] firstdata        = Data.Split(';');
                string[] toinendata       = firstdata[0].Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                string   automaticChat    = firstdata[2];
                string   speakingInterval = firstdata[4];    //seconds

                if (String.IsNullOrEmpty(speakingInterval) || Convert.ToInt32(speakingInterval) <= 0)
                {
                    speakingInterval = "7";
                }
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("DELETE FROM bots_speech WHERE bot_id = '" + id + "'");
                }
                for (int i = 0; i <= toinendata.Length - 1; i++)
                {
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.AddParamWithValue("data", toinendata[i]);
                        dbClient.ExecuteQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES ('" + id + "', @data)");
                        dbClient.ExecuteQuery("UPDATE user_bots SET automatic_chat='" + automaticChat + "',speaking_interval=" + Convert.ToInt32(speakingInterval) + " WHERE id = " + id);
                    }
                }

                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    BotData = dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id = '" + id + "'");
                }
                DataTable BotSpeech;
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    BotSpeech = dbClient.ReadDataTable("SELECT text, shout, bot_id FROM bots_speech;");
                    bot       = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + id));
                }
                foreach (DataRow Row2 in BotSpeech.Rows)
                {
                    list.Add(new RandomSpeech((string)Row2["text"], Essential.StringToBoolean(Row2["shout"].ToString()), Convert.ToUInt32(Row2["bot_id"])));
                }
                room.method_6(BotUser.VirtualId, false);
                room.AddBotToRoom(new RoomBot((uint)BotData["id"], (uint)BotData["room_id"], AIType.UserBot, "freeroam", (string)BotData["name"], (string)BotData["motto"], (string)BotData["look"], currentX, currentY, 0, currentRot, 0, 0, 0, 0, ref list, ref list2, (int)Session.GetHabbo().Id), bot);


                break;

            case 3:
                //stop dancing
                break;

            case 4:
                if (BotUser.DanceId > 0)
                {
                    BotUser.DanceId = 0;
                }
                else
                {
                    Random rnd = new Random();
                    BotUser.DanceId = rnd.Next(1, 4);
                }
                ServerMessage message = new ServerMessage(Outgoing.Dance);
                message.AppendInt32(BotUser.VirtualId);
                message.AppendInt32(BotUser.DanceId);
                Session.GetHabbo().CurrentRoom.SendMessage(message, null);
                break;

            case 5:
                string Username = Event.PopFixedString();
                if (!Essential.IsValidName(Username))
                {
                    break;
                }
                BotUser.RoomBot.Name = Username;
                room.method_6(BotUser.VirtualId, false);
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("username", Username);
                    dbClient.ExecuteQuery("UPDATE user_bots SET name=@username WHERE id=" + id);
                    bot = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + id));
                }
                room.AddBotToRoom(new RoomBot(id, Session.GetHabbo().CurrentRoomId, AIType.UserBot, "freeroam", Username, BotUser.RoomBot.Motto, BotUser.RoomBot.Look, currentX, currentY, 0, currentRot, 0, 0, 0, 0, ref list, ref list2, 0), bot);
                break;

            default:
                //nothing
                break;
            }
        }
Ejemplo n.º 57
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="TeamScoreChangedArgs" /> class.
 /// </summary>
 /// <param name="points">The points.</param>
 /// <param name="team">The team.</param>
 /// <param name="user">The user.</param>
 public TeamScoreChangedArgs(int points, Team team, RoomUser user)
 {
     Points = points;
     Team   = team;
     User   = user;
 }
Ejemplo n.º 58
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            ChatStyle Style = null;

            if (!RocketEmulador.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (RocketEmulador.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Ops, você está no momento silenciado.", 34);
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && RocketEmulador.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            RocketEmulador.GetGame().GetChatManager().GetLogs().StoreChatlog(new Rocket.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (RocketEmulador.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= RocketGame.BannedPhrasesAmount)
                {
                    RocketEmulador.GetGame().GetModerationManager().BanUser("RocketEmulador", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (RocketEmulador.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                Session.SendMessage(new ShoutComposer(User.VirtualId, Message, 0, Colour));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                Message = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
            }

            RocketEmulador.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.UnIdle();
            User.OnChat(User.LastBubble, Message, true);
        }
Ejemplo n.º 59
0
 internal void MoveBall(RoomItem item, GameClient client, Point user, Point ball, int length, RoomUser useroom)
 {
 }
Ejemplo n.º 60
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int    BotId      = Packet.PopInt();
            int    ActionId   = Packet.PopInt();
            string DataString = Packet.PopString();

            if (ActionId < 1 || ActionId > 5)
            {
                return;
            }

            RoomUser Bot = null;

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

            if ((Bot.BotData.ownerID != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("bot_edit_any_override")))
            {
                return;
            }

            RoomBot RoomBot = Bot.BotData;

            if (RoomBot == null)
            {
                return;
            }

            /* 1 = Copy looks
             * 2 = Setup Speech
             * 3 = Relax
             * 4 = Dance
             * 5 = Change Name
             */

            switch (ActionId)
            {
                #region Copy Looks (1)
            case 1:
            {
                ServerPacket UserChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer);
                UserChangeComposer.WriteInteger(Bot.VirtualId);
                UserChangeComposer.WriteString(Session.GetHabbo().Look);
                UserChangeComposer.WriteString(Session.GetHabbo().Gender);
                UserChangeComposer.WriteString(Bot.BotData.Motto);
                UserChangeComposer.WriteInteger(0);
                Room.SendMessage(UserChangeComposer);

                //Change the defaults
                Bot.BotData.Look   = Session.GetHabbo().Look;
                Bot.BotData.Gender = Session.GetHabbo().Gender;

                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = '" + Session.GetHabbo().Gender + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                    dbClient.AddParameter("look", Session.GetHabbo().Look);
                    dbClient.RunQuery();
                }

                //Room.SendMessage(new UserChangeComposer(BotUser.GetClient(), true));
                break;
            }
                #endregion

                #region Setup Speech (2)
            case 2:
            {
                string[] ConfigData = DataString.Split(new string[]
                    {
                        ";#;"
                    }, StringSplitOptions.None);

                string[] SpeechData = ConfigData[0].Split(new char[]
                    {
                        '\r',
                        '\n'
                    }, StringSplitOptions.RemoveEmptyEntries);

                string AutomaticChat    = Convert.ToString(ConfigData[1]);
                string SpeakingInterval = Convert.ToString(ConfigData[2]);
                string MixChat          = Convert.ToString(ConfigData[3]);

                if (String.IsNullOrEmpty(SpeakingInterval) || Convert.ToInt32(SpeakingInterval) <= 0 || Convert.ToInt32(SpeakingInterval) < 7)
                {
                    SpeakingInterval = "7";
                }

                RoomBot.AutomaticChat    = Convert.ToBoolean(AutomaticChat);
                RoomBot.SpeakingInterval = Convert.ToInt32(SpeakingInterval);
                RoomBot.MixSentences     = Convert.ToBoolean(MixChat);

                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                { dbClient.runFastQuery("DELETE FROM `bots_speech` WHERE `bot_id` = '" + Bot.BotData.Id + "'"); }

                #region Save Data - TODO: MAKE METHODS FOR THIS.
                for (int i = 0; i <= SpeechData.Length - 1; i++)
                {
                    using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES (@id, @data)");
                        dbClient.AddParameter("id", BotId);
                        dbClient.AddParameter("data", SpeechData[i]);
                        dbClient.RunQuery();

                        dbClient.SetQuery("UPDATE `bots` SET `automatic_chat` = @AutomaticChat, `speaking_interval` = @SpeakingInterval, `mix_sentences` = @MixChat WHERE `id` = @id LIMIT 1");
                        dbClient.AddParameter("id", BotId);
                        dbClient.AddParameter("AutomaticChat", AutomaticChat.ToLower());
                        dbClient.AddParameter("SpeakingInterval", Convert.ToInt32(SpeakingInterval));
                        dbClient.AddParameter("MixChat", CloudServer.BoolToEnum(Convert.ToBoolean(MixChat)));
                        dbClient.RunQuery();
                    }
                }
                #endregion

                #region Handle Speech
                RoomBot.RandomSpeech.Clear();
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT * FROM `bots_speech` WHERE `bot_id` = @id ORDER BY id ASC");
                    dbClient.AddParameter("id", BotId);

                    DataTable BotSpeech = dbClient.getTable();

                    List <RandomSpeech> Speeches = new List <RandomSpeech>();
                    foreach (DataRow Speech in BotSpeech.Rows)
                    {
                        RoomBot.RandomSpeech.Add(new RandomSpeech(Convert.ToString(Speech["text"]), BotId));
                    }
                }
                #endregion

                break;
            }
                #endregion

                #region Relax (3)
            case 3:
            {
                if (Bot.BotData.WalkingMode == "stand")
                {
                    Bot.BotData.WalkingMode = "freeroam";
                }
                else
                {
                    Bot.BotData.WalkingMode = "stand";
                }

                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `bots` SET `walk_mode` = '" + Bot.BotData.WalkingMode + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                }
                break;
            }
                #endregion

                #region Dance (4)
            case 4:
            {
                if (Bot.BotData.DanceId > 0)
                {
                    Bot.BotData.DanceId = 0;
                }
                else
                {
                    Random RandomDance = new Random();
                    Bot.BotData.DanceId = RandomDance.Next(1, 4);
                }

                Room.SendMessage(new DanceComposer(Bot, Bot.BotData.DanceId));
                break;
            }
                #endregion

                #region Change Name (5)
            case 5:
            {
                if (DataString.Length == 0)
                {
                    Session.SendWhisper("Vamos, al menos dale un nombre al bot!");
                    return;
                }
                else if (DataString.Length >= 16)
                {
                    Session.SendWhisper("Vamos, el bot no necesita un nombre tan largo!");
                    return;
                }

                if (DataString.Contains("<img src") || DataString.Contains("<font ") || DataString.Contains("</font>") || DataString.Contains("</a>") || DataString.Contains("<i>"))
                {
                    Session.SendWhisper("No HTML, Porfavor :<");
                    return;
                }

                Bot.BotData.Name = DataString;
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `name` = @name WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                    dbClient.AddParameter("name", DataString);
                    dbClient.RunQuery();
                }
                Room.SendMessage(new UsersComposer(Bot));
                break;
            }
                #endregion
            }
        }