Exemple #1
0
        /// <summary>
        /// Checks to see if the client is jailed, if true send back to jail if not already in one
        /// </summary>
        private void JailCheck(GameClient Client, object[] Params)
        {
            if (Client.GetRoleplay().IsJailed)
            {
                if (Client.GetRoleplay().Jailbroken)
                {
                    RoleplayManager.GetLookAndMotto(Client);
                    return;
                }

                int  JailRID  = Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid"));
                int  JailRID2 = Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid"));
                int  CourtRID = Convert.ToInt32(RoleplayData.GetData("court", "roomid"));
                Room Room     = (Room)Params[0];

                if (RoleplayManager.Defendant == Client && Room.Id == CourtRID)
                {
                    RoleplayManager.GetLookAndMotto(Client);
                    RoleplayManager.SpawnChairs(Client, "uni_lectern");

                    new Thread(() =>
                    {
                        Thread.Sleep(500);
                        if (Client.GetRoomUser() != null)
                        {
                            Client.GetRoomUser().Frozen = true;
                        }
                    }).Start();
                    return;
                }

                if (Room.Id != JailRID && Room.Id != JailRID2)
                {
                    RoleplayManager.SendUser(Client, JailRID);
                    Client.SendNotification("You cannot leave jail until your sentence has expired!");
                }

                if (Room.Id == JailRID)
                {
                    RoleplayManager.GetLookAndMotto(Client);
                    RoleplayManager.SpawnBeds(Client, "bed_silo_one");
                }
            }
            else
            {
                return;
            }
        }
Exemple #2
0
        /// <summary>
        /// Checks to see if the client is dead, if true send back to hospital if not already in one
        /// </summary>
        private void DeathCheck(GameClient Client, object[] Params)
        {
            if (Client.GetRoleplay().IsDead)
            {
                int  HospitalRID = Convert.ToInt32(RoleplayData.GetData("hospital", "roomid2"));
                Room Room        = (Room)Params[0];

                if (Room.Id != HospitalRID)
                {
                    RoleplayManager.SendUser(Client, HospitalRID);
                    Client.SendNotification("You cannot leave the hospital while you are dead!");
                }

                RoleplayManager.GetLookAndMotto(Client);
                RoleplayManager.SpawnBeds(Client, "hosptl_bed");
            }
            else
            {
                return;
            }
        }
