public ProfileInformationComposer(Habbo habbo, Player 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(Program.GameContext.PlayerController.GetClientByUserId(habbo.Id) != null);

            WriteInteger(groups.Count);
            foreach (var group in groups)
            {
                WriteInteger(group.Id);
                WriteString(group.Name);
                WriteString(group.Badge);
                WriteString(Program.GameContext.GetGroupManager().GetColourCode(group.Colour1, true));
                WriteString(Program.GameContext.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(UnixUtilities.GetNow() - habbo.LastOnline)); // Last online
            WriteBoolean(true);                                                       // Show the profile
        }
示例#2
0
        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((RocketEmulador.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(RocketEmulador.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true));
                base.WriteString(RocketEmulador.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(RocketEmulador.GetUnixTimestamp() - Data.LastOnline)); // Last online
            base.WriteBoolean(true);                                                                 // Show the profile
        }
 public PetInformationComposer(Habbo Habbo)
     : base(ServerPacketHeader.PetInformationMessageComposer)
 {
     base.WriteInteger(Habbo.Id);
     base.WriteString(Habbo.Username);
     base.WriteInteger(Habbo.Rank);
     base.WriteInteger(10);
     base.WriteInteger(0);
     base.WriteInteger(0);
     base.WriteInteger(100);
     base.WriteInteger(100);
     base.WriteInteger(100);
     base.WriteInteger(100);
     base.WriteInteger(Habbo.GetStats().Respect);
     base.WriteInteger(Habbo.Id);
     base.WriteInteger(Convert.ToInt32(Math.Floor((RocketEmulador.GetUnixTimestamp() - Habbo.AccountCreated) / 86400))); //How?
     base.WriteString(Habbo.Username);
     base.WriteInteger(1);                                                                                               //3 on hab
     base.WriteBoolean(false);
     base.WriteBoolean(false);
     base.WriteInteger(0); //5 on hab
     base.WriteInteger(0); // Anyone can ride horse
     base.WriteInteger(0);
     base.WriteInteger(0); //512 on hab
     base.WriteInteger(0); //1536
     base.WriteInteger(0); //2560
     base.WriteInteger(0); //3584
     base.WriteInteger(0);
     base.WriteString("");
     base.WriteBoolean(false);
     base.WriteInteger(-1);//255 on hab
     base.WriteInteger(-1);
     base.WriteInteger(-1);
     base.WriteBoolean(false);
 }
示例#4
0
        public static void SerializeQuest(ServerPacket Message, Habbo habbo, Quest Quest, string Category)
        {
            if (Message == null || habbo == null)
            {
                return;
            }

            int AmountInCat  = PlusEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
            int Number       = Quest == null ? AmountInCat : Quest.Number - 1;
            int UserProgress = Quest == null ? 0 : habbo.GetQuestProgress(Quest.Id);

            if (Quest != null && Quest.IsCompleted(UserProgress))
            {
                Number++;
            }

            Message.WriteString(Category);
            Message.WriteInteger(Quest == null ? 0 : ((Quest.Category.Contains("xmas2012")) ? 0 : Number));    // Quest progress in this cat
            Message.WriteInteger(Quest == null ? 0 : (Quest.Category.Contains("xmas2012")) ? 0 : AmountInCat); // Total quests in this cat
            Message.WriteInteger(Quest == null ? 3 : Quest.RewardType);                                        // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.WriteInteger(Quest == null ? 0 : Quest.Id);                                                // Quest id
            Message.WriteBoolean(Quest == null ? false : habbo.GetStats().QuestId == Quest.Id);                // Quest started
            Message.WriteString(Quest == null ? string.Empty : Quest.ActionName);
            Message.WriteString(Quest == null ? string.Empty : Quest.DataBit);
            Message.WriteInteger(Quest == null ? 0 : Quest.Reward);
            Message.WriteString(Quest == null ? string.Empty : Quest.Name);
            Message.WriteInteger(UserProgress);                         // Current progress
            Message.WriteInteger(Quest == null ? 0 : Quest.GoalData);   // Target progress
            Message.WriteInteger(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds
            Message.WriteString("");
            Message.WriteString("");
            Message.WriteBoolean(true);
        }
示例#5
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);
 }
示例#6
0
 public UserObjectComposer(Habbo Habbo)
     : base(ServerPacketHeader.UserObjectMessageComposer)
 {
     WriteInteger(Habbo.Id);
     WriteString(Habbo.Username);
     WriteString(Habbo.Look);
     WriteString(Habbo.Gender.ToUpper());
     WriteString(Habbo.Motto);
     WriteString("");
     WriteBoolean(false);
     WriteInteger(Habbo.GetStats().Respect);
     WriteInteger(Habbo.GetStats().DailyRespectPoints);
     WriteInteger(Habbo.GetStats().DailyPetRespectPoints);
     WriteBoolean(false);                      // Friends stream active
     WriteString(Habbo.LastOnline.ToString()); // last online?
     WriteBoolean(Habbo.ChangingName);         // Can change name
     WriteBoolean(false);
 }
        public ProfileInformationComposer(Habbo Data, GameClient Session, List <Group> Groups, int friendCount, RoleplayBot Bot = null)
            : base(ServerPacketHeader.ProfileInformationMessageComposer)
        {
            if (Bot != null)
            {
                BotProfile(Session, Groups, friendCount, Bot);
            }
            else
            {
                DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Data.AccountCreated).ToLocalTime();

                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() == null) ? 0 : 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.Where(x => x != null).ToList().Count);
                foreach (Group Group in Groups)
                {
                    if (Group == null)
                    {
                        continue;
                    }

                    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.Id == 0 && Group.Id == 1) ? true : ((Group.Id < 1000 && Data.Id > 0) ? true : false)); // 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
            }
        }
