Habbo Hotel: Hapishane Sistemi ! (PLUS)







Selam dostlarım ben Nurullah bugun sizlere En gelişmiş retrolarda olan hapishane sistemini verecegim. Kendim test etmedim ama test edenlerde başarılı olmuş. Yapamadıgınız yeleri yorum olarak atın dönücegim hepinize. Bu arada kendimiz yapmadık. Başka bir yabancı Retro paylaşım sitesinden aldık.





DB'ye Ekle
ALTER TABLE `users` ADD `in_jail` int(11) NOT NULL
ALTER TABLE `users` ADD `jail_time` int(11) NOT NULL




Habbo.cs dosyasını bulun ve özel int _id dosyasını bulun; ve üstüne yerleştir
public Timer JailTimer;





Habbo.cs üstünde yer
using System.Timers;





Özel int bulun _friendCount; ve üstüne yerleştir
private int _jail_time;
private int _in_jail;





Bulun 
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank)





Sonunda ekle
,int In_Jail, int Jail_Time





Sonunda {ekle
this._jail_time = Jail_Time;
this._in_jail = In_Jail;




bulmak
public int Id

        {
            get { return this._id; }
            set { this._id = value; }
        }




Aşağıda ekleyebilirsiniz
 public int Jail_Time

        {
            get { return this._jail_time; }
            set { this._jail_time = value; }
        }

        public int In_Jail
        {
            get { return this._in_jail; }
            set { this._in_jail = value; }
        }




bulmak
  public string GetQueryString
        {
            get
            {
                this._habboSaved = true;
                return "UPDATE `users` SET `online` = '0', `last_online` = '" + PlusEnvironment.GetUnixTimestamp() + "', `activity_points` = '" + this.Duckets + "', `credits` = '" + this.Credits + "',  `in_jail` = '" + this.In_Jail + "', `jail_time` = '" + this.Jail_Time + "', `vip_points` = '" + this.Diamonds + "', `home_room` = '" + this.HomeRoom + "', `gotw_points` = '" + this.GOTWPoints + "', `time_muted` = '" + this.TimeMuted + "',`friend_bar_state` = '" + FriendBarStateUtility.GetInt(this._friendbarState) + "' WHERE id = '" + Id + "' LIMIT 1;UPDATE `user_stats` SET `roomvisits` = '" + this._habboStats.RoomVisits + "', `onlineTime` = '" + (PlusEnvironment.GetUnixTimestamp() - SessionStart + this._habboStats.OnlineTime) + "', `respect` = '" + this._habboStats.Respect + "', `respectGiven` = '" + this._habboStats.RespectGiven + "', `giftsGiven` = '" + this._habboStats.GiftsGiven + "', `giftsReceived` = '" + this._habboStats.GiftsReceived + "', `dailyRespectPoints` = '" + this._habboStats.DailyRespectPoints + "', `dailyPetRespectPoints` = '" + this._habboStats.DailyPetRespectPoints + "', `AchievementScore` = '" + this._habboStats.AchievementPoints + "', `quest_id` = '" + this._habboStats.QuestID + "', `quest_progress` = '" + this._habboStats.QuestProgress + "', `groupid` = '" + this._habboStats.FavouriteGroupId + "',`forum_posts` = '" + this._habboStats.ForumPosts + "' WHERE `id` = '" + this.Id + "' LIMIT 1;";
            }
        }





İle değiştirin
 public string GetQueryString
        {
            get
            {
                this._habboSaved = true;
                return "UPDATE `users` SET `online` = '0', `last_online` = '" + PlusEnvironment.GetUnixTimestamp() + "', `activity_points` = '" + this.Duckets + "', `credits` = '" + this.Credits + "',  `in_jail` = '" + this.In_Jail + "', `jail_time` = '" + this.Jail_Time + "', `vip_points` = '" + this.Diamonds + "', `home_room` = '" + this.HomeRoom + "', `gotw_points` = '" + this.GOTWPoints + "', `time_muted` = '" + this.TimeMuted + "',`friend_bar_state` = '" + FriendBarStateUtility.GetInt(this._friendbarState) + "' WHERE id = '" + Id + "' LIMIT 1;UPDATE `user_stats` SET `roomvisits` = '" + this._habboStats.RoomVisits + "', `onlineTime` = '" + (PlusEnvironment.GetUnixTimestamp() - SessionStart + this._habboStats.OnlineTime) + "', `respect` = '" + this._habboStats.Respect + "', `respectGiven` = '" + this._habboStats.RespectGiven + "', `giftsGiven` = '" + this._habboStats.GiftsGiven + "', `giftsReceived` = '" + this._habboStats.GiftsReceived + "', `dailyRespectPoints` = '" + this._habboStats.DailyRespectPoints + "', `dailyPetRespectPoints` = '" + this._habboStats.DailyPetRespectPoints + "', `AchievementScore` = '" + this._habboStats.AchievementPoints + "', `quest_id` = '" + this._habboStats.QuestID + "', `quest_progress` = '" + this._habboStats.QuestProgress + "', `groupid` = '" + this._habboStats.FavouriteGroupId + "',`forum_posts` = '" + this._habboStats.ForumPosts + "' WHERE `id` = '" + this.Id + "' LIMIT 1;";
            }
        }



bulmak
 public void InitInformation(UserData data)

        {
            BadgeComponent = new BadgeComponent(this   , data);
            Relationships = data.Relations;
        }




Üzerinde eklemek 
internal void StartJailTimer(GameClient Session, int Time)
        {
            Timer JailTimer = new Timer((Time * 60) * 1000);
            JailTimer.Start();
            Session.GetHabbo().In_Jail = 1;
            JailTimer.Elapsed += (o, e) =>
            {
                Session.GetHabbo().PrepareRoom(0, "");
                Session.SendMessage(new RoomNotificationComposer("Notification",
                "  You've been released from jail! \n\n" +
                "  Next time behave yourself!!", "small", ""));

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    Session.GetHabbo().In_Jail = 0;
                    dbClient.SetQuery("UPDATE `users` SET `jail_time` = @jail_time, `in_jail` = @in_jail, `home_room` = @home_room WHERE id = @id");
                    dbClient.AddParameter("jail_time", 0);
                    dbClient.AddParameter("in_jail", 0);
                    dbClient.AddParameter("home_room", 0);
                    dbClient.AddParameter("id", Session.GetHabbo().Id);
                    dbClient.RunQuery();
                }
                JailTimer.Dispose();
            }
             ;



Tamam, bu sınıfla işimiz bitti, şimdi Authenticator.cs adresine gidin

değişim Convert.ToInt32(Row["rank_vip"])); para Convert.ToInt32(Row["rank_vip"]), ve aşağıdaki kodu yan tarafa ekleyin