Exemple #3
0
        /// <summary>
        /// Ends the jailbreak
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (!JailbreakManager.JailbreakActivated)
                {
                    base.EndTimer();
                    return;
                }

                List <GameClient> CurrentJailbrokenUsers = PlusEnvironment.GetGame().GetClientManager().GetClients.Where(x => x != null && x.GetHabbo() != null && x.GetRoleplay() != null && x.GetRoleplay().Jailbroken).ToList();
                GameClient        UserJailbreaking       = JailbreakManager.UserJailbreaking;

                if (CurrentJailbrokenUsers.Count <= 0)
                {
                    JailbreakManager.JailbreakActivated = false;
                    if (JailbreakManager.FenceBroken)
                    {
                        Room Room = RoleplayManager.GenerateRoom(Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")));

                        if (Room != null)
                        {
                            JailbreakManager.GenerateFence(Room);
                        }
                        JailbreakManager.FenceBroken = false;
                    }
                    MessagePoliceOfficers();
                    base.EndTimer();
                    return;
                }

                if (UserJailbreaking != null || UserJailbreaking.GetHabbo().CurrentRoom != null || UserJailbreaking.GetRoomUser() != null)
                {
                    if (UserJailbreaking.GetHabbo().CurrentRoomId != Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")))
                    {
                        JailbreakManager.JailbreakActivated = false;
                        if (JailbreakManager.FenceBroken)
                        {
                            Room Room = RoleplayManager.GenerateRoom(Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")));

                            if (Room != null)
                            {
                                JailbreakManager.GenerateFence(Room);
                            }
                            JailbreakManager.FenceBroken = false;
                        }

                        foreach (GameClient Client in CurrentJailbrokenUsers)
                        {
                            if (Client == null || Client.GetRoleplay() == null || Client.GetHabbo() == null)
                            {
                                continue;
                            }

                            if (Client.GetRoleplay().Jailbroken&& !JailbreakManager.FenceBroken)
                            {
                                Client.GetRoleplay().Jailbroken = false;
                            }

                            if (Client.GetHabbo().CurrentRoomId == Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid")))
                            {
                                RoleplayManager.GetLookAndMotto(Client);
                                RoleplayManager.SpawnBeds(Client, "bed_silo_one");
                                Client.SendNotification("O processo para fuga da prisão parou, então você voltou para ela!");
                            }
                            else
                            {
                                Client.SendNotification("O processo para fuga da prisão parou, então você voltou para ela!");
                                RoleplayManager.SendUser(Client, Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid")));
                            }
                        }

                        MessagePoliceOfficers();

                        RoleplayManager.Shout(UserJailbreaking, "*Para a fuga*", 4);
                        base.EndTimer();
                        return;
                    }
                }

                TimeCount++;
                TimeLeft -= 1000;

                if (TimeLeft > 0)
                {
                    if (TimeCount == 60)
                    {
                        if (UserJailbreaking != null || UserJailbreaking.GetHabbo().CurrentRoom != null || UserJailbreaking.GetRoomUser() != null)
                        {
                            RoleplayManager.Shout(UserJailbreaking, "*Estou mais perto de terminar a fuga dos prisioneiros [" + (TimeLeft / 60000) + " minutos restantes]*", 4);
                        }

                        TimeCount = 0;
                    }
                    return;
                }

                foreach (GameClient Client in CurrentJailbrokenUsers)
                {
                    if (Client == null || Client.GetRoleplay() == null || Client.GetHabbo() == null)
                    {
                        continue;
                    }

                    RoleplayManager.Shout(Client, "*Escapa completamente da prisão graças a um parceiro*", 4);
                    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Client, "ACH_Jailbreak", 1);
                    Client.GetRoleplay().Jailbroken = false;
                    Client.GetRoleplay().IsWanted   = false;
                    Client.GetRoleplay().IsJailed   = false;
                    Client.GetHabbo().Poof();
                }

                if (JailbreakManager.FenceBroken)
                {
                    Room Room = RoleplayManager.GenerateRoom(Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")));

                    if (Room != null)
                    {
                        JailbreakManager.GenerateFence(Room);
                    }
                    JailbreakManager.FenceBroken = false;
                }
                JailbreakManager.JailbreakActivated = false;
                JailbreakManager.UserJailbreaking   = null;
                base.EndTimer();
                return;
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }
Exemple #4
0
        /// <summary>
        /// Kills the user normally, sends them to the hospital
        /// </summary>
        /// <param name="Client"></param>
        private void NormalDeath(GameClient Client)
        {
            RoleplayManager.Shout(Client, "*Cai no chão desmaiado e morre*", 32);

            if (Client.GetRoomUser() != null)
            {
                Client.GetRoomUser().ApplyEffect(0);
            }

            #region Lays User Down
            if (Client.GetRoomUser() != null)
            {
                var User = Client.GetRoomUser();

                if (User.isLying)
                {
                    User.RemoveStatus("lay");
                    User.isLying = false;
                }

                if (User.isSitting)
                {
                    User.RemoveStatus("sit");
                    User.isSitting = false;
                }

                if ((User.RotBody % 2) == 0)
                {
                    if (User == null)
                    {
                        return;
                    }

                    try
                    {
                        User.Statusses.Add("lay", "1.0 null");
                        User.Z           -= 0.35;
                        User.isLying      = true;
                        User.UpdateNeeded = true;
                    }
                    catch { }
                }
                else
                {
                    User.RotBody--;
                    User.Statusses.Add("lay", "1.0 null");
                    User.Z           -= 0.35;
                    User.isLying      = true;
                    User.UpdateNeeded = true;
                }
            }
            #endregion

            if (Client.GetRoleplay().IsWorking)
            {
                WorkManager.RemoveWorkerFromList(Client);
                Client.GetRoleplay().IsWorking = false;
            }

            Client.GetRoleplay().IsDead       = true;
            Client.GetRoleplay().DeadTimeLeft = RoleplayManager.DeathTime;

            if (Client.GetRoleplay() != null && Client.GetRoleplay().TimerManager != null && Client.GetRoleplay().TimerManager.ActiveTimers != null)
            {
                if (Client.GetRoleplay().TimerManager.ActiveTimers.ContainsKey("death"))
                {
                    Client.GetRoleplay().TimerManager.ActiveTimers["death"].EndTimer();
                }
                Client.GetRoleplay().TimerManager.CreateTimer("death", 1000, true);
            }

            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Client, QuestType.DEATH);

            int      HospitalRID = Convert.ToInt32(RoleplayData.GetData("hospital", "insideroomid"));
            RoomData roomData    = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(HospitalRID);

            if (Client != null && Client.GetHabbo() != null)
            {
                if (Client.GetHabbo().CurrentRoomId == HospitalRID)
                {
                    RoleplayManager.GetLookAndMotto(Client);
                    RoleplayManager.SpawnBeds(Client, "hosptl_bed");
                    Client.SendMessage(new RoomNotificationComposer("room_death_axe", "message", "Você morreu! Você está sendo levado ao Hospital."));
                }
                else
                {
                    Client.SendMessage(new RoomNotificationComposer("room_death_axe", "message", "Você morreu! Você está sendo levado ao Hospital."));
                    RoleplayManager.SendUser(Client, HospitalRID);
                }
            }
        }
Exemple #5
0
        public void Execute(GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length < 3)
            {
                Session.SendWhisper("Opa, você esqueceu de inserir um nome de usuário ou o número de estrelas de 1-6!", 1);
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                Session.SendWhisper("Ocorreu um erro ao tentar encontrar esse usuário, talvez ele esteja offline.", 1);
                return;
            }

            var RoomUser       = Session.GetRoomUser();
            var TargetRoomUser = TargetClient.GetRoomUser();

            if (RoomUser == null || TargetRoomUser == null)
            {
                return;
            }

            if (TargetClient.GetRoleplay().IsJailed)
            {
                Session.SendWhisper("Esta pessoa já está presa!", 1);
                return;
            }

            int Stars;

            if (!int.TryParse(Params[2], out Stars))
            {
                Session.SendWhisper("Digite um número de estrelas válido de 1-6", 1);
                return;
            }
            else
            {
                if (Stars < 1 || Stars > 6)
                {
                    Session.SendWhisper("Digite um número de estrelas válido de 1-6", 1);
                    return;
                }
            }

            int WantedTime = Stars * 5;

            TargetClient.GetRoleplay().WantedLevel = Stars;
            if (TargetClient.GetRoleplay().IsDead)
            {
                TargetClient.GetRoleplay().IsDead = false;
                TargetClient.GetRoleplay().ReplenishStats(true);
                TargetClient.GetHabbo().Poof();
            }

            if (TargetClient.GetRoleplay().IsWorking)
            {
                WorkManager.RemoveWorkerFromList(TargetClient);
                TargetClient.GetRoleplay().IsWorking = false;
                TargetClient.GetHabbo().Poof();
            }

            if (TargetClient.GetRoleplay().Cuffed)
            {
                TargetClient.GetRoleplay().Cuffed = false;
            }

            if (TargetClient.GetRoleplay().OnProbation)
            {
                TargetClient.GetRoleplay().OnProbation = false;
            }

            if (TargetRoomUser.Frozen)
            {
                TargetRoomUser.Frozen = false;
            }

            TargetClient.GetRoleplay().IsJailed       = true;
            TargetClient.GetRoleplay().JailedTimeLeft = WantedTime;
            TargetClient.GetRoleplay().TimerManager.CreateTimer("jail", 1000, false);

            int JailRID = Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid"));

            if (TargetClient.GetHabbo().CurrentRoomId == JailRID)
            {
                RoleplayManager.GetLookAndMotto(TargetClient);
                RoleplayManager.SpawnBeds(TargetClient, "bed_silo_one");
                TargetClient.SendMessage(new RoomNotificationComposer("room_jail_prison", "message", "Você foi preso por " + Session.GetHabbo().Username + " por " + WantedTime + " minutos!"));
            }
            else
            {
                TargetClient.SendMessage(new RoomNotificationComposer("room_jail_prison", "message", "Você foi preso por " + Session.GetHabbo().Username + " por " + WantedTime + " minutos!"));
                RoleplayManager.SendUser(TargetClient, JailRID);
            }

            if (RoleplayManager.WantedList.ContainsKey(TargetClient.GetHabbo().Id))
            {
                Wanted Junk;
                RoleplayManager.WantedList.TryRemove(TargetClient.GetHabbo().Id, out Junk);
                PlusEnvironment.GetGame().GetClientManager().JailAlert("[Alerta RÁDIO] " + TargetClient.GetHabbo().Username + " acabou de ser preso por " + Session.GetHabbo().Username + "! Bom trabalho.");
            }

            Session.Shout("*Prende imediatamente o " + TargetClient.GetHabbo().Username + " por " + WantedTime + " minutos*", 23);
            return;
        }
Exemple #6
0
        public static RoomUser DeployBotByID(int RoleplayBotsID, string SpawnType = "default", int RoomID = 0)
        {
            lock (SyncLock)
            {
                try
                {
                    if (!RoleplayBotManager.CachedRoleplayBots.ContainsKey(RoleplayBotsID))
                    {
                        return(null);
                    }

                    #region If the bot already exists simply transfer it
                    RoleplayBot DeployingBot = RoleplayBotManager.CachedRoleplayBots[RoleplayBotsID];

                    if (DeployingBot.DRoomUser != null)
                    {
                        if (DeployingBot.DRoom != null)
                        {
                            if (DeployingBot.DRoom.Id != RoomID)
                            {
                                RoleplayBotManager.TransportDeployedBot(DeployingBot.DRoomUser, (RoomID == 0 ? DeployingBot.SpawnId : RoomID));
                            }
                        }
                        return(null);
                    }
                    #endregion

                    Room RoleplayBotsRoom;

                    if (RoomID == 0)
                    {
                        if (RoleplayManager.GenerateRoom(DeployingBot.SpawnId, false) == null)
                        {
                            return(null);
                        }
                        else
                        {
                            RoleplayBotsRoom = RoleplayManager.GenerateRoom(DeployingBot.SpawnId, false);
                        }
                    }
                    else
                    {
                        if (RoleplayManager.GenerateRoom(RoomID, false) == null)
                        {
                            return(null);
                        }
                        else
                        {
                            RoleplayBotsRoom = RoleplayManager.GenerateRoom(RoomID, false);
                        }

                        DeployingBot.SpawnId = RoleplayBotsRoom.RoomId;
                    }

                    #region Misc variables
                    RoomUserManager     RoomManager          = RoleplayBotsRoom.GetRoomUserManager();
                    RoomUser            BotsRoomUserInstance = new RoomUser(0, RoleplayBotsRoom.RoomId, RoomManager.primaryPrivateUserID++, RoleplayBotsRoom);
                    List <RandomSpeech> BotsSpeech           = new List <RandomSpeech>();
                    int BotsPersonalID = RoomManager.secondaryPrivateUserID++;
                    BotsRoomUserInstance.InternalRoomID = BotsPersonalID;
                    RoomManager._users.TryAdd(BotsPersonalID, BotsRoomUserInstance);
                    DynamicRoomModel RoleplayBotsModel = RoleplayBotsRoom.GetGameMap().Model;
                    #endregion

                    #region Spawning & Positioning
                    if (DeployingBot.Dead)
                    {
                        RoleplayManager.SpawnBeds(null, "hosptl_bed", BotsRoomUserInstance);
                    }
                    else
                    {
                        #region Spawn at origin
                        if (SpawnType == "default")
                        {
                            if ((DeployingBot.X > 0 && DeployingBot.Y > 0) && DeployingBot.X < RoleplayBotsModel.MapSizeX && DeployingBot.Y < RoleplayBotsModel.MapSizeY)
                            {
                                BotsRoomUserInstance.SetPos(DeployingBot.X, DeployingBot.Y, DeployingBot.Z);
                                BotsRoomUserInstance.SetRot(DeployingBot.SpawnRot, false);
                            }
                            else
                            {
                                DeployingBot.X = RoleplayBotsModel.DoorX;
                                DeployingBot.Y = RoleplayBotsModel.DoorY;

                                BotsRoomUserInstance.SetPos(RoleplayBotsModel.DoorX, RoleplayBotsModel.DoorY, RoleplayBotsModel.DoorZ);
                                BotsRoomUserInstance.SetRot(RoleplayBotsModel.DoorOrientation, false);
                            }
                        }
                        #endregion

                        #region Spawn at work item
                        if (SpawnType == "workitem")
                        {
                            Item Item;
                            if (DeployingBot.GetStopWorkItem(RoleplayBotsRoom, out Item))
                            {
                                var Point = new Point(Item.GetX, Item.GetY);

                                BotsRoomUserInstance.X = Point.X;
                                BotsRoomUserInstance.Y = Point.Y;

                                BotsRoomUserInstance.SetPos(Point.X, Point.Y, RoleplayBotsRoom.GetGameMap().GetHeightForSquare(Point));
                                BotsRoomUserInstance.SetRot(Item.Rotation, false);
                            }
                            else
                            {
                                BotsRoomUserInstance.X = RoleplayBotsModel.DoorX;
                                BotsRoomUserInstance.Y = RoleplayBotsModel.DoorY;

                                BotsRoomUserInstance.SetPos(RoleplayBotsModel.DoorX, RoleplayBotsModel.DoorY, RoleplayBotsModel.DoorZ);
                                BotsRoomUserInstance.SetRot(RoleplayBotsModel.DoorOrientation, false);
                            }
                        }
                        #endregion

                        #region Spawn at owner

                        if (SpawnType == "owner" && DeployingBot.Owner != null)
                        {
                            RoomUser OwnerInstance = DeployingBot.Owner.GetRoomUser();
                            int      X             = OwnerInstance.SquareInFront.X;
                            int      Y             = OwnerInstance.SquareInFront.Y;
                            double   Z             = OwnerInstance.Z;

                            if ((OwnerInstance != null) && (X > 0 && Y > 0) && X < RoleplayBotsModel.MapSizeX && Y < RoleplayBotsModel.MapSizeY)
                            {
                                BotsRoomUserInstance.SetPos(X, Y, Z);
                                BotsRoomUserInstance.SetRot(DeployingBot.SpawnRot, false);
                            }
                            else
                            {
                                X = OwnerInstance.X;
                                Y = OwnerInstance.Y;
                                DeployingBot.X = X;
                                DeployingBot.Y = Y;

                                BotsRoomUserInstance.SetPos(X, Y, OwnerInstance.Z);
                                BotsRoomUserInstance.SetRot(DeployingBot.SpawnRot, false);
                            }
                        }
                        #endregion
                    }
                    #endregion

                    #region Generate Roleplay Bot's data, timers

                    BotsRoomUserInstance.BotData = new RoomBot(DeployingBot.Id, DeployingBot.SpawnId, DeployingBot.AITypeString, "stand", DeployingBot.Name, "Motto", DeployingBot.Figure, DeployingBot.X, DeployingBot.Y, DeployingBot.Z, DeployingBot.SpawnRot, DeployingBot.X, DeployingBot.Y, DeployingBot.X, DeployingBot.Y, ref BotsSpeech, DeployingBot.Gender, 0, 0, false, 0, false, 0);
                    BotsRoomUserInstance.RPBotAI = RoleplayBotManager.GetRoleplayBotAI(DeployingBot.AIType, BotsRoomUserInstance.VirtualId);
                    BotsRoomUserInstance.BotAI   = BotsRoomUserInstance.BotData.GenerateBotAI(BotsRoomUserInstance.VirtualId);

                    if (DeployingBot.IsPet)
                    {
                        BotsRoomUserInstance.PetData           = DeployingBot.PetInstance;
                        BotsRoomUserInstance.PetData.VirtualId = BotsRoomUserInstance.VirtualId;
                    }

                    BotsRoomUserInstance.RPBotAI.Init(DeployingBot.Id, DeployingBot, BotsRoomUserInstance.VirtualId, DeployingBot.SpawnId, BotsRoomUserInstance, RoleplayBotsRoom);

                    BotsRoomUserInstance.BotAI.Init(DeployingBot.Id, BotsRoomUserInstance.VirtualId, DeployingBot.SpawnId, BotsRoomUserInstance, RoleplayBotsRoom);

                    if (DeployingBot.TimerManager == null)
                    {
                        DeployingBot.TimerManager = new BotTimerManager(DeployingBot);
                    }
                    else
                    {
                        DeployingBot.TimerManager.CachedBot = DeployingBot;
                    }

                    if (DeployingBot.CooldownManager == null)
                    {
                        DeployingBot.CooldownManager = new BotCooldownManager(DeployingBot);
                    }
                    else
                    {
                        DeployingBot.CooldownManager.CachedBot = DeployingBot;
                    }

                    RoomManager.UpdateUserStatus(BotsRoomUserInstance, false);
                    BotsRoomUserInstance.UpdateNeeded = true;

                    #region Set general variables
                    DeployingBot.Teleporting        = false;
                    DeployingBot.TeleporterEntering = null;
                    DeployingBot.TeleporterExiting  = null;
                    DeployingBot.Teleported         = false;
                    DeployingBot.Deployed           = true;
                    DeployingBot.RoomStayTime       = new CryptoRandom().Next(0, DeployingBot.RoomStayInterval);
                    DeployingBot.FollowCooldown     = new CryptoRandom().Next(0, DeployingBot.FollowInterval);
                    DeployingBot.AttackCooldown     = new CryptoRandom().Next(0, DeployingBot.AttackInterval);
                    DeployingBot.RoamCooldown       = new CryptoRandom().Next(0, DeployingBot.RoamInterval);
                    DeployingBot.RoomStayTime       = new CryptoRandom().Next(0, DeployingBot.RoomStayInterval);
                    DeployingBot.LookCooldown       = new CryptoRandom().Next(0, DeployingBot.LookCooldown);
                    #endregion

                    #endregion

                    #region Compose Roleplay Bot's visibility & insert into deployed bots

                    DeployingBot.Invisible = false;

                    if (!DeployingBot.Invisible)
                    {
                        RoleplayBotsRoom.SendMessage(new UsersComposer(BotsRoomUserInstance));
                    }


                    if (RoomManager._bots.ContainsKey(DeployingBot.Id))
                    {
                        RoomManager._bots[DeployingBot.Id] = BotsRoomUserInstance;
                    }
                    else
                    {
                        RoomManager._bots.TryAdd(DeployingBot.Id, BotsRoomUserInstance);
                    }

                    RoleplayBotsRoom.SendMessage(new DanceComposer(BotsRoomUserInstance, 0));

                    #endregion

                    #region Attach RoleplayBot Instance to RoomUser & deliver its respective data
                    BotsRoomUserInstance.RPBotData = DeployingBot;
                    if (!RoleplayBotManager.DeployedRoleplayBots.ContainsKey(DeployingBot.Id))
                    {
                        RoleplayBotManager.DeployedRoleplayBots.TryAdd(DeployingBot.Id, BotsRoomUserInstance);
                    }
                    else
                    {
                        RoomUser NullBot;
                        RoleplayBotManager.ClearRoleplayBotClones(DeployingBot.Id);
                        RoleplayBotManager.DeployedRoleplayBots.TryAdd(DeployingBot.Id, BotsRoomUserInstance);
                    }


                    #region Start roaming
                    if (DeployingBot.RoamBot)
                    {
                        DeployingBot.MoveRandomly();
                    }
                    #endregion

                    DeployingBot.DRoomUser.GetBotRoleplayAI().OnDeployed(DeployingBot.Owner);

                    #endregion

                    return(BotsRoomUserInstance);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            return(null);
        }
Exemple #7
0
        public void Execute(GameClient Session, Rooms.Room Room, string[] Params)
        {
            #region Conditions
            if (Params.Length == 1)
            {
                Session.SendWhisper("Opa, você esqueceu de inserir um nome de usuário!", 1);
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("Ocorreu um erro ao tentar encontrar esse usuário, talvez ele esteja offline.", 1);
                return;
            }

            RoomUser RoomUser   = Session.GetRoomUser();
            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);
            if (TargetUser == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            if (TargetUser == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            if (TargetClient.GetRoleplay().IsDead)
            {
                Session.SendWhisper("Você não pode escoltar alguém que está morto!", 1);
                return;
            }

            if (TargetClient.GetRoleplay().IsJailed&& !TargetClient.GetRoleplay().Jailbroken)
            {
                Session.SendWhisper("Você não pode escoltar alguém que já está preso!", 1);
                return;
            }

            if (!TargetClient.GetRoleplay().Cuffed)
            {
                Session.SendWhisper("Você não pode escoltar alguém que não está algemado!", 1);
                return;
            }

            if (TargetUser.IsAsleep)
            {
                Session.SendWhisper("Você não pode escoltar alguém que está ausente!", 1);
                return;
            }

            if (TargetClient == Session)
            {
                Session.SendWhisper("Você não pode se escoltar!", 1);
                return;
            }

            if (!TargetClient.GetRoleplay().Jailbroken)
            {
                if (!RoleplayManager.WantedList.ContainsKey(TargetClient.GetHabbo().Id))
                {
                    if (TargetClient.GetRoleplay().TimerManager.ActiveTimers.ContainsKey("probation"))
                    {
                        TargetClient.GetRoleplay().TimerManager.ActiveTimers["probation"].EndTimer();
                    }

                    TargetClient.GetRoleplay().IsWanted       = true;
                    TargetClient.GetRoleplay().WantedLevel    = 1;
                    TargetClient.GetRoleplay().WantedTimeLeft = 10;

                    TargetClient.GetRoleplay().TimerManager.CreateTimer("procurado", 1000, false);
                    RoleplayManager.WantedList.TryUpdate(TargetClient.GetHabbo().Id, new Wanted(Convert.ToUInt32(TargetClient.GetHabbo().Id), Room.Id.ToString(), 1), RoleplayManager.WantedList[TargetClient.GetHabbo().Id]);
                }
            }

            #endregion

            #region Execute
            Point  ClientPos       = new Point(RoomUser.X, RoomUser.Y);
            Point  TargetClientPos = new Point(TargetUser.X, TargetUser.Y);
            double Distance        = RoleplayManager.GetDistanceBetweenPoints2D(ClientPos, TargetClientPos);
            Wanted Wanted          = RoleplayManager.WantedList.ContainsKey(TargetClient.GetHabbo().Id) ? RoleplayManager.WantedList[TargetClient.GetHabbo().Id] : null;
            int    WantedTime      = Wanted == null ? 6 : Wanted.WantedLevel * 5;

            if (Distance <= 1)
            {
                if (TargetClient.GetRoleplay().IsWorking)
                {
                    WorkManager.RemoveWorkerFromList(TargetClient);
                    TargetClient.GetRoleplay().IsWorking = false;
                    TargetClient.GetHabbo().Poof();
                }

                Session.Shout("*Algema as mãos de " + TargetClient.GetHabbo().Username + ", coloca as algemas e prende por " + WantedTime + " minutos*", (GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking ? 37 : 4));
                TargetClient.GetRoleplay().Cuffed = false;
                TargetClient.GetRoomUser().ApplyEffect(0);

                if (TargetClient.GetHabbo().Look.Contains("lg-78322"))
                {
                    if (!TargetClient.GetRoleplay().WantedFor.Contains("exposição indecente"))
                    {
                        TargetClient.GetRoleplay().WantedFor = TargetClient.GetRoleplay().WantedFor + "exposição indecente, ";
                    }
                }

                if (TargetUser.Frozen)
                {
                    TargetUser.Frozen = false;
                }

                if (!TargetClient.GetRoleplay().IsJailed)
                {
                    TargetClient.GetRoleplay().IsJailed       = true;
                    TargetClient.GetRoleplay().JailedTimeLeft = WantedTime;
                    TargetClient.GetRoleplay().TimerManager.CreateTimer("jail", 1000, false);
                }

                if (TargetClient.GetRoleplay().Jailbroken&& !JailbreakManager.FenceBroken)
                {
                    TargetClient.GetRoleplay().Jailbroken = false;
                }

                int JailRID = Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid"));

                if (TargetClient.GetHabbo().CurrentRoomId == JailRID)
                {
                    RoleplayManager.GetLookAndMotto(TargetClient);
                    RoleplayManager.SpawnBeds(TargetClient, "bed_silo_one");
                    TargetClient.SendMessage(new RoomNotificationComposer("room_jail_prison", "message", "Você foi escoltado por " + Session.GetHabbo().Username + " por " + WantedTime + " minutos!"));
                }
                else
                {
                    TargetClient.SendMessage(new RoomNotificationComposer("room_jail_prison", "message", "Você foi escoltado por " + Session.GetHabbo().Username + " por " + WantedTime + " minutos!"));
                    RoleplayManager.SendUser(TargetClient, JailRID);
                }

                PlusEnvironment.GetGame().GetClientManager().JailAlert("[Alerta RÁDIO] " + TargetClient.GetHabbo().Username + " acabou de ser escoltado para a prisão por " + Session.GetHabbo().Username + "!");
                PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Arrests", 1);
                Session.GetRoleplay().Arrests++;
                PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(TargetClient, "ACH_Arrested", 1);
                TargetClient.GetRoleplay().Arrested++;
                return;
            }
            else
            {
                Session.SendWhisper("Você deve se aproximar desse cidadão para escoltá-lo!", 1);
                return;
            }
            #endregion
        }