Example #1
0
        internal static void LockTrade(GameClient ModSession, uint UserId, string Message, int Length)
        {
            GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);

            if (clientByUserID == null)
            {
                return;
            }
            int num = Length;

            checked
            {
                if (!clientByUserID.GetHabbo().CheckTrading())
                {
                    num += CyberEnvironment.GetUnixTimestamp() - clientByUserID.GetHabbo().TradeLockExpire;
                }
                clientByUserID.GetHabbo().TradeLocked     = true;
                clientByUserID.GetHabbo().TradeLockExpire = CyberEnvironment.GetUnixTimestamp() + num;
                clientByUserID.SendNotif(Message);
                using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                {
                    queryreactor.runFastQuery("UPDATE users SET trade_lock = '1', trade_lock_expire = '" + clientByUserID.GetHabbo().TradeLockExpire + "'");
                }
            }
        }
Example #2
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser 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 (Room.MutedUsers.ContainsKey(UserId))
            {
                Room.MutedUsers.Remove(UserId);
            }
            Room.MutedUsers.Add(UserId, Convert.ToUInt32((CyberEnvironment.GetUnixTimestamp() + (Minutes * 60))));
            if (!String.IsNullOrEmpty(this.OtherString))
            {
                roomUser.GetClient().SendWhisper(this.OtherString);
            }
            return(true);
        }
Example #3
0
        internal ServerMessage Serialize(ServerMessage Message)
        {
            Message.AppendUInt(this.Id);
            Message.AppendInt32(this.TabId);
            Message.AppendInt32(this.Type);
            Message.AppendInt32(114);             // Category
            checked
            {
                Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - (int)this.Timestamp) * 1000);
                Message.AppendInt32(this.Score);
                Message.AppendInt32(0);
                Message.AppendUInt(this.SenderId);
                Message.AppendString(this.SenderName);
                Message.AppendUInt(this.ReportedId);
                Message.AppendString(this.ReportedName);
                Message.AppendUInt((this.Status == TicketStatus.PICKED) ? this.ModeratorId : 0u);
                Message.AppendString(this.ModName);
                Message.AppendString(this.Message);
                Message.AppendInt32(0);

                Message.AppendInt32(this.ReportedChats.Count);

                foreach (string str in ReportedChats)
                {
                    Message.AppendString(str);
                    Message.AppendInt32(-1);
                    Message.AppendInt32(-1);
                }
                return(Message);
            }
        }
Example #4
0
        internal void BanzaiStart()
        {
            if (this.banzaiStarted)
            {
                return;
            }
            this.room.GetGameManager().StartGame();
            this.floorMap    = new byte[this.room.GetGameMap().Model.MapSizeY, this.room.GetGameMap().Model.MapSizeX];
            this.field       = new GameField(this.floorMap, true);
            this.timestarted = (double)CyberEnvironment.GetUnixTimestamp();
            this.room.GetGameManager().LockGates();
            int index = 1;

            while (index < 5)
            {
                this.room.GetGameManager().Points[index] = 0;
                checked { ++index; }
            }
            foreach (RoomItem roomItem in (IEnumerable)this.banzaiTiles.Values)
            {
                roomItem.ExtraData = "1";
                roomItem.value     = 0;
                roomItem.team      = Team.none;
                roomItem.UpdateState();
            }
            this.room.GetRoomItemHandler().mFloorItems.QueueDelegate(new onCycleDoneDelegate(this.ResetTiles));
            this.banzaiStarted = true;
            this.room.GetWiredHandler().ExecuteWired(WiredItemType.TriggerGameStarts, new object[0]);
            foreach (RoomUser roomUser in this.room.GetRoomUserManager().GetRoomUsers())
            {
                roomUser.LockedTilesCount = 0;
            }
        }
Example #5
0
 internal RoomEvent(uint RoomId, string Name, string Description, int Time = 0)
 {
     this.RoomId      = RoomId;
     this.Name        = Name;
     this.Description = Description;
     this.Time        = ((Time == 0) ? checked (CyberEnvironment.GetUnixTimestamp() + 7200) : Time);
 }
