예제 #1
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            StringBuilder Message = new StringBuilder().Append("<----- Usuários com Recompensas ----->\n\n");

            if (BountyManager.BountyUsers.Count <= 0)
            {
                Message.Append("Ninguém está em uma recompensa agora!\n");
            }

            lock (BountyManager.BountyUsers.Values)
            {
                foreach (Bounty Bounty in BountyManager.BountyUsers.Values)
                {
                    if (PlusEnvironment.GetUnixTimestamp() > Bounty.ExpiryTimeStamp)
                    {
                        BountyManager.RemoveBounty(Bounty.UserId, true);
                        Habbo BountyOwner = PlusEnvironment.GetHabboById(Convert.ToInt32(Bounty.AddedBy));

                        if (BountyOwner == null || BountyOwner.GetClient() == null)
                        {
                            continue;
                        }

                        BountyOwner.GetClient().SendWhisper("A recompensa que você definiu " + PlusEnvironment.GetHabboById(Convert.ToInt32(Bounty.UserId)).Username + " expirou!", 1);
                    }

                    TimeSpan Difference = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Bounty.ExpiryTimeStamp).Subtract(new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(PlusEnvironment.GetUnixTimestamp()));

                    Message.Append("Usuário: " + PlusEnvironment.GetHabboById(Convert.ToInt32(Bounty.UserId)).Username + " - Expira em " + ((int)Difference.TotalMinutes < 0 ? 0 : (int)Difference.TotalMinutes) + " minutos\n");
                    Message.Append("Recompensa: R$" + String.Format("{0:N0}", Bounty.Reward) + "\n\n");
                }
            }
            Session.SendMessage(new MOTDNotificationComposer(Message.ToString()));
        }
