Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Session.GetRoleplay().TexasHoldEmPlayer > 0)
            {
                Session.Shout("*Sai do Texas Hold 'Em *", 4);
                TexasHoldEmManager.RemovePlayer(Session.GetHabbo().Id);
                return;
            }

            if (Session.GetRoleplay().Game == null)
            {
                Session.SendWhisper("Você não está dentro de um evento!", 1);
                return;
            }

            if (Session.GetRoleplay().Game.IsGameStarting() && !Session.GetRoleplay().Game.HasGameStarted())
            {
                Session.SendWhisper("Você não pode deixar um jogo enquanto está começando!", 1);
                return;
            }

            if (RoleplayGameManager.RunningGames.ContainsKey(Session.GetRoleplay().Game.GetGameMode()))
            {
                if (Session.GetRoleplay().Game.GetGameMode() == GameMode.Brawl || Session.GetRoleplay().Game.GetGameMode() == GameMode.SoloQueue || Session.GetRoleplay().Game.GetGameMode() == GameMode.SoloQueueGuns)
                {
                    if (Session.GetRoomUser() != null)
                    {
                        Session.GetRoomUser().ClearMovement(true);
                    }
                    RoleplayGameManager.GetGame(Session.GetRoleplay().Game.GetGameMode()).RemovePlayerFromGame(Session);
                    RoleplayManager.SpawnChairs(Session, "es_bench");
                }
                else
                {
                    RoleplayGameManager.GetGame(Session.GetRoleplay().Game.GetGameMode()).RemovePlayerFromGame(Session);
                }

                Session.GetRoleplay().Game = null;
                Session.GetRoleplay().Team = null;
                return;
            }
            else
            {
                Session.SendWhisper("Um erro ocorreu!", 1);
                return;
            }
        }