Example #6
0
        internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, string Message, int type, List <string> Messages)
        {
            UInt32 Id = 0;

            if (Session.GetHabbo().CurrentRoomId <= 0)
            {
                using (IQueryAdapter DBClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                {
                    DBClient.setQuery(string.Concat(new object[]
                    {
                        "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                        Category,
                        "','open','",
                        Session.GetHabbo().Id,
                        "','",
                        ReportedUser,
                        "','0',@message,'0','','",
                        CyberEnvironment.GetUnixTimestamp(),
                        "')"
                    }));
                    DBClient.addParameter("message", Message);
                    Id = (uint)DBClient.insertQuery();
                    DBClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id);
                }

                SupportTicket Ticket = new SupportTicket(Id, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0u, "", (double)CyberEnvironment.GetUnixTimestamp(), Messages);
                this.Tickets.Add(Ticket);
                ModerationTool.SendTicketToModerators(Ticket);
                return;
            }

            RoomData Data = CyberEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData(Session.GetHabbo().CurrentRoomId);

            using (IQueryAdapter DBClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                DBClient.setQuery(string.Concat(new object[]
                {
                    "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                    Category,
                    "','open','",
                    Session.GetHabbo().Id,
                    "','",
                    ReportedUser,
                    "','0',@message,'",
                    Data.Id,
                    "',@name,'",
                    CyberEnvironment.GetUnixTimestamp(),
                    "')"
                }));
                DBClient.addParameter("message", Message);
                DBClient.addParameter("name", Data.Name);
                Id = (uint)DBClient.insertQuery();
                DBClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id);
            }
            SupportTicket Ticket2 = new SupportTicket(Id, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0u, "", (double)CyberEnvironment.GetUnixTimestamp(), Messages);

            this.Tickets.Add(Ticket2);
            ModerationTool.SendTicketToModerators(Ticket2);
        }
Example #7
0
        internal ServerMessage SerializeOfflineMessages(OfflineMessage Message)
        {
            ServerMessage serverMessage = new ServerMessage(Outgoing.ConsoleChatMessageComposer);

            serverMessage.AppendUInt(Message.FromId);
            serverMessage.AppendString(Message.Message);
            serverMessage.AppendInt32(checked ((int)unchecked ((double)CyberEnvironment.GetUnixTimestamp() - Message.Timestamp)));
            return(serverMessage);
        }
Example #8
0
        public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (Session == null)
            {
                return;
            }
            RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (Item.InteractingUser2 != roomUserByHabbo.UserID)
            {
                Item.InteractingUser2 = roomUserByHabbo.UserID;
            }
            if (roomUserByHabbo == null)
            {
                return;
            }
            if (roomUserByHabbo.Coordinate != Item.SquareInFront && roomUserByHabbo.CanWalk)
            {
                roomUserByHabbo.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, 0u) || !Item.GetRoom().GetGameMap().SquareIsOpen(Item.SquareBehind.X, Item.SquareBehind.Y, false))
            {
                return;
            }
            checked
            {
                if (roomUserByHabbo.LastInteraction - CyberEnvironment.GetUnixTimestamp() < 0 && roomUserByHabbo.InteractingGate && roomUserByHabbo.GateId == Item.Id)
                {
                    roomUserByHabbo.InteractingGate = false;
                    roomUserByHabbo.GateId          = 0u;
                }
                {
                    if (!Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, roomUserByHabbo.AllowOverride, 0u))
                    {
                        return;
                    }
                    if (Item.InteractingUser == 0u)
                    {
                        roomUserByHabbo.InteractingGate = true;
                        roomUserByHabbo.GateId          = Item.Id;
                        Item.InteractingUser            = roomUserByHabbo.HabboId;
                        roomUserByHabbo.CanWalk         = false;
                        if (roomUserByHabbo.IsWalking && (roomUserByHabbo.GoalX != Item.SquareInFront.X || roomUserByHabbo.GoalY != Item.SquareInFront.Y))
                        {
                            roomUserByHabbo.ClearMovement(true);
                        }

                        roomUserByHabbo.InteractingGate = false;
                        roomUserByHabbo.GateId          = 0u;
                        return;
                    }
                    return;
                }
            }
        }