예제 #2
0
 public void LogCommand(int UserId, string Data, string MachineId, string Type)
 {
     using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
     {
         if (Type.ToLower() == "staff")
         {
             dbClient.SetQuery("INSERT INTO `command_logs_staff` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         }
         else if (Type.ToLower() == "ambassador")
         {
             dbClient.SetQuery("INSERT INTO `command_logs_ambassador` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         }
         else if (Type.ToLower() == "job")
         {
             dbClient.SetQuery("INSERT INTO `command_logs_jobs` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         }
         else if (Type.ToLower() == "vip")
         {
             dbClient.SetQuery("INSERT INTO `command_logs_vip` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         }
         else if (Type.ToLower() == "event")
         {
             dbClient.SetQuery("INSERT INTO `command_logs_events` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         }
         else
         {
             dbClient.SetQuery("INSERT INTO `command_logs_users` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         }
         dbClient.AddParameter("UserId", UserId);
         dbClient.AddParameter("Data", Data);
         dbClient.AddParameter("MachineId", MachineId);
         dbClient.AddParameter("Timestamp", PlusEnvironment.GetUnixTimestamp());
         dbClient.RunQuery();
     }
 }
예제 #3
0
        public void BanUser(string mod, ModerationBanType type, string banValue, string reason, double expireTimestamp)
        {
            var banType = type == ModerationBanType.Ip ? "ip" : type == ModerationBanType.Machine ? "machine" : "user";

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    "REPLACE INTO `bans` (`bantype`, `value`, `reason`, `expire`, `added_by`,`added_date`) VALUES ('" +
                    banType +
                    "', '" +
                    banValue +
                    "', @reason, " +
                    expireTimestamp +
                    ", '" +
                    mod +
                    "', '" +
                    PlusEnvironment.GetUnixTimestamp() +
                    "');");
                dbClient.AddParameter("reason", reason);
                dbClient.RunQuery();
            }
            if (type == ModerationBanType.Machine || type == ModerationBanType.Username)
            {
                if (!_bans.ContainsKey(banValue))
                {
                    _bans.Add(banValue, new ModerationBan(type, banValue, reason, expireTimestamp));
                }
            }
        }
        public ProfileInformationComposer(Habbo Data, GameClient Session, List <Group> Groups, int friendCount)
            : base(ServerPacketHeader.ProfileInformationMessageComposer)
        {
            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Data.AccountCreated);

            base.WriteInteger(Data.Id);
            base.WriteString(Data.Username);
            base.WriteString(Data.Look);
            base.WriteString(Data.Motto);
            base.WriteString(origin.ToString("dd/MM/yyyy"));
            base.WriteInteger(Data.GetStats().AchievementPoints);
            base.WriteInteger(friendCount);                                                                                                                                                 // Friend Count
            base.WriteBoolean(Data.Id != Session.GetHabbo().Id&& Session.GetHabbo().GetMessenger().FriendshipExists(Data.Id));                                                              //  Is friend
            base.WriteBoolean(Data.Id != Session.GetHabbo().Id&& !Session.GetHabbo().GetMessenger().FriendshipExists(Data.Id) && Session.GetHabbo().GetMessenger().RequestExists(Data.Id)); // Sent friend request
            base.WriteBoolean((PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Data.Id)) != null);

            base.WriteInteger(Groups.Count);
            foreach (Group Group in Groups)
            {
                base.WriteInteger(Group.Id);
                base.WriteString(Group.Name);
                base.WriteString(Group.Badge);
                base.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true));
                base.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false));
                base.WriteBoolean(Data.GetStats().FavouriteGroupId == Group.Id); // todo favs
                base.WriteInteger(0);                                            //what the f**k
                base.WriteBoolean(Group != null ? Group.ForumEnabled : true);    //HabboTalk
            }

            base.WriteInteger(Convert.ToInt32(PlusEnvironment.GetUnixTimestamp() - Data.LastOnline)); // Last online
            base.WriteBoolean(true);                                                                  // Show the profile
        }
예제 #5
0
        internal void BanzaiStart()
        {
            if (isBanzaiActive)
            {
                return;
            }

            floorMap    = new byte[_room.GetGameMap().Model.MapSizeY, _room.GetGameMap().Model.MapSizeX];
            field       = new GameField(floorMap, true);
            timestarted = PlusEnvironment.GetUnixTimestamp();
            _room.GetGameManager().LockGates();
            for (var i = 1; i < 5; i++)
            {
                _room.GetGameManager().Points[i] = 0;
            }
            foreach (var tile in _banzaiTiles.Values)
            {
                tile.ExtraData = "1";
                tile.Value     = 0;
                tile.Team      = TEAM.NONE;
                tile.UpdateState();
            }

            ResetTiles();
            isBanzaiActive = true;
            _room.GetWired().TriggerEvent(WiredBoxType.TriggerGameStarts, null);
            foreach (var user in _room.GetRoomUserManager().GetRoomUsers())
            {
                user.LockedTilesCount = 0;
            }
        }
예제 #6
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Digite o usuário que deseja banir o IP.", 1);
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.", 1);
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Opa, você não pode proibir esse usuário.", 1);
                return;
            }

            String IPAddress = String.Empty;
            Double Expire    = PlusEnvironment.GetUnixTimestamp() + 78892200;
            string Username  = Habbo.Username;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");

                dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
                IPAddress = dbClient.getString();
            }

            string Reason = null;

            if (Params.Length >= 3)
            {
                Reason = CommandManager.MergeParams(Params, 2);
            }
            else
            {
                Reason = "Sem razão específica, mas provavelmente fez merda.";
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username);

            Session.SendWhisper("Successo, você baniu o usuário '" + Username + "' no ip, '" + Reason + "'!", 1);

            if (!string.IsNullOrEmpty(IPAddress))
            {
                PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire);
            }
            PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire);

            if (TargetClient != null)
            {
                TargetClient.Disconnect(true);
            }
        }
예제 #7
0
        public void BanzaiStart()
        {
            if (banzaiStarted)
            {
                return;
            }

            floorMap    = new byte[_room.GetGameMap().Model.MapSizeY, _room.GetGameMap().Model.MapSizeX];
            field       = new GameField(floorMap, true);
            timestarted = PlusEnvironment.GetUnixTimestamp();
            _room.GetGameManager().LockGates();
            for (int i = 1; i < 5; i++)
            {
                _room.GetGameManager().Points[i] = 0;
            }

            foreach (Item tile in _banzaiTiles.Values)
            {
                tile.ExtraData = "1";
                tile.value     = 0;
                tile.team      = Team.None;
                tile.UpdateState();
            }

            this.ResetTiles();
            banzaiStarted = true;

            _room.GetWired().TriggerEvent(WiredBoxType.TriggerGameStarts, null);

            foreach (RoomUser user in _room.GetRoomUserManager().GetRoomUsers())
            {
                user.LockedTilesCount = 0;
            }
        }