Exemplo n.º 3
0
        public void Winner()
        {
            try
            {
                GameClient Player = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Players[0]);

                if (Player != null)
                {
                    Player.GetRoleplay().UpdateEventWins("sq", 1);
                    if (Player.GetRoleplay() != null)
                    {
                        Player.GetRoleplay().ReplenishStats(true);
                    }
                    Player.SendNotification("Parabéns! Você ganhou o SoloQueue!");
                    RoleplayManager.SpawnChairs(Player, "es_bench");
                    RemovePlayerFromGame(Player);

                    if (Player.GetHabbo() != null && Player.GetHabbo().CurrentRoom != null && Player.GetHabbo().CurrentRoom.GetRoomUserManager() != null && Player.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers() != null)
                    {
                        lock (Player.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers())
                        {
                            foreach (var User in Player.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers())
                            {
                                if (User == null || User.IsBot || User.GetClient() == null)
                                {
                                    continue;
                                }

                                User.GetClient().SendWhisper("[Alerta de EVENTO] " + Player.GetHabbo().Username + " acabou de ganhar o evento [SoloQueue]! Parabéns!", 33);
                            }
                        }
                    }
                }
                Stop();
            }
            catch (Exception e)
            {
                Logging.LogRPGamesError("Error in Winner() void: " + e);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Kills the user normally, depends on the event mode
        /// </summary>
        /// <param name="Client"></param>
        private void EventDeath(GameClient Client)
        {
            if (Client.GetRoleplay().Game == null)
            {
                NormalDeath(Client);
            }

            #region Brawl
            else if (Client.GetRoleplay().Game == Games.RoleplayGameManager.GetGame(Games.GameMode.Brawl))
            {
                Client.GetRoleplay().ReplenishStats();

                RoleplayManager.Shout(Client, "*Nocauteado e expulso da briga*", 32);
                RoleplayManager.SpawnChairs(Client, "es_bench");

                Client.SendMessage(new RoomNotificationComposer("room_kick_cannonball", "message", "Você foi nocauteado e perdeu a briga!"));
                Client.GetRoleplay().Game.RemovePlayerFromGame(Client);
            }
            #endregion

            #region Team Brawl
            else if (Client.GetRoleplay().Game == Games.RoleplayGameManager.GetGame(Games.GameMode.TeamBrawl))
            {
                Client.GetRoleplay().ReplenishStats();
                RoleplayManager.Shout(Client, "*Sai da briga por ser nocauteado*", 32);

                #region Graveyard Spawn
                if (Client.GetRoomUser() != null)
                {
                    int ArenaStartX  = Convert.ToInt32(RoleplayData.GetData("teambrawl", "graveyardstartx"));
                    int ArenaStartY  = Convert.ToInt32(RoleplayData.GetData("teambrawl", "graveyardstarty"));
                    int ArenaFinishX = Convert.ToInt32(RoleplayData.GetData("teambrawl", "graveyardfinishx"));
                    int ArenaFinishY = Convert.ToInt32(RoleplayData.GetData("teambrawl", "graveyardfinishy"));

                    CryptoRandom       Random       = new CryptoRandom();
                    List <ThreeDCoord> Squares      = RoleplayManager.GenerateMap(ArenaStartX, ArenaStartY, ArenaFinishX, ArenaFinishY);
                    ThreeDCoord        RandomSquare = Squares[Random.Next(0, Squares.Count)] == null?Squares.FirstOrDefault() : Squares[Random.Next(0, Squares.Count)];

                    Client.GetRoomUser().ClearMovement(true);
                    var Room = RoleplayManager.GenerateRoom(Client.GetRoomUser().RoomId);
                    if (Room != null)
                    {
                        Room.GetGameMap().UpdateUserMovement(new Point(Client.GetRoomUser().X, Client.GetRoomUser().Y), new Point(RandomSquare.X, RandomSquare.Y), Client.GetRoomUser());
                    }

                    Client.GetRoomUser().X            = RandomSquare.X;
                    Client.GetRoomUser().Y            = RandomSquare.Y;
                    Client.GetRoomUser().UpdateNeeded = true;
                }
                #endregion

                Client.SendMessage(new RoomNotificationComposer("room_kick_cannonball", "message", "Você foi nocauteado da Briga de Times!"));

                if (!Client.GetRoleplay().Team.LostMembers.Contains(Client.GetHabbo().Id))
                {
                    Client.GetRoleplay().Team.LostMembers.Add(Client.GetHabbo().Id);
                }

                if (Client.GetRoleplay().Team.LostMembers.Count == Client.GetRoleplay().Team.Members.Count)
                {
                    Client.GetRoleplay().Team.InGame = false;
                }
            }
            #endregion

            #region SoloQueue
            else if (Client.GetRoleplay().Game.GetGameMode() == Games.GameMode.SoloQueue || Client.GetRoleplay().Game.GetGameMode() == Games.GameMode.SoloQueueGuns)
            {
                Client.GetRoleplay().ReplenishStats();

                RoleplayManager.Shout(Client, "*Sai do Soloqueue por ser nocauteado*", 32);
                RoleplayManager.SpawnChairs(Client, "es_bench");

                Client.SendMessage(new RoomNotificationComposer("room_kick_cannonball", "message", "Você foi nocauteado do Soloqueue!"));
                Client.GetRoleplay().Game.RemovePlayerFromGame(Client);
            }
            #endregion

            #region Colour Wars
            else if (Client.GetRoleplay().Game == Games.RoleplayGameManager.GetGame(Games.GameMode.ColourWars))
            {
                Client.GetRoleplay().ReplenishStats();
                Client.GetRoleplay().NeedsRespawn = true;

                RoleplayManager.Shout(Client, "*Nocauteado! Você está sendo levado para sala de revivência*", 32);
                RoleplayManager.SendUser(Client, Client.GetRoleplay().Team.SpawnRoom);
                Client.SendMessage(new RoomNotificationComposer("room_kick_cannonball", "message", "Você foi nocauteado. Vai demorar dois minutos para recuperar."));

                new Thread(() =>
                {
                    Thread.Sleep(2000);

                    int Counter = 0;
                    while (Counter < 200)
                    {
                        if (Client == null || Client.GetRoleplay() == null || Client.GetRoleplay().Game == null || Client.GetRoleplay().Team == null || Client.GetRoleplay().Game.GetGameMode() != Games.GameMode.ColourWars)
                        {
                            if (Client.GetRoomUser() != null)
                            {
                                Client.GetRoomUser().CanWalk = true;
                            }

                            if (Client.GetRoleplay() != null)
                            {
                                Client.GetRoleplay().NeedsRespawn = false;
                            }
                            break;
                        }

                        Counter++;
                        Thread.Sleep(1000);

                        if (Counter == 30)
                        {
                            Client.SendWhisper("Você tem 1 minuto, 30 segundos restantes até que você possa se mover novamente!", 1);
                        }
                        else if (Counter == 60)
                        {
                            Client.SendWhisper("Você tem 1 minuto restante até que você possa se mover novamente!", 1);
                        }
                        else if (Counter == 90)
                        {
                            Client.SendWhisper("Você tem 30 segundos restantes até que você possa se mover novamente!", 1);
                        }
                        else if (Counter == 110)
                        {
                            Client.SendWhisper("Você tem 10 segundos restantes até que você possa se mover novament!", 1);
                        }
                        else if (Counter == 120)
                        {
                            Client.SendWhisper("Você agora está consciente e pode se mover!", 1);
                        }
                        else if (Counter >= 121)
                        {
                            if (Client.GetRoomUser() != null)
                            {
                                Client.GetRoomUser().CanWalk = true;
                            }

                            if (Client.GetRoleplay() != null)
                            {
                                Client.GetRoleplay().NeedsRespawn = false;
                            }
                            break;
                        }
                    }
                }).Start();
            }
            #endregion

            #region Mafia Wars
            else if (Client.GetRoleplay().Game == Games.RoleplayGameManager.GetGame(Games.GameMode.MafiaWars))
            {
                Client.GetRoleplay().ReplenishStats();
                Client.GetRoleplay().NeedsRespawn = true;

                RoleplayManager.Shout(Client, "*Nocauteado! Você está sendo levado para sala de revivência*", 32);
                RoleplayManager.SendUser(Client, Client.GetRoleplay().Team.SpawnRoom);
                Client.SendMessage(new RoomNotificationComposer("room_kick_cannonball", "message", "Você foi nocauteado! Levará 35 segundos para recuperar."));

                new Thread(() =>
                {
                    Thread.Sleep(2000);


                    if (Client.GetRoomUser() != null)
                    {
                        Client.GetRoomUser().ApplyEffect(EffectsList.Ghost);
                        Client.GetRoomUser().Frozen = true;
                    }

                    Thread.Sleep(4000);

                    int Counter = 0;
                    while (Counter < 30)
                    {
                        if (Client == null)
                        {
                            break;
                        }

                        if (Client.GetRoomUser() == null)
                        {
                            break;
                        }

                        Counter++;
                        Thread.Sleep(1000);

                        if (Counter == 30)
                        {
                            Client.SendWhisper("Agora você pode se mover novamente!", 1);

                            if (Client.GetRoomUser() != null)
                            {
                                Client.GetRoomUser().ApplyEffect(EffectsList.None);
                                Client.GetRoomUser().CanWalk = true;
                                Client.GetRoomUser().Frozen  = false;
                            }

                            if (Client.GetRoleplay() != null)
                            {
                                Client.GetRoleplay().NeedsRespawn = false;
                            }
                            break;
                        }
                    }
                }).Start();
            }
            #endregion
        }
Exemplo n.º 5
0
        /// <summary>
        /// Decrease our users timer
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.Client == null || base.Client.GetHabbo() == null || base.Client.GetRoleplay() == null)
                {
                    base.EndTimer();
                    return;
                }

                if (base.Client.GetRoomUser() == null)
                {
                    return;
                }

                if (!base.Client.GetRoleplay().IsDead)
                {
                    Client.GetRoleplay().UpdateTimerDialogue("Dead-Timer", "remove", Client.GetRoleplay().DeadTimeLeft, OriginalTime);

                    if (base.Client.GetRoomUser().Frozen)
                    {
                        base.Client.GetRoomUser().Frozen = false;
                    }

                    if (base.Client.GetHabbo().CurrentRoomId == Convert.ToInt32(RoleplayData.GetData("hospital", "roomid2")))
                    {
                        RoleplayManager.SpawnChairs(base.Client, "pura_mdl3*4");
                    }

                    base.Client.GetRoleplay().BeingHealed  = false;
                    base.Client.GetRoleplay().IsDead       = false;
                    base.Client.GetRoleplay().DeadTimeLeft = 0;
                    base.Client.GetRoleplay().ReplenishStats(true);
                    base.EndTimer();
                    return;
                }

                if (!base.Client.GetRoomUser().Frozen)
                {
                    base.Client.GetRoomUser().Frozen = true;
                }

                if (base.Client.GetRoleplay().BeingHealed)
                {
                    return;
                }

                TimeCount++;
                TimeLeft -= 1000;

                if (TimeCount == 60)
                {
                    base.Client.GetRoleplay().DeadTimeLeft--;
                }

                if (TimeLeft > 0)
                {
                    if (TimeCount == 60)
                    {
                        Client.GetRoleplay().UpdateTimerDialogue("Dead-Timer", "decrement", Client.GetRoleplay().DeadTimeLeft, OriginalTime);
                        base.Client.SendWhisper("Você tem " + base.Client.GetRoleplay().DeadTimeLeft + " minuto(s) para ser liberado do hospital", 1);
                        TimeCount = 0;
                    }
                    return;
                }

                if (base.Client.GetRoomUser().Frozen)
                {
                    base.Client.GetRoomUser().Frozen = false;
                }

                if (base.Client.GetRoomUser().RoomId == Convert.ToInt32(RoleplayData.GetData("hospital", "roomid2")))
                {
                    RoleplayManager.SpawnChairs(base.Client, "pura_mdl3*4");
                }

                Client.GetRoleplay().UpdateTimerDialogue("Dead-Timer", "remove", Client.GetRoleplay().DeadTimeLeft, OriginalTime);

                RoleplayManager.Shout(base.Client, "*Recupera a consciência*", 4);
                Client.SendWhisper("Seu visual voltará ao original após sair do quarto!", 1);
                base.Client.GetRoleplay().BeingHealed  = false;
                base.Client.GetRoleplay().IsDead       = false;
                base.Client.GetRoleplay().DeadTimeLeft = 0;
                base.Client.GetRoleplay().ReplenishStats(true);
                base.EndTimer();
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }
Exemplo n.º 6
0
        private void SpawnJuryUsersOut(bool Reward)
        {
            #region Null checks & Court Variables
            if (RoleplayManager.InvitedUsersToJuryDuty == null)
            {
                return;
            }
            if (RoleplayManager.InvitedUsersToJuryDuty.Count <= 0)
            {
                return;
            }
            int  CourtRoomId = Convert.ToInt32(RoleplayData.GetData("court", "roomid"));
            Room Room        = RoleplayManager.GenerateRoom(CourtRoomId);
            if (Room == null)
            {
                return;
            }
            int Award = new CryptoRandom().Next(Convert.ToInt32(RoleplayData.GetData("court", "minaward")), Convert.ToInt32(RoleplayData.GetData("court", "maxaward")));
            #endregion

            lock (RoleplayManager.InvitedUsersToJuryDuty)
            {
                foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
                {
                    #region Null checks
                    if (User == null)
                    {
                        continue;
                    }
                    if (User.GetClient() == null)
                    {
                        continue;
                    }
                    if (User.GetClient().GetHabbo() == null)
                    {
                        continue;
                    }
                    if (User.GetClient().GetRoleplay() == null)
                    {
                        continue;
                    }
                    if (!RoleplayManager.InvitedUsersToJuryDuty.Contains(User.GetClient()))
                    {
                        continue;
                    }
                    #endregion

                    #region Reward
                    if (Reward)
                    {
                        User.GetClient().GetHabbo().Credits += Award;
                        User.GetClient().GetHabbo().UpdateCreditsBalance();
                        User.GetClient().SendWhisper("O Juíz deu para os juris R$" + String.Format("{0:N0}", Award) + " pelo seu tempo. Obrigado!", 1);
                    }
                    #endregion

                    RoleplayManager.SpawnChairs(User.GetClient(), "sofachair_silo*2");
                    User.Frozen = false;
                }
            }
        }
