コード例 #1
0
ファイル: TexasHoldEm.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Removes old bet furni and spawns new bet furni
        /// </summary>
        public void SpawnStartingBet(int Number)
        {
            try
            {
                Room Room = RoleplayManager.GenerateRoom(this.RoomId);

                if (Room == null)
                {
                    return;
                }

                TexasHoldEmPlayer Player = this.PlayerList[Number];

                if (Player == null || Player.UserId == 0)
                {
                    return;
                }

                GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player.UserId);

                if (Client == null || Client.GetRoleplay() == null || Client.GetHabbo() == null)
                {
                    return;
                }

                RemoveBetFurni(Number);
                SpawnBetFurni(Number, Player.TotalAmount);
            }
            catch (Exception e)
            {
                Logging.LogRPGamesError("Error in SpawnStartingBet() void: " + e);
            }
        }
コード例 #2
0
ファイル: GangTurfsCommand.cs プロジェクト: xjoao97/HabboRP
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            StringBuilder Message = new StringBuilder().Append("<----- Territórios de Gangue ----->\n\n");

            if (TurfManager.TurfList.Count == 0)
            {
                Message.Append("Não há territórios de gangues disponíveis!\n");
            }

            lock (TurfManager.TurfList)
            {
                foreach (Turf Turf in TurfManager.TurfList.Values)
                {
                    if (Turf == null)
                    {
                        continue;
                    }

                    Room         TurfRoom = RoleplayManager.GenerateRoom(Turf.RoomId, false);
                    Groups.Group Gang     = Groups.GroupManager.GetGang(Turf.GangId);

                    if (TurfRoom != null)
                    {
                        Message.Append(TurfRoom.Name + " [Quarto ID: " + Turf.RoomId + "] --- Controlado por: " + Gang.Name + "\n");
                        Message.Append("----------\n");
                    }
                }
            }

            Session.SendMessage(new MOTDNotificationComposer(Message.ToString()));
        }
コード例 #3
0
ファイル: TexasHoldEm.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Removes all bet furni from the pot square
        /// </summary>
        public void RemovePotFurni()
        {
            try
            {
                Room Room = RoleplayManager.GenerateRoom(this.RoomId);

                if (Room == null || Room.GetRoomItemHandler() == null || Room.GetGameMap() == null)
                {
                    return;
                }

                int X = PotSquare.X;
                int Y = PotSquare.Y;

                List <Item> Items = Room.GetGameMap().GetRoomItemForSquare(X, Y).Where(x => x.GetBaseItem().ItemName.ToLower().Contains("cfc")).ToList();

                if (Items.Count <= 0)
                {
                    return;
                }

                lock (Items)
                {
                    foreach (Item Item in Items)
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id);
                    }
                }
            }
            catch (Exception e)
            {
                Logging.LogRPGamesError("Error in RemovePotFurni() void: " + e);
            }
        }
コード例 #4
0
        /// <summary>
        /// Creates a game based on the string gameMode
        /// </summary>
        /// <param name="gameMode"></param>
        /// <returns></returns>
        public static IGame CreateGame(string gameMode)
        {
            GameMode mode = GameList.GetGameModeType(gameMode);
            IGame    game = GetNewGame(mode);

            if (game == null || RunningGames.ContainsKey(mode))
            {
                return(null);
            }

            string EventData = RoleplayData.GetData("eventslobby", gameMode);

            if (EventData != null)
            {
                int EventsLobby = Convert.ToInt32(EventData);
                var EventsRoom  = RoleplayManager.GenerateRoom(EventsLobby);

                if (EventsRoom != null)
                {
                    EventsRoom.RoleplayEvent          = game;
                    EventsRoom.RoomData.RoleplayEvent = EventsRoom.RoleplayEvent;
                    PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(EventsRoom);
                }
            }

            RunningGames.Add(mode, game);

            if (GameTick == null || GameTick.ThreadState != ThreadState.Running)
            {
                GameTick = new Thread(TickGames);
                GameTick.Start();
            }

            return(game);
        }
コード例 #5
0
ファイル: RoleplayBot.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Gets the linked teleport for a target teleport
        /// </summary>
        /// <param name="EnteringTeleport"></param>
        /// <returns></returns>
        public Item GetLinkedTeleport(Item EnteringTeleport)
        {
            int LinkedTele = ItemTeleporterFinder.GetLinkedTele(EnteringTeleport.Id, this.DRoom);
            int TeleRoomId = ItemTeleporterFinder.GetTeleRoomId(LinkedTele, this.DRoom);

            if (TeleRoomId <= 0)
            {
                return(null);
            }

            Room NewRoom = RoleplayManager.GenerateRoom(TeleRoomId);

            if (NewRoom == null)
            {
                return(null);
            }
            if (NewRoom.GetRoomItemHandler() == null)
            {
                return(null);
            }

            Item Teleport = NewRoom.GetRoomItemHandler().GetItem(LinkedTele);

            return(Teleport);
        }
コード例 #6
0
ファイル: TexasHoldEm.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Sends a whisper to all players in the room
        /// </summary>
        public void SendWinnerMessage(string Message)
        {
            try
            {
                Room Room = RoleplayManager.GenerateRoom(this.RoomId);

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

                            User.GetClient().SendWhisper(Message, 38);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logging.LogRPGamesError("Error in SendStartMessage() void: " + e);
            }
        }