예제 #8
0
 public void ChangeName(string username)
 {
     LastNameChange = PlusEnvironment.GetUnixTimestamp();
     Username       = username;
     SaveKey("username", username);
     SaveKey("last_change", LastNameChange.ToString());
 }
예제 #9
0
        public void OnTrigger(GameClient session, Item item, int request, bool hasRights)
        {
            if (session == null)
            {
                return;
            }

            var user = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (item.InteractingUser2 != user.UserId)
            {
                item.InteractingUser2 = user.UserId;
            }
            if (user == null)
            {
                return;
            }

            if (item.GetBaseItem().InteractionType == InteractionType.OneWayGate)
            {
                if (user.Coordinate != item.SquareInFront && user.CanWalk)
                {
                    user.MoveTo(item.SquareInFront);
                    return;
                }

                if (!item.GetRoom().GetGameMap().ValidTile(item.SquareBehind.X, item.SquareBehind.Y) ||
                    !item.GetRoom().GetGameMap().CanWalk(item.SquareBehind.X, item.SquareBehind.Y, false) ||
                    !item.GetRoom().GetGameMap().SquareIsOpen(item.SquareBehind.X, item.SquareBehind.Y, false))
                {
                    return;
                }

                if (user.LastInteraction - PlusEnvironment.GetUnixTimestamp() < 0 && user.InteractingGate &&
                    user.GateId == item.Id)
                {
                    user.InteractingGate = false;
                    user.GateId          = 0;
                }
                if (!item.GetRoom().GetGameMap().CanWalk(item.SquareBehind.X, item.SquareBehind.Y, user.AllowOverride))
                {
                    return;
                }

                if (item.InteractingUser == 0)
                {
                    user.InteractingGate = true;
                    user.GateId          = item.Id;
                    item.InteractingUser = user.HabboId;
                    user.CanWalk         = false;
                    if (user.IsWalking && (user.GoalX != item.SquareInFront.X || user.GoalY != item.SquareInFront.Y))
                    {
                        user.ClearMovement(true);
                    }
                    user.AllowOverride = true;
                    user.MoveTo(item.Coordinate);
                    item.RequestUpdate(4, true);
                }
            }
        }
예제 #10
0
        private bool CanChangeName(Habbo habbo)
        {
            if (habbo.Rank == 1 && habbo.VipRank == 0 && habbo.LastNameChange == 0)
            {
                return(true);
            }
            if (habbo.Rank == 1 &&
                habbo.VipRank == 1 &&
                (habbo.LastNameChange == 0 || PlusEnvironment.GetUnixTimestamp() + 604800 > habbo.LastNameChange))
            {
                return(true);
            }
            if (habbo.Rank == 1 &&
                habbo.VipRank == 2 &&
                (habbo.LastNameChange == 0 || PlusEnvironment.GetUnixTimestamp() + 86400 > habbo.LastNameChange))
            {
                return(true);
            }
            if (habbo.Rank == 1 && habbo.VipRank == 3)
            {
                return(true);
            }
            if (habbo.GetPermissions().HasRight("mod_tool"))
            {
                return(true);
            }

            return(false);
        }