Exemplo n.º 7
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1 && Params[0] != "checarloteria")
            {
                Session.SendWhisper("Digite um tipo de evento!", 1);
                return;
            }

            string Message;

            if (Params[0] == "checarloteria")
            {
                Message = "lottery";
            }
            else
            {
                Message = Params[1].ToString().ToLower();
            }

            switch (Message)
            {
                #region Brawl
            case "brawl":
            case "briga":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.Brawl))
                {
                    Session.SendWhisper("Não há evento de Briga acontecendo!", 1);
                }
                else
                {
                    var Game = RoleplayGameManager.GetGame(GameMode.Brawl);
                    if (Game.GetPlayers().Count > 0)
                    {
                        while (Game.GetPlayers().Count > 0)
                        {
                            foreach (var player in Game.GetPlayers())
                            {
                                var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(player);

                                if (Client != null)
                                {
                                    if (Client.GetRoomUser() != null)
                                    {
                                        Client.GetRoomUser().ClearMovement(true);
                                    }
                                    RoleplayManager.SpawnChairs(Client, "es_bench");
                                    Game.RemovePlayerFromGame(Client);
                                }

                                if (Game.GetPlayers().Contains(player))
                                {
                                    Game.GetPlayers().Remove(player);
                                }
                                break;
                            }

                            if (Game.GetPlayers().Count <= 0)
                            {
                                break;
                            }
                        }
                    }
                    RoleplayGameManager.StopGame(GameMode.Brawl);
                    Session.SendWhisper("Você parou o Evento de Briga!", 1);
                }
                break;
            }
                #endregion

                #region Team Brawl
            case "teambrawl":
            case "tbrawl":
            case "tb":
            case "brigatimes":
            case "bt":
            case "brigadetimes":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.TeamBrawl))
                {
                    Session.SendWhisper("Não há um evento de Briga de Times acontecendo!", 1);
                }
                else
                {
                    var Game = RoleplayGameManager.GetGame(GameMode.TeamBrawl);
                    if (Game.GetPlayers().Count > 0)
                    {
                        while (Game.GetPlayers().Count > 0)
                        {
                            foreach (var Player in Game.GetPlayers())
                            {
                                var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player);

                                if (Client != null)
                                {
                                    Game.RemovePlayerFromGame(Client);
                                    RoleplayManager.SpawnChairs(Client, "es_bench");
                                }
                                if (Game.GetPlayers().Contains(Player))
                                {
                                    Game.GetPlayers().Remove(Player);
                                }
                                break;
                            }

                            if (Game.GetPlayers().Count <= 0)
                            {
                                break;
                            }
                        }
                    }
                    RoleplayGameManager.StopGame(GameMode.TeamBrawl);
                    Session.SendWhisper("Você parou o Evento Briga de Times!", 1);
                }
                break;
            }
                #endregion

                #region Colour Wars
            case "colorwars":
            case "colourwars":
            case "cw":
            case "guerradecores":
            case "guerracores":
            case "gc":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.ColourWars))
                {
                    Session.SendWhisper("Não há nenhum evento de Guerra de Cores acontecendo!", 1);
                }
                else
                {
                    var Game = RoleplayGameManager.GetGame(GameMode.ColourWars);
                    if (Game.GetPlayers().Count > 0)
                    {
                        while (Game.GetPlayers().Count > 0)
                        {
                            foreach (var Player in Game.GetPlayers())
                            {
                                var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player);

                                if (Client != null)
                                {
                                    Game.RemovePlayerFromGame(Client);
                                }

                                if (Game.GetPlayers().Contains(Player))
                                {
                                    Game.GetPlayers().Remove(Player);
                                }
                                break;
                            }

                            if (Game.GetPlayers().Count <= 0)
                            {
                                break;
                            }
                        }
                    }
                    RoleplayGameManager.StopGame(GameMode.ColourWars);
                    Session.SendWhisper("Você parou o Evento Guerra de Cores!", 1);
                }
                break;
            }
                #endregion

                #region Mafia Wars
            case "mafiawars":
            case "mwars":
            case "mw":
            case "gm":
            case "guerramafia":
            case "guerrademafias":
            case "guerrademafia":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.MafiaWars))
                {
                    Session.SendWhisper("Não há um evento de Guerra de Máfias acontecendo!", 1);
                }
                else
                {
                    var Game = RoleplayGameManager.GetGame(GameMode.MafiaWars);
                    if (Game.GetPlayers().Count > 0)
                    {
                        while (Game.GetPlayers().Count > 0)
                        {
                            foreach (var Player in Game.GetPlayers())
                            {
                                var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player);

                                if (Client != null)
                                {
                                    Game.RemovePlayerFromGame(Client);
                                }

                                if (Game.GetPlayers().Contains(Player))
                                {
                                    Game.GetPlayers().Remove(Player);
                                }
                                break;
                            }

                            if (Game.GetPlayers().Count <= 0)
                            {
                                break;
                            }
                        }
                    }
                    RoleplayGameManager.StopGame(GameMode.MafiaWars);
                    Session.SendWhisper("Você parou o Evento Guerra de Máfias!", 1);
                }
                break;
            }
                #endregion

                #region Purge

            case "purge":
            case "purga":
            case "tempodepurga":
            case "purg":
            {
                if (!RoleplayManager.PurgeStarted)
                {
                    Session.SendWhisper("Este não há um evento de Purga acontecendo agora!");
                    break;
                }

                try
                {
                    lock (PlusEnvironment.GetGame().GetClientManager().GetClients)
                    {
                        foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                        {
                            if (client == null)
                            {
                                continue;
                            }

                            if (client.GetHabbo() == null)
                            {
                                continue;
                            }

                            client.SendWhisper("Um membro da Equipe terminou o Evento de Purga. Nós esperamos que você tenha aproveitado! ;)", 34);
                        }
                    }

                    RoleplayManager.PurgeStarted = false;
                }
                catch (Exception e)
                {
                    Logging.LogCriticalException("Erro ao parar a purga: " + e);
                }
                break;
            }

                #endregion

                #region Lottery
            case "lottery":
            case "loteria":
            {
                if (!LotteryManager.LotteryFull())
                {
                    Session.SendWhisper("Nem todos os bilhetes foram vendidos! [" + LotteryManager.LotteryTickets.Count + "/" + LotteryManager.TicketLimit + "]", 1);
                    break;
                }
                else
                {
                    int Winner = LotteryManager.GetWinner();
                    LotteryManager.GivePrize(Winner);
                    LotteryManager.ClearLottery();
                    Session.SendWhisper("A loteria foi limpa com sucesso!", 1);
                }

                break;
            }
                #endregion

            default:
            {
                Session.SendWhisper("Este tipo de evento não existe ou está desabilitado!", 1);
                break;
            }
            }
        }