Example #9
0
        internal void CreateGroup(string Name, string Desc, uint RoomId, string Badge, GameClient Session, int Colour1, int Colour2, out Guild Group)
        {
            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery(string.Concat(new object[]
                {
                    "INSERT INTO groups (`name`, `desc`,`badge`,`owner_id`,`created`,`room_id`,`colour1`,`colour2`) VALUES(@name, @desc, @badge, ",
                    Session.GetHabbo().Id,
                    ", UNIX_TIMESTAMP(), ",
                    RoomId,
                    ",'",
                    Colour1,
                    "','",
                    Colour2,
                    "')"
                }));
                queryreactor.addParameter("name", Name);
                queryreactor.addParameter("desc", Desc);
                queryreactor.addParameter("badge", Badge);
                uint num = checked ((uint)queryreactor.insertQuery());
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "UPDATE rooms SET group_id=",
                    num,
                    " WHERE id=",
                    RoomId,
                    " LIMIT 1"
                }));
                Dictionary <uint, GroupUser> dictionary = new Dictionary <uint, GroupUser>();
                dictionary.Add(Session.GetHabbo().Id, new GroupUser(Session.GetHabbo().Id, num, 2));
                this.Groups.Add(num, new Guild(num, Name, Desc, RoomId, Badge, CyberEnvironment.GetUnixTimestamp(), Session.GetHabbo().Id, Colour1, Colour2, dictionary, new List <uint>(), new Dictionary <uint, GroupUser>(), 0u, 1u, false, Name, Desc, 0, 0.0, 0, "", 0));

                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "INSERT INTO group_memberships (group_id, user_id, rank) VALUES (",
                    num,
                    ", ",
                    Session.GetHabbo().Id,
                    ", '2')"
                }));
                Group = this.GetGroup(num);
                GroupUser User = new GroupUser(Session.GetHabbo().Id, num, 2);
                Session.GetHabbo().UserGroups.Add(User);
                Group.Admins.Add(Session.GetHabbo().Id, User);
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "UPDATE user_stats SET favourite_group=",
                    num,
                    " WHERE id= ",
                    Session.GetHabbo().Id,
                    " LIMIT 1"
                }));
                queryreactor.runFastQuery("DELETE FROM room_rights WHERE room_id=" + RoomId);
            }
        }
Example #10
0
 internal bool CheckMute(GameClient Session)
 {
     if (this.MutedUsers.ContainsKey(Session.GetHabbo().Id))
     {
         if (this.MutedUsers[Session.GetHabbo().Id] >= CyberEnvironment.GetUnixTimestamp())
         {
             return(true);
         }
         this.MutedUsers.Remove(Session.GetHabbo().Id);
     }
     return(Session.GetHabbo().Muted || this.RoomMuted);
 }
Example #11
0
        internal void SerializeClub()
        {
            GameClient    client        = this.GetClient();
            ServerMessage serverMessage = new ServerMessage();

            serverMessage.Init(Outgoing.SubscriptionStatusMessageComposer);
            serverMessage.AppendString("club_habbo");
            if (client.GetHabbo().GetSubscriptionManager().HasSubscription)
            {
                double num  = (double)client.GetHabbo().GetSubscriptionManager().GetSubscription().ExpireTime;
                double num2 = num - (double)CyberEnvironment.GetUnixTimestamp();
                checked
                {
                    int num3 = (int)Math.Ceiling(num2 / 86400.0);
                    int i    = (int)Math.Ceiling(unchecked ((double)CyberEnvironment.GetUnixTimestamp() - (double)client.GetHabbo().GetSubscriptionManager().GetSubscription().ActivateTime) / 86400.0);
                    int num4 = num3 / 31;
                    if (num4 >= 1)
                    {
                        num4--;
                    }
                    serverMessage.AppendInt32(num3 - num4 * 31);
                    serverMessage.AppendInt32(1);
                    serverMessage.AppendInt32(num4);
                    serverMessage.AppendInt32(1);
                    serverMessage.AppendBoolean(true);
                    serverMessage.AppendBoolean(true);
                    serverMessage.AppendInt32(i);
                    serverMessage.AppendInt32(i);
                    serverMessage.AppendInt32(10);
                }
            }
            else
            {
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(0);
                serverMessage.AppendBoolean(false);
                serverMessage.AppendBoolean(false);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(0);
            }
            client.SendMessage(serverMessage);
            ServerMessage serverMessage2 = new ServerMessage(Outgoing.UserClubRightsMessageComposer);

            serverMessage2.AppendInt32(this.GetSubscriptionManager().HasSubscription ? 2 : 0);
            serverMessage2.AppendUInt(this.Rank);
            serverMessage2.AppendInt32(0);
            client.SendMessage(serverMessage2);
        }
Example #12
0
 public Quest(uint Id, string Category, int Number, QuestType GoalType, uint GoalData, string Name, int Reward, string DataBit, int RewardType, int TimeUnlock, int TimeLock)
 {
     this.Id         = Id;
     this.Category   = Category;
     this.Number     = Number;
     this.GoalType   = GoalType;
     this.GoalData   = GoalData;
     this.Name       = Name;
     this.Reward     = Reward;
     this.DataBit    = DataBit;
     this.RewardType = RewardType;
     this.TimeUnlock = TimeUnlock;
     this.HasEnded   = (TimeLock >= CyberEnvironment.GetUnixTimestamp() && TimeLock > 0);
 }