예제 #11
0
        public ProfileInformationComposer(Habbo habbo, GameClient session, List <Group> groups, int friendCount)
            : base(ServerPacketHeader.ProfileInformationMessageComposer)
        {
            var origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(habbo.AccountCreated);

            WriteInteger(habbo.Id);
            WriteString(habbo.Username);
            WriteString(habbo.Look);
            WriteString(habbo.Motto);
            WriteString(origin.ToString("dd/MM/yyyy"));
            WriteInteger(habbo.GetStats().AchievementPoints);
            WriteInteger(friendCount);                                                                                      // Friend Count
            WriteBoolean(habbo.Id != session.GetHabbo().Id&& session.GetHabbo().GetMessenger().FriendshipExists(habbo.Id)); //  Is friend
            WriteBoolean(habbo.Id != session.GetHabbo().Id&& !session.GetHabbo().GetMessenger().FriendshipExists(habbo.Id) &&
                         session.GetHabbo().GetMessenger().RequestExists(habbo.Id));                                        // Sent friend request
            WriteBoolean(PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(habbo.Id) != null);

            WriteInteger(groups.Count);
            foreach (var group in groups)
            {
                WriteInteger(group.Id);
                WriteString(group.Name);
                WriteString(group.Badge);
                WriteString(PlusEnvironment.GetGame().GetGroupManager().GetColourCode(group.Colour1, true));
                WriteString(PlusEnvironment.GetGame().GetGroupManager().GetColourCode(group.Colour2, false));
                WriteBoolean(habbo.GetStats().FavouriteGroupId == group.Id); // todo favs
                WriteInteger(0);                                             //what the f**k
                WriteBoolean(group != null ? group.ForumEnabled : true);     //HabboTalk
            }

            WriteInteger(Convert.ToInt32(PlusEnvironment.GetUnixTimestamp() - habbo.LastOnline)); // Last online
            WriteBoolean(true);                                                                   // Show the profile
        }
예제 #12
0
        public static Pet CreatePet(int UserId, string Name, int Type, string Race, string Color)
        {
            var pet = new Pet(0, UserId, 0, Name, Type, Race, Color, 0, 100, 100, 0, PlusEnvironment.GetUnixTimestamp(), 0, 0,
                              0.0, 0, 0, 0, -1, "-1");

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO bots (user_id,name, ai_type) VALUES (" + pet.OwnerId + ",@" + pet.PetId +
                                  "name, 'pet')");
                dbClient.AddParameter(pet.PetId + "name", pet.Name);
                pet.PetId = Convert.ToInt32(dbClient.InsertQuery());
                dbClient.SetQuery("INSERT INTO bots_petdata (id,type,race,color,experience,energy,createstamp) VALUES (" +
                                  pet.PetId +
                                  ", " +
                                  pet.Type +
                                  ",@" +
                                  pet.PetId +
                                  "race,@" +
                                  pet.PetId +
                                  "color,0,100,UNIX_TIMESTAMP())");
                dbClient.AddParameter(pet.PetId + "race", pet.Race);
                dbClient.AddParameter(pet.PetId + "color", pet.Color);
                dbClient.RunQuery();
            }
            return(pet);
        }
예제 #13
0
        public static void CheckBounty(GameClient Session, int UserId)
        {
            try
            {
                if (Session == null || !BountyUsers.ContainsKey(UserId))
                {
                    return;
                }

                Bounty Junk;
                BountyUsers.TryRemove(UserId, out Junk);

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("DELETE FROM `rp_bounties` WHERE `user_id` = '" + UserId + "'");
                }

                if (PlusEnvironment.GetUnixTimestamp() < Junk.ExpiryTimeStamp)
                {
                    Session.Shout("*Reinvindica R$" + String.Format("{0:N0}", Junk.Reward) + " da recompensa de " + PlusEnvironment.GetHabboById(UserId).Username + "*", 4);
                    Session.SendWhisper("Você reivindicou com sucesso R$" + String.Format("{0:N0}", Junk.Reward) + " da recompensa de " + PlusEnvironment.GetHabboById(UserId).Username + "!", 1);

                    Session.GetHabbo().Credits += Junk.Reward;
                    Session.GetHabbo().UpdateCreditsBalance();
                    return;
                }
                else
                {
                    Session.SendWhisper("Você reivindicou a recompensa de " + PlusEnvironment.GetHabboById(UserId).Username + ", mas a recompensa expirou!", 1);
                    return;
                }
            }
            catch { }
        }