Convert.ToInt32(Row["in_jail"]), Convert.ToInt32(Row["jail_time"]));




UserDataFactory.cs adresine gidin ve arayın




dbClient.SetQuery("SELECT `id`,`username`,`rank`,`motto`,`look`,`gender`,`last_online`,`credits`,`activity_points`,`home_room`,`block_newfriends`,`hide_online`,`hide_inroom`,`vip`,`account_created`,`vip_points`,`machine_id`,`volume`,`chat_preference`,`focus_preference`, `pets_muted`,`bots_muted`,`advertising_report_blocked`,`last_change`,`gotw_points`,`ignore_invites`,`time_muted`,`allow_gifts`,`friend_bar_state`,`disable_forced_effects`,`allow_mimic`,`rank_vip` FROM `users` WHERE `auth_ticket` = @sso LIMIT 1");

                dbClient.AddParameter("sso", SessionTicket);


Ve yerini alır




dbClient.SetQuery("SELECT `id`,`username`,`rank`,`jail_time`,`in_jail`,`motto`,`look`,`gender`,`last_online`,`credits`,`activity_points`,`home_room`,`block_newfriends`,`hide_online`,`hide_inroom`,`vip`,`account_created`,`vip_points`,`machine_id`,`volume`,`chat_preference`,`focus_preference`, `pets_muted`,`bots_muted`,`advertising_report_blocked`,`last_change`,`gotw_points`,`ignore_invites`,`time_muted`,`allow_gifts`,`friend_bar_state`,`disable_forced_effects`,`allow_mimic`,`rank_vip` FROM `users` WHERE `auth_ticket` = @sso LIMIT 1");

                dbClient.AddParameter("sso", SessionTicket);




bakmak 
 using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `id`,`username`,`rank`,`motto`,`look`,`gender`,`last_online`,`credits`,`activity_points`,`home_room`,`block_newfriends`,`hide_online`,`hide_inroom`,`vip`,`account_created`,`vip_points`,`machine_id`,`volume`,`chat_preference`, `focus_preference`, `pets_muted`,`bots_muted`,`advertising_report_blocked`,`last_change`,`gotw_points`,`ignore_invites`,`time_muted`,`allow_gifts`,`friend_bar_state`,`disable_forced_effects`,`allow_mimic`,`rank_vip` FROM `users` WHERE `id` = @id LIMIT 1");
                dbClient.AddParameter("id", UserId);