Example #13
0
        internal static void GiveCredits(GameClient Client, int amount)
        {
            if (Client == null || Client.GetHabbo() == null)
            {
                return;
            }
            double arg_12_0 = (double)CyberEnvironment.GetUnixTimestamp();

            checked
            {
                Client.GetHabbo().Credits += amount;
                Client.GetHabbo().UpdateCreditsBalance();
            }
        }
Example #14
0
 public void PlaySong()
 {
     if (this.mSongQueuePosition >= this.mPlaylist.Count)
     {
         this.mSongQueuePosition = 0;
     }
     if (this.mPlaylist.Count == 0)
     {
         this.Stop();
         return;
     }
     this.mSong = this.mPlaylist[this.mSongQueuePosition];
     this.mStartedPlayingTimestamp        = (double)CyberEnvironment.GetUnixTimestamp();
     RoomMusicController.mBroadcastNeeded = true;
 }
Example #15
0
 internal void RunDBUpdate(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery(string.Concat(new object[]
     {
         "UPDATE users SET last_online = '",
         CyberEnvironment.GetUnixTimestamp(),
         "', activity_points = '",
         this.ActivityPoints,
         "', credits = '",
         this.Credits,
         "', seasonal_currency = '",
         this.BelCredits,
         "' WHERE id = '",
         this.Id,
         "' LIMIT 1; "
     }));
 }
Example #16
0
 internal bool CheckTrading()
 {
     if (!this.TradeLocked)
     {
         return(true);
     }
     if (this.TradeLockExpire < CyberEnvironment.GetUnixTimestamp())
     {
         return(false);
     }
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery("UPDATE users SET trade_lock = '0' WHERE id = " + this.Id);
     }
     this.TradeLocked = false;
     return(true);
 }
Example #17
0
        internal static void ProcessThread()
        {
            double      num  = (double)CyberEnvironment.GetUnixTimestamp();
            List <uint> list = new List <uint>();

            foreach (KeyValuePair <uint, double> current in SongManager.cacheTimer)
            {
                if (num - current.Value >= 180.0)
                {
                    list.Add(current.Key);
                }
            }
            foreach (uint current2 in list)
            {
                SongManager.songs.Remove(current2);
                SongManager.cacheTimer.Remove(current2);
            }
        }
Example #18
0
 internal void AddBan(int pId, long Time)
 {
     if (!this.Bans.ContainsKey((long)Convert.ToInt32(pId)))
     {
         this.Bans.Add((long)pId, (double)checked (unchecked ((long)CyberEnvironment.GetUnixTimestamp()) + Time));
     }
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery(string.Concat(new object[]
         {
             "REPLACE INTO room_bans VALUES (",
             pId,
             ", ",
             this.Id,
             ", '",
             (CyberEnvironment.GetUnixTimestamp() + Time),
             "')"
         }));
     }
 }
Example #19
0
 internal void Pick(uint pModeratorId, bool UpdateInDb)
 {
     this.Status      = TicketStatus.PICKED;
     this.ModeratorId = pModeratorId;
     this.ModName     = CyberEnvironment.getHabboForId(pModeratorId).Username;
     if (UpdateInDb)
     {
         using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
         {
             queryreactor.runFastQuery(string.Concat(new object[]
             {
                 "UPDATE moderation_tickets SET status = 'picked', moderator_id = ",
                 pModeratorId,
                 ", timestamp = '",
                 CyberEnvironment.GetUnixTimestamp(),
                 "' WHERE id = ",
                 this.Id
             }));
         }
     }
 }
Example #20
0
        internal void AddSubscription(double DayLength)
        {
            int        num            = checked ((int)Math.Round(DayLength));
            GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(this.UserId);
            DateTime   target;
            int        num2;
            int        num3;

            if (this.Subscription != null)
            {
                target = CyberEnvironment.UnixToDateTime((double)this.Subscription.ExpireTime).AddDays((double)num);
                num2   = this.Subscription.ActivateTime;
                num3   = this.Subscription.LastGiftTime;
            }
            else
            {
                target = DateTime.Now.AddDays((double)num);
                num2   = CyberEnvironment.GetUnixTimestamp();
                num3   = CyberEnvironment.GetUnixTimestamp();
            }
            int num4 = CyberEnvironment.DateTimeToUnix(target);

            this.Subscription = new Subscription(2, num2, num4, num3);
            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "REPLACE INTO user_subscriptions VALUES (",
                    this.UserId,
                    ", 2, ",
                    num2,
                    ", ",
                    num4,
                    ", ",
                    num3,
                    ");"
                }));
            }
            clientByUserID.GetHabbo().SerializeClub();
        }