예제 #14
0
 public PetInformationComposer(Habbo habbo)
     : base(ServerPacketHeader.PetInformationMessageComposer)
 {
     WriteInteger(habbo.Id);
     WriteString(habbo.Username);
     WriteInteger(habbo.Rank);
     WriteInteger(10);
     WriteInteger(0);
     WriteInteger(0);
     WriteInteger(100);
     WriteInteger(100);
     WriteInteger(100);
     WriteInteger(100);
     WriteInteger(habbo.GetStats().Respect);
     WriteInteger(habbo.Id);
     WriteInteger(Convert.ToInt32(Math.Floor((PlusEnvironment.GetUnixTimestamp() - habbo.AccountCreated) / 86400))); //How?
     WriteString(habbo.Username);
     WriteInteger(1);                                                                                                //3 on hab
     WriteBoolean(false);
     WriteBoolean(false);
     WriteInteger(0); //5 on hab
     WriteInteger(0); // Anyone can ride horse
     WriteInteger(0);
     WriteInteger(0); //512 on hab
     WriteInteger(0); //1536
     WriteInteger(0); //2560
     WriteInteger(0); //3584
     WriteInteger(0);
     WriteString("");
     WriteBoolean(false);
     WriteInteger(-1); //255 on hab
     WriteInteger(-1);
     WriteInteger(-1);
     WriteBoolean(false);
 }
예제 #15
0
        public bool IncrementAndCheckFlood(out int MuteTime)
        {
            MuteTime = 0;

            ChatSpamCount++;
            if (ChatSpamTicks == -1)
            {
                ChatSpamTicks = 8;
            }
            else if (ChatSpamCount >= 6)
            {
                if (GetClient().GetHabbo().GetPermissions().HasRight("events_staff"))
                {
                    MuteTime = 3;
                }
                else if (GetClient().GetHabbo().GetPermissions().HasRight("gold_vip"))
                {
                    MuteTime = 7;
                }
                else if (GetClient().GetHabbo().GetPermissions().HasRight("silver_vip"))
                {
                    MuteTime = 10;
                }
                else
                {
                    MuteTime = 15;
                }

                GetClient().GetHabbo().FloodTime = PlusEnvironment.GetUnixTimestamp() + MuteTime;

                ChatSpamCount = 0;
                return(true);
            }
            return(false);
        }
        public ModeratorTicketChatlogComposer(SupportTicket Ticket, RoomData RoomData, double Timestamp)
            : base(ServerPacketHeader.ModeratorTicketChatlogMessageComposer)
        {
            base.WriteInteger(Ticket.TicketId);
            base.WriteInteger(Ticket.SenderId);
            base.WriteInteger(Ticket.ReportedId);
            base.WriteInteger(RoomData.Id);

            base.WriteByte(1);
            base.WriteShort(2);//Count
            base.WriteString("roomName");
            base.WriteByte(2);
            base.WriteString(RoomData.Name);
            base.WriteString("roomId");
            base.WriteByte(1);
            base.WriteInteger(RoomData.Id);

            base.WriteShort(Ticket.ReportedChats.Count);
            foreach (string Chat in Ticket.ReportedChats)
            {
                Habbo Habbo = PlusEnvironment.GetHabboById(Ticket.ReportedId);

                base.WriteInteger(((int)PlusEnvironment.GetUnixTimestamp() - Convert.ToInt32(Timestamp)) * 1000);
                base.WriteInteger(Ticket.ReportedId);
                base.WriteString(Habbo != null ? Habbo.Username : "******");
                base.WriteString(Chat);
                base.WriteBoolean(false);
            }
        }