コード例 #7
0
ファイル: Gun.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Gets the damage
        /// </summary>
        private int GetDamage(GameClient Client, GameClient TargetClient)
        {
            CryptoRandom Randomizer = new CryptoRandom();
            Weapon       Weapon     = Client.GetRoleplay().EquippedWeapon;

            int MinDamage = Weapon.MinDamage;
            int MaxDamage = Weapon.MaxDamage;

            int Damage = Randomizer.Next(MinDamage, MaxDamage);

            if (Client.GetRoleplay().Class.ToLower() == "gunner")
            {
                Damage += Randomizer.Next(1, 3);
            }

            if (Client.GetRoleplay().GangId > 1000)
            {
                if (GroupManager.HasGangCommand(Client, "gunner"))
                {
                    if (RoleplayManager.GenerateRoom(Client.GetHabbo().CurrentRoomId, false).TurfEnabled || GroupManager.HasJobCommand(TargetClient, "guide"))
                    {
                        Damage += Randomizer.Next(0, 2);
                    }
                }
            }

            return(Damage);
        }
コード例 #8
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            UInt32 RoomId = 0;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Opa, você esqueceu de inserir um ID do quarto!", 1);
                return;
            }

            if (!UInt32.TryParse(Params[1].ToString(), out RoomId))
            {
                Session.SendWhisper("Por favor insira um número válido.", 1);
                return;
            }

            Room TargetRoom = RoleplayManager.GenerateRoom(Convert.ToInt32(RoomId));

            if (Session.GetRoleplay().IsDead)
            {
                Session.SendWhisper("Você não pode taxi enquanto está morto!", 1);
                return;
            }

            if (Session.GetRoleplay().IsJailed)
            {
                Session.SendWhisper("Você não pode usar táxi enquanto está preso!!", 1);
                return;
            }

            if (RoomId == Session.GetHabbo().CurrentRoomId)
            {
                Session.SendWhisper("Você já está nesta sala!", 1);
                return;
            }

            if (TargetRoom == null)
            {
                Session.SendWhisper("[RPG TAXI] Desculpe, não conseguimos encontrar esse quarto!", 1);
                return;
            }

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

            if (!Session.GetHabbo().Username.Contains("Ying"))
            {
                Session.Shout("*Pega o Taxi Administrativo e vai imediatamente para o local*", 23);
            }


            RoleplayManager.SendUser(Session, (int)RoomId);
        }
コード例 #9
0
ファイル: RepairTimer.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Fence Repair timer
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.Client == null || base.Client.GetHabbo() == null || base.Client.GetRoleplay() == null || base.Client.GetRoomUser() == null || base.Client.GetRoomUser().GetRoom() == null || !JailbreakManager.FenceBroken)
                {
                    base.EndTimer();
                    return;
                }

                int  ItemId = (int)Params[0];
                Item BTile  = base.Client.GetRoomUser().GetRoom().GetRoomItemHandler().GetItem(ItemId);
                Room Room   = RoleplayManager.GenerateRoom(base.Client.GetHabbo().CurrentRoomId);

                if (Room == null)
                {
                    return;
                }

                if (BTile == null || BTile.Coordinate != base.Client.GetRoomUser().Coordinate || Room.RoomId != Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")))
                {
                    if (base.Client.GetRoomUser().CurrentEffect == EffectsList.SunnyD)
                    {
                        base.Client.GetRoomUser().ApplyEffect(EffectsList.None);
                    }

                    RoleplayManager.Shout(base.Client, "*Para de reparar a cerca*", 4);
                    base.EndTimer();
                    return;
                }

                TimeLeft -= 1000;

                if (TimeLeft > 0)
                {
                    return;
                }

                if (base.Client.GetRoomUser().CurrentEffect == EffectsList.SunnyD)
                {
                    base.Client.GetRoomUser().ApplyEffect(EffectsList.None);
                }

                RoleplayManager.Shout(base.Client, "*Repara com sucesso a cerca*", 4);
                JailbreakManager.FenceBroken = false;
                JailbreakManager.GenerateFence(Room);
                base.EndTimer();
                return;
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }
コード例 #10
0
ファイル: TexasHoldEmItem.cs プロジェクト: xjoao97/HabboRP
 public void SpawnDice()
 {
     try
     {
         Room Room = RoleplayManager.GenerateRoom(this.RoomId);
         this.Furni = RoleplayManager.PlaceItemToRoom(null, this.ItemId, 0, this.X, this.Y, this.Z, this.Rotation, false, this.RoomId, false, "0", false, "", null, null, this);
     }
     catch (Exception e)
     {
         Logging.LogRPGamesError("Error in SpawnDice() void: " + e);
     }
 }
コード例 #11
0
        public void messageCunts(string message)
        {
            Room FuckingRoom = RoleplayManager.GenerateRoom(ColourManager.GameLobby);

            lock (FuckingRoom.GetRoomUserManager().GetRoomUsers())
            {
                foreach (RoomUser User in FuckingRoom.GetRoomUserManager().GetRoomUsers())
                {
                    GameClient me = User.GetClient();
                    me.SendWhisper(message);
                }
            }
        }