Example #21
0
        public bool Execute(params object[] Stuff)
        {
            int Date1 = 0;
            int Date2 = 0;

            string[] strArray = mExtra.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);
            }

            int CurrentTimestamp = CyberEnvironment.GetUnixTimestamp();

            bool Result = false;

            if (Date2 < 1)
            {
                Result = (CurrentTimestamp >= Date1);
            }
            else
            {
                Result = (CurrentTimestamp >= Date1 && CurrentTimestamp <= Date2);
            }
            return(Result);
        }
Example #22
0
        internal void ActivateEffect(int EffectId)
        {
            if (!this.Session.GetHabbo().InRoom)
            {
                return;
            }
            else
            {
                if (!this.HasEffect(EffectId))
                {
                    return;
                }
            }
            if (EffectId < 1)
            {
                this.ActivateCustomEffect(EffectId);
                return;
            }
            AvatarEffect avatarEffect = (
                from X in this.Effects
                where X.EffectId == EffectId
                select X).Last <AvatarEffect>();

            avatarEffect.Activate();
            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "UPDATE user_effects SET is_activated = '1', activated_stamp = ",
                    CyberEnvironment.GetUnixTimestamp(),
                    " WHERE user_id = ",
                    this.UserId,
                    " AND effect_id = ",
                    EffectId
                }));
            }
            this.EnableInRoom(EffectId);
        }
Example #23
0
        internal static void Process(object Caller)
        {
            int      clientCount      = CyberEnvironment.GetGame().GetClientManager().ClientCount;
            int      loadedRoomsCount = CyberEnvironment.GetGame().GetRoomManager().LoadedRoomsCount;
            DateTime dateTime         = new DateTime((DateTime.Now - CyberEnvironment.ServerStarted).Ticks);
            string   text             = dateTime.ToString("HH:mm:ss");


            Console.Title = string.Concat(new object[]
            {
                "CYBER EMULATOR - VERSION: ", CyberEnvironment.PrettyBuild, " | TIME: ",
                text,
                " | ONLINE COUNT: ",
                clientCount,
                " | ROOM COUNT: ",
                loadedRoomsCount
            });

            if (clientCount > LowPriorityWorker.UserPeak)
            {
                LowPriorityWorker.UserPeak = clientCount;
            }
            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "UPDATE server_status SET stamp = '",
                    CyberEnvironment.GetUnixTimestamp(),
                    "', users_online = ",
                    clientCount,
                    ", rooms_loaded = ",
                    loadedRoomsCount,
                    ", server_ver = 'Cyber Emulator', userpeak = ",
                    LowPriorityWorker.UserPeak
                }));
            }
        }
Example #24
0
        internal void BanzaiEnd()
        {
            this.banzaiStarted = false;
            this.room.GetGameManager().StopGame();
            this.floorMap = (byte[, ])null;
            this.room.GetWiredHandler().ExecuteWired(WiredItemType.TriggerGameEnds, new object[0]);
            Team winningTeam = this.room.GetGameManager().getWinningTeam();

            this.room.GetGameManager().UnlockGates();
            foreach (RoomItem roomItem in (IEnumerable)this.banzaiTiles.Values)
            {
                if (roomItem.team == winningTeam)
                {
                    roomItem.interactionCount       = (byte)0;
                    roomItem.interactionCountHelper = (byte)0;
                    roomItem.UpdateNeeded           = true;
                }
                else if (roomItem.team == Team.none)
                {
                    roomItem.ExtraData = "0";
                    roomItem.UpdateState();
                }
            }
            if (winningTeam == Team.none)
            {
                return;
            }
            foreach (RoomUser Avatar in this.room.GetRoomUserManager().GetRoomUsers())
            {
                if (Avatar.team != Team.none && (double)CyberEnvironment.GetUnixTimestamp() - this.timestarted > 5.0)
                {
                    CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Avatar.GetClient(), "ACH_BattleBallTilesLocked", Avatar.LockedTilesCount, false);
                    CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Avatar.GetClient(), "ACH_BattleBallPlayer", 1, false);
                }

                if (winningTeam == Team.blue)
                {
                    if (Avatar.CurrentEffect == 35)
                    {
                        if ((double)CyberEnvironment.GetUnixTimestamp() - this.timestarted > 5.0)
                        {
                            CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Avatar.GetClient(), "ACH_BattleBallWinner", 1, false);
                        }
                        ServerMessage waveAtWin = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                        waveAtWin.AppendInt32(Avatar.VirtualId);
                        waveAtWin.AppendInt32(1);
                        this.room.SendMessage(waveAtWin);
                    }
                }
                else if (winningTeam == Team.red)
                {
                    if (Avatar.CurrentEffect == 33)
                    {
                        if ((double)CyberEnvironment.GetUnixTimestamp() - this.timestarted > 5.0)
                        {
                            CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Avatar.GetClient(), "ACH_BattleBallWinner", 1, false);
                        }
                        ServerMessage waveAtWin = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                        waveAtWin.AppendInt32(Avatar.VirtualId);
                        waveAtWin.AppendInt32(1);
                        this.room.SendMessage(waveAtWin);
                    }
                }
                else if (winningTeam == Team.green)
                {
                    if (Avatar.CurrentEffect == 34)
                    {
                        if ((double)CyberEnvironment.GetUnixTimestamp() - this.timestarted > 5.0)
                        {
                            CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Avatar.GetClient(), "ACH_BattleBallWinner", 1, false);
                        }
                        ServerMessage waveAtWin = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                        waveAtWin.AppendInt32(Avatar.VirtualId);
                        waveAtWin.AppendInt32(1);
                        this.room.SendMessage(waveAtWin);
                    }
                }
                else if (winningTeam == Team.yellow && Avatar.CurrentEffect == 36)
                {
                    if ((double)CyberEnvironment.GetUnixTimestamp() - this.timestarted > 5.0)
                    {
                        CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Avatar.GetClient(), "ACH_BattleBallWinner", 1, false);
                    }
                    ServerMessage waveAtWin = new ServerMessage(Outgoing.RoomUserActionMessageComposer);
                    waveAtWin.AppendInt32(Avatar.VirtualId);
                    waveAtWin.AppendInt32(1);
                    this.room.SendMessage(waveAtWin);
                }
            }
            this.field.destroy();
        }