예제 #17
0
        public override void Compose(ServerPacket packet)
        {
            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(TargetHabbo.AccountCreated);

            packet.WriteInteger(TargetHabbo.Id);
            packet.WriteString(TargetHabbo.Username);
            packet.WriteString(TargetHabbo.Look);
            packet.WriteString(TargetHabbo.Motto);
            packet.WriteString(origin.ToString("dd/MM/yyyy"));
            packet.WriteInteger(TargetHabbo.GetStats().AchievementPoints);
            packet.WriteInteger(FriendCount);                                                                                                                                      // Friend Count
            packet.WriteBoolean(TargetHabbo.Id != MyHabbo.Id && MyHabbo.GetMessenger().FriendshipExists(TargetHabbo.Id));                                                          //  Is friend
            packet.WriteBoolean(TargetHabbo.Id != MyHabbo.Id && !MyHabbo.GetMessenger().FriendshipExists(TargetHabbo.Id) && MyHabbo.GetMessenger().RequestExists(TargetHabbo.Id)); // Sent friend request
            packet.WriteBoolean((PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(TargetHabbo.Id)) != null);

            packet.WriteInteger(Groups.Count);
            foreach (Group group in Groups)
            {
                packet.WriteInteger(group.Id);
                packet.WriteString(group.Name);
                packet.WriteString(group.Badge);
                packet.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetColourCode(group.Colour1, true));
                packet.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetColourCode(group.Colour2, false));
                packet.WriteBoolean(TargetHabbo.GetStats().FavouriteGroupId == group.Id); // todo favs
                packet.WriteInteger(0);                                                   //what the f**k
                packet.WriteBoolean(group != null ? group.ForumEnabled : true);           //HabboTalk
            }

            packet.WriteInteger(Convert.ToInt32(PlusEnvironment.GetUnixTimestamp() - TargetHabbo.LastOnline)); // Last online
            packet.WriteBoolean(true);                                                                         // Show the profile
        }
 public ModeratorSupportTicketComposer(SupportTicket Ticket)
     : base(ServerPacketHeader.ModeratorSupportTicketMessageComposer)
 {
     base.WriteInteger(Ticket.Id);
     base.WriteInteger(Ticket.TabId);
     base.WriteInteger(1);               // Type
     base.WriteInteger(Ticket.Category); // Category
     base.WriteInteger(((int)PlusEnvironment.GetUnixTimestamp() - (int)Ticket.Timestamp) * 1000);
     base.WriteInteger(Ticket.Score);
     base.WriteInteger(0);
     base.WriteInteger(Ticket.SenderId);
     base.WriteString(Ticket.SenderName);
     base.WriteInteger(Ticket.ReportedId);
     base.WriteString(Ticket.ReportedName);
     base.WriteInteger((Ticket.Status == TicketStatus.PICKED) ? Ticket.ModeratorId : 0);
     base.WriteString(Ticket.ModName);
     base.WriteString(Ticket.Message);
     base.WriteInteger(0); //No idea?
     base.WriteInteger(0); //String, int, int - this is the "matched to" a string
     {
         base.WriteString("fresh-hotel.org");
         base.WriteInteger(-1);
         base.WriteInteger(-1);
     }
 }
예제 #19
0
        public void ChangeName(string Username)
        {
            this.LastNameChange = PlusEnvironment.GetUnixTimestamp();
            this.Username       = Username;

            this.SaveKey("username", Username);
            this.SaveKey("last_change", this.LastNameChange.ToString());
        }
예제 #20
0
 public RoomPromotion(string name, string description, int categoryId)
 {
     this._name             = name;
     this._description      = description;
     this._timestampStarted = PlusEnvironment.GetUnixTimestamp();
     this._timestampExpires = (PlusEnvironment.GetUnixTimestamp()) + (Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("room.promotion.lifespan")) * 60);
     this._categoryId       = categoryId;
 }
예제 #21
0
 public RoomPromotion(string Name, string Desc, int CategoryId)
 {
     this._name             = Name;
     this._description      = Desc;
     this._timestampStarted = PlusEnvironment.GetUnixTimestamp();
     this._timestampExpires = (PlusEnvironment.GetUnixTimestamp()) + (PlusStaticGameSettings.RoomPromotionLifeTime * 60);
     this._categoryId       = CategoryId;
 }