示例#8
0
        public override void Compose(ServerPacket packet)
        {
            int AmountInCat  = PlusEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category);
            int Number       = Quest == null ? AmountInCat : Quest.Number;
            int UserProgress = Quest == null ? 0 : Habbo.GetQuestProgress(Quest.Id);

            packet.WriteString(Quest.Category);
            packet.WriteInteger(Number);                                                       // Quest progress in this cat
            packet.WriteInteger((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat);          // Total quests in this cat
            packet.WriteInteger(Quest == null ? 3 : Quest.RewardType);                         // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            packet.WriteInteger(Quest == null ? 0 : Quest.Id);                                 // Quest id
            packet.WriteBoolean(Quest == null ? false : Habbo.GetStats().QuestId == Quest.Id); // Quest started
            packet.WriteString(Quest == null ? string.Empty : Quest.ActionName);
            packet.WriteString(Quest == null ? string.Empty : Quest.DataBit);
            packet.WriteInteger(Quest == null ? 0 : Quest.Reward);
            packet.WriteString(Quest == null ? string.Empty : Quest.Name);
            packet.WriteInteger(UserProgress);                         // Current progress
            packet.WriteInteger(Quest == null ? 0 : Quest.GoalData);   // Target progress
            packet.WriteInteger(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds
            packet.WriteString("");
            packet.WriteString("");
            packet.WriteBoolean(true); // ?
            packet.WriteBoolean(true); // Activate next quest..
        }
示例#9
0
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                UserData userData = UserDataFactory.GetUserData(AuthTicket, out byte errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking
                //Let's have a quick search for a ban before we successfully authenticate..
                ModerationBan BanRecord = null;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (CloudServer.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (CloudServer.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (userData.user != null)
                {
                    //Now let us check for a username ban record..
                    BanRecord = null;
                    if (CloudServer.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                    {
                        if (CloudServer.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }
                #endregion

                CloudServer.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                _habbo           = userData.user;
                _habbo.ssoTicket = AuthTicket;
                if (_habbo != null)
                {
                    userData.user.Init(this, userData);

                    SendMessage(new AuthenticationOKComposer());
                    SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingParts));
                    SendMessage(new UserRightsComposer(_habbo));
                    SendMessage(new AvailabilityStatusComposer());
                    SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));
                    SendMessage(new BuildersClubMembershipComposer());
                    SendMessage(new CfhTopicsInitComposer(CloudServer.GetGame().GetModerationManager().UserActionPresets));
                    SendMessage(new BadgeDefinitionsComposer(CloudServer.GetGame().GetAchievementManager()._achievements));
                    SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));

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

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (_habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }

                    if (CloudServer.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup PermissionGroup))
                    {
                        if (!String.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    if (!CloudServer.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        CloudServer.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.InitProcess();

                    if (userData.user.GetPermissions().HasRight("mod_tickets"))
                    {
                        SendMessage(new ModeratorInitComposer(
                                        CloudServer.GetGame().GetModerationManager().UserMessagePresets,
                                        CloudServer.GetGame().GetModerationManager().RoomMessagePresets,
                                        CloudServer.GetGame().GetModerationManager().GetTickets));
                    }

                    if (CloudServer.GetGame().GetSettingsManager().TryGetValue("user.login.message.enabled") == "1")
                    {
                        SendMessage(new MOTDNotificationComposer(CloudServer.GetGame().GetLanguageManager().TryGetValue("user.login.message")));
                    }

                    if (ExtraSettings.WELCOME_MESSAGE_ENABLED)
                    {
                        SendMessage(new MOTDNotificationComposer(ExtraSettings.WelcomeMessage.Replace("%username%", GetHabbo().Username)));
                    }



                    if (ExtraSettings.TARGETED_OFFERS_ENABLED)
                    {
                        if (CloudServer.GetGame().GetTargetedOffersManager().TargetedOffer != null)
                        {
                            CloudServer.GetGame().GetTargetedOffersManager().Initialize(CloudServer.GetDatabaseManager().GetQueryReactor());
                            TargetedOffers TargetedOffer = CloudServer.GetGame().GetTargetedOffersManager().TargetedOffer;

                            if (TargetedOffer.Expire > CloudServer.GetIUnixTimestamp())
                            {
                                if (TargetedOffer.Limit != GetHabbo()._TargetedBuy)
                                {
                                    SendMessage(CloudServer.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                                }
                            }
                            else
                            {
                                using (var dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                                    dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'");
                                using (var dbClient2 = CloudServer.GetDatabaseManager().GetQueryReactor())
                                    dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0");
                            }
                        }
                    }

                    //SendMessage(new HCGiftsAlertComposer());



                    /*var nuxStatuss = new ServerPacket(ServerPacketHeader.NuxSuggestFreeGiftsMessageComposer);
                     * SendMessage(nuxStatuss);*/

                    CloudServer.GetGame().GetRewardManager().CheckRewards(this);
                    CloudServer.GetGame().GetAchievementManager().TryProgressHabboClubAchievements(this);
                    CloudServer.GetGame().GetAchievementManager().TryProgressRegistrationAchievements(this);
                    CloudServer.GetGame().GetAchievementManager().TryProgressLoginAchievements(this);
                    ICollection <MessengerBuddy> Friends = new List <MessengerBuddy>();
                    foreach (MessengerBuddy Buddy in GetHabbo().GetMessenger().GetFriends().ToList())
                    {
                        if (Buddy == null)
                        {
                            continue;
                        }

                        GameClient Friend = CloudServer.GetGame().GetClientManager().GetClientByUserID(Buddy.Id);
                        if (Friend == null)
                        {
                            continue;
                        }
                        string figure = GetHabbo().Look;
                    }
                    return(true);
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }
            return(false);
        }
示例#10
0
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                UserData userData = UserDataFactory.GetUserData(AuthTicket, out byte errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking

                //Let's have a quick search for a ban before we successfully authenticate..
                ModerationBan BanRecord;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (NeonEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                {
                    if (NeonEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                    {
                        Disconnect();
                        return(false);
                    }
                }

                #endregion

                NeonEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                _habbo = userData.user;


                if (_habbo != null)
                {
                    ssoTicket = AuthTicket;
                    userData.user.Init(this, userData);


                    SendMessage(new AuthenticationOKComposer());
                    SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingAllParts));
                    SendMessage(new UserRightsComposer(_habbo));
                    SendMessage(new AvailabilityStatusComposer());
                    SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));


                    //var habboClubSubscription = new ServerPacket(ServerPacketHeader.HabboClubSubscriptionComposer);
                    //habboClubSubscription.WriteString("club_habbo");
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(2);
                    //habboClubSubscription.WriteBoolean(false);
                    //habboClubSubscription.WriteBoolean(false);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //SendMessage(habboClubSubscription);

                    SendMessage(new BuildersClubMembershipComposer());
                    SendMessage(new CfhTopicsInitComposer());

                    SendMessage(new BadgeDefinitionsComposer(NeonEnvironment.GetGame().GetAchievementManager()._achievements));
                    SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));

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

                    if (_habbo.Rank < 2 && !NeonStaticGameSettings.HotelOpenForUsers)
                    {
                        SendMessage(new SendHotelAlertLinkEventComposer("Actualmente solo el Equipo Adminsitrativo puede entrar al hotel para comprobar que todo está bien antes de que los usuarios puedan entrar. Vuelve a intentarlo en unos minutos, podrás encontrar más información en nuestro Facebook.", NeonEnvironment.GetDBConfig().DBData["facebook_url"]));
                        Thread.Sleep(10000);
                        Disconnect();
                        return(false);
                    }

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (_habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }
                    if (NeonEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup PermissionGroup))
                    {
                        if (!string.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    if (NeonEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(_habbo.VIPRank, out SubscriptionData SubData))
                    {
                        if (!string.IsNullOrEmpty(SubData.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this);
                            }
                        }
                    }

                    if (!NeonEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        NeonEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.InitProcess();

                    GetHabbo()._lastitems = new Dictionary <int, CatalogItem>();
                    //ICollection<MessengerBuddy> Friends = new List<MessengerBuddy>();
                    //foreach (MessengerBuddy Buddy in this.GetHabbo().GetMessenger().GetFriends().ToList())
                    //{
                    //    if (Buddy == null)
                    //        continue;

                    //    GameClient Friend = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Buddy.Id);
                    //    if (Friend == null)
                    //        continue;
                    //    string figure = this.GetHabbo().Look;


                    //    Friend.SendMessage(RoomNotificationComposer.SendBubble("usr/look/" + this.GetHabbo().Username + "", this.GetHabbo().Username + " se ha conectado a " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ".", ""));

                    //}

                    if (GetHabbo()._NUX)
                    {
                        SendMessage(new MassEventComposer("habbopages/bienvenida.txt"));
                    }
                    else
                    {
                        SendMessage(new MassEventComposer("habbopages/welk.txt?249"));
                    }


                    if (NeonEnvironment.GetDBConfig().DBData["pin.system.enable"] == "0")
                    {
                        GetHabbo().StaffOk = true;
                    }

                    if (GetHabbo().StaffOk)
                    {
                        if (GetHabbo().GetPermissions().HasRight("mod_tickets"))
                        {
                            SendMessage(new ModeratorInitComposer(
                                            NeonEnvironment.GetGame().GetModerationManager().UserMessagePresets,
                                            NeonEnvironment.GetGame().GetModerationManager().RoomMessagePresets,
                                            NeonEnvironment.GetGame().GetModerationManager().GetTickets));
                        }
                    }

                    if (GetHabbo().Rank > 5 || GetHabbo()._guidelevel > 0)
                    {
                        HelperToolsManager.AddHelper(_habbo.GetClient(), false, true, true);
                        SendMessage(new HandleHelperToolComposer(true));
                    }

                    //SendMessage(new CampaignCalendarDataComposer(_habbo.calendarGift));
                    //if (int.Parse(NeonEnvironment.GetDBConfig().DBData["advent.calendar.enable"]) == 1) // Tk Custom By Whats
                    //    SendMessage(new MassEventComposer("openView/calendar"));

                    if (NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer != null)
                    {
                        NeonEnvironment.GetGame().GetTargetedOffersManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                        TargetedOffers TargetedOffer = NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer;

                        if (TargetedOffer.Expire > NeonEnvironment.GetIUnixTimestamp())
                        {
                            if (TargetedOffer.Limit != GetHabbo()._TargetedBuy)
                            {
                                SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                            }
                        }
                        else if (TargetedOffer.Expire == -1)
                        {
                            if (TargetedOffer.Limit != GetHabbo()._TargetedBuy)
                            {
                                SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                            }
                        }
                        else
                        {
                            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'");
                            }

                            using (IQueryAdapter dbClient2 = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0");
                            }
                        }
                    }

                    if (_habbo.MysticBoxes.Count == 0 && _habbo.MysticKeys.Count == 0)
                    {
                        int    box      = RandomNumber.GenerateRandom(1, 8);
                        string boxcolor = "";
                        switch (box)
                        {
                        case 1:
                            boxcolor = "purple";
                            break;

                        case 2:
                            boxcolor = "blue";
                            break;

                        case 3:
                            boxcolor = "green";
                            break;

                        case 4:
                            boxcolor = "yellow";
                            break;

                        case 5:
                            boxcolor = "lilac";
                            break;

                        case 6:
                            boxcolor = "orange";
                            break;

                        case 7:
                            boxcolor = "turquoise";
                            break;

                        case 8:
                            boxcolor = "red";
                            break;
                        }

                        int    key      = RandomNumber.GenerateRandom(1, 8);
                        string keycolor = "";
                        switch (key)
                        {
                        case 1:
                            keycolor = "purple";
                            break;

                        case 2:
                            keycolor = "blue";
                            break;

                        case 3:
                            keycolor = "green";
                            break;

                        case 4:
                            keycolor = "yellow";
                            break;

                        case 5:
                            keycolor = "lilac";
                            break;

                        case 6:
                            keycolor = "orange";
                            break;

                        case 7:
                            keycolor = "turquoise";
                            break;

                        case 8:
                            keycolor = "red";
                            break;
                        }

                        _habbo.MysticKeys.Add(keycolor);
                        _habbo.MysticBoxes.Add(boxcolor);

                        using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery("INSERT INTO user_mystic_data(user_id, mystic_keys, mystic_boxes) VALUES(" + GetHabbo().Id + ", '" + keycolor + "', '" + boxcolor + "');");
                        }
                    }

                    SendMessage(new MysteryBoxDataComposer(_habbo.GetClient()));

                    SendMessage(new HCGiftsAlertComposer());

                    //if(!GetHabbo()._NUX)
                    //{
                    //    DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                    //    dtDateTime = dtDateTime.AddSeconds(GetHabbo().LastOnline);

                    //    if ((DateTime.Now - dtDateTime).TotalDays > 2)
                    //    {
                    //        //NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_Login", 1, true);
                    //        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_RegistrationDuration", 1);
                    //    }

                    //    else if ((DateTime.Now - dtDateTime).TotalDays > 1 && (DateTime.Now - dtDateTime).TotalDays < 2)
                    //    {
                    //        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_Login", 1);
                    //        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_RegistrationDuration", 1);

                    //        if(GetHabbo().Rank > 2 || GetHabbo()._guidelevel > 0)
                    //        {
                    //            NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_GuideEnrollmentLifetime", 1);
                    //        }
                    //    }
                    //}


                    NeonEnvironment.GetGame().GetRewardManager().CheckRewards(this);

                    if (GetHabbo()._NUX)
                    {
                        NeonEnvironment.GetGame().GetClientManager().StaffAlert(new RoomInviteComposer(int.MinValue, GetHabbo().Username + " acaba de registrarse en Keko."));

                        GetHabbo()._NUX = false;
                        using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery("UPDATE users SET nux_user = '******' WHERE id = " + GetHabbo().Id + ";");
                        }
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Bug during user login: " + e);
            }
            return(false);
        }
示例#11
0
        public bool TryAuthenticate(string authTicket)
        {
            try
            {
                UserData userData = UserDataFactory.GetUserData(authTicket, out byte errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking
                //Let's have a quick search for a ban before we successfully authenticate..
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (PlusEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out _))
                    {
                        if (PlusEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (userData.user != null)
                {
                    if (PlusEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out _))
                    {
                        if (PlusEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }
                #endregion

                if (userData.user == null) //Possible NPE
                {
                    return(false);
                }

                PlusEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.UserId, userData.user.Username);
                _habbo = userData.user;
                if (_habbo != null)
                {
                    userData.user.Init(this, userData);

                    SendPacket(new AuthenticationOKComposer());
                    SendPacket(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    SendPacket(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendPacket(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendPacket(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingParts));
                    SendPacket(new UserRightsComposer(_habbo.Rank));
                    SendPacket(new AvailabilityStatusComposer());
                    SendPacket(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));
                    SendPacket(new BuildersClubMembershipComposer());
                    SendPacket(new CfhTopicsInitComposer(PlusEnvironment.GetGame().GetModerationManager().UserActionPresets));

                    SendPacket(new BadgeDefinitionsComposer(PlusEnvironment.GetGame().GetAchievementManager().Achievements));
                    SendPacket(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));
                    //SendMessage(new TalentTrackLevelComposer());

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

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (_habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }

                    if (PlusEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup group))
                    {
                        if (!String.IsNullOrEmpty(group.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(group.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(group.Badge, true, this);
                            }
                        }
                    }

                    if (PlusEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(_habbo.VIPRank, out SubscriptionData subData))
                    {
                        if (!String.IsNullOrEmpty(subData.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(subData.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(subData.Badge, true, this);
                            }
                        }
                    }

                    if (!PlusEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        PlusEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.Look = PlusEnvironment.GetFigureManager().ProcessFigure(_habbo.Look, _habbo.Gender, _habbo.GetClothing().GetClothingParts, true);
                    _habbo.InitProcess();

                    if (userData.user.GetPermissions().HasRight("mod_tickets"))
                    {
                        SendPacket(new ModeratorInitComposer(
                                       PlusEnvironment.GetGame().GetModerationManager().UserMessagePresets,
                                       PlusEnvironment.GetGame().GetModerationManager().RoomMessagePresets,
                                       PlusEnvironment.GetGame().GetModerationManager().GetTickets));
                    }

                    if (PlusEnvironment.GetSettingsManager().TryGetValue("user.login.message.enabled") == "1")
                    {
                        SendPacket(new MotdNotificationComposer(PlusEnvironment.GetLanguageManager().TryGetValue("user.login.message")));
                    }

                    PlusEnvironment.GetGame().GetRewardManager().CheckRewards(this);
                    return(true);
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }
            return(false);
        }
示例#12
0
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                byte     errorCode = 0;
                UserData userData  = UserDataFactory.GetUserData(AuthTicket, out errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect(true);
                    return(false);
                }

                #region Ban Checking
                //Let's have a quick search for a ban before we successfully authenticate..
                ModerationBan BanRecord = null;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (PlusEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (PlusEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect(true);
                            return(false);
                        }
                    }
                }

                if (userData.user != null)
                {
                    //Now let us check for a username ban record..
                    BanRecord = null;
                    if (PlusEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                    {
                        if (PlusEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                        {
                            Disconnect(true);
                            return(false);
                        }
                    }
                }
                #endregion

                #region Roleplay Data
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT * FROM `rp_stats` WHERE `id` = '" + userData.userID + "' LIMIT 1");
                    DataRow UserRPRow = dbClient.getRow();

                    dbClient.SetQuery("SELECT * FROM `rp_stats_cooldowns` WHERE `id` = '" + userData.userID + "' LIMIT 1");
                    DataRow UserRPCooldowns = dbClient.getRow();

                    if (UserRPCooldowns == null)
                    {
                        dbClient.RunQuery("INSERT INTO `rp_stats_cooldowns` (`id`) VALUES ('" + userData.userID + "')");
                        dbClient.SetQuery("SELECT * FROM `rp_stats_cooldowns` WHERE `id` = '" + userData.userID + "' LIMIT 1");
                        UserRPCooldowns = dbClient.getRow();
                    }

                    dbClient.SetQuery("SELECT * FROM `rp_stats_farming` WHERE `id` = '" + userData.userID + "' LIMIT 1");
                    DataRow UserRPFarming = dbClient.getRow();

                    if (UserRPFarming == null)
                    {
                        dbClient.RunQuery("INSERT INTO `rp_stats_farming` (`id`) VALUES ('" + userData.userID + "')");
                        dbClient.SetQuery("SELECT * FROM `rp_stats_farming` WHERE `id` = '" + userData.userID + "' LIMIT 1");
                        UserRPFarming = dbClient.getRow();
                    }

                    _roleplay = new RoleplayUser(this, UserRPRow, UserRPCooldowns, UserRPFarming);
                }
                #endregion

                PlusEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                _habbo = userData.user;

                if (_habbo != null)
                {
                    userData.user.Init(this, userData);

                    SendMessage(new AuthenticationOKComposer());
                    SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingAllParts));
                    SendMessage(new UserRightsComposer(this, _habbo.Rank));
                    SendMessage(new AvailabilityStatusComposer());
                    SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));
                    SendMessage(new BuildersClubMembershipComposer());
                    SendMessage(new CfhTopicsInitComposer());
                    SendMessage(new BadgeDefinitionsComposer(PlusEnvironment.GetGame().GetAchievementManager()._achievements));
                    SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));
                    //SendMessage(new TalentTrackLevelComposer());

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (this._habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }

                    PermissionGroup PermissionGroup = null;
                    if (PlusEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup))
                    {
                        if (!String.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    SubscriptionData SubData = null;
                    if (PlusEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(this._habbo.VIPRank, out SubData))
                    {
                        if (!String.IsNullOrEmpty(SubData.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this);
                            }
                        }
                    }

                    if (!PlusEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        PlusEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.InitProcess();

                    if (userData.user.GetPermissions().HasRight("mod_tickets"))
                    {
                        SendMessage(new ModeratorInitComposer(
                                        PlusEnvironment.GetGame().GetModerationManager().UserMessagePresets,
                                        PlusEnvironment.GetGame().GetModerationManager().RoomMessagePresets,
                                        PlusEnvironment.GetGame().GetModerationManager().UserActionPresets,
                                        PlusEnvironment.GetGame().GetModerationTool().GetTickets));
                    }

                    if (!string.IsNullOrWhiteSpace(PlusEnvironment.GetDBConfig().DBData["welcome_message"]))
                    {
                        SendMessage(new MOTDNotificationComposer(PlusEnvironment.GetDBConfig().DBData["welcome_message"].Replace("\\r\\n", "\n")));
                    }

                    PlusEnvironment.GetGame().GetRewardManager().CheckRewards(this);
                    this.AuthTicket = AuthTicket;
                    EventManager.TriggerEvent("OnLogin", this);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Erro durante o login do usuário: " + e);
            }
            return(false);
        }