Example #25
0
        internal void Chat(GameClient Session, string Message, bool Shout, int count, int TextColor = 0)
        {
            if (IsPet || IsBot)
            {
                if (!IsPet)
                {
                    TextColor = 2;
                }

                ServerMessage botChatmsg = new ServerMessage();
                botChatmsg.Init(Shout ? Outgoing.ShoutMessageComposer : Outgoing.ChatMessageComposer);
                botChatmsg.AppendInt32(VirtualId);
                botChatmsg.AppendString(Message);
                botChatmsg.AppendInt32(0);
                botChatmsg.AppendInt32(TextColor);
                botChatmsg.AppendInt32(0);
                botChatmsg.AppendInt32(count);

                this.GetRoom().SendMessage(botChatmsg);
                return;
            }

            if (Session.GetHabbo().Rank <= 9 && AntiPublicistas.CheckPublicistas(Message))
            {
                Session.PublicistaCount++;
                Session.HandlePublicista(Message);
                return;
            }

            if (!IsBot && IsFlooded && FloodExpiryTime <= CyberEnvironment.GetUnixTimestamp())
            {
                IsFlooded = false;
            }
            else if (!IsBot && IsFlooded)
            {
                return; // ciao flooders!
            }
            if (Session.GetHabbo().Rank < 4 && GetRoom().CheckMute(Session))
            {
                return;
            }

            this.UnIdle();
            if (!this.IsPet && !this.IsBot)
            {
                if (Message.StartsWith(":") && GetClient().GetHabbo().GetCommandHandler().Parse(Message))
                {
                    return;
                }

                ServerMessage message;
                Habbo         habbo = this.GetClient().GetHabbo();

                if (GetRoom().GetWiredHandler().ExecuteWired(WiredItemType.TriggerUserSaysKeyword, new object[]
                {
                    this,
                    Message
                }))
                {
                    return;
                }


                uint rank = 1;

                if ((Session != null) && (Session.GetHabbo() != null))
                {
                    rank = Session.GetHabbo().Rank;
                }

                GetRoom().AddChatlog(Session.GetHabbo().Id, Message, false);

                foreach (string current in GetRoom().WordFilter)
                {
                    Message = System.Text.RegularExpressions.Regex.Replace(Message, current, "bobba", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                }

                if (rank < 4)
                {
                    TimeSpan span = (TimeSpan)(DateTime.Now - habbo.spamFloodTime);
                    if ((span.TotalSeconds > habbo.spamProtectionTime) && habbo.spamProtectionBol)
                    {
                        this.FloodCount           = 0;
                        habbo.spamProtectionBol   = false;
                        habbo.spamProtectionAbuse = 0;
                    }
                    else if (span.TotalSeconds > 4.0)
                    {
                        this.FloodCount = 0;
                    }
                    if ((span.TotalSeconds < habbo.spamProtectionTime) && habbo.spamProtectionBol)
                    {
                        message = new ServerMessage(Outgoing.FloodFilterMessageComposer);
                        int i = habbo.spamProtectionTime - span.Seconds;
                        message.AppendInt32(i);
                        this.IsFlooded       = true;
                        this.FloodExpiryTime = CyberEnvironment.GetUnixTimestamp() + i;
                        this.GetClient().SendMessage(message);
                        return;
                    }
                    if (((span.TotalSeconds < 4.0) && (this.FloodCount > 5)) && (rank < 5))
                    {
                        message = new ServerMessage(Outgoing.FloodFilterMessageComposer);
                        habbo.spamProtectionCount++;
                        if ((habbo.spamProtectionCount % 2) == 0)
                        {
                            habbo.spamProtectionTime = 10 * habbo.spamProtectionCount;
                        }
                        else
                        {
                            habbo.spamProtectionTime = 10 * (habbo.spamProtectionCount - 1);
                        }
                        habbo.spamProtectionBol = true;
                        int j = (int)(habbo.spamProtectionTime - span.Seconds);
                        message.AppendInt32(j);
                        this.IsFlooded       = true;
                        this.FloodExpiryTime = CyberEnvironment.GetUnixTimestamp() + j;
                        this.GetClient().SendMessage(message);
                        return;
                    }
                    habbo.spamFloodTime = DateTime.Now;
                    this.FloodCount++;
                }
            }
            else
            {
                if (!IsPet)
                {
                    TextColor = 2;
                }
            }

            ServerMessage chatMsg = new ServerMessage();

            chatMsg.Init(Shout ? Outgoing.ShoutMessageComposer : Outgoing.ChatMessageComposer);
            chatMsg.AppendInt32(VirtualId);
            chatMsg.AppendString(Message);
            chatMsg.AppendInt32(RoomUser.GetSpeechEmotion(Message));
            chatMsg.AppendInt32(TextColor);
            chatMsg.AppendInt32(0);
            chatMsg.AppendInt32(count);
            GetRoom().BroadcastChatMessage(chatMsg, this, Session.GetHabbo().Id);

            this.GetRoom().OnUserSay(this, Message, Shout);

            this.GetRoom().GetRoomUserManager().TurnHeads(this.X, this.Y, this.HabboId);
        }
Example #26
0
        internal List <Quest> GetSeasonalQuests(string Season)
        {
            List <Quest> list = new List <Quest>();

            foreach (Quest current in this.quests.Values)
            {
                if (current.Category.Contains(Season) && checked (current.TimeUnlock - CyberEnvironment.GetUnixTimestamp()) < 0)
                {
                    list.Add(current);
                }
            }
            return(list);
        }
Example #27
0
 internal void Activate()
 {
     this.Activated      = true;
     this.StampActivated = (double)CyberEnvironment.GetUnixTimestamp();
 }
Example #28
0
        internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool HasFriendRequestsDisabled, uint currentQuestID, int currentQuestProgress, int achievementPoints, int RegTimestamp, int LastOnline, bool AppearOffline, bool HideInRoom, bool VIP, double CreateDate, bool Online, string Citizenship, int BelCredits, HashSet <GroupUser> Groups, uint FavId, int LastChange, bool TradeLocked, int TradeLockExpire, bool NUXPassed)
        {
            this.Id       = Id;
            this.Username = Username;
            this.RealName = RealName;
            if (Rank < 1u)
            {
                Rank = 1u;
            }
            this.Rank                      = Rank;
            this.Motto                     = Motto;
            this.Look                      = CyberEnvironment.GetGame().GetAntiMutant().RunLook(Look.ToLower());
            this.VIP                       = VIP;
            this.LastChange                = LastChange;
            this.TradeLocked               = TradeLocked;
            this.TradeLockExpire           = TradeLockExpire;
            this.Gender                    = Gender.ToLower();
            this.Credits                   = Credits;
            this.ActivityPoints            = ActivityPoints;
            this.BelCredits                = BelCredits;
            this.AchievementPoints         = achievementPoints;
            this.Muted                     = Muted;
            this.LoadingRoom               = 0u;
            this.CreateDate                = CreateDate;
            this.LoadingChecksPassed       = false;
            this.FloodTime                 = 0;
            this.NUXPassed                 = NUXPassed;
            this.CurrentRoomId             = 0u;
            this.HomeRoom                  = HomeRoom;
            this.HideInRoom                = HideInRoom;
            this.AppearOffline             = AppearOffline;
            this.FavoriteRooms             = new ArrayList();
            this.MutedUsers                = new List <uint>();
            this.Tags                      = new List <string>();
            this.Achievements              = new Dictionary <string, UserAchievement>();
            this.Talents                   = new Dictionary <int, UserTalent>();
            this.Relationships             = new Dictionary <int, Relationship>();
            this.RatedRooms                = new HashSet <uint>();
            this.Respect                   = Respect;
            this.DailyRespectPoints        = DailyRespectPoints;
            this.DailyPetRespectPoints     = DailyPetRespectPoints;
            this.IsTeleporting             = false;
            this.TeleporterId              = 0u;
            this.UsersRooms                = new HashSet <RoomData>();
            this.HasFriendRequestsDisabled = HasFriendRequestsDisabled;
            this.LastOnline                = CyberEnvironment.GetUnixTimestamp();//LastOnline;
            this.PreviousOnline            = LastOnline;
            this.RecentlyVisitedRooms      = new HashSet <uint>();
            this.CurrentQuestId            = currentQuestID;
            this.IsHopping                 = false;

            if (CyberEnvironment.GetGame().GetGroupManager().GetGroup(FavId) != null)
            {
                this.FavouriteGroup = FavId;
            }
            else
            {
                this.FavouriteGroup = 0u;
            }
            this.UserGroups = Groups;
            if (this.DailyPetRespectPoints > 99)
            {
                this.DailyPetRespectPoints = 99;
            }
            if (this.DailyRespectPoints > 99)
            {
                this.DailyRespectPoints = 99;
            }
            this.LastGiftPurchaseTime = DateTime.Now;
            this.LastGiftOpenTime     = DateTime.Now;
            this.TalentStatus         = Citizenship;
            this.CurrentTalentLevel   = this.GetCurrentTalentLevel();
        }