İle değiştirin
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())

            {
                dbClient.SetQuery("SELECT `id`,`username`,`rank`,`motto`,`jail_time`,`in_jail`,`look`,`gender`,`last_online`,`credits`,`activity_points`,`home_room`,`block_newfriends`,`hide_online`,`hide_inroom`,`vip`,`account_created`,`vip_points`,`machine_id`,`volume`,`chat_preference`, `focus_preference`, `pets_muted`,`bots_muted`,`advertising_report_blocked`,`last_change`,`gotw_points`,`ignore_invites`,`time_muted`,`allow_gifts`,`friend_bar_state`,`disable_forced_effects`,`allow_mimic`,`rank_vip` FROM `users` WHERE `id` = @id LIMIT 1");
                dbClient.AddParameter("id", UserId);


Git HabboHotel > Rooms > Chat > Commands > Administrator
Sağ tıklayın ve "Yeni Sınıf Ekle" ye tıklayın ve bu adı girin. JailUserCommand Geçerli sınıftaki her şeyi silin ve ile değiştirin

using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.Database.Interfaces;
using Plus.HabboHotel.GameClients;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class JailUserCommand : IChatCommand
    {
        public string PermissionRequired => "command_jail";
        public string Parameters => "%username% %time%";
        public string Description => "Put a user in jail!.";


        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            int Time = 0;
            int Time_Now;

            Time_Now = Time;


            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to jail");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper($"An error occoured whilst trying to find {Params[1]}!");
                return;
            }

            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (TargetUser == null)
            {
                Session.SendWhisper($"An error occoured whilst trying to find {Params[1]}, maybe they're not online or in this room.");
                return;
            }

            if (TargetClient.GetHabbo().Rank > Session.GetHabbo().Rank)
            {
                Session.SendWhisper("Oops , it appears you can't jail this user!");
                return;
            }

            if (Session.GetHabbo().In_Jail == 1)
            {
                Session.SendWhisper($"Oops , it appears {Params[1]} is already jailed!");
                return;
            }

            if (Session == TargetClient)
            {
                Session.SendWhisper("You can't put yourself in jail!");
                return;
            }


            if (Int32.TryParse(Params[2], out Time))
            {
 


                Session.SendWhisper($"You have successfully jailed {Params[1]} for {Time} minutes!");

                TargetClient.GetHabbo().PrepareRoom(// put room id of jail here // , "");
                TargetClient.GetHabbo().StartJailTimer(TargetClient, Time);

                TargetClient.SendMessage(new RoomNotificationComposer("Notification",
                "  You've been jailed by " + $"{Params[1]}\n\n" +
                "  You've been jailed for " + $"{Time} " + "Minute(s)", "small", ""));

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `users` SET `jail_time` = @jail_time, `in_jail` = @in_jail, `home_room` = @home_room WHERE id = @id");
                    dbClient.AddParameter("jail_time", Params[2]);
                    dbClient.AddParameter("in_jail", 1);
                    dbClient.AddParameter("home_room", // your room id here //);
                    dbClient.AddParameter("id", TargetClient.GetHabbo().Id);
                    dbClient.RunQuery();
                }
            }

        }

    }
}


Aşağıdaki sınıflara git
, "ShoutEvent" "WhisperEvent" "ChatEvent"
Her sınıfta, aşağıdaki kodu bir yere girin



if (Session.GetHabbo().In_Jail == 1)
            {
                Session.SendWhisper("You can't talk whilst you're in jail!");
                return;
            }


 SendMgsEvent'e gidin ve aşağıdaki kodu girin




if (Session.GetHabbo().In_Jail == 1)
            {
                Session.SendMessage(new RoomNotificationComposer("Notification",
                      "  Oops , it appears you're jailed! \n\n" +
                      "  You can't message your friends whilst jailed!", "small", ""));
                return;
            }



FollowFriendEvent öğesine gidin ve aşağıdaki kodu girin




if (Session.GetHabbo().In_Jail == 1)
            {
                Session.SendMessage(new RoomNotificationComposer("Notification",
               " Oops, it appears you're jailed ! \n\n" +
               "  You can't visit your friend whilst you're in jail!", "small", ""));
                return;
            }



GameClient.cs adresine gidin ve aşağıdaki kodu bulun




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


Ve üstüne koy




if (Session.GetHabbo().Jail_Time != 0)
                    {
                        Session.GetHabbo().StartJailTimer(Session, Session.GetHabbo().Jail_Time);
                    }

                    if (Session.GetHabbo().Jail_Time == 0 && Session.GetHabbo().Jail_Time == 0)
                    {
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("UPDATE `users` SET `jail_time` = '0', `in_jail` = '0' WHERE id = @id");
                            dbClient.AddParameter("jail_time", 0);
                            dbClient.AddParameter("in_jail", 0);
                            dbClient.AddParameter("id", Session.GetHabbo().Id);
                            dbClient.RunQuery();
                        }
                    }



GameClient bulundu



public bool TryAuthenticate(string AuthTicket)


Ve aşağıdaki kodla değiştirin



 public bool TryAuthenticate(string AuthTicket,GameClient Session)



Şimdi SSOTicketEvent'e git
Ve son satırı aşağıdaki kodla değiştirin




 Session.TryAuthenticate(Packet.PopString(), Session);


Aşağıdaki sınıflara git
 UpdateNavigatorSettingsEvent , GetNavigatorFlatsEvent , NewNavigatorSearchEvent , InitializeNewNavigatorEvent & CanCreateRoomEvent

Ve aşağıdaki kodu her sınıfta bir yere ekleyin



if (Session.GetHabbo().In_Jail == 1)
                return;


CommandManager.cs'ye gidin ve aşağıdaki kodu ekleyin


this.Register("prender", new JailUserCommand());



Buraya Ekle permissions_commands



command_jail



Aşağıdaki linkini verdigimiz resmi buraya ekleyin /swf/c_images/notifications

Resim: https://resmim.net/f/A0Q3Vp.png

Credits !

Criando
LeftSpace
HabbocuyumDevs

Yorum Gönder

0Yorumlar
Yorum Gönder (0)