예제 #22
0
        public void Execute(GameClient session, Room room, string[] Params)
        {
            if (Params.Length == 1)
            {
                session.SendWhisper("Please enter the username of the user you'd like to IP ban & account ban.");
                return;
            }

            var habbo = PlusEnvironment.GetHabboByUsername(Params[1]);

            if (habbo == null)
            {
                session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (habbo.GetPermissions().HasRight("mod_tool") && !session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                session.SendWhisper("Oops, you cannot ban that user.");
                return;
            }

            var ipAddress = string.Empty;
            var expire    = PlusEnvironment.GetUnixTimestamp() + 78892200;
            var username  = habbo.Username;

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + habbo.Id + "' LIMIT 1");
                dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + habbo.Id + "' LIMIT 1");
                ipAddress = dbClient.GetString();
            }
            string reason = null;

            if (Params.Length >= 3)
            {
                reason = CommandManager.MergeParams(Params, 2);
            }
            else
            {
                reason = "No reason specified.";
            }
            if (!string.IsNullOrEmpty(ipAddress))
            {
                PlusEnvironment.GetGame().GetModerationManager().BanUser(session.GetHabbo().Username, ModerationBanType.Ip,
                                                                         ipAddress, reason, expire);
            }
            PlusEnvironment.GetGame()
            .GetModerationManager()
            .BanUser(session.GetHabbo().Username, ModerationBanType.Username, habbo.Username, reason, expire);
            var targetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(username);

            if (targetClient != null)
            {
                targetClient.Disconnect();
            }
            session.SendWhisper("Success, you have IP and account banned the user '" + username + "' for '" + reason + "'!");
        }
예제 #23
0
 public RoomPromotion(string Name, string Desc, int CategoryId)
 {
     this.Name        = Name;
     Description      = Desc;
     TimestampStarted = PlusEnvironment.GetUnixTimestamp();
     TimestampExpires = PlusEnvironment.GetUnixTimestamp() +
                        Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("room.promotion.lifespan")) * 60;
     this.CategoryId = CategoryId;
 }
예제 #24
0
 public void LogPM(int From_Id, int ToId, string Message)
 {
     using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
     {
         dbClient.SetQuery("INSERT INTO chatlogs_console VALUES (NULL, " + From_Id + ", " + ToId + ", @message, @timestamp)");
         dbClient.AddParameter("message", Message);
         dbClient.AddParameter("timestamp", PlusEnvironment.GetUnixTimestamp());
         dbClient.RunQuery();
     }
 }
예제 #25
0
        public bool TryCreateGroup(Habbo Player, string Name, string Description, int RoomId, string Badge, int Colour1, int Colour2, out Group Group)
        {
            Group = new Group(0, Name, Description, Badge, RoomId, Player.Id, (int)PlusEnvironment.GetUnixTimestamp(), 1, Colour1, Colour2, 0,
                              false, Name, Description, 0, 0, 0, "", 0, 1, 2, 2, 3, GenericGangRanks, new ConcurrentDictionary <int, GroupMember>(), new List <int>(), 0, 0, 0, 0);

            try
            {
                if (Gangs.Values.Where(x => x.CreatorId == Player.Id).ToList().Count > 0)
                {
                    return(false);
                }

                if (string.IsNullOrWhiteSpace(Name) || string.IsNullOrWhiteSpace(Badge))
                {
                    return(false);
                }

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO `rp_gangs` (`name`, `desc`, `badge`, `owner_id`, `created`, `room_id`, `state`, `colour1`, `colour2`, `admindeco`) VALUES (@name, @desc, @badge, @owner, UNIX_TIMESTAMP(), @room, '0', @colour1, @colour2, '0')");
                    dbClient.AddParameter("name", Group.Name);
                    dbClient.AddParameter("desc", Group.Description);
                    dbClient.AddParameter("owner", Group.CreatorId);
                    dbClient.AddParameter("badge", Group.Badge);
                    dbClient.AddParameter("room", Group.RoomId);
                    dbClient.AddParameter("colour1", Group.Colour1);
                    dbClient.AddParameter("colour2", Group.Colour2);
                    Group.Id = Convert.ToInt32(dbClient.InsertQuery());

                    if (Gangs.ContainsKey(Group.Id))
                    {
                        return(false);
                    }

                    Gangs.TryAdd(Group.Id, Group);

                    Player.GetClient().GetRoleplay().GangId      = Group.Id;
                    Player.GetClient().GetRoleplay().GangRank    = 6;
                    Player.GetClient().GetRoleplay().GangRequest = 0;

                    Group.AddNewMember(Player.Id, 6, true);

                    UserCache Junk;
                    PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(Player.Id, out Junk);
                    PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Player.Id);
                }
            }
            catch (Exception e)
            {
                log.Info(e.Message);
                return(false);
            }

            return(true);
        }