示例#13
0
        /// <summary>
        /// Called for each time the timer ticks.
        /// </summary>
        /// <param name="State"></param>
        public void Run(object State)
        {
            try
            {
                if (_disabled)
                {
                    return;
                }

                if (_timerRunning)
                {
                    _timerLagging = true;
                    log.Warn("<Player " + _player.Id + "> Server can't keep up, Player timer is lagging behind.");
                    return;
                }

                _resetEvent.Reset();

                #region Muted Checks
                if (_player.TimeMuted > 0)
                {
                    _player.TimeMuted -= 60;
                }
                #endregion

                #region Console Checks
                if (_player.MessengerSpamTime > 0)
                {
                    _player.MessengerSpamTime -= 60;
                }

                if (_player.MessengerSpamTime <= 0)
                {
                    _player.MessengerSpamCount = 0;
                }
                #endregion

                _player.TimeAFK += 1;

                #region Respect checking
                if (_player.GetStats().RespectsTimestamp != DateTime.Today.ToString("MM/dd"))
                {
                    _player.GetStats().RespectsTimestamp = DateTime.Today.ToString("MM/dd");
                    using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("UPDATE `user_stats` SET `dailyRespectPoints` = '" + (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20) + "', `dailyPetRespectPoints` = '" + (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20) + "', `respectsTimestamp` = '" + DateTime.Today.ToString("MM/dd") + "' WHERE `id` = '" + _player.Id + "' LIMIT 1");
                    }

                    _player.GetStats().DailyRespectPoints    = (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20);
                    _player.GetStats().DailyPetRespectPoints = (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20);

                    if (_player.GetClient() != null)
                    {
                        _player.GetClient().SendMessage(new UserObjectComposer(_player));
                    }
                }
                #endregion

                #region Reset Scripting Warnings
                if (_player.GiftPurchasingWarnings < 15)
                {
                    _player.GiftPurchasingWarnings = 0;
                }

                if (_player.MottoUpdateWarnings < 15)
                {
                    _player.MottoUpdateWarnings = 0;
                }

                if (_player.ClothingUpdateWarnings < 15)
                {
                    _player.ClothingUpdateWarnings = 0;
                }
                #endregion


                if (_player.GetClient() != null)
                {
                    NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_player.GetClient(), "ACH_AllTimeHotelPresence", 1);
                }

                _player.CheckCreditsTimer();
                _player.Effects().CheckEffectExpiry(_player);

                _timerRunning = false;
                _timerLagging = false;

                _resetEvent.Set();
            }
            catch { }
        }
示例#14
0
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                byte     errorCode = 0;
                UserData userData  = UserDataFactory.GetUserData(AuthTicket, out errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking
                //Let's have a quick search for a ban before we successfully authenticate..
                ModerationBan BanRecord = null;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (QuasarEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (QuasarEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (userData.user != null)
                {
                    //Now let us check for a username ban record..
                    BanRecord = null;
                    if (QuasarEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                    {
                        if (QuasarEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }
                #endregion

                QuasarEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                _habbo = userData.user;
                if (_habbo != null)
                {
                    userData.user.Init(this, userData);

                    SendMessage(new AuthenticationOKComposer());
                    SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    //FurniListNotification -> why?
                    SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingAllParts));
                    //1984
                    //2102
                    SendMessage(new UserRightsComposer(_habbo));
                    SendMessage(new AvailabilityStatusComposer());
                    //1044
                    SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));
                    //3674
                    //3437
                    SendMessage(new CampaignCalendarDataComposer(_habbo.calendarGift));

                    var habboClubSubscription = new ServerPacket(ServerPacketHeader.HabboClubSubscriptionComposer);
                    habboClubSubscription.WriteString("club_habbo");
                    habboClubSubscription.WriteInteger(0);
                    habboClubSubscription.WriteInteger(0);
                    habboClubSubscription.WriteInteger(0);
                    habboClubSubscription.WriteInteger(2);
                    habboClubSubscription.WriteBoolean(false);
                    habboClubSubscription.WriteBoolean(false);
                    habboClubSubscription.WriteInteger(0);
                    habboClubSubscription.WriteInteger(0);
                    habboClubSubscription.WriteInteger(0);
                    SendMessage(habboClubSubscription);

                    SendMessage(new BuildersClubMembershipComposer());
                    SendMessage(new CfhTopicsInitComposer());

                    SendMessage(new BadgeDefinitionsComposer(QuasarEnvironment.GetGame().GetAchievementManager()._achievements));
                    SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));
                    //SendMessage(new TalentTrackLevelComposer());

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (this._habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }

                    PermissionGroup PermissionGroup = null;
                    if (QuasarEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup))
                    {
                        if (!String.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    SubscriptionData SubData = null;
                    if (QuasarEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(this._habbo.VIPRank, out SubData))
                    {
                        if (!String.IsNullOrEmpty(SubData.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this);
                            }
                        }
                    }

                    if (!QuasarEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        QuasarEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }


                    _habbo.InitProcess();

                    if (userData.user.GetPermissions().HasRight("mod_tickets"))
                    {
                        SendMessage(new ModeratorInitComposer(
                                        QuasarEnvironment.GetGame().GetModerationManager().UserMessagePresets,
                                        QuasarEnvironment.GetGame().GetModerationManager().RoomMessagePresets,
                                        QuasarEnvironment.GetGame().GetModerationManager().UserActionPresets,
                                        QuasarEnvironment.GetGame().GetModerationTool().GetTickets));
                    }

                    if (!string.IsNullOrWhiteSpace(QuasarEnvironment.GetDBConfig().DBData["welcome_message"]))
                    {
                        SendMessage(new MOTDNotificationComposer(QuasarEnvironment.GetDBConfig().DBData["welcome_message"]));
                    }

                    QuasarEnvironment.GetGame().GetRewardManager().CheckRewards(this);


                    if (GetHabbo()._NUX)
                    {
                        var nuxStatus = new ServerPacket(ServerPacketHeader.NuxUserStatus);
                        nuxStatus.WriteInteger(2);
                        SendMessage(nuxStatus);
                        QuasarEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("bubble_filter", "Er is een nieuwe gebruiker geregistreerd in Habbis!\n\nGebruiker: " + GetHabbo().Username + "", ""));
                    }

                    if (QuasarEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer != null)
                    {
                        SendMessage(QuasarEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Bug during user login: " + e);
            }
            return(false);
        }
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                UserData userData = UserDataFactory.GetUserData(AuthTicket, out byte errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking
                //Let's have a quick search for a ban before we successfully authenticate..
                ModerationBan BanRecord = null;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (BiosEmuThiago.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (BiosEmuThiago.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (userData.user != null)
                {
                    //Now let us check for a username ban record..
                    BanRecord = null;
                    if (BiosEmuThiago.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                    {
                        if (BiosEmuThiago.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }
                #endregion

                BiosEmuThiago.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                _habbo           = userData.user;
                _habbo.ssoTicket = AuthTicket;
                if (_habbo != null)
                {
                    userData.user.Init(this, userData);

                    SendMessage(new AuthenticationOKComposer());
                    SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingParts));
                    SendMessage(new UserRightsComposer(_habbo));
                    SendMessage(new AvailabilityStatusComposer());
                    SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));
                    SendMessage(new BuildersClubMembershipComposer());
                    SendMessage(new CfhTopicsInitComposer(BiosEmuThiago.GetGame().GetModerationManager().UserActionPresets));
                    SendMessage(new BadgeDefinitionsComposer(BiosEmuThiago.GetGame().GetAchievementManager()._achievements));
                    SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));

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

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (_habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }

                    if (BiosEmuThiago.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup PermissionGroup))
                    {
                        if (!String.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    if (!BiosEmuThiago.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        BiosEmuThiago.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.InitProcess();

                    if (userData.user.GetPermissions().HasRight("mod_tickets"))
                    {
                        SendMessage(new ModeratorInitComposer(
                                        BiosEmuThiago.GetGame().GetModerationManager().UserMessagePresets,
                                        BiosEmuThiago.GetGame().GetModerationManager().RoomMessagePresets,
                                        BiosEmuThiago.GetGame().GetModerationManager().GetTickets));
                    }

                    if (BiosEmuThiago.GetGame().GetSettingsManager().TryGetValue("user.login.message.enabled") == "1")
                    {
                        SendMessage(new MOTDNotificationComposer(BiosEmuThiago.GetGame().GetLanguageManager().TryGetValue("user.login.message")));
                    }

                    if (ExtraSettings.WELCOME_MESSAGE_ENABLED)
                    {
                        SendMessage(new MOTDNotificationComposer(ExtraSettings.WelcomeMessage.Replace("%username%", GetHabbo().Username)));
                    }

                    if (GetHabbo().Rank >= 3)
                    {
                        using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("SELECT * FROM `ranks` WHERE id = '" + GetHabbo().Rank + "'");
                            DataRow Table = dbClient.getRow();

                            if (GetHabbo().GetBadgeComponent().HasBadge(Convert.ToString(Table["badgeid"])))
                            {
                            }
                            else
                            {
                                GetHabbo().GetBadgeComponent().GiveBadge(Convert.ToString(Table["badgeid"]), true, GetHabbo().GetClient());
                                SendMessage(RoomNotificationComposer.SendBubble("badge/" + Table["badgeid"], "Você recebeu o emblema staff do seu rank!", "/inventory/open/badge"));
                            }
                        }
                    }

                    if (ExtraSettings.TARGETED_OFFERS_ENABLED)
                    {
                        if (BiosEmuThiago.GetGame().GetTargetedOffersManager().TargetedOffer != null)
                        {
                            BiosEmuThiago.GetGame().GetTargetedOffersManager().Initialize(BiosEmuThiago.GetDatabaseManager().GetQueryReactor());
                            TargetedOffers TargetedOffer = BiosEmuThiago.GetGame().GetTargetedOffersManager().TargetedOffer;

                            if (TargetedOffer.Expire > BiosEmuThiago.GetIUnixTimestamp())
                            {
                                if (TargetedOffer.Limit != GetHabbo()._TargetedBuy)
                                {
                                    SendMessage(BiosEmuThiago.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                                }
                            }
                            else
                            {
                                using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                                    dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'");
                                using (var dbClient2 = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                                    dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0");
                            }
                        }
                    }

                    // Fixe do Presentes do HC By Thiago Araujo
                    //DateTime dateGregorians = new DateTime();
                    //dateGregorians = DateTime.Today;
                    //int days = (dateGregorians.Day);
                    //if (30 == days)
                    //{
                    //    SendMessage(new HCGiftsAlertComposer());
                    //    SendMessage(new RoomNotificationComposer("sumando", "message", "Hoje é dia de presentes HC, pegue o seu antes que acabe!"));
                    //}

                    // Da a conquista de login por dia feito por Thiago Araujo
                    string dFrank = null;
                    using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("SELECT Datahoje FROM users WHERE id = '" + userData.user.GetClient().GetHabbo().Id + "' LIMIT 1");
                        dFrank = dbClient.getString();
                    }
                    int      dFrankInt     = Int32.Parse(dFrank);
                    DateTime dateGregorian = new DateTime();
                    dateGregorian = DateTime.Today;
                    int day = (dateGregorian.Day);
                    if (dFrankInt != day)
                    {
                        using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE users SET Datahoje = '" + day + "' WHERE id = " + GetHabbo().Id + ";");
                        }
                        BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_Login", 1);
                    }

                    if (ExtraSettings.STAFF_MENSG_ENTERTHIAGO)
                    {
                        using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("SELECT * FROM `ranks` WHERE id = '" + GetHabbo().Rank + "'");
                            DataRow Table = dbClient.getRow();

                            if (GetHabbo().Rank == 1)
                            {
                                // Thiago é muito lindo ser é doido
                            }
                            else
                            {
                                string figure = this.GetHabbo().Look;

                                BiosEmuThiago.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("fig/" + figure, 3, "O " + Convert.ToString(Table["name"]) + " " + userData.user.GetClient().GetHabbo().Username + " entrou no hotel!", ""));
                            }
                        }

                        if (GetHabbo().isMedal)
                        {
                            var nuxStatus = new ServerPacket(ServerPacketHeader.NuxUserStatus);
                            nuxStatus.WriteInteger(2);
                            SendMessage(nuxStatus);

                            string thiagolindogostoso = this.GetHabbo().Look;

                            BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("fig/" + thiagolindogostoso, 3, "Hey o usuário: " + GetHabbo().Username + " acaba de se registra no hotel.", ""));

                            if (GetHabbo().isMedal)
                            {
                                string thiago = this.GetHabbo().Look;

                                SendMessage(new RoomNotificationComposer("fig/" + thiago, 3, "Hey " + userData.user.GetClient().GetHabbo().Username + " Bem-vindo ao nosso hotel!", ""));
                            }


                            if (GetHabbo().isMedal == false)
                            {
                                string thiagolindo = this.GetHabbo().Look;

                                SendMessage(new RoomNotificationComposer("fig/" + thiagolindo, 3, "Hey " + userData.user.GetClient().GetHabbo().Username + " Bem-vindo de volta ao nosso hotel!", ""));
                            }
                        }
                    }

                    if (GetHabbo().Rank > Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"]))
                    {
                        using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE users SET prefix_name = '' WHERE id = '" + GetHabbo().Id + "'");
                            dbClient.RunQuery("UPDATE users SET prefix_name_color = '' WHERE id = '" + GetHabbo().Id + "'");
                        }
                        GetHabbo()._NamePrefixColor = "";
                        GetHabbo()._NamePrefix      = "";
                    }

                    if (GetHabbo().Rank > 0)
                    {
                        using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("SELECT * FROM `users` WHERE id = '" + GetHabbo().Id + "'");
                            DataRow Table = dbClient.getRow();

                            if (Convert.ToString(Table["LalaConf"]) == "0")
                            {
                                // Thiago é muito lindo ser é doido
                            }
                            else
                            {
                                BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_TraderPass", 1);
                                BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_AvatarTags", 1);
                                BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_EmailVerification", 1);
                            }
                        }
                    }

                    if (GetHabbo().isMedal)
                    {
                        if (ExtraSettings.WELCOME_NEW_MESSAGE_ENABLED)
                        {
                            ServerPacket notif = new ServerPacket(ServerPacketHeader.NuxAlertMessageComposer);
                            notif.WriteString(ExtraSettings.WELCOME_MESSAGE_URL);
                            SendMessage(notif);
                        }
                        using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE users SET isMedal = '0' WHERE id = " + GetHabbo().Id + ";");
                        }
                        GetHabbo().isMedal = false;
                    }

                    BiosEmuThiago.GetGame().GetRewardManager().CheckRewards(this);
                    BiosEmuThiago.GetGame().GetAchievementManager().TryProgressHabboClubAchievements(this);
                    BiosEmuThiago.GetGame().GetAchievementManager().TryProgressRegistrationAchievements(this);
                    BiosEmuThiago.GetGame().GetAchievementManager().TryProgressLoginAchievements(this);
                    ICollection <MessengerBuddy> Friends = new List <MessengerBuddy>();
                    foreach (MessengerBuddy Buddy in GetHabbo().GetMessenger().GetFriends().ToList())
                    {
                        if (Buddy == null)
                        {
                            continue;
                        }

                        GameClient Friend = BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(Buddy.Id);
                        if (Friend == null)
                        {
                            continue;
                        }
                        string figure = GetHabbo().Look;

                        Friend.SendMessage(new RoomNotificationComposer("fig/" + figure, 3, this.GetHabbo().Username + ", seu amigo acabou de entrar no hotel!", ""));
                    }
                    return(true);
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }
            return(false);
        }
示例#16
0
        public void Run(object state)
        {
            try
            {
                if (_disabled)
                {
                    return;
                }

                if (_timerRunning)
                {
                    _timerLagging = true;
                    Log.Warn("<Player " + _player.Id + "> Server can't keep up, Player timer is lagging behind.");
                    return;
                }

                _resetEvent.Reset();

                if (_player.TimeMuted > 0)
                {
                    _player.TimeMuted -= 60;
                }
                if (_player.MessengerSpamTime > 0)
                {
                    _player.MessengerSpamTime -= 60;
                }
                if (_player.MessengerSpamTime <= 0)
                {
                    _player.MessengerSpamCount = 0;
                }
                _player.TimeAfk += 1;
                if (_player.GetStats().RespectsTimestamp != DateTime.Today.ToString("MM/dd"))
                {
                    _player.GetStats().RespectsTimestamp = DateTime.Today.ToString("MM/dd");
                    using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("UPDATE `user_stats` SET `dailyRespectPoints` = '" +
                                          (_player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20) +
                                          "', `dailyPetRespectPoints` = '" +
                                          (_player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20) +
                                          "', `respectsTimestamp` = '" +
                                          DateTime.Today.ToString("MM/dd") +
                                          "' WHERE `id` = '" +
                                          _player.Id +
                                          "' LIMIT 1");
                    }
                    _player.GetStats().DailyRespectPoints =
                        _player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20;
                    _player.GetStats().DailyPetRespectPoints =
                        _player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20;
                    if (_player.GetClient() != null)
                    {
                        _player.GetClient().SendPacket(new UserObjectComposer(_player));
                    }
                }
                if (_player.GiftPurchasingWarnings < 15)
                {
                    _player.GiftPurchasingWarnings = 0;
                }
                if (_player.MottoUpdateWarnings < 15)
                {
                    _player.MottoUpdateWarnings = 0;
                }
                if (_player.ClothingUpdateWarnings < 15)
                {
                    _player.ClothingUpdateWarnings = 0;
                }
                if (_player.GetClient() != null)
                {
                    PlusEnvironment.GetGame().GetAchievementManager()
                    .ProgressAchievement(_player.GetClient(), "ACH_AllTimeHotelPresence", 1);
                }
                _player.CheckCreditsTimer();
                _player.Effects().CheckEffectExpiry(_player);

                // END CODE

                // Reset the values
                _timerRunning = false;
                _timerLagging = false;
                _resetEvent.Set();
            }
            catch
            {
            }
        }
示例#17
0
        private void WriteUser(RoomUser User)
        {
            if (!User.IsPet && !User.IsBot)
            {
                Habbo Habbo = User.GetClient().GetHabbo();

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

                if (Habbo.PetId == 0)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(Habbo.Look);
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);

                    base.WriteInteger(0); //2 for user, 4 for bot.
                    base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot.
                    base.WriteString(Habbo.Gender.ToLower());

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

                    base.WriteString("");                                  //Whats this?
                    base.WriteInteger(Habbo.GetStats().AchievementPoints); //Achievement score
                    base.WriteBoolean(false);                              //Builders club?
                }
                else if (Habbo.PetId > 0 && Habbo.PetId != 100)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(PetFigureForType(Habbo.PetId));

                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger(2);             //Pet.

                    base.WriteInteger(Habbo.PetId);   //pet type.
                    base.WriteInteger(Habbo.Id);      //UserId of the owner.
                    base.WriteString(Habbo.Username); //Username of the owner.
                    base.WriteInteger(1);
                    base.WriteBoolean(false);         //Has saddle.
                    base.WriteBoolean(false);         //Is someone riding this horse?
                    base.WriteInteger(0);
                    base.WriteInteger(0);
                    base.WriteString("");
                }
                else if (Habbo.PetId > 0 && Habbo.PetId == 100)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(Habbo.Look.ToLower());
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger(4);

                    base.WriteString(Habbo.Gender.ToLower()); // ?
                    base.WriteInteger(Habbo.Id);              //Owner Id
                    base.WriteString(Habbo.Username);         // Owner name
                    base.WriteInteger(0);                     //Action Count
                }
            }
            else if (User.IsPet)
            {
                base.WriteInteger(User.BotAI.BaseId);
                base.WriteString(User.BotData.Name);
                base.WriteString(User.BotData.Motto);

                //base.WriteString("26 30 ffffff 5 3 302 4 2 201 11 1 102 12 0 -1 28 4 401 24");
                base.WriteString(User.BotData.Look.ToLower() + ((User.PetData.Saddle > 0) ? " 3 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 4 " + User.PetData.Saddle + " 0" : " 2 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + ""));

                base.WriteInteger(User.VirtualId);
                base.WriteInteger(User.X);
                base.WriteInteger(User.Y);
                base.WriteDouble(User.Z);
                base.WriteInteger(0);
                base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4);
                base.WriteInteger(User.PetData.Type);
                base.WriteInteger(User.PetData.OwnerId);  // userid
                base.WriteString(User.PetData.OwnerName); // username
                base.WriteInteger(1);
                base.WriteBoolean(User.PetData.Saddle > 0);
                base.WriteBoolean(User.RidingHorse);
                base.WriteInteger(0);
                base.WriteInteger(0);
                base.WriteString("");
            }
            else if (User.IsBot)
            {
                base.WriteInteger(User.BotAI.BaseId);
                base.WriteString(User.BotData.Name);
                base.WriteString(User.BotData.Motto);
                base.WriteString(User.BotData.Look.ToLower());
                base.WriteInteger(User.VirtualId);
                base.WriteInteger(User.X);
                base.WriteInteger(User.Y);
                base.WriteDouble(User.Z);
                base.WriteInteger(0);
                base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4);

                base.WriteString(User.BotData.Gender.ToLower());                          // ?
                base.WriteInteger(User.BotData.ownerID);                                  //Owner Id
                base.WriteString(RavenEnvironment.GetUsernameById(User.BotData.ownerID)); // Owner name
                base.WriteInteger(5);                                                     //Action Count
                base.WriteShort(1);                                                       //Copy looks
                base.WriteShort(2);                                                       //Setup speech
                base.WriteShort(3);                                                       //Relax
                base.WriteShort(4);                                                       //Dance
                base.WriteShort(5);                                                       //Change name
            }
        }
示例#18
0
        private void WriteUser(RoomUser User)
        {
            if (!User.IsPet && !User.IsBot)
            {
                Habbo Habbo = User.GetClient().GetHabbo();
                Group Group = GroupManager.GetJob(User.GetClient().GetRoleplay().JobId);

                if (Habbo.PetId == 0)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(Habbo.Look);
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);

                    base.WriteInteger(0); //2 for user, 4 for bot.
                    base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot.
                    base.WriteString(Habbo.Gender.ToLower());

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

                    base.WriteString("");                                  //Whats this?
                    base.WriteInteger(Habbo.GetStats().AchievementPoints); //Achievement score
                    base.WriteBoolean(false);                              //Builders club?
                }
                else if (Habbo.PetId > 0 && Habbo.PetId != 100)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString((Habbo.PetFigure == null) ? PetFigureForType(Habbo) : Habbo.PetFigure);

                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger(2);             //Pet.

                    base.WriteInteger(Habbo.PetId);   //pet type.
                    base.WriteInteger(Habbo.Id);      //UserId of the owner.
                    base.WriteString(Habbo.Username); //Username of the owner.
                    base.WriteInteger(1);
                    base.WriteBoolean(false);         //Has saddle.
                    base.WriteBoolean(false);         //Is someone riding this horse?
                    base.WriteInteger(0);
                    base.WriteInteger(0);
                    base.WriteString("");
                }
                else if (Habbo.PetId > 0 && Habbo.PetId == 100)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(Habbo.Look.ToLower());
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger(4);

                    base.WriteString(Habbo.Gender.ToLower()); // ?
                    base.WriteInteger(Habbo.Id);              //Owner Id
                    base.WriteString(Habbo.Username);         // Owner name
                    base.WriteInteger(0);                     //Action Count
                }
            }
            else if (User.IsPet)
            {
                base.WriteInteger(User.BotAI.BaseId);
                base.WriteString(User.BotData.Name);
                base.WriteString(User.BotData.Motto);

                //base.WriteString("26 30 ffffff 5 3 302 4 2 201 11 1 102 12 0 -1 28 4 401 24");
                base.WriteString(User.BotData.Look.ToLower() + ((User.PetData.Saddle > 0) ? " 3 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 4 " + User.PetData.Saddle + " 0" : " 2 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + ""));

                base.WriteInteger(User.VirtualId);
                base.WriteInteger(User.X);
                base.WriteInteger(User.Y);
                base.WriteDouble(User.Z);
                base.WriteInteger(0);
                base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4);
                base.WriteInteger(User.PetData.Type);
                base.WriteInteger(User.PetData.OwnerId);  // userid
                base.WriteString(User.PetData.OwnerName); // username
                base.WriteInteger(1);
                base.WriteBoolean(User.PetData.Saddle > 0);
                base.WriteBoolean(User.RidingHorse);
                base.WriteInteger(0);
                base.WriteInteger(0);
                base.WriteString("");
            }
            else if (User.IsBot)
            {
                if (User.IsRoleplayBot)
                {
                    string[] Outfit = User.GetBotRoleplay().GetOutFit();

                    #region BOT Profile Type 1
                    base.WriteInteger(User.BotAI.BaseId + 1000000);
                    base.WriteString(User.GetBotRoleplay().Name);
                    base.WriteString(Outfit[1]);
                    base.WriteString(Outfit[0]);
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);

                    base.WriteInteger(0); //2 for user, 4 for bot.
                    base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot.
                    base.WriteString(User.GetBotRoleplay().Gender.ToLower());

                    Group BotGroup = GroupManager.GetJob(User.GetBotRoleplay().Corporation);
                    if (BotGroup != null)
                    {
                        base.WriteInteger(BotGroup.Id);
                        base.WriteInteger(0);
                        base.WriteString(BotGroup.Name);
                    }
                    else
                    {
                        base.WriteInteger(0);
                        base.WriteInteger(0);
                        base.WriteString("");
                    }

                    base.WriteString("");     //Whats this?
                    base.WriteInteger(0);     //Achievement score
                    base.WriteBoolean(false); //Builders club?
                    #endregion
                }
                else
                {
                    #region BOT Profile Type 2
                    base.WriteInteger(User.BotAI.BaseId);
                    base.WriteString(User.BotData.Name);
                    base.WriteString(User.BotData.Motto);
                    base.WriteString(User.BotData.Look.ToLower());
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4);

                    base.WriteString(User.BotData.Gender.ToLower());                         // ?
                    base.WriteInteger(User.BotData.ownerID);                                 //Owner Id
                    base.WriteString(PlusEnvironment.GetUsernameById(User.BotData.ownerID)); // Owner name
                    base.WriteInteger(5);                                                    //Action Count
                    base.WriteShort(1);                                                      //Copy looks
                    base.WriteShort(2);                                                      //Setup speech
                    base.WriteShort(3);                                                      //Relax
                    base.WriteShort(4);                                                      //Dance
                    base.WriteShort(5);                                                      //Change name
                    #endregion
                }
            }
        }