Exemplo n.º 8
0
        public void ExecuteBot(GameClient Session, RoomUser Bot, Room Room)
        {
            if (!Bot.GetBotRoleplay().Dead)
            {
                Session.SendWhisper("Desculpe, mas " + Bot.GetBotRoleplay().Name + " não está morto!", 1);
                return;
            }

            double Distance = RoleplayManager.GetDistanceBetweenPoints2D(Session.GetRoomUser().Coordinate, Bot.Coordinate);

            if (Distance <= 5)
            {
                if (Bot.GetBotRoleplay().TimerManager.ActiveTimers.ContainsKey("botdeath"))
                {
                    Bot.GetBotRoleplay().TimerManager.ActiveTimers["botdeath"].EndTimer();
                }

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

                Session.Shout("*Revive " + Bot.GetBotRoleplay().Name + " da cama de hospital*", 4);
                RoleplayManager.SpawnChairs(null, "val14_wchair", Bot);

                Bot.GetBotRoleplay().Dead = false;
                Room.SendMessage(new UsersComposer(Bot));

                if (Bot.GetBotRoleplay().RoamBot)
                {
                    Bot.GetBotRoleplay().MoveRandomly();
                }

                if (Session.GetRoleplay().LastKilled != (RoleplayBotManager.BotFriendMultiplyer + Bot.GetBotRoleplay().Id))
                {
                    int Amount = 0;

                    if (Session.GetRoleplay().Level <= 5)
                    {
                        Amount = 1;
                    }
                    else if (Session.GetRoleplay().Level > 5 && Session.GetRoleplay().Level <= 10)
                    {
                        Amount = 2;
                    }
                    else if (Session.GetRoleplay().Level > 10 && Session.GetRoleplay().Level <= 15)
                    {
                        Amount = 3;
                    }
                    else
                    {
                        Amount = 4;
                    }

                    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Discharging", 1);

                    Session.GetRoleplay().LastKilled = (RoleplayBotManager.BotFriendMultiplyer + Bot.GetBotRoleplay().Id);

                    if (!Room.HitEnabled && !Room.ShootEnabled)
                    {
                        Session.GetHabbo().Credits += Amount;
                        Session.GetHabbo().UpdateCreditsBalance();
                        Session.SendWhisper("Você ganhou R$" + Amount + " extra por reviver " + Bot.GetBotRoleplay().Name + "!", 1);
                    }
                }
                return;
            }
            else
            {
                Session.SendWhisper("Você deve se aproximar de " + Bot.GetBotRoleplay().Name + " para revive-lo!", 1);
                return;
            }
        }