예제 #26
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session?.GetHabbo() == null || !session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            var    userId  = packet.PopInt();
            var    message = packet.PopString();
            double days    = packet.PopInt() / 1440;

            packet.PopString();
            packet.PopString();

            var length = PlusEnvironment.GetUnixTimestamp() + days * 86400;

            var habbo = PlusEnvironment.GetHabboById(userId);

            if (habbo == null)
            {
                session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (habbo.GetPermissions().HasRight("mod_trade_lock") && !session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                session.SendWhisper("Oops, you cannot trade lock another user ranked 5 or higher.");
                return;
            }

            if (days < 1)
            {
                days = 1;
            }

            if (days > 365)
            {
                days = 365;
            }

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + habbo.Id +
                                  "' LIMIT 1");
            }

            if (habbo.GetClient() == null)
            {
                return;
            }

            habbo.TradingLockExpiry = length;
            habbo.GetClient().SendNotification("You have been trade banned for " + days + " day(s)!\r\rReason:\r\r" + message);
        }
예제 #27
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null)
            {
                return;
            }

            Room room = session.GetHabbo().CurrentRoom;

            if (room == null)
            {
                return;
            }

            if (!room.GetRoomUserManager().AddAvatarToRoom(session))
            {
                room.GetRoomUserManager().RemoveUserFromRoom(session, false);
                return;//TODO: Remove?
            }

            room.SendObjects(session);

            if (session.GetHabbo().GetMessenger() != null)
            {
                session.GetHabbo().GetMessenger().OnStatusChanged(true);
            }

            if (session.GetHabbo().GetStats().QuestId > 0)
            {
                PlusEnvironment.GetGame().GetQuestManager().QuestReminder(session, session.GetHabbo().GetStats().QuestId);
            }

            session.SendPacket(new RoomEntryInfoComposer(room.RoomId, room.CheckRights(session, true)));
            session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));

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

            if (user != null && session.GetHabbo().PetId == 0)
            {
                room.SendPacket(new UserChangeComposer(user, false));
            }

            session.SendPacket(new RoomEventComposer(room, room.Promotion));

            if (room.GetWired() != null)
            {
                room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, session.GetHabbo());
            }

            if (PlusEnvironment.GetUnixTimestamp() < session.GetHabbo().FloodTime&& session.GetHabbo().FloodTime != 0)
            {
                session.SendPacket(new FloodControlComposer((int)session.GetHabbo().FloodTime - (int)PlusEnvironment.GetUnixTimestamp()));
            }
        }
예제 #28
0
        public void AddBan(int pId, long Time)
        {
            if (!Bans.ContainsKey(Convert.ToInt32(pId)))
            {
                Bans.Add(pId, PlusEnvironment.GetUnixTimestamp() + Time);
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("REPLACE INTO `room_bans` VALUES (" + pId + ", " + Id + ", " + (PlusEnvironment.GetUnixTimestamp() + Time) + ")");
            }
        }
예제 #29
0
 public void AddChatlog(int Id, string Message)
 {
     using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
     {
         dbClient.SetQuery("INSERT INTO `chatlogs` (user_id, room_id, message, timestamp) VALUES (@user, @room, @message, @time)");
         dbClient.AddParameter("user", Id);
         dbClient.AddParameter("room", RoomId);
         dbClient.AddParameter("message", Message);
         dbClient.AddParameter("time", PlusEnvironment.GetUnixTimestamp());
         dbClient.RunQuery();
     }
 }
예제 #30
0
 public void LogCommand(int UserId, string Data, string MachineId)
 {
     using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
     {
         dbClient.SetQuery("INSERT INTO `logs_client_staff` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
         dbClient.AddParameter("UserId", UserId);
         dbClient.AddParameter("Data", Data);
         dbClient.AddParameter("MachineId", MachineId);
         dbClient.AddParameter("Timestamp", PlusEnvironment.GetUnixTimestamp());
         dbClient.RunQuery();
     }
 }