Exemplo n.º 1
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (RoleplayGameManager.RunningGames.ContainsKey(GameMode.SoloQueue))
            {
                if (Session.GetRoleplay().Game != null && Session.GetRoleplay().Game.GetGameMode() == GameMode.SoloQueue)
                {
                    Session.SendWhisper("Você já está no evento SoloQueue!", 1);
                    return;
                }
                else
                {
                    if (RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.SoloQueue), Session, "") != "OK")
                    {
                        return;
                    }

                    if (Session.GetRoleplay().EquippedWeapon != null)
                    {
                        Session.GetRoleplay().EquippedWeapon = null;
                    }

                    if (Session.GetRoleplay().IsWorking)
                    {
                        Session.GetRoleplay().IsWorking = false;
                    }

                    if (Session.GetRoleplay().InsideTaxi)
                    {
                        Session.GetRoleplay().InsideTaxi = false;
                    }
                }
            }
            else
            {
                return;
            }
        }
Exemplo n.º 2
0
        public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
        {
            if (Session == null)
            {
                return;
            }

            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (Item == null || User == null)
            {
                return;
            }

            if (Item.InteractingUser2 != User.UserId)
            {
                Item.InteractingUser2 = User.UserId;
            }

            if (Item.GetBaseItem().InteractionType == InteractionType.ONE_WAY_GATE)
            {
                if (Item.GetBaseItem().ItemName == "one_way_door*2")
                {
                    if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.Brawl))
                    {
                        Session.SendWhisper("Não há nenhum evento de briga no momento!", 1);
                        return;
                    }
                }
                else if (Item.GetBaseItem().ItemName == "one_way_door*5")
                {
                    if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.SoloQueue))
                    {
                        RoleplayGameManager.CreateGame("soloqueue");
                    }
                }
                else if (Item.GetBaseItem().ItemName == "one_way_door*6")
                {
                    if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.SoloQueueGuns))
                    {
                        RoleplayGameManager.CreateGame("soloqueueguns");
                    }
                }

                if (User.Coordinate != Item.SquareInFront && User.CanWalk)
                {
                    User.MoveTo(Item.SquareInFront);
                    return;
                }
                if (!Item.GetRoom().GetGameMap().ValidTile(Item.SquareBehind.X, Item.SquareBehind.Y) || !Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, false) || !Item.GetRoom().GetGameMap().SquareIsOpen(Item.SquareBehind.X, Item.SquareBehind.Y, false))
                {
                    return;
                }

                if ((User.LastInteraction - PlusEnvironment.GetUnixTimestamp() < 0) && User.InteractingGate && User.GateId == Item.Id)
                {
                    User.InteractingGate = false;
                    User.GateId          = 0;
                }

                if (!Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, User.AllowOverride))
                {
                    return;
                }

                if (Item.InteractingUser == 0)
                {
                    #region Brawl
                    if (Item.GetBaseItem().ItemName == "one_way_door*2")
                    {
                        if (RoleplayGameManager.RunningGames.ContainsKey(GameMode.Brawl))
                        {
                            if (Session.GetRoleplay().Game != null && Session.GetRoleplay().Game.GetGameMode() == GameMode.Brawl)
                            {
                                Session.SendWhisper("Você já está no evento Briga!", 1);
                                return;
                            }
                            else
                            {
                                if (Session.GetRoleplay().IsWorking)
                                {
                                    Session.GetRoleplay().IsWorking = false;
                                }

                                if (RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.Brawl), Session, "") != "OK")
                                {
                                    return;
                                }

                                if (Session.GetRoleplay().EquippedWeapon != null)
                                {
                                    Session.GetRoleplay().EquippedWeapon = null;
                                }

                                if (Session.GetRoleplay().InsideTaxi)
                                {
                                    Session.GetRoleplay().InsideTaxi = false;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    #endregion

                    #region SoloQueue
                    else if (Item.GetBaseItem().ItemName == "one_way_door*5")
                    {
                        if (RoleplayGameManager.RunningGames.ContainsKey(GameMode.SoloQueue))
                        {
                            if (Session.GetRoleplay().Game != null && Session.GetRoleplay().Game.GetGameMode() == GameMode.SoloQueue)
                            {
                                Session.SendWhisper("Você já está no Evento SoloQueue!", 1);
                                return;
                            }
                            else if (Session.GetRoleplay().IsWanted)
                            {
                                Session.SendWhisper("Você não pode completar esta ação enquanto você é procurado!", 1);
                                return;
                            }
                            else
                            {
                                if (Session.GetRoleplay().IsWorking)
                                {
                                    Session.GetRoleplay().IsWorking = false;
                                }

                                if (RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.SoloQueue), Session, "") != "OK")
                                {
                                    return;
                                }

                                if (Session.GetRoleplay().EquippedWeapon != null)
                                {
                                    Session.GetRoleplay().EquippedWeapon = null;
                                }

                                if (Session.GetRoleplay().InsideTaxi)
                                {
                                    Session.GetRoleplay().InsideTaxi = false;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    #endregion

                    #region SoloQueue Guns
                    else if (Item.GetBaseItem().ItemName == "one_way_door*6")
                    {
                        if (RoleplayGameManager.RunningGames.ContainsKey(GameMode.SoloQueueGuns))
                        {
                            if (Session.GetRoleplay().Game != null && Session.GetRoleplay().Game == RoleplayGameManager.GetGame(GameMode.SoloQueueGuns))
                            {
                                Session.SendWhisper("Você já está no evento SoloQueue!", 1);
                                return;
                            }
                            else if (Session.GetRoleplay().IsWanted)
                            {
                                Session.SendWhisper("Você não pode completar esta ação enquanto você é procurado!", 1);
                                return;
                            }
                            else
                            {
                                if (Session.GetRoleplay().IsWorking)
                                {
                                    Session.GetRoleplay().IsWorking = false;
                                }

                                if (RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.SoloQueueGuns), Session, "") != "OK")
                                {
                                    return;
                                }

                                if (Session.GetRoleplay().InsideTaxi)
                                {
                                    Session.GetRoleplay().InsideTaxi = false;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    #endregion

                    User.InteractingGate = true;
                    User.GateId          = Item.Id;
                    Item.InteractingUser = User.HabboId;

                    User.CanWalk = false;

                    if (User.IsWalking && (User.GoalX != Item.SquareInFront.X || User.GoalY != Item.SquareInFront.Y))
                    {
                        User.ClearMovement(true);
                    }

                    User.AllowOverride = true;
                    User.MoveTo(Item.Coordinate);

                    Item.RequestUpdate(4, true);
                }
            }
        }
Exemplo n.º 3
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 4 && Params[2].ToLower() != "briga" && Params[2].ToLower() != "bg")
            {
                Session.SendWhisper("Digite o usuário, jogo e equipe (se necessário) que deseja atribuir.", 1);
                return;
            }

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

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

            if (TargetClient.GetRoleplay().Game != null || TargetClient.GetRoleplay().Team != null)
            {
                Session.SendWhisper("Este usuário já está dentro de um evento!", 1);
                return;
            }

            if (TargetClient.GetRoleplay().IsDead)
            {
                Session.SendWhisper("Você não pode colocar esse usuário em um evento enquanto ele está morto!", 1);
                return;
            }

            if (TargetClient.GetRoleplay().IsJailed)
            {
                Session.SendWhisper("Você não pode colocar esse usuário em um evento enquanto ele está preso!", 1);
                return;
            }

            if (TargetClient.GetRoleplay().IsNoob)
            {
                Session.SendWhisper("Você não pode atribuir esse usuário a um evento enquanto ele é novato!", 1);
                return;
            }

            string Game = Params[2].ToString().ToLower();

            List <string> ValidTeams = new List <string>();

            ValidTeams.Add("blue");
            ValidTeams.Add("green");
            ValidTeams.Add("pink");
            ValidTeams.Add("yellow");

            switch (Game)
            {
                #region Brawl

            case "brawl":
            case "br":
            case "briga":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.Brawl))
                {
                    Session.SendWhisper("Não há nenhum evento de Briga atualmente ativo!", 1);
                    break;
                }

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

                if (TargetClient.GetRoleplay().EquippedWeapon != null)
                {
                    TargetClient.GetRoleplay().EquippedWeapon = null;
                }

                RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.Brawl), TargetClient, "", true);
                Session.SendWhisper("Sucesso, você colocou " + TargetClient.GetHabbo().Username + " no evento de Briga!", 1);
                break;
            }

                #endregion

                #region Colour Wars

            case "cw":
            case "color":
            case "colourwars":
            case "colorwars":
            case "gc":
            case "guerradecores":
            case "guerracores":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.ColourWars))
                {
                    Session.SendWhisper("Não há nenhum evento de Guerra de Cores atualmente ativo!", 1);
                    break;
                }

                string Team = Params[3].ToString().ToLower();
                if (Params.Length != 4 || !ValidTeams.Contains(Team))
                {
                    Session.SendWhisper("Você escolheu uma equipe inválida. Aqui estão as equipes disponíveis: " + string.Join(", ", ValidTeams.ToArray()), 1);
                    break;
                }

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

                if (TargetClient.GetRoleplay().EquippedWeapon != null)
                {
                    TargetClient.GetRoleplay().EquippedWeapon = null;
                }

                RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.ColourWars), TargetClient, Team, true);
                Session.SendWhisper("Sucesso, você colocou " + TargetClient.GetHabbo().Username + " no evento Guerra de Cores!", 1);
                break;
            }

                #endregion

                #region Team Brawl

            case "tb":
            case "teambrawl":
            case "tbrawl":
            case "teamb":
            case "brigatimes":
            case "bt":
            case "brigatime":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.TeamBrawl))
                {
                    Session.SendWhisper("Não há um evento Briga de Times atualmente ativo!", 1);
                    break;
                }

                string Team = Params[3].ToString().ToLower();
                if (Params.Length != 4 || !ValidTeams.Contains(Team))
                {
                    Session.SendWhisper("Você escolheu uma equipe inválida. Aqui estão as equipes disponíveis: " + string.Join(", ", ValidTeams.ToArray()), 1);
                    break;
                }

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

                if (TargetClient.GetRoleplay().EquippedWeapon != null)
                {
                    TargetClient.GetRoleplay().EquippedWeapon = null;
                }

                RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.TeamBrawl), TargetClient, Team, true);
                Session.SendWhisper("Sucesso, você colocou " + TargetClient.GetHabbo().Username + " no evento Briga de Times!", 1);
                break;
            }

                #endregion

                #region Mafia Wars

            case "mw":
            case "mafia":
            case "mariawars":
            case "gm":
            case "guerramafia":
            case "guerrademafias":
            case "guerramafias":
            {
                if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.MafiaWars))
                {
                    Session.SendWhisper("Não há um evento Guerra de Máfias atualmente ativo!", 1);
                    break;
                }

                string Team = Params[3].ToString().ToLower();
                if (Params.Length != 4 || !ValidTeams.Contains(Team))
                {
                    Session.SendWhisper("Você escolheu uma equipe inválida. Aqui estão as equipes disponíveis: " + string.Join(", ", ValidTeams.ToArray()), 1);
                    break;
                }

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

                if (TargetClient.GetRoleplay().EquippedWeapon != null)
                {
                    TargetClient.GetRoleplay().EquippedWeapon = null;
                }

                RoleplayGameManager.AddPlayerToGame(RoleplayGameManager.GetGame(GameMode.MafiaWars), TargetClient, Team, true);
                Session.SendWhisper("Sucesso, você colocou " + TargetClient.GetHabbo().Username + " no evento Guerra de Máfias!", 1);
                break;
            }

                #endregion

            default:
            {
                Session.SendWhisper("O jogo que você escolheu não existe. Aqui estão os eventos disponíveis: briga, guerradecores/gc, brigadetimes/bt, guerrademafias/gm.", 1);
                break;
            }
            }
        }