Example #29
0
        internal void AddNewEvent(uint RoomId, string EventName, string EventDesc, GameClient Session, int Time = 7200)
        {
            checked
            {
                if (this.Events.ContainsKey(RoomId))
                {
                    RoomEvent roomEvent = this.Events[RoomId];
                    roomEvent.Name        = EventName;
                    roomEvent.Description = EventDesc;
                    if (roomEvent.HasExpired)
                    {
                        roomEvent.Time = CyberEnvironment.GetUnixTimestamp() + Time;
                    }
                    else
                    {
                        roomEvent.Time += Time;
                    }
                    using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                    {
                        queryreactor.setQuery(string.Concat(new object[]
                        {
                            "REPLACE INTO room_events VALUES (",
                            RoomId,
                            ", @name, @desc, ",
                            roomEvent.Time,
                            ")"
                        }));
                        queryreactor.addParameter("name", EventName);
                        queryreactor.addParameter("desc", EventDesc);
                        queryreactor.runQuery();
                        goto IL_17C;
                    }
                }
                using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                {
                    queryreactor2.setQuery(string.Concat(new object[]
                    {
                        "REPLACE INTO room_events VALUES (",
                        RoomId,
                        ", @name, @desc, ",
                        CyberEnvironment.GetUnixTimestamp() + 7200,
                        ")"
                    }));
                    queryreactor2.addParameter("name", EventName);
                    queryreactor2.addParameter("desc", EventDesc);
                    queryreactor2.runQuery();
                }
                this.Events.Add(RoomId, new RoomEvent(RoomId, EventName, EventDesc, 0));
IL_17C:
                CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId).Event = this.Events[RoomId];
                Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(RoomId);
                if (room != null)
                {
                    room.Event = this.Events[RoomId];
                }
                if (Session.GetHabbo().CurrentRoomId == RoomId)
                {
                    this.SerializeEventInfo(RoomId);
                }
            }
        }
Example #30
0
        internal void SerializeEventInfo(uint RoomId)
        {
            Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(RoomId);

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

            if (@event != null && [email protected])
            {
                if (!this.RoomHasEvents(RoomId))
                {
                    return;
                }
                ServerMessage serverMessage = new ServerMessage();
                serverMessage.Init(Outgoing.RoomEventMessageComposer);
                serverMessage.AppendUInt(RoomId);
                serverMessage.AppendInt32(room.OwnerId);
                serverMessage.AppendString(room.Owner);
                serverMessage.AppendInt32(1);
                serverMessage.AppendInt32(1);
                serverMessage.AppendString(@event.Name);
                serverMessage.AppendString(@event.Description);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(checked ((int)Math.Floor((double)(@event.Time - CyberEnvironment.GetUnixTimestamp()) / 60.0)));
                room.SendMessage(serverMessage);
            }
        }