コード例 #12
0
ファイル: RoleplayBot.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Handles teleporting
        /// </summary>
        /// <param name="Self">Bot's roomuser instance</param>
        /// <param name="Room">Bot's room</param>
        public void HandleTeleporting(RoomUser Self, Room Room)
        {
            if (Self == null || Room == null)
            {
                return;
            }

            RoleplayBot Bot = Self.GetBotRoleplay();

            if (!Bot.Teleported)
            {
                if (Bot.TeleporterEntering == null)
                {
                    Bot.Teleporting = false;
                    return;
                }

                if (Self.Coordinate == Bot.TeleporterEntering.Coordinate)
                {
                    // Lets teleport the bot!
                    Self.GetBotRoleplayAI().GetRoom().SendMessage(new UserRemoveComposer(Self.VirtualId));
                    Bot.Teleported   = true;
                    Bot.X            = Bot.TeleporterExiting.GetX;
                    Bot.Y            = Bot.TeleporterExiting.GetY;
                    Bot.SpawnId      = Bot.TeleporterExiting.RoomId;
                    Bot.LastTeleport = Bot.TeleporterExiting;
                    Room TeleRoom = RoleplayManager.GenerateRoom(Bot.TeleporterExiting.RoomId);
                    RoleplayBotManager.TransportDeployedBot(Self, TeleRoom.Id, true);

                    if (Bot != null && Bot.TimerManager != null && Bot.TimerManager.ActiveTimers != null && Bot.TimerManager.ActiveTimers.ContainsKey("teleport"))
                    {
                        Bot.TimerManager.ActiveTimers["teleport"].EndTimer();

                        if (Bot.UserAttacking != null && Bot.UserAttacking.GetHabbo() != null)
                        {
                            Bot.TimerManager.CreateTimer("attack", this, 10, true, Bot.UserAttacking.GetHabbo().Id);
                        }
                        else
                        {
                            Bot.MoveRandomly();
                        }
                    }
                }
                else
                {
                    // Lets make the bot walk to the teleport!
                    Self.MoveTo(Bot.TeleporterEntering.GetX, Bot.TeleporterEntering.GetY);
                }
            }
            return;
        }
コード例 #13
0
        /// <summary>
        /// Sends out a hotel alert based on the gamemode
        /// </summary>
        /// <param name="Mode"></param>
        public static void EventAlert(IGame Game)
        {
            int GameRoom;

            if (int.TryParse(RoleplayData.GetData("eventslobby", Game.GetName().Replace(" ", "").ToLower()), out GameRoom))
            {
                var Room = RoleplayManager.GenerateRoom(GameRoom);

                if (Room != null)
                {
                    PlusEnvironment.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer(null, "event", "", 0, Game.GetGameMode(), Room));
                }
            }
        }
コード例 #14
0
ファイル: TexasHoldEm.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Removes all the players bet furni in the spawn point
        /// </summary>
        /// <param name="Number"></param>
        public void RemoveBetFurni(int Number)
        {
            try
            {
                Room Room = RoleplayManager.GenerateRoom(this.RoomId);

                if (Room == null || Room.GetRoomItemHandler() == null || Room.GetGameMap() == null)
                {
                    return;
                }

                string[] Data;
                if (Number == 1)
                {
                    Data = this.Player1Data;
                }
                else if (Number == 2)
                {
                    Data = this.Player2Data;
                }
                else
                {
                    Data = this.Player3Data;
                }

                int X = Convert.ToInt32(Data[2]);
                int Y = Convert.ToInt32(Data[3]);

                List <Item> Items = Room.GetGameMap().GetRoomItemForSquare(X, Y).Where(x => x.GetBaseItem().ItemName.ToLower().Contains("cfc")).ToList();

                if (Items.Count <= 0)
                {
                    return;
                }

                lock (Items)
                {
                    foreach (Item Item in Items)
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id);
                    }
                }
            }
            catch (Exception e)
            {
                Logging.LogRPGamesError("Error in RemoveBetFurni() void: " + e);
            }
        }
コード例 #15
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;
                }

                TimeLeft -= 1000;

                if (TimeLeft > 0)
                {
                    return;
                }

                base.CachedBot.DRoomUser.Chat("*Libertado da prisão*", true);
                base.CachedBot.DRoomUser.GetBotRoleplay().Jailed = false;

                Room RandRoom = RoleplayManager.GenerateRoom(1);
                RoleplayBotManager.TransportDeployedBot(CachedBot.DRoomUser, RandRoom.Id, false);

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

                base.EndTimer();
                return;
            }
            catch
            {
                base.EndTimer();
            }
        }
コード例 #16
0
        /// <summary>
        /// Gets the damage
        /// </summary>
        private int GetDamage(GameClient Client, GameClient TargetClient, RoleplayBot Bot = null)
        {
            CryptoRandom Randomizer = new CryptoRandom();

            if (Client.GetRoleplay().Game != null && Client.GetRoleplay().Game.GetGameMode() == GameMode.ColourWars)
            {
                return(Randomizer.Next(5, 13));
            }

            int Strength  = Client.GetRoleplay().Strength;
            int MinDamage = (Strength - 6) <= 0 ? 5 : (Strength - 6);
            int MaxDamage = Strength + 6;

            // Lucky shot?
            if (Randomizer.Next(0, 100) < 12)
            {
                MinDamage = Strength + 12;
                MaxDamage = MinDamage + 3;
            }

            int Damage = Randomizer.Next(MinDamage, MaxDamage);

            if (Client.GetRoleplay().Class.ToLower() == "fighter")
            {
                Damage += Randomizer.Next(2, 4);
            }

            if (Client.GetRoleplay().GangId > 1000 && Bot == null)
            {
                if (GroupManager.HasGangCommand(Client, "fighter"))
                {
                    if (RoleplayManager.GenerateRoom(Client.GetHabbo().CurrentRoomId, false).TurfEnabled || GroupManager.HasJobCommand(TargetClient, "guide"))
                    {
                        Damage += Randomizer.Next(1, 3);
                    }
                }
            }

            if (Client.GetRoleplay().HighOffWeed)
            {
                Damage += Randomizer.Next(1, 3);
            }

            return(Damage);
        }
コード例 #17
0
ファイル: RoleplayBot.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Initiates the bots death
        /// </summary>
        public void InitiateDeath()
        {
            this.Dead          = true;
            this.UserAttacking = null;
            this.TimerManager.EndAllTimers();
            this.CurHealth = this.MaxHealth;

            RoomUser Bot = RoleplayBotManager.GetDeployedBotById(this.Id);

            if (Bot == null)
            {
                return;
            }

            int  HospitalRoomId = Convert.ToInt32(RoleplayData.GetData("hospital", "roomid2"));
            Room Hospital       = RoleplayManager.GenerateRoom(HospitalRoomId);

            RoleplayBotManager.TransportDeployedBot(Bot, HospitalRoomId, true);
            this.TimerManager.CreateTimer("botdeath", this, 1000, true);
        }
コード例 #18
0
        public void SpawnSign()
        {
            Room Room = RoleplayManager.GenerateRoom(this.RoomId, false);

            if (Room != null && this.Item != null)
            {
                if (Room.GetRoomItemHandler().GetFloor.Where(x => x.Id == this.Item.Id).ToList().Count > 0)
                {
                    foreach (Item Item in Room.GetRoomItemHandler().GetFloor.Where(x => x.Id == this.Item.Id).ToList())
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id);
                    }
                }
            }

            if (Room != null)
            {
                this.Item    = RoleplayManager.PlaceItemToRoom(null, this.ItemId, 0, this.X, this.Y, this.Z, 0, false, this.RoomId, false, "0", false, "", null, this);
                this.Spawned = true;
            }
        }
コード例 #19
0
ファイル: TeleportHandler.cs プロジェクト: xjoao97/HabboRP
        private void UseTeleport()
        {
            RoomUser BotUserInstance = this.InteractingBot.DRoomUser;


            this.InteractingBot.X        = this.LeavingTeleport.GetX;
            this.InteractingBot.Y        = this.LeavingTeleport.GetY;
            this.InteractingBot.Z        = this.LeavingTeleport.GetZ;
            this.InteractingBot.SpawnRot = this.LeavingTeleport.Rotation;

            this.InteractingBot.DRoomUser.ClearMovement(true);

            this.InteractingBot.SpawnId      = this.LeavingTeleport.RoomId;
            this.InteractingBot.LastTeleport = this.LeavingTeleport;

            Room TeleRoom = RoleplayManager.GenerateRoom(this.LeavingTeleport.RoomId);

            RoleplayBotManager.TransportDeployedBot(BotUserInstance, TeleRoom.Id, true);

            this.UsedTeleport = true;
        }
コード例 #20
0
        public static bool TransportDeployedBot(RoomUser RoleplayBot, int NewRoomID, bool SaveDataToCache = true)
        {
            if (RoleplayBot == null)
            {
                return(false);
            }
            if (RoleplayBot.GetBotRoleplay() == null)
            {
                return(false);
            }

            int BotsID = RoleplayBot.GetBotRoleplay().Id;

            try
            {
                Room NewRoom;
                if (RoleplayManager.GenerateRoom(NewRoomID, false) == null)
                {
                    return(false);
                }
                else
                {
                    NewRoom = RoleplayManager.GenerateRoom(NewRoomID, false);
                }


                RoleplayBotManager.EjectDeployedBot(RoleplayBot, RoleplayBot.GetRoom(), SaveDataToCache);
                RoleplayBotManager.DeployBotByID(BotsID, "default", NewRoom.Id);


                //Console.WriteLine("Transfered bot " + RoleplayBotManager.GetDeployedBotById(BotsID).GetBotRoleplay().Name + " to [" + NewRoom.Id + "] " + NewRoom.Name);
                return(true);
            }
            catch (Exception ex)
            {
                RoleplayBotManager.OnError(ex.Message);
                return(false);
            }
        }
コード例 #21
0
ファイル: CorpListCommand.cs プロジェクト: xjoao97/HabboRP
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            lock (GroupManager.Jobs)
            {
                List <Group> CorpList = GroupManager.Jobs.Values.Where(x => x.Id > 1).ToList();

                StringBuilder Message = new StringBuilder();
                Message.Append("<---------- Empresas Disponíveis ---------->\n\n");

                foreach (Group Corp in CorpList)
                {
                    Room CorpRoom = RoleplayManager.GenerateRoom(Corp.RoomId);

                    Message.Append("<----- " + Corp.Name + " [ID: " + Corp.Id + "] ----->\n");
                    Message.Append("Descrição: " + Corp.Description + "\n");

                    if (CorpRoom != null)
                    {
                        Message.Append("Quarto(s) principal: " + CorpRoom.Name + " [Quarto ID: " + CorpRoom.RoomId + "]\n");
                    }
                    else
                    {
                        Message.Append("Quarto(s) principal: Desconhecido [Quarto ID: N/A]\n");
                    }

                    if (Corp.Members.Values.Where(x => x.UserRank == 6).ToList().Count > 0)
                    {
                        Message.Append("Gerenciado por: " + ((PlusEnvironment.GetHabboById(Corp.Members.Values.FirstOrDefault(x => x.UserRank == 6).UserId) != null) ? PlusEnvironment.GetHabboById(Corp.Members.Values.FirstOrDefault(x => x.UserRank == 6).UserId).Username : "******") + "\n\n");
                    }
                    else
                    {
                        Message.Append("Gerenciado por: HabboRPG\n\n");
                    }
                }

                Session.SendMessage(new MOTDNotificationComposer(Message.ToString()));
            }
        }
コード例 #22
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
        }
コード例 #23
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Opa, você esqueceu de entrar em um comando!", 1);
                return;
            }

            string Command = Convert.ToString(Params[1]);

            switch (Command)
            {
                #region follow
            case "follow":
            case "followme":
            case "mesiga":
            {
                RoomUser Target = null;

                foreach (RoomUser Bot in Room.GetRoomUserManager()._bots.Values)
                {
                    if (!Bot.IsRoleplayBot)
                    {
                        continue;
                    }

                    Target = Bot;
                }

                if (Target == null)
                {
                    Session.SendWhisper("Nenhum BOT para interagir foi encontrado, desculpe!");
                    return;
                }

                Target.GetBotRoleplay().UserFollowing = Session;
                Target.GetBotRoleplay().Following     = true;

                Session.Shout("*Avisa " + Target.GetBotRoleplay().Name + " para me seguir");

                return;
            }
            break;
                #endregion

                #region attack
            case "attack":
            case "attackme":
            case "fight":
            case "fightme":
            case "atacar":
            {
                RoomUser Target = null;

                foreach (RoomUser Bot in Room.GetRoomUserManager()._bots.Values)
                {
                    if (!Bot.IsRoleplayBot)
                    {
                        continue;
                    }

                    Target = Bot;
                }

                if (Target == null)
                {
                    Session.SendWhisper("Nenhum BOT para interagir foi encontrado, desculpe!");
                    return;
                }

                Target.GetBotRoleplay().UserAttacking = Session;
                Target.GetBotRoleplay().Roaming       = false;
                Target.GetBotRoleplay().Attacking     = true;

                Session.Shout("*Avisa " + Target.GetBotRoleplay().Name + " para me atacar");

                return;
            }
            break;
                #endregion

                #region tele
            case "randomtele":
            case "tele":
            {
                RoomUser Target   = null;
                Item     Randtele = null;
                foreach (RoomUser Bot in Room.GetRoomUserManager()._bots.Values)
                {
                    if (!Bot.IsRoleplayBot)
                    {
                        continue;
                    }

                    Target = Bot;
                }

                if (Target == null)
                {
                    Session.SendWhisper("Nenhum BOT para interagir foi encontrado, desculpe!");
                    return;
                }

                foreach (Item Item in Room.GetRoomItemHandler().GetFloor.ToList())
                {
                    if (Item == null || Item.GetBaseItem() == null)
                    {
                        continue;
                    }

                    if (Item.GetBaseItem().InteractionType != InteractionType.ARROW)
                    {
                        continue;
                    }

                    Randtele = Item;
                }

                if (Randtele == null)
                {
                    Session.SendWhisper("Não foi encontrado TELEPORTE para interagir, desculpe!");
                    return;
                }


                Target.GetBotRoleplay().TeleporterEntering = Randtele;
                int LinkedTele = ItemTeleporterFinder.GetLinkedTele(Target.GetBotRoleplay().TeleporterEntering.Id, Room);
                int TeleRoomId = ItemTeleporterFinder.GetTeleRoomId(LinkedTele, Room);

                Room NewRoom = RoleplayManager.GenerateRoom(TeleRoomId);

                Target.GetBotRoleplay().TeleporterExiting = NewRoom.GetRoomItemHandler().GetItem(LinkedTele);
                Target.GetBotRoleplay().Teleporting       = true;

                Session.Shout("*Avisa " + Target.GetBotRoleplay().Name + " para pisar na seta*");

                return;
            }
            break;
                #endregion
            }
        }
コード例 #24
0
ファイル: BreakdownTimer.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Nuke process
        /// </summary>
        public override void Execute()
        {
            try
            {
                GameClient Nuker = (GameClient)Params[0];

                if (Nuker == null || Nuker.LoggingOut || Nuker.GetHabbo() == null || Nuker.GetRoleplay() == null || Nuker.GetRoleplay().IsDead || Nuker.GetRoleplay().IsJailed)
                {
                    base.EndTimer();
                    return;
                }

                Room Room = RoleplayManager.GenerateRoom(Nuker.GetHabbo().CurrentRoomId);

                if (Room == null)
                {
                    return;
                }

                List <Item> Items = Room.GetGameMap().GetRoomItemForSquare(Nuker.GetRoomUser().Coordinate.X, Nuker.GetRoomUser().Coordinate.Y);

                if (Items.Count < 1)
                {
                    RoleplayManager.Shout(Nuker, "*Para o processo de demolir a cidade*", 4);
                    base.EndTimer();
                    return;
                }

                bool HasCaptureTile = Items.ToList().Where(x => x.GetBaseItem().ItemName == "actionpoint01").ToList().Count() > 0;

                if (!HasCaptureTile)
                {
                    RoleplayManager.Shout(Nuker, "*Para o processo de demolir a cidade*", 4);
                    base.EndTimer();
                    return;
                }

                TimeCount++;
                TimeLeft -= 1000;

                if (TimeLeft > 0)
                {
                    if (TimeCount == 60)
                    {
                        RoleplayManager.Shout(Nuker, "*Chega mais perto de completar o processo de demolir a cidade [" + (TimeLeft / 60000) + " minutos restantes]*", 4);
                        TimeCount = 0;
                    }
                    return;
                }

                // TODO: Execute the event after the timer is finished.

                base.EndTimer();
                return;
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }
コード例 #25
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();

            if (GroupId <= 1000)
            {
                Session.SendNotification("Você não pode excluir uma Empresa!");
                return;
            }

            Group Group = GroupManager.GetGang(GroupId);

            if (Group == null)
            {
                Session.SendNotification("Opa, não conseguimos encontrar esta gangue!");
                return;
            }

            if (Group.CreatorId != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager")) //Maybe a FUSE check for staff override?
            {
                Session.SendNotification("Opa, apenas o proprietário pode excluir a empresa!");
                return;
            }

            if (Group.Members.Count >= PlusStaticGameSettings.GroupMemberDeletionLimit)
            {
                Session.SendNotification("Opa, sua empresa excedeu o valor máximo de empregados (" + PlusStaticGameSettings.GroupMemberDeletionLimit + "). Procure assistência de um membro da equipe.");
                return;
            }

            Room Room = RoleplayManager.GenerateRoom(Group.RoomId);

            if (Room != null)
            {
                Room.Group          = null;
                Room.RoomData.Group = null;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `rp_stats` SET `gang_id` = '1000', `gang_rank` = '1', `gang_request` = '0' WHERE `gang_id` = '" + Group.Id + "'");
                dbClient.RunQuery("UPDATE `rooms` SET `group_id` = '0' WHERE `group_id` = '" + Group.Id + "' LIMIT 1");
                dbClient.RunQuery("DELETE FROM `rp_gangs` WHERE `id` = '" + Group.Id + "' LIMIT 1");
                dbClient.RunQuery("DELETE FROM `items_groups` WHERE `group_id` = '" + Group.Id + "'");
            }

            foreach (int Member in Group.Members.Keys)
            {
                GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Member);
                if (Client != null)
                {
                    Client.GetRoleplay().GangId      = 1000;
                    Client.GetRoleplay().GangRank    = 1;
                    Client.GetRoleplay().GangRequest = 0;

                    Group NoGang = GroupManager.GetGang(1000);
                    NoGang.AddNewMember(Client.GetHabbo().Id);

                    UserCache Junk = null;
                    PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(Member, out Junk);
                    PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Member);
                    NoGang.SendPackets(Client);
                }
            }

            foreach (var turf in TurfManager.TurfList.Values)
            {
                if (turf.GangId != Group.Id)
                {
                    continue;
                }

                turf.UpdateTurf(1000);
            }

            PlusEnvironment.GetGame().GetGroupManager().DeleteGroup(Group.Id);
            Session.SendNotification("Você deletou com sucesso o seu grupo!");
            return;
        }
コード例 #26
0
ファイル: JailbreakTimer.cs プロジェクト: xjoao97/HabboRP
        /// <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();
            }
        }
コード例 #27
0
ファイル: OnDisconnect.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Responds to the event
        /// </summary>
        public void Execute(object Source, object[] Params)
        {
            GameClient Client = (GameClient)Source;

            if (Client == null)
            {
                return;
            }

            if (Client.GetRoleplay() == null)
            {
                return;
            }

            if (Client.GetHabbo() == null)
            {
                return;
            }

            if (Client.GetHabbo()._disconnected)
            {
                return;
            }

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

            if (RoleplayManager.InvitedUsersToJuryDuty.Contains(Client))
            {
                RoleplayManager.InvitedUsersToJuryDuty.Remove(Client);
            }

            if (Client.GetRoleplay().TexasHoldEmPlayer > 0)
            {
                var Game = TexasHoldEmManager.GetGameForUser(Client.GetHabbo().Id);

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

            Client.GetRoleplay().CloseInteractingUserDialogues();

            var GuideManager = PlusEnvironment.GetGame().GetGuideManager();

            if (GuideManager != null && Client != null)
            {
                if (GuideManager.AllPolice.Contains(Client))
                {
                    GuideManager.AllPolice.Remove(Client);
                }
                if (GuideManager.GuardiansOnDuty.Contains(Client))
                {
                    GuideManager.GuardiansOnDuty.Remove(Client);
                }
                if (GuideManager.GuidesOnDuty.Contains(Client))
                {
                    GuideManager.GuidesOnDuty.Remove(Client);
                }
                if (GuideManager.HelpersOnDuty.Contains(Client))
                {
                    GuideManager.HelpersOnDuty.Remove(Client);
                }

                #region End Existing Calls
                if (Client.GetRoleplay() != null && Client.GetRoleplay().GuideOtherUser != null)
                {
                    Client.GetRoleplay().GuideOtherUser.SendMessage(new OnGuideSessionDetachedComposer(0));
                    Client.GetRoleplay().GuideOtherUser.SendMessage(new OnGuideSessionDetachedComposer(1));
                    if (Client.GetRoleplay().GuideOtherUser.GetRoleplay() != null)
                    {
                        Client.GetRoleplay().GuideOtherUser.GetRoleplay().Sent911Call = false;
                        Client.GetRoleplay().GuideOtherUser.GetRoleplay().GuideOtherUser = null;
                    }

                    Client.GetRoleplay().GuideOtherUser = null;
                    Client.SendMessage(new OnGuideSessionDetachedComposer(0));
                    Client.SendMessage(new OnGuideSessionDetachedComposer(1));
                }
                #endregion
            }

            if (RoleplayData.GetData("farming", "room") != null)
            {
                int RoomId = Convert.ToInt32(RoleplayData.GetData("farming", "room"));
                var Room   = RoleplayManager.GenerateRoom(RoomId);

                if (Room != null && Room.GetRoomItemHandler() != null && Room.GetRoomItemHandler().GetFloor != null)
                {
                    List <Item> Items = Room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == InteractionType.FARMING && x.FarmingData != null && x.FarmingData.OwnerId == Client.GetHabbo().Id).ToList();

                    foreach (Item Item in Items)
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id);
                    }
                }
            }

            Client.GetRoleplay().EndCycle();

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

            Logging.WriteLine(Client.GetHabbo().Username + " has logged out!", ConsoleColor.DarkGray);
        }
コード例 #28
0
ファイル: JuryTimer.cs プロジェクト: xjoao97/HabboRP
        /// <summary>
        /// Begins chasing the client
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.CachedBot == null || base.CachedBot.DRoomUser == null || base.CachedBot.DRoom == null)
                {
                    SpawnJuryUsersOut(false);
                    Thread.Sleep(200);

                    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;
                }

                GameClient Client      = RoleplayManager.Defendant;
                int        CourtRoomId = Convert.ToInt32(RoleplayData.GetData("court", "roomid"));
                Room       Room        = RoleplayManager.GenerateRoom(CourtRoomId);

                if (Client == null || Client.LoggingOut || Client.GetHabbo() == null || Client.GetRoleplay() == null)
                {
                    SpawnJuryUsersOut(false);

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

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

                    if (base.CachedBot != null)
                    {
                        if (base.CachedBot.DRoomUser != null)
                        {
                            base.CachedBot.DRoomUser.Chat("Olá, como o réu saiu, o processo judicial foi suspenso. Desculpas por qualquer inconveniente!", false, 2);
                        }
                    }
                    base.EndTimer();
                    return;
                }

                RoleplayManager.CourtJuryTime++;

                if (RoleplayManager.CourtJuryTime < 151)
                {
                    if (RoleplayManager.CourtJuryTime == 2)
                    {
                        RoleplayManager.SendUser(Client, CourtRoomId, "");
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 5)
                    {
                        base.CachedBot.DRoomUser.Chat("Bom dia senhoras e senhores, agora irá começar o julgamento da Polícia do HabboRPG contra o(a) " + Client.GetHabbo().Username + ", seja honesto.", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 10)
                    {
                        if (Client.GetRoleplay().WantedFor != "")
                        {
                            base.CachedBot.DRoomUser.Chat("Esta pessoa é acusada de " + Client.GetRoleplay().WantedFor.TrimEnd(',', ' ') + ".", false, 2);
                        }
                        else
                        {
                            base.CachedBot.DRoomUser.Chat("Infelizmente, não recebi receber o relatório das acusações para o julgamento deste tribunal, então o juiz ouvirá sua explicação " + Client.GetHabbo().Username + "!", false, 2);
                        }
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 18)
                    {
                        base.CachedBot.DRoomUser.Chat("Apenas um lembrete. A Polícia do HabboRPG afirma que o Réu é culpado dos crimes, vamos prosseguir.", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 26)
                    {
                        base.CachedBot.DRoomUser.Chat(Client.GetHabbo().Username + ", explique para mim e para os juris, o que realmente aconteceu?", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 75)
                    {
                        base.CachedBot.DRoomUser.Chat("Obrigado por sua explicação.", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 81)
                    {
                        base.CachedBot.DRoomUser.Chat(Client.GetHabbo().Username + ", Se os jurados achar que você é inocente, você será libertado da prisão.", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 87)
                    {
                        base.CachedBot.DRoomUser.Chat("No entanto, se acharem que você é culpado, você permanecerá na prisão para servir o resto da sua sentença.", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 93)
                    {
                        base.CachedBot.DRoomUser.Chat("Advogado(a), por favor, pode remover " + Client.GetHabbo().Username + " para prosseguirmos com o julgamento.", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 96)
                    {
                        int JailRID = Convert.ToInt32(RoleplayData.GetData("jail", "insideroomid"));
                        RoleplayManager.SendUser(Client, JailRID);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 100)
                    {
                        base.CachedBot.DRoomUser.Chat("Agora são vocês, juris, decidir o destino do Réu", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 105)
                    {
                        RoleplayManager.CourtVoteEnabled = true;
                        base.CachedBot.DRoomUser.Chat("Por favor, vote digitando ':votar (culpado/inocente)'!", false, 2);
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 125)
                    {
                        int CourtResult = Math.Max(RoleplayManager.InnocentVotes, RoleplayManager.GuiltyVotes);

                        if (CourtResult == 0)
                        {
                            base.CachedBot.DRoomUser.Chat("Obrigado pelos seus votos. O júri definiu que o réu, " + Client.GetHabbo().Username + ", é culpado de todos os crimes.", false, 2);
                            Thread.Sleep(4000);
                            base.CachedBot.DRoomUser.Chat("O réu permanecerá na prisão e servirá o resto de sua sentença lá.", false, 2);
                            Client.SendNotification("Os juris definiu que você é culpado de todos os crimes. Você permanecerá na prisão e servirá o resto da sua sentença!");
                            return;
                        }
                        else if (CourtResult == RoleplayManager.GuiltyVotes)
                        {
                            base.CachedBot.DRoomUser.Chat("Obrigado pelo seu voto. O júri definiu que o réu, " + Client.GetHabbo().Username + ", é culpado de todos os crimes.", false, 2);
                            Thread.Sleep(4000);
                            base.CachedBot.DRoomUser.Chat("O réu permanecerá na prisão e servirá o resto de sua sentença lá.", false, 2);
                            Client.SendNotification("Os juris definiu que você é culpado de todos os crimes. Você permanecerá na prisão e servirá o resto da sua sentença!");
                            return;
                        }
                        else
                        {
                            base.CachedBot.DRoomUser.Chat("Obrigado por seu voto. Os juris definiu que o réu, " + Client.GetHabbo().Username + ", é inocente de todos os crimes.", false, 2);
                            Thread.Sleep(4000);
                            base.CachedBot.DRoomUser.Chat("Eu liberto o réu e perdoo de todos os crimes.", false, 2);
                            Client.SendNotification("Os juris definiu que você é inocente de todos os crimes. Você foi libertado da prisão!");
                            Client.GetRoleplay().IsJailed       = false;
                            Client.GetRoleplay().JailedTimeLeft = 0;
                        }
                        return;
                    }
                    else if (RoleplayManager.CourtJuryTime == 150)
                    {
                        base.CachedBot.DRoomUser.Chat("Obrigado juris. Caso encerrado.", false, 2);

                        if (Room != null)
                        {
                            SpawnJuryUsersOut(true);
                        }
                        return;
                    }
                    return;
                }

                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();
            }
            catch (Exception e)
            {
                Logging.LogRPTimersError("Error in Execute() void: " + e);
                base.EndTimer();
            }
        }
コード例 #29
0
ファイル: JuryTimer.cs プロジェクト: xjoao97/HabboRP
        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;
                }
            }
        }
コード例 #30
0
        /// <summary>
        /// Runs the gametick to check for running games
        /// </summary>
        public static void TickGames()
        {
            while (RunningGames.Count > 0)
            {
                try
                {
                    lock (RunningGames)
                    {
                        foreach (var game in RunningGames)
                        {
                            if (game.Value == null)
                            {
                                continue;
                            }

                            if (game.Value.Finished())
                            {
                                #region Reset Colour Wars Gates
                                if (game.Value.GetGameMode() == GameMode.ColourWars)
                                {
                                    var Room = RoleplayManager.GenerateRoom(Convert.ToInt32(RoleplayData.GetData("colourwars", "lobbyid")));

                                    if (Room != null)
                                    {
                                        foreach (var item in Room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigateblue || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigategreen || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigatered || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigateyellow).ToList())
                                        {
                                            if (item != null)
                                            {
                                                item.ExtraData = "0";
                                                item.UpdateState();

                                                if (item.GetRoom().GetGameMap().GameMap[item.GetX, item.GetY] == 0)
                                                {
                                                    foreach (var sser in item.GetRoom().GetGameMap().GetRoomUsers(new Point(item.GetX, item.GetY)))
                                                    {
                                                        sser.SqState = 1;
                                                    }
                                                    item.GetRoom().GetGameMap().GameMap[item.GetX, item.GetY] = 1;
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion

                                #region Reset Team Brawl Gates
                                if (game.Value.GetGameMode() == GameMode.TeamBrawl)
                                {
                                    var Room = RoleplayManager.GenerateRoom(Convert.ToInt32(RoleplayData.GetData("teambrawl", "lobbyid")));

                                    if (Room != null)
                                    {
                                        foreach (var item in Room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigateblue || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigategreen || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigatered || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigateyellow).ToList())
                                        {
                                            if (item != null)
                                            {
                                                item.ExtraData = "0";
                                                item.UpdateState();

                                                if (item.GetRoom().GetGameMap().GameMap[item.GetX, item.GetY] == 0)
                                                {
                                                    foreach (var sser in item.GetRoom().GetGameMap().GetRoomUsers(new Point(item.GetX, item.GetY)))
                                                    {
                                                        sser.SqState = 1;
                                                    }
                                                    item.GetRoom().GetGameMap().GameMap[item.GetX, item.GetY] = 1;
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion

                                #region Reset Mafia Wars Gates
                                if (game.Value.GetGameMode() == GameMode.MafiaWars)
                                {
                                    var Room = RoleplayManager.GenerateRoom(Convert.ToInt32(RoleplayData.GetData("mafiawars", "lobbyid")));

                                    if (Room != null)
                                    {
                                        foreach (var item in Room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigateblue || x.GetBaseItem().InteractionType == HabboHotel.Items.InteractionType.banzaigategreen).ToList())
                                        {
                                            if (item != null)
                                            {
                                                item.ExtraData = "0";
                                                item.UpdateState();

                                                if (item.GetRoom().GetGameMap().GameMap[item.GetX, item.GetY] == 0)
                                                {
                                                    foreach (var sser in item.GetRoom().GetGameMap().GetRoomUsers(new Point(item.GetX, item.GetY)))
                                                    {
                                                        sser.SqState = 1;
                                                    }
                                                    item.GetRoom().GetGameMap().GameMap[item.GetX, item.GetY] = 1;
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion

                                StopGame(game.Value.GetGameMode());
                                break;
                            }
                            else
                            {
                                game.Value.Check();
                            }
                        }
                        Thread.Sleep(1000);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }