示例#1
0
        /// <summary>
        /// Serializes the event information.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        internal void SerializeEventInfo(uint roomId)
        {
            Room room = Plus.GetGame().GetRoomManager().GetRoom(roomId);

            if (room == null)
            {
                return;
            }
            RoomEvent @event = this.GetEvent(roomId);

            if (@event == null || @event.HasExpired)
            {
                return;
            }
            if (!this.RoomHasEvents(roomId))
            {
                return;
            }
            var serverMessage = new ServerMessage();

            serverMessage.Init(LibraryParser.OutgoingRequest("RoomEventMessageComposer"));
            serverMessage.AppendInteger(roomId);
            serverMessage.AppendInteger(room.RoomData.OwnerId);
            serverMessage.AppendString(room.RoomData.Owner);
            serverMessage.AppendInteger(1);
            serverMessage.AppendInteger(1);
            serverMessage.AppendString(@event.Name);
            serverMessage.AppendString(@event.Description);
            serverMessage.AppendInteger(0);
            serverMessage.AppendInteger(
                ((int)Math.Floor((@event.Time - Plus.GetUnixTimeStamp()) / 60.0)));

            serverMessage.AppendInteger(@event.Category);
            room.SendMessage(serverMessage);
        }
示例#2
0
        public void Init()
        {
            using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
            {
                DataTable GetBans = null;
                dbClient.SetQuery("SELECT `bantype`,`value`,`reason`,`expire` FROM `users_bans` WHERE `bantype` = 'machine' OR `bantype` = 'user'");
                GetBans = dbClient.GetTable();

                if (GetBans != null)
                {
                    foreach (DataRow dRow in GetBans.Rows)
                    {
                        string value   = Convert.ToString(dRow["value"]);
                        string reason  = Convert.ToString(dRow["reason"]);
                        double expires = (double)dRow["expire"];
                        string type    = Convert.ToString(dRow["bantype"]);

                        ModerationBan Ban = new ModerationBan(BanTypeUtility.GetModerationBanType(type), value, reason, expires);
                        if (Ban != null)
                        {
                            if (expires > Plus.GetUnixTimeStamp())
                            {
                                if (!this._bans.ContainsKey(value))
                                {
                                    this._bans.Add(value, Ban);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        internal void BanzaiEnd()
        {
            IsBanzaiActive = false;
            _room.GetGameManager().StopGame();
            _floorMap = null;
            _room.GetWiredHandler().ExecuteWired(Interaction.TriggerGameEnd);
            var winningTeam = _room.GetGameManager().GetWinningTeam();

            _room.GetGameManager().UnlockGates();
            foreach (RoomItem roomItem in BanzaiTiles.Values)
            {
                if (roomItem.Team == winningTeam)
                {
                    roomItem.InteractionCount       = 0;
                    roomItem.InteractionCountHelper = 0;
                    roomItem.UpdateNeeded           = true;
                }
                else if (roomItem.Team == Team.none)
                {
                    roomItem.ExtraData = "0";
                    roomItem.UpdateState();
                }
            }
            if (winningTeam == Team.none)
            {
                return;
            }
            foreach (var avatar in _room.GetRoomUserManager().GetRoomUsers())
            {
                if (avatar.Team != Team.none && Plus.GetUnixTimeStamp() - _timestarted > 5.0)
                {
                    Plus.GetGame()
                    .GetAchievementManager()
                    .ProgressUserAchievement(avatar.GetClient(), "ACH_BattleBallTilesLocked",
                                             avatar.LockedTilesCount, false);
                    Plus.GetGame()
                    .GetAchievementManager()
                    .ProgressUserAchievement(avatar.GetClient(), "ACH_BattleBallPlayer", 1, false);
                }

                if ((winningTeam == Team.red && avatar.CurrentEffect != 33) ||
                    (winningTeam == Team.green && avatar.CurrentEffect != 34) ||
                    (winningTeam == Team.blue && avatar.CurrentEffect != 35) ||
                    (winningTeam == Team.yellow && avatar.CurrentEffect != 36))
                {
                    continue;
                }
                if (Plus.GetUnixTimeStamp() - _timestarted > 5.0)
                {
                    Plus.GetGame()
                    .GetAchievementManager()
                    .ProgressUserAchievement(avatar.GetClient(), "ACH_BattleBallWinner", 1, false);
                }
                var waveAtWin = new ServerMessage(LibraryParser.OutgoingRequest("RoomUserActionMessageComposer"));
                waveAtWin.AppendInteger(avatar.VirtualId);
                waveAtWin.AppendInteger(1);
                _room.SendMessage(waveAtWin);
            }
            _field.Destroy();
        }
        /// <summary>
        /// Activates the effect.
        /// </summary>
        /// <param name="effectId">The effect identifier.</param>
        internal void ActivateEffect(int effectId)
        {
            if (!_session.GetHabbo().InRoom)
            {
                return;
            }
            if (!HasEffect(effectId))
            {
                return;
            }
            if (effectId < 1)
            {
                ActivateCustomEffect(effectId);
                return;
            }
            var avatarEffect = (
                from x in _effects
                where x.EffectId == effectId
                select x).Last <AvatarEffect>();

            avatarEffect.Activate();
            using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(string.Concat(new object[]
                {
                    "UPDATE users_effects SET is_activated = '1', activated_stamp = ",
                    Plus.GetUnixTimeStamp(),
                    " WHERE user_id = ",
                    _userId,
                    " AND effect_id = ",
                    effectId
                }));
            EnableInRoom(effectId);
        }
示例#5
0
        /// <summary>
        /// Serializes the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns>ServerMessage.</returns>
        internal ServerMessage Serialize(ServerMessage message)
        {
            message.AppendInteger(TicketId);                                          // id
            message.AppendInteger(TabId);                                             // state
            message.AppendInteger(Type);                                              // type (3 or 4 for new style)
            message.AppendInteger(Category);
            message.AppendInteger((Plus.GetUnixTimeStamp() - (int)Timestamp) * 1000); // -->> timestamp
            message.AppendInteger(Score);                                             // priority
            message.AppendInteger(1);                                                 // ensures that more tickets of the same reporter/reported user get merged
            message.AppendInteger(SenderId);                                          // sender id 8 ints
            message.AppendString(_senderName);                                        // sender name
            message.AppendInteger(ReportedId);
            message.AppendString(_reportedName);
            message.AppendInteger((Status == TicketStatus.Picked) ? ModeratorId : 0); // mod id
            message.AppendString(_modName);                                           // mod name
            message.AppendString(this.Message);                                       // issue message
            message.AppendInteger(0);                                                 // is room public?

            message.AppendInteger(ReportedChats.Count);
            foreach (string str in this.ReportedChats)
            {
                message.AppendString(str);
                message.AppendInteger(-1);
                message.AppendInteger(-1);
            }

            return(message);
        }
示例#6
0
        public bool Execute(params object[] stuff)
        {
            int date1;
            var date2 = 0;

            var strArray = OtherString.Split(',');

            if (string.IsNullOrWhiteSpace(strArray[0]))
            {
                return(false);
            }

            int.TryParse(strArray[0], out date1);

            if (strArray.Length > 1)
            {
                int.TryParse(strArray[1], out date2);
            }

            if (date1 == 0)
            {
                return(false);
            }

            var currentTimestamp = Plus.GetUnixTimeStamp();

            return(date2 < 1 ? currentTimestamp >= date1 : currentTimestamp >= date1 && currentTimestamp <= date2);
        }
示例#7
0
        /// <summary>
        /// Adds the subscription.
        /// </summary>
        /// <param name="dayLength">Length of the day.</param>
        internal void AddSubscription(double dayLength)
        {
            var num = ((int)Math.Round(dayLength));

            var      clientByUserId = Plus.GetGame().GetClientManager().GetClientByUserId(_userId);
            DateTime target;
            Int64    num2;
            Int64    num3;

            if (_subscription != null)
            {
                target = Plus.UnixToDateTime(_subscription.ExpireTime).AddDays(num);
                num2   = _subscription.ActivateTime;
                num3   = _subscription.LastGiftTime;
            }
            else
            {
                target = DateTime.Now.AddDays(num);
                num2   = Plus.GetUnixTimeStamp();
                num3   = Plus.GetUnixTimeStamp();
            }
            var num4 = Plus.DateTimeToUnix(target);

            _subscription = new Subscription(2, num2, num4, num3);
            using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(
                    string.Concat(new object[]
                                  { "REPLACE INTO users_subscriptions VALUES (", _userId, ", 2, ", num2, ", ", num4, ", ", num3, ");" }));
            clientByUserId.GetHabbo().SerializeClub();
            Plus.GetGame().GetAchievementManager().TryProgressHabboClubAchievements(clientByUserId);
        }
示例#8
0
        /// <summary>
        /// Tries the progress registration achievements.
        /// </summary>
        /// <param name="Session">The session.</param>
        internal void TryProgressRegistrationAchievements(GameClient Session)
        {
            if (Session.GetHabbo() == null)
            {
                return;
            }
            UserAchievement regACH = Session.GetHabbo().GetAchievementData("ACH_RegistrationDuration");

            if (regACH == null)
            {
                this.ProgressUserAchievement(Session, "ACH_RegistrationDuration", 1, true);
                return;
            }
            else if (regACH.Level == 5)
            {
                return;
            }
            int sinceMember     = Plus.GetUnixTimeStamp() - (int)Session.GetHabbo().CreateDate;
            int daysSinceMember = Convert.ToInt32(Math.Round((double)259200 / 86400));

            if (daysSinceMember == regACH.Progress)
            {
                return;
            }
            int dais = daysSinceMember - regACH.Progress;

            if (dais < 1)
            {
                return;
            }
            this.ProgressUserAchievement(Session, "ACH_RegistrationDuration", dais, false);
        }
示例#9
0
        /// <summary>
        /// Serializes the user information.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>ServerMessage.</returns>
        /// <exception cref="System.NullReferenceException">User not found in database.</exception>
        internal static ServerMessage SerializeUserInfo(uint userId)
        {
            {
                ServerMessage result;
                using (IQueryAdapter queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
                {
                    queryReactor.SetQuery("SELECT id, username, online, mail, ip_last, look , rank , trade_lock , trade_lock_expire FROM users WHERE id = " + userId);
                    DataRow row = queryReactor.GetRow();
                    queryReactor.SetQuery("SELECT reg_timestamp, login_timestamp, cfhs, cfhs_abusive, cautions, bans FROM users_info WHERE user_id = " + userId);
                    DataRow row2 = queryReactor.GetRow();
                    if (row == null)
                    {
                        throw new NullReferenceException("User not found in database.");
                    }
                    var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolUserToolMessageComposer"));
                    serverMessage.AppendInteger(Convert.ToUInt32(row["id"]));
                    serverMessage.AppendString((string)row["username"]);
                    serverMessage.AppendString((string)row["look"]);
                    if (row2 != null)
                    {
                        serverMessage.AppendInteger((int)Math.Ceiling((Plus.GetUnixTimeStamp() - (double)row2["reg_timestamp"]) / 60.0));

                        serverMessage.AppendInteger((int)Math.Ceiling((Plus.GetUnixTimeStamp() - (double)row2["login_timestamp"]) / 60.0));
                    }
                    else
                    {
                        serverMessage.AppendInteger(0);
                        serverMessage.AppendInteger(0);
                    }
                    serverMessage.AppendBool(Plus.GetGame().GetClientManager().GetClientByUserId(Convert.ToUInt32(row["id"])) != null);
                    if (row2 != null)
                    {
                        serverMessage.AppendInteger((int)row2["cfhs"]);
                        serverMessage.AppendInteger((int)row2["cfhs_abusive"]);
                        serverMessage.AppendInteger((int)row2["cautions"]);
                        serverMessage.AppendInteger((int)row2["bans"]);
                    }
                    else
                    {
                        serverMessage.AppendInteger(0);
                        serverMessage.AppendInteger(0);
                        serverMessage.AppendInteger(0);
                        serverMessage.AppendInteger(0);
                    }
                    serverMessage.AppendInteger(0);
                    serverMessage.AppendString((row["trade_lock"].ToString() == "1") ? Plus.UnixToDateTime(int.Parse(row["trade_lock_expire"].ToString())).ToLongDateString() : "Not trade-locked");
                    Random _random = new Random();
                    string fakeip  = string.Format("{0}.{1}.{2}.{3}", _random.Next(0, 255), _random.Next(0, 255), _random.Next(0, 255), _random.Next(0, 255));
                    serverMessage.AppendString(((uint)row["rank"] < 6u) ? ((string)row["ip_last"]) : fakeip);
                    serverMessage.AppendInteger(Convert.ToUInt32(row["id"]));
                    serverMessage.AppendInteger(0);
                    serverMessage.AppendString(string.Format("E-Mail:         {0}", row["mail"]));
                    uint Rank = (uint)row["rank"];
                    serverMessage.AppendString((Rank == 12 ? string.Format("Rank ID:        {0}", 1) : string.Format("Rank ID:        {0}", Rank)));

                    result = serverMessage;
                }
                return(result);
            }
        }
示例#10
0
        public void BanUser(GameClient client, string Mod, ModerationBanType Type, string BanValue, string Reason, double ExpireTimestamp)
        {
            string BanType   = (Type == ModerationBanType.IP ? "ip" : Type == ModerationBanType.MACHINE ? "machine" : "user");
            double BanExpire = Plus.GetUnixTimeStamp() + ExpireTimestamp;

            using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `users_bans` (`bantype`, `value`, `reason`, `expire`, `added_by`,`added_date`) VALUES ('" + BanType + "', '" + BanValue + "', @reason, " + BanExpire + ", '" + Mod + "', '" + DateTime.Now.ToLongDateString() + "');");
                dbClient.AddParameter("reason", Reason);
                dbClient.RunQuery();
            }

            if (Type == ModerationBanType.MACHINE || Type == ModerationBanType.USERNAME)
            {
                if (!this._bans.ContainsKey(BanValue))
                {
                    this._bans.Add(BanValue, new ModerationBan(Type, BanValue, Reason, BanExpire));
                }
            }

            using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunFastQuery("UPDATE `users_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + client.GetHabbo().Id + "' LIMIT 1");
            }

            client.Disconnect("banned");
        }
示例#11
0
        /// <summary>
        /// Creates the group.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="desc">The desc.</param>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="badge">The badge.</param>
        /// <param name="session">The session.</param>
        /// <param name="colour1">The colour1.</param>
        /// <param name="colour2">The colour2.</param>
        /// <param name="group">The group.</param>
        internal void CreateGroup(string name, string desc, uint roomId, string badge, GameClient session, int colour1,
                                  int colour2, out Guild group)
        {
            using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery(string.Format("INSERT INTO groups_data (`name`, `desc`,`badge`,`owner_id`,`created`,`room_id`,`colour1`,`colour2`) VALUES(@name,@desc,@badge,'{0}',UNIX_TIMESTAMP(),'{1}','{2}','{3}')", session.GetHabbo().Id, roomId, colour1, colour2));
                queryReactor.AddParameter("name", name);
                queryReactor.AddParameter("desc", desc);
                queryReactor.AddParameter("badge", badge);

                var id = (uint)queryReactor.InsertQuery();
                queryReactor.RunFastQuery(string.Format("UPDATE rooms_data SET group_id='{0}' WHERE id='{1}' LIMIT 1", id, roomId));
                var dictionary = new Dictionary <uint, GroupUser> {
                    { session.GetHabbo().Id, new GroupUser(session.GetHabbo().Id, id, 2) }
                };
                group = new Guild(id, name, desc, roomId, badge, Plus.GetUnixTimeStamp(), session.GetHabbo().Id, colour1, colour2, dictionary, new List <uint>(), new Dictionary <uint, GroupUser>(), 0u, 1u, false, name, desc, 0, 0.0, 0, string.Empty, 0);
                Groups.Add(id, group);
                queryReactor.RunFastQuery(string.Format("INSERT INTO groups_members (group_id, user_id, rank) VALUES ('{0}','{1}','2')", id, session.GetHabbo().Id));
                var room = Plus.GetGame().GetRoomManager().GetRoom(roomId);
                if (room != null)
                {
                    room.RoomData.Group   = group;
                    room.RoomData.GroupId = id;
                }
                var user = new GroupUser(session.GetHabbo().Id, id, 2);
                session.GetHabbo().UserGroups.Add(user);
                group.Admins.Add(session.GetHabbo().Id, user);
                queryReactor.RunFastQuery(string.Format("UPDATE users_stats SET favourite_group='{0}' WHERE id='{1}' LIMIT 1", id, session.GetHabbo().Id));
                queryReactor.RunFastQuery(string.Format("DELETE FROM rooms_rights WHERE room_id='{0}'", roomId));
            }
        }
示例#12
0
        /// <summary>
        /// Adds the new event.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="eventName">Name of the event.</param>
        /// <param name="eventDesc">The event desc.</param>
        /// <param name="session">The session.</param>
        /// <param name="time">The time.</param>
        /// <param name="category">The category.</param>
        internal void AddNewEvent(uint roomId, string eventName, string eventDesc, GameClient session, int time = 7200, int category = 1)
        {
            {
                if (this._events.ContainsKey(roomId))
                {
                    RoomEvent roomEvent = this._events[roomId];
                    roomEvent.Name        = eventName;
                    roomEvent.Description = eventDesc;
                    if (roomEvent.HasExpired)
                    {
                        roomEvent.Time = Plus.GetUnixTimeStamp() + time;
                    }
                    else
                    {
                        roomEvent.Time += time;
                    }
                    using (IQueryAdapter queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
                    {
                        queryReactor.SetQuery("REPLACE INTO rooms_events VALUES ('@id','@name','@desc','@time','@category')");
                        queryReactor.AddParameter("id", roomId);
                        queryReactor.AddParameter("name", eventName);
                        queryReactor.AddParameter("desc", eventDesc);
                        queryReactor.AddParameter("time", roomEvent.Time);
                        queryReactor.AddParameter("category", category);
                        queryReactor.RunQuery();
                        goto IL_17C;
                    }
                }
                using (IQueryAdapter queryreactor2 = Plus.GetDatabaseManager().GetQueryReactor())
                {
                    queryreactor2.SetQuery(string.Concat(new object[]
                    {
                        "REPLACE INTO rooms_events VALUES (",
                        roomId,
                        ", @name, @desc, ",
                        Plus.GetUnixTimeStamp() + 7200,
                        ", @category)"
                    }));
                    queryreactor2.AddParameter("name", eventName);
                    queryreactor2.AddParameter("desc", eventDesc);
                    queryreactor2.AddParameter("category", category);
                    queryreactor2.RunQuery();
                }
                this._events.Add(roomId, new RoomEvent(roomId, eventName, eventDesc, 0));
IL_17C:
                Plus.GetGame().GetRoomManager().GenerateRoomData(roomId).Event = this._events[roomId];
                Room room = Plus.GetGame().GetRoomManager().GetRoom(roomId);
                if (room != null)
                {
                    room.RoomData.Event = this._events[roomId];
                }
                if (session.GetHabbo().CurrentRoomId == roomId)
                {
                    this.SerializeEventInfo(roomId);
                }
            }
        }
示例#13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RoomEvent"/> class.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="time">The time.</param>
        /// <param name="category">The category.</param>
        internal RoomEvent(uint roomId, string name, string description, int time = 0, int category = 1)
        {
            this.RoomId      = roomId;
            this.Name        = name;
            this.Description = description;
            this.Time        = ((time == 0) ? (Plus.GetUnixTimeStamp() + 7200) : time);

            this.Category = category;
        }
示例#14
0
        /// <summary>
        /// Serializes the offline messages.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns>ServerMessage.</returns>
        internal ServerMessage SerializeOfflineMessages(OfflineMessage message)
        {
            var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ConsoleChatMessageComposer"));

            serverMessage.AppendInteger(message.FromId);
            serverMessage.AppendString(message.Message);
            serverMessage.AppendInteger(((int)(Plus.GetUnixTimeStamp() - message.Timestamp)));

            return(serverMessage);
        }
示例#15
0
        /// <summary>
        /// Databases the cleanup.
        /// </summary>
        /// <param name="dbClient">The database client.</param>
        internal static void DatabaseCleanup(IQueryAdapter dbClient)
        {
            dbClient.RunFastQuery("UPDATE users SET online = '0' WHERE online > '0'");
            dbClient.RunFastQuery("UPDATE rooms_data SET users_now = 0 WHERE users_now > 0");
            dbClient.RunFastQuery("UPDATE bots SET room_id = '0' WHERE ai_type = 'fightpet' AND room_id > 0");

            dbClient.RunFastQuery(
                string.Format(
                    "UPDATE server_status SET status = 1, users_online = 0, rooms_loaded = 0, server_ver = 'FluxRP Emulator', stamp = '{0}' ",
                    Plus.GetUnixTimeStamp()));
        }
示例#16
0
        /// <summary>
        /// Processes the thread.
        /// </summary>
        internal static void ProcessThread()
        {
            double      num  = Plus.GetUnixTimeStamp();
            List <uint> list = (from current in _cacheTimer where num - current.Value >= 180.0 select current.Key).ToList();

            foreach (uint current2 in list)
            {
                Songs.Remove(current2);
                _cacheTimer.Remove(current2);
            }
        }
示例#17
0
        /// <summary>
        /// Tries the progress habbo club achievements.
        /// </summary>
        /// <param name="Session">The session.</param>
        internal void TryProgressHabboClubAchievements(GameClient Session)
        {
            if (Session.GetHabbo() == null || !Session.GetHabbo().GetSubscriptionManager().HasSubscription)
            {
                return;
            }
            UserAchievement ClubACH = Session.GetHabbo().GetAchievementData("ACH_VipHC");

            if (ClubACH == null)
            {
                this.ProgressUserAchievement(Session, "ACH_VipHC", 1, true);
                this.ProgressUserAchievement(Session, "ACH_BasicClub", 1, true);
                return;
            }
            else if (ClubACH.Level == 5)
            {
                return;
            }
            Subscription Subscription    = Session.GetHabbo().GetSubscriptionManager().GetSubscription();
            Int64        SinceActivation = Plus.GetUnixTimeStamp() - Subscription.ActivateTime;

            if (SinceActivation < 31556926)
            {
                return;
            }
            if (SinceActivation >= 31556926)
            {
                this.ProgressUserAchievement(Session, "ACH_VipHC", 1, false);
                this.ProgressUserAchievement(Session, "ACH_BasicClub", 1, false);
            }
            if (SinceActivation >= 63113851)
            {
                this.ProgressUserAchievement(Session, "ACH_VipHC", 1, false);
                this.ProgressUserAchievement(Session, "ACH_BasicClub", 1, false);
            }
            if (SinceActivation >= 94670777)
            {
                this.ProgressUserAchievement(Session, "ACH_VipHC", 1, false);
                this.ProgressUserAchievement(Session, "ACH_BasicClub", 1, false);
            }
            if (SinceActivation >= 126227704)
            {
                this.ProgressUserAchievement(Session, "ACH_VipHC", 1, false);
                this.ProgressUserAchievement(Session, "ACH_BasicClub", 1, false);
            }
            if (SinceActivation >= 157784630)
            {
                this.ProgressUserAchievement(Session, "ACH_VipHC", 1, false);
                this.ProgressUserAchievement(Session, "ACH_BasicClub", 1, false);
            }
        }
示例#18
0
        /// <summary>
        /// Games the center join queue.
        /// </summary>
        internal void GameCenterJoinQueue()
        {
            ServerMessage JoinQueue = new ServerMessage(LibraryParser.OutgoingRequest("GameCenterJoinGameQueueMessageComposer"));

            JoinQueue.AppendInteger(18);//gameId
            Session.SendMessage(JoinQueue);

            ServerMessage LoadGame = new ServerMessage(LibraryParser.OutgoingRequest("GameCenterLoadGameUrlMessageComposer"));

            LoadGame.AppendInteger(18);//gameId
            LoadGame.AppendString(Convert.ToString(Plus.GetUnixTimeStamp()));
            LoadGame.AppendString(ExtraSettings.GameCenterStoriesUrl);
            Session.SendMessage(LoadGame);
        }
示例#19
0
 /// <summary>
 /// Plays the song.
 /// </summary>
 public void PlaySong()
 {
     if (SongQueuePosition >= _mPlaylist.Count)
     {
         SongQueuePosition = 0;
     }
     if (!_mPlaylist.Any())
     {
         Stop();
         return;
     }
     CurrentSong = _mPlaylist[SongQueuePosition];
     _mStartedPlayingTimestamp = Plus.GetUnixTimeStamp();
     _mBroadcastNeeded         = true;
 }
示例#20
0
文件: Quest.cs 项目: Mereos/HabboEMU
 /// <summary>
 /// Initializes a new instance of the <see cref="Quest"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="category">The category.</param>
 /// <param name="number">The number.</param>
 /// <param name="goalType">Type of the goal.</param>
 /// <param name="goalData">The goal data.</param>
 /// <param name="name">The name.</param>
 /// <param name="reward">The reward.</param>
 /// <param name="dataBit">The data bit.</param>
 /// <param name="rewardType">Type of the reward.</param>
 /// <param name="timeUnlock">The time unlock.</param>
 /// <param name="timeLock">The time lock.</param>
 public Quest(uint id, string category, int number, QuestType goalType, uint goalData, string name, int reward,
              string dataBit, int rewardType, int timeUnlock, int timeLock)
 {
     Id         = id;
     Category   = category;
     Number     = number;
     GoalType   = goalType;
     GoalData   = goalData;
     Name       = name;
     Reward     = reward;
     DataBit    = dataBit;
     RewardType = rewardType;
     TimeUnlock = timeUnlock;
     HasEnded   = (timeLock >= Plus.GetUnixTimeStamp() && timeLock > 0);
 }
示例#21
0
文件: Habbo.cs 项目: Mereos/HabboEMU
 /// <summary>
 /// Checks the trading.
 /// </summary>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 internal bool CheckTrading()
 {
     if (!TradeLocked)
     {
         return(true);
     }
     if (TradeLockExpire - Plus.GetUnixTimeStamp() > 0)
     {
         return(false);
     }
     using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
         queryReactor.RunFastQuery(string.Format("UPDATE users SET trade_lock = '0' WHERE id = {0}", Id));
     TradeLocked = false;
     return(true);
 }
示例#22
0
文件: Habbo.cs 项目: Mereos/HabboEMU
 /// <summary>
 /// Runs the database update.
 /// </summary>
 /// <param name="dbClient">The database client.</param>
 internal void RunDbUpdate(IQueryAdapter dbClient)
 {
     dbClient.RunFastQuery(string.Concat(new object[]
     {
         "UPDATE users SET last_online = '",
         Plus.GetUnixTimeStamp(),
         "', activity_points = '",
         ActivityPoints,
         "', credits = '",
         Credits,
         "', seasonal_currency = '",
         BelCredits,
         "' WHERE id = '",
         Id,
         "' LIMIT 1; "
     }));
 }
示例#23
0
        /// <summary>
        /// Tries the progress login achievements.
        /// </summary>
        /// <param name="Session">The session.</param>
        internal void TryProgressLoginAchievements(GameClient Session)
        {
            if (Session.GetHabbo() == null)
            {
                return;
            }
            UserAchievement loginACH = Session.GetHabbo().GetAchievementData("ACH_Login");

            if (loginACH == null)
            {
                this.ProgressUserAchievement(Session, "ACH_Login", 1, true);
                return;
            }
            int daysBtwLastLogin = Plus.GetUnixTimeStamp() - Session.GetHabbo().PreviousOnline;

            if (daysBtwLastLogin >= 51840 && daysBtwLastLogin <= 112320)
            {
                this.ProgressUserAchievement(Session, "ACH_Login", 1, true);
            }
        }
示例#24
0
 /// <summary>
 /// Picks the specified p moderator identifier.
 /// </summary>
 /// <param name="pModeratorId">The p moderator identifier.</param>
 /// <param name="updateInDb">if set to <c>true</c> [update in database].</param>
 internal void Pick(uint pModeratorId, bool updateInDb)
 {
     this.Status      = TicketStatus.Picked;
     this.ModeratorId = pModeratorId;
     this._modName    = Plus.GetHabboById(pModeratorId).UserName;
     if (!updateInDb)
     {
         return;
     }
     using (IQueryAdapter queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
     {
         queryReactor.RunFastQuery(string.Concat(new object[]
         {
             "UPDATE moderation_tickets SET status = 'picked', moderator_id = ",
             pModeratorId,
             ", timestamp = '",
             Plus.GetUnixTimeStamp(),
             "' WHERE id = ",
             this.TicketId
         }));
     }
 }
示例#25
0
        public bool Execute(params object[] stuff)
        {
            if (stuff[0] == null)
            {
                return(false);
            }
            var roomUser = (RoomUser)stuff[0];

            if (roomUser == null || roomUser.IsBot || roomUser.GetClient() == null ||
                roomUser.GetClient().GetHabbo() == null)
            {
                return(false);
            }

            if (roomUser.GetClient().GetHabbo().Rank > 3)
            {
                return(false);
            }

            if (this.Delay == 0)
            {
                return(false);
            }

            int  minutes = this.Delay / 500;
            uint userId  = roomUser.GetClient().GetHabbo().Id;

            if (this.Room.MutedUsers.ContainsKey(userId))
            {
                this.Room.MutedUsers.Remove(userId);
            }
            this.Room.MutedUsers.Add(userId, Convert.ToUInt32((Plus.GetUnixTimeStamp() + (minutes * 60))));
            if (!String.IsNullOrEmpty(this.OtherString))
            {
                roomUser.GetClient().SendWhisper(this.OtherString);
            }
            return(true);
        }
示例#26
0
        internal void BanzaiStart()
        {
            if (IsBanzaiActive)
            {
                return;
            }
            _room.GetGameManager().StartGame();
            _floorMap    = new byte[_room.GetGameMap().Model.MapSizeY, _room.GetGameMap().Model.MapSizeX];
            _field       = new GameField(_floorMap, true);
            _timestarted = Plus.GetUnixTimeStamp();
            _room.GetGameManager().LockGates();
            var index = 1;

            while (index < 5)
            {
                _room.GetGameManager().Points[index] = 0;

                {
                    ++index;
                }
            }
            foreach (RoomItem roomItem in BanzaiTiles.Values)
            {
                roomItem.ExtraData = "1";
                roomItem.Value     = 0;
                roomItem.Team      = Team.none;
                roomItem.UpdateState();
            }

            ResetTiles();
            IsBanzaiActive = true;
            _room.GetWiredHandler().ExecuteWired(Interaction.TriggerGameStart);
            foreach (var roomUser in _room.GetRoomUserManager().GetRoomUsers())
            {
                roomUser.LockedTilesCount = 0;
            }
        }
示例#27
0
        /// <summary>
        /// Locks the trade.
        /// </summary>
        /// <param name="modSession">The mod session.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="message">The message.</param>
        /// <param name="length">The length.</param>
        internal static void LockTrade(GameClient modSession, uint userId, string message, int length)
        {
            GameClient clientByUserId = Plus.GetGame().GetClientManager().GetClientByUserId(userId);

            if (clientByUserId == null)
            {
                return;
            }
            int num = length;

            {
                if (!clientByUserId.GetHabbo().CheckTrading())
                {
                    num += Plus.GetUnixTimeStamp() - clientByUserId.GetHabbo().TradeLockExpire;
                }
                clientByUserId.GetHabbo().TradeLocked     = true;
                clientByUserId.GetHabbo().TradeLockExpire = Plus.GetUnixTimeStamp() + num;
                clientByUserId.SendNotif(message);
                using (IQueryAdapter queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
                {
                    queryReactor.RunFastQuery(string.Format("UPDATE users SET trade_lock = '1', trade_lock_expire = '{0}' WHERE id = '{1}'", clientByUserId.GetHabbo().TradeLockExpire, clientByUserId.GetHabbo().Id));
                }
            }
        }
示例#28
0
 /// <summary>
 /// Activates this instance.
 /// </summary>
 internal void Activate()
 {
     Activated      = true;
     StampActivated = Plus.GetUnixTimeStamp();
 }
示例#29
0
 /// <summary>
 /// Gets the seasonal quests.
 /// </summary>
 /// <param name="season">The season.</param>
 /// <returns>List&lt;Quest&gt;.</returns>
 internal List <Quest> GetSeasonalQuests(string season)
 {
     return(_quests.Values.Where(current => current.Category.Contains(season) && (current.TimeUnlock - Plus.GetUnixTimeStamp()) < 0).ToList());
 }
示例#30
0
        public static bool CanExecuteAttack(GameClient Session, GameClient TargetSession)
        {
            if (TargetSession == null || TargetSession.GetHabbo().CurrentRoomId != Session.GetHabbo().CurrentRoomId)
            {
                Session.SendWhisper("Este usuário não foi encontrado nesta sala!");
                return(false);
            }

            Room     Room     = Plus.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            RoomUser RoomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().UserName);
            RoomUser Target   = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetSession.GetHabbo().UserName);

            Vector2D Pos1 = new Vector2D(RoomUser.X, RoomUser.Y);
            Vector2D Pos2 = new Vector2D(Target.X, Target.Y);

            #region Distance
            if (Room.RoomData.Description.Contains("NOSHOOT") && RoleplayManager.PurgeTime == false)
            {
                Session.SendWhisper("Sorry, but this is a non bombing zone!");
                return(false);
            }
            if (Room.RoomData.Description.Contains("SAFEZONE"))
            {
                Session.SendWhisper("Sorry, but this is a safezone!");
                return(false);
            }
            int MyJobId   = Session.GetRoleplay().JobId;
            int MyJobRank = Session.GetRoleplay().JobRank;
            if (Session.GetRoleplay().Bombs <= 0 && (!JobManager.JobRankData[MyJobId, MyJobRank].hasRights("army") && !Session.GetRoleplay().Working))
            {
                Session.SendWhisper("You do not have any bombs!");
                return(false);
            }
            #endregion

            #region Status Conditions
            if (Session.GetRoleplay().Energy <= 0)
            {
                Session.SendWhisper("You ran out of energy ");
                return(false);
            }
            if (Session.GetRoleplay().inBrawl == true)
            {
                Session.SendWhisper("Cannot do this in a Brawl");
                return(false);
            }

            if (Session.GetRoleplay().Dead)
            {
                Session.SendWhisper("Cannot complete this action while you are dead!");
                return(false);
            }

            if (Session.GetRoleplay().Jailed)
            {
                Session.SendWhisper("Cannot complete this action while you are jailed!");
                return(false);
            }

            if (TargetSession.GetRoleplay().Dead)
            {
                Session.SendWhisper("Cannot complete this action as this user is dead!");
                return(false);
            }

            if (TargetSession.GetRoleplay().Jailed)
            {
                Session.SendWhisper("Cannot complete this action as this user is jailed!");
                return(false);
            }

            if (RoomUser.Stunned)
            {
                Session.SendWhisper("Cannot complete this action while you are stunned!");
                return(false);
            }
            if (Target.IsAsleep)
            {
                Session.SendWhisper("Cannot complete this action as this user is AFK!");
                return(false);
            }
            if (Session.GetRoleplay().GunShots >= 7)
            {
                Session.GetHabbo().GetRoomUser().LastBubble = 3;
                Session.Shout("*Stops to stretch their arm, cramped from throwing so many bombs*");
                Session.GetHabbo().GetRoomUser().LastBubble = 0;
                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));
                message.AppendInteger(5);
                Session.GetHabbo().GetRoomUser().IsGunReloaded    = true;
                Session.GetHabbo().GetRoomUser().ReloadExpiryTime = Plus.GetUnixTimeStamp() + 5;
                Session.GetHabbo().GetRoomUser().GetClient().SendMessage(message);
                Session.GetRoleplay().GunShots = 0;
                return(false);
            }
            if (TargetSession.GetRoleplay().usingPlane&& !WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Name.ToLower().Contains("rpg"))
            {
                RoleplayManager.Shout(Session, "*Attempts to shoot " + TargetSession.GetHabbo().UserName + ", but misses as they are in a plane*");
                Session.GetRoleplay().GunShots++;
                return(false);
            }
            if (RoleplayManager.Distance(Pos1, Pos2) > 6)
            {
                Session.GetHabbo().GetRoomUser().LastBubble = 3;
                RoleplayManager.Shout(Session, "*Throws my Grenade at " + TargetSession.GetHabbo().UserName + ", but misses*", 3);
                Session.GetHabbo().GetRoomUser().LastBubble = 0;
                Session.GetRoleplay().GunShots++;
                return(false);
            }
            if (Session.GetRoleplay().IsNoob)
            {
                if (!Session.GetRoleplay().NoobWarned)
                {
                    Session.SendNotif("If you choose to do this again your temporary God Protection will be disabled!");
                    Session.GetRoleplay().NoobWarned = true;
                    return(false);
                }
                else
                {
                    using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunFastQuery("UPDATE rp_stats SET is_noob = 0 WHERE id = '" + Session.GetHabbo().Id + "'");
                    }

                    Session.SendWhisper("Your god protection has been disabled!");
                    Session.GetRoleplay().IsNoob = false;
                    Session.GetRoleplay().SaveQuickStat("is_noob", "0");
                }
            }

            if (TargetSession.GetRoleplay().IsNoob)
            {
                Session.SendWhisper("Cannot complete this action as this user is under God Protection!");
                return(false);
            }
            #endregion

            return(true);
        }