Exemplo n.º 9
0
        public void RemovePlayerFromGame(GameClient player, bool Winner = false)
        {
            try
            {
                if (player == null || player.GetHabbo() == null || player.GetRoleplay() == null)
                {
                    return;
                }

                if (Players.Contains(player.GetHabbo().Id))
                {
                    Players.Remove(player.GetHabbo().Id);
                }
                else
                {
                    return;
                }

                if (Teams.Values.Where(x => x.Members.Contains(player.GetHabbo().Id)).ToList().Count > 0)
                {
                    RoleplayTeam Team = Teams.Values.FirstOrDefault(x => x.Members.Contains(player.GetHabbo().Id));
                    Team.Members.Remove(player.GetHabbo().Id);

                    if (Team.LostMembers.Contains(player.GetHabbo().Id))
                    {
                        Team.LostMembers.Remove(player.GetHabbo().Id);
                    }
                }

                player.GetHabbo().Look  = player.GetRoleplay().OriginalOutfit;
                player.GetHabbo().Motto = player.GetRoleplay().Class;
                player.GetHabbo().Poof(false);

                player.GetRoleplay().GameSpawned = false;
                player.GetRoleplay().Game        = null;
                player.GetRoleplay().Team        = null;

                if (player.GetRoomUser() != null)
                {
                    player.GetRoomUser().ClearMovement(true);
                }
                RoleplayManager.SpawnChairs(player, "es_bench");

                if (GameStarted)
                {
                    if (Winner)
                    {
                        player.GetRoleplay().UpdateEventWins("brawl", 1);
                        player.GetRoleplay().ReplenishStats(true);
                        player.GetHabbo().EventPoints += Prize;
                        player.GetHabbo().UpdateEventPointsBalance();
                        player.SendNotification("Prabéns! Sua equipe ganhou, você foi premiado " + Prize + " pontos de eventos!");
                    }
                    else
                    {
                        player.GetHabbo().EventPoints++;
                        player.GetHabbo().UpdateEventPointsBalance();
                        player.SendNotification("Que merda hein, sua equipe perdeu no evento [Briga de Times]! Você ganhou 1 ponto de evento por participar!");
                    }
                }
            }
            catch (Exception e)
            {
                Logging.LogRPGamesError("Error in RemovePlayerFromGame() void: " + e);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Court of appeals invitation
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (!RoleplayManager.CourtTrialIsStarting)
                {
                    base.EndTimer();
                    return;
                }

                GameClient Defendant          = RoleplayManager.Defendant;
                int        CourtRoomId        = Convert.ToInt32(RoleplayData.GetData("court", "roomid"));
                int        OutsideCourtRoomId = Convert.ToInt32(RoleplayData.GetData("court", "outsideroomid"));

                if (Defendant == null || Defendant.LoggingOut || Defendant.GetHabbo() == null || Defendant.GetRoleplay() == null)
                {
                    lock (RoleplayManager.InvitedUsersToJuryDuty)
                    {
                        foreach (GameClient client in RoleplayManager.InvitedUsersToJuryDuty)
                        {
                            if (client == null || client.GetHabbo() == null)
                            {
                                continue;
                            }

                            client.SendWhisper("A sessão do júri foi cancelada! Desculpe por qualquer inconveniente!", 26);
                        }
                    }

                    RoleplayManager.CourtVoteEnabled = false;
                    RoleplayManager.InnocentVotes    = 0;
                    RoleplayManager.GuiltyVotes      = 0;

                    RoleplayManager.CourtJuryTime        = 0;
                    RoleplayManager.CourtTrialIsStarting = false;
                    RoleplayManager.CourtTrialStarted    = false;
                    RoleplayManager.Defendant            = null;
                    RoleplayManager.InvitedUsersToJuryDuty.Clear();

                    base.EndTimer();
                    return;
                }

                TimeCount++;
                TimeLeft -= 1000;

                if (TimeLeft > 0)
                {
                    if (TimeCount == 60)
                    {
                        if (Defendant != null)
                        {
                            Defendant.SendWhisper("Seu julgamento irá começar em " + (TimeLeft / 60000) + " minuto(s). Esteja preparado!", 1);
                        }

                        lock (RoleplayManager.InvitedUsersToJuryDuty)
                        {
                            foreach (GameClient client in RoleplayManager.InvitedUsersToJuryDuty)
                            {
                                if (client == null || client.GetHabbo() == null)
                                {
                                    continue;
                                }

                                client.SendWhisper("Você foi convidado para o (" + CourtRoomId + "  / [ID do Quarto: " + OutsideCourtRoomId + "] para participar de um julgamento. Você tem " + (TimeLeft / 60000) + " minuto(s) para ir até lá!", 26);
                                client.SendMessage(new RoomNotificationComposer("jury_invitation", "message", "Você foi convidado para um julgamento! Você tem " + (TimeLeft / 60000) + " minuto(s) para ir até lá!"));
                            }
                        }
                        TimeCount = 0;
                    }
                    return;
                }

                lock (RoleplayManager.InvitedUsersToJuryDuty)
                {
                    foreach (GameClient Client in RoleplayManager.InvitedUsersToJuryDuty)
                    {
                        if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoom == null || Client.GetRoleplay() == null || !RoleplayManager.InvitedUsersToJuryDuty.Contains(Client))
                        {
                            continue;
                        }

                        if (Client.GetHabbo().CurrentRoomId != CourtRoomId)
                        {
                            RoleplayManager.InvitedUsersToRemove.Add(Client);
                        }

                        if (Client.GetHabbo().CurrentRoomId == CourtRoomId)
                        {
                            RoleplayManager.SpawnChairs(Client, "gothic_stool*4");

                            if (Client.GetRoomUser() != null)
                            {
                                Client.GetRoomUser().Frozen = true;
                            }
                        }
                    }
                }

                lock (RoleplayManager.InvitedUsersToRemove)
                {
                    foreach (GameClient Client in RoleplayManager.InvitedUsersToRemove)
                    {
                        if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoom == null || Client.GetRoleplay() == null)
                        {
                            continue;
                        }

                        RoleplayManager.InvitedUsersToJuryDuty.Remove(Client);
                    }

                    RoleplayManager.InvitedUsersToRemove.Clear();
                }

                if (Defendant != null)
                {
                    Defendant.SendWhisper("Seu julgamento irá começar! Você será enviado para o tribunal em alguns segundos...", 1);
                }

                RoleplayManager.CourtTrialStarted    = true;
                RoleplayManager.CourtTrialIsStarting = false;
                base.EndTimer();
                return;
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Begins death sequence
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.CachedBot == null || base.CachedBot.DRoomUser == null || base.CachedBot.DRoom == null)
                {
                    base.EndTimer();
                    return;
                }

                if (!base.CachedBot.DRoomUser.GetBotRoleplay().Dead)
                {
                    base.EndTimer();
                    return;
                }

                if (base.CachedBot.DRoomUser == null)
                {
                    return;
                }

                if (!base.CachedBot.DRoomUser.Frozen)
                {
                    base.CachedBot.DRoomUser.Frozen = true;
                }

                TimeLeft -= 1000;

                if (TimeLeft > 0)
                {
                    return;
                }

                if (base.CachedBot.DRoomUser.Frozen)
                {
                    base.CachedBot.DRoomUser.Frozen = false;
                }

                base.CachedBot.DRoomUser.Chat("*Recupera a consciência *", true);
                RoleplayManager.SpawnChairs(null, "val14_wchair", base.CachedBot.DRoomUser);

                base.CachedBot.DRoomUser.GetBotRoleplay().Dead = false;

                if (base.CachedBot.DRoom != null)
                {
                    base.CachedBot.DRoom.SendMessage(new UsersComposer(base.CachedBot.DRoomUser));
                }

                if (base.CachedBot.DRoomUser.GetBotRoleplay().RoamBot)
                {
                    base.CachedBot.MoveRandomly();
                }

                base.EndTimer();
                return;
            }
            catch
            {
                base.EndTimer();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Prison timer
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.Client == null || base.Client.GetHabbo() == null || base.Client.GetRoleplay() == null)
                {
                    base.EndTimer();
                    return;
                }

                if (base.Client.GetRoomUser() == null)
                {
                    return;
                }

                if (!base.Client.GetRoleplay().IsJailed)
                {
                    Client.GetRoleplay().UpdateTimerDialogue("Jail-Timer", "remove", Client.GetRoleplay().JailedTimeLeft, OriginalTime);

                    if (base.Client.GetHabbo().CurrentRoomId == Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid")))
                    {
                        RoleplayManager.SpawnChairs(base.Client, "room_wl15_sofa");
                    }

                    if (base.Client.GetHabbo().CurrentRoomId == Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")))
                    {
                        RoleplayManager.SpawnChairs(base.Client, "es_bench");
                    }

                    RoleplayManager.Shout(base.Client, "*Obtém-se liberdade da prisão*", 4);

                    if (base.Client.GetRoleplay().JailedTimeLeft != -5)
                    {
                        base.Client.GetRoleplay().OnProbation       = true;
                        base.Client.GetRoleplay().ProbationTimeLeft = 5;
                        base.Client.GetRoleplay().TimerManager.CreateTimer("probation", 1000, false);
                        base.Client.SendWhisper("Você foi colocado em liberdade condicional " + base.Client.GetRoleplay().ProbationTimeLeft + " minutos!", 1);
                        base.Client.SendWhisper("Se você cometer algum crime durante a liberdade condicional, você será procurado um nível de estrela extra!", 1);
                    }

                    base.Client.GetRoleplay().WantedFor      = "";
                    base.Client.GetRoleplay().Trialled       = false;
                    base.Client.GetRoleplay().Jailbroken     = false;
                    base.Client.GetRoleplay().IsJailed       = false;
                    base.Client.GetRoleplay().JailedTimeLeft = 0;
                    base.EndTimer();
                    return;
                }

                if (base.Client.GetRoleplay().Jailbroken)
                {
                    return;
                }

                TimeCount++;
                TimeLeft -= 1000;

                if (TimeCount == 60)
                {
                    base.Client.GetRoleplay().JailedTimeLeft--;
                }

                if (base.Client.GetRoleplay().Cuffed)
                {
                    base.Client.GetRoleplay().Cuffed = false;
                }

                if (RoleplayManager.WantedList.ContainsKey(base.Client.GetHabbo().Id))
                {
                    Wanted Junk;
                    RoleplayManager.WantedList.TryRemove(base.Client.GetHabbo().Id, out Junk);
                }

                if (base.Client.GetRoleplay().IsWanted || base.Client.GetRoleplay().WantedLevel != 0 || base.Client.GetRoleplay().WantedTimeLeft != 0)
                {
                    base.Client.GetRoleplay().IsWanted       = false;
                    base.Client.GetRoleplay().WantedLevel    = 0;
                    base.Client.GetRoleplay().WantedTimeLeft = 0;
                }

                if (TimeLeft > 0)
                {
                    if (TimeCount == 60)
                    {
                        Client.GetRoleplay().UpdateTimerDialogue("Jail-Timer", "decrement", Client.GetRoleplay().JailedTimeLeft, OriginalTime);
                        base.Client.SendWhisper("Você tem " + base.Client.GetRoleplay().JailedTimeLeft + " minuto(s) até você ser libertado da prisão!", 1);
                        TimeCount = 0;
                    }
                    return;
                }

                if (base.Client.GetRoomUser() != null)
                {
                    if (base.Client.GetHabbo().CurrentRoomId == Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid")))
                    {
                        RoleplayManager.SpawnChairs(base.Client, "room_wl15_sofa");
                    }

                    if (base.Client.GetHabbo().CurrentRoomId == Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")))
                    {
                        RoleplayManager.SpawnChairs(base.Client, "es_bench");
                    }
                }

                base.Client.GetRoleplay().OnProbation       = true;
                base.Client.GetRoleplay().ProbationTimeLeft = 5;
                base.Client.SendWhisper("Você foi colocado em liberdade condicional por " + base.Client.GetRoleplay().ProbationTimeLeft + " minutos!", 1);
                base.Client.SendWhisper("Se você cometer algum crime durante a liberdade condicional, você será procurado um nível de estrela extra!", 1);
                base.Client.GetRoleplay().TimerManager.CreateTimer("probation", 1000, false);

                base.Client.GetRoleplay().WantedFor      = "";
                base.Client.GetRoleplay().Trialled       = false;
                base.Client.GetRoleplay().Jailbroken     = false;
                base.Client.GetRoleplay().IsJailed       = false;
                base.Client.GetRoleplay().JailedTimeLeft = 0;
                Client.GetRoleplay().UpdateTimerDialogue("Jail-Timer", "remove", Client.GetRoleplay().JailedTimeLeft, OriginalTime);
                RoleplayManager.Shout(base.Client, "*Obtém-se liberdade da prisão, por cumprir a sentença*", 4);
                base.EndTimer();
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }