Exemplo n.º 1
0
        public void Handle(RoomUser user, Team team, RoomItem item)
        {
            //InteractorGenericSwitch.DoAnimation(itemID);

            if (user != null && !user.IsBot && user.GetClient() != null && message.Length > 0)
            {
                string specialMessage = BlackWordsManager.SpecialReplace(message, user);

                var servermsg = new ServerMessage(Outgoing.Whisp);
                servermsg.AppendInt32(user.VirtualId);
                servermsg.AppendString(specialMessage);
                servermsg.AppendInt32(0);
                servermsg.AppendInt32(34); // color
                servermsg.AppendInt32(0);
                servermsg.AppendInt32(-1);

                user.GetClient().SendMessage(servermsg);
            }
        }
Exemplo n.º 2
0
        internal bool tryLogin(string AuthTicket)
        {
            try
            {
                if (GetConnection() == null)
                {
                    return(false);
                }

                var userData = UserDataFactory.GetUserData(AuthTicket);
                if (userData == null)
                {
                    this.Disconnect();
                    return(false);
                }

                OtanixEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.user.Id, userData.user.Username);
                Habbo = userData.user;

                if (userData.user.Username == null || GetHabbo() == null)
                {
                    SendBanMessage("Você não possui um nome.");
                    return(false);
                }

                userData.user.Init(userData);
                Habbo.MachineId = MachineId;

                var response = new QueuedServerMessage(Connection);

                var authok = new ServerMessage(Outgoing.AuthenticationOK);
                response.appendResponse(authok);

                var HomeRoom = new ServerMessage(Outgoing.HomeRoom);
                HomeRoom.AppendUInt((OtanixEnvironment.GetGame().GetPrisaoManager().estaPreso(GetHabbo().Id)) ? OtanixEnvironment.prisaoId() : GetHabbo().HomeRoom); // first home
                HomeRoom.AppendUInt((OtanixEnvironment.GetGame().GetPrisaoManager().estaPreso(GetHabbo().Id)) ? OtanixEnvironment.prisaoId() : GetHabbo().HomeRoom); // current home
                response.appendResponse(HomeRoom);

                var FavouriteRooms = new ServerMessage(Outgoing.FavouriteRooms);
                FavouriteRooms.AppendInt32(30); // max rooms
                FavouriteRooms.AppendInt32(userData.user.FavoriteRooms.Count);
                foreach (var Id in userData.user.FavoriteRooms.ToArray())
                {
                    FavouriteRooms.AppendUInt(Id);
                }
                response.appendResponse(FavouriteRooms);

                var sendClub = new ServerMessage(Outgoing.SerializeClub);
                sendClub.AppendString("club_habbo");
                sendClub.AppendInt32(0);      // days left
                sendClub.AppendInt32(0);      // days multiplier
                sendClub.AppendInt32(0);      // months left
                sendClub.AppendInt32(0);      // ???
                sendClub.AppendBoolean(true); // HC PRIVILEGE
                sendClub.AppendBoolean(true); // VIP PRIVILEGE
                sendClub.AppendInt32(0);      // days i have on hc
                sendClub.AppendInt32(0);      // days i've purchased
                sendClub.AppendInt32(495);    // value 4 groups
                response.appendResponse(sendClub);

                var roomAccessConfig = new ServerMessage(Outgoing.RoomAccessConfig);
                roomAccessConfig.AppendBoolean(true); // isOpen
                roomAccessConfig.AppendBoolean(false);
                roomAccessConfig.AppendBoolean(true);
                response.appendResponse(roomAccessConfig);

                var fuserights = new ServerMessage(Outgoing.Fuserights);
                fuserights.AppendInt32(2);                                       // normal|hc|vip
                fuserights.AppendUInt(GetHabbo().Rank);
                fuserights.AppendBoolean(GetHabbo().HasFuse("fuse_ambassador")); // embajador ?
                // fuserights.AppendInt32(0); // New Identity (1 == 1 min and Alert!)
                response.appendResponse(fuserights);

                var newidentity = new ServerMessage(Outgoing.SendNewIdentityState);
                newidentity.AppendInt32(GetHabbo().NewIdentity);
                response.appendResponse(newidentity);

                var HabboInformation = new ServerMessage(Outgoing.HabboInfomation);
                HabboInformation.AppendUInt(GetHabbo().Id);
                HabboInformation.AppendString(GetHabbo().Username);
                HabboInformation.AppendString(GetHabbo().Look);
                HabboInformation.AppendString(GetHabbo().Gender.ToUpper());
                HabboInformation.AppendString(GetHabbo().Motto);
                HabboInformation.AppendString(GetHabbo().RealName);
                HabboInformation.AppendBoolean(false);
                HabboInformation.AppendUInt(GetHabbo().Respect);
                HabboInformation.AppendUInt(GetHabbo().DailyRespectPoints); // respect to give away
                HabboInformation.AppendUInt(GetHabbo().DailyPetRespectPoints);
                HabboInformation.AppendBoolean(true);
                HabboInformation.AppendString(OtanixEnvironment.UnixTimeStampToDateTime(GetHabbo().LastOnline).ToString());
                HabboInformation.AppendBoolean(GetHabbo().NameChanges < EmuSettings.MAX_NAME_CHANGES); // CHANGENAME - HabboInformation.AppendBoolean((this.GetHabbo().Diamonds<=0||this.GetHabbo().NameChanges>=ButterflyEnvironment.maxNameChanges)?false:true);
                HabboInformation.AppendBoolean(false);
                response.appendResponse(HabboInformation);

                var IsGuide            = (Habbo.Rank > 1) ? true : false;
                var VoteInCompetitions = false;
                var Trade     = true;
                var Citizien  = (Habbo.CitizenshipLevel >= 4) ? true : false;
                var JudgeChat = (Habbo.Rank > 2) ? true : false;
                var NavigatorThumbailCamera = false;
                var navigatorphaseTwo       = true;
                var Camera        = true;
                var CallHelpers   = true;
                var BuilderAtWork = true;
                var MouseZoom     = false;

                var Allows = new ServerMessage(Outgoing.PerkAllowancesMessageParser);
                Allows.AppendInt32(11); // count
                Allows.AppendString("TRADE");
                Allows.AppendString((!Trade) ? "requirement.unfulfilled.citizenship_level_3" : "");
                Allows.AppendBoolean(Trade);
                Allows.AppendString("NAVIGATOR_ROOM_THUMBNAIL_CAMERA");
                Allows.AppendString((!NavigatorThumbailCamera) ? "" : "");
                Allows.AppendBoolean(NavigatorThumbailCamera);
                Allows.AppendString("NAVIGATOR_PHASE_TWO_2014");
                Allows.AppendString((!navigatorphaseTwo) ? "requirement.unfulfilled.feature_disabled" : "");
                Allows.AppendBoolean(navigatorphaseTwo);
                Allows.AppendString("VOTE_IN_COMPETITIONS");
                Allows.AppendString((!VoteInCompetitions) ? "requirement.unfulfilled.helper_level_2" : "");
                Allows.AppendBoolean(VoteInCompetitions);
                Allows.AppendString("BUILDER_AT_WORK");
                Allows.AppendString((!BuilderAtWork) ? "requirement.unfulfilled.group_membership" : "");
                Allows.AppendBoolean(BuilderAtWork);
                Allows.AppendString("MOUSE_ZOOM");
                Allows.AppendString((!MouseZoom) ? "requirement.unfulfilled.feature_disabled" : "");
                Allows.AppendBoolean(MouseZoom);
                Allows.AppendString("CAMERA");
                Allows.AppendString((!Camera) ? "requirement.unfulfilled.feature_disabled" : "");
                Allows.AppendBoolean(Camera);
                Allows.AppendString("CALL_ON_HELPERS");
                Allows.AppendString((!CallHelpers) ? "requirement.unfulfilled.citizenship_level_1" : "");
                Allows.AppendBoolean(CallHelpers);
                Allows.AppendString("CITIZEN");
                Allows.AppendString((!Citizien) ? "requirement.unfulfilled.citizenship_level_3" : "");
                Allows.AppendBoolean(Citizien);
                Allows.AppendString("USE_GUIDE_TOOL");
                Allows.AppendString((!IsGuide) ? "requirement.unfulfilled.helper_level_4" : "");
                Allows.AppendBoolean(IsGuide);
                Allows.AppendString("JUDGE_CHAT_REVIEWS");
                Allows.AppendString((!JudgeChat) ? "requirement.unfulfilled.citizenship_level_6" : "");
                Allows.AppendBoolean(JudgeChat);
                response.appendResponse(Allows);

                var enabledBuilderClub = new ServerMessage(Outgoing.EnableBuilderClub);
                enabledBuilderClub.AppendInt32(GetHabbo().IsPremium() ? GetHabbo().GetPremiumManager().GetRemainingTime() : 0); // Tiempo restante de Constructor (2678400 = 1 mes entero (s))
                enabledBuilderClub.AppendUInt(GetHabbo().IsPremium() ? GetHabbo().GetPremiumManager().GetMaxItems() : 50);      // Furnis que puedo alquilar
                enabledBuilderClub.AppendInt32(20000);                                                                          // Se puede ampliar la alquilación hasta..
                enabledBuilderClub.AppendInt32(0);
                response.appendResponse(enabledBuilderClub);

                response.appendResponse(GetHabbo().GetUserClothingManager().SerializeClothes());

                var achivPoints = new ServerMessage(Outgoing.AchievementPoints);
                achivPoints.AppendUInt(GetHabbo().AchievementPoints);
                response.appendResponse(achivPoints);

                var loadVolumen = new ServerMessage(Outgoing.LoadVolumen);
                loadVolumen.AppendInt32(int.Parse(GetHabbo().volumenSystem.Split(';')[0]));
                loadVolumen.AppendInt32(int.Parse(GetHabbo().volumenSystem.Split(';')[1]));
                loadVolumen.AppendInt32(int.Parse(GetHabbo().volumenSystem.Split(';')[2]));
                loadVolumen.AppendBoolean(GetHabbo().preferOldChat);
                loadVolumen.AppendBoolean(GetHabbo().IgnoreRoomInvitations);
                loadVolumen.AppendBoolean(GetHabbo().DontFocusUser); // fcus user
                loadVolumen.AppendInt32(0);                          //
                loadVolumen.AppendInt32(0);                          // freeFlowChat
                response.appendResponse(loadVolumen);

                var muteUsers = new ServerMessage(Outgoing.SerializeMuteUsers);
                muteUsers.AppendInt32(GetHabbo().MutedUsers.Count);
                foreach (string IgnoreName in GetHabbo().MutedUsers)
                {
                    muteUsers.AppendString(IgnoreName);
                }
                response.appendResponse(muteUsers);

                TargetedOffer to = OtanixEnvironment.GetGame().GetTargetedOfferManager().GetRandomStaticTargetedOffer();
                if (to != null)
                {
                    if (!GetHabbo().TargetedOffers.ContainsKey(to.Id) || GetHabbo().TargetedOffers[to.Id] < to.PurchaseLimit)
                    {
                        response.appendResponse(OtanixEnvironment.GetGame().GetTargetedOfferManager().SerializeTargetedOffer(to));
                    }
                }

                /*var giftOptions = new ServerMessage(Outgoing.NewUserExperienceGiftOfferParser);
                 * giftOptions.AppendInt32(1); // foreach
                 * {
                 *  giftOptions.AppendInt32(0);
                 *  giftOptions.AppendInt32(0);
                 *  giftOptions.AppendInt32(1); // foreach (items?)
                 *  {
                 *      giftOptions.AppendString("Testeando"); // itemName ??
                 *      giftOptions.AppendInt32(1); // foreach
                 *      {
                 *          giftOptions.AppendString("a1_kumiankka"); // item 1
                 *          giftOptions.AppendString(""); // item 2 (if is empty == null)
                 *      }
                 *  }
                 * }
                 * response.appendResponse(giftOptions);*/

                response.appendResponse(OtanixEnvironment.GetGame().GetAchievementManager().AchievementPrede);

                if (GetHabbo().HomeRoom <= 0)
                {
                    var homeRoom = new ServerMessage(Outgoing.OutOfRoom);
                    response.appendResponse(homeRoom);
                }
                else
                {
                    Room room = OtanixEnvironment.GetGame().GetRoomManager().GetRoom(GetHabbo().HomeRoom);
                    if (room != null)
                    {
                        this.GetMessageHandler().enterOnRoom3(room);
                    }
                }

                response.sendResponse();

                // Verifica a conta staff
                if (GetHabbo().Rank > 5)
                {
                    ServerMessage VerificaSenha = new ServerMessage(Outgoing.MobilePhoneNumero);
                    VerificaSenha.AppendInt32(1);
                    VerificaSenha.AppendInt32(1);
                    SendMessage(VerificaSenha);
                }
                // Termina de verificar a conta staff

                Ban BanReason = OtanixEnvironment.GetGame().GetBanManager().GetBanReason(Habbo.Username, Habbo.MachineId);
                if (BanReason != null)
                {
                    SendScrollNotif("Você tem um banimento do tipo: " + BanReason.Type + "\r\nMotivo: " + BanReason.ReasonMessage);
                    Disconnect();
                    return(false);
                }

                GetHabbo().InitMessenger();

                if (GetHabbo().GetAvatarEffectsInventoryComponent() != null)
                {
                    SendMessage(GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());
                }

                SendMessage(OtanixEnvironment.GetGame().GetModerationTool().SerializeCfhTopics());

                if (LanguageLocale.welcomeAlertEnabled)
                {
                    string strAlert = BlackWordsManager.SpecialReplace(LanguageLocale.welcomeAlert, this);

                    if (LanguageLocale.welcomeAlertType == 0)
                    {
                        SendScrollNotif(strAlert);
                    }
                    else if (LanguageLocale.welcomeAlertType == 1)
                    {
                        SendNotif(strAlert);
                    }
                    else if (LanguageLocale.welcomeAlertType == 2)
                    {
                        SendNotifWithImage(strAlert, LanguageLocale.welcomeAlertImage);
                    }
                }

                OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Habbo.Id, "ACH_EmailVerification", 1);

                GetHabbo().UpdateCreditsBalance();
                GetHabbo().UpdateExtraMoneyBalance();
                GetHabbo().setMeOnline();
                GetHabbo().InitExtra();

                UsersCache.enterProvisionalRoom(this);

                return(true);
            }
            catch (UserDataNotFoundException e)
            {
                SendScrollNotif(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e);
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Invalid Dario bug duing user login: "******"Login error: " + e);
            }
            return(false);
        }