Ejemplo n.º 1
0
        /// <summary>
        /// Generates the lottery dictionary values from database
        /// </summary>
        public static void Initialize()
        {
            TicketLimit = Convert.ToInt32(RoleplayData.GetData("lottery", "limit"));
            Prize       = Convert.ToInt32(RoleplayData.GetData("lottery", "prize"));
            Cost        = Convert.ToInt32(RoleplayData.GetData("lottery", "cost"));

            LotteryTickets.Clear();

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `rp_lottery`");
                DataTable Table = dbClient.getTable();

                if (Table != null)
                {
                    foreach (DataRow Row in Table.Rows)
                    {
                        int UserId = Convert.ToInt32(Row["user_id"]);
                        int Ticket = Convert.ToInt32(Row["ticket"]);

                        if (!LotteryTickets.ContainsKey(UserId))
                        {
                            LotteryTickets.TryAdd(UserId, Ticket);
                        }
                    }
                }
            }

            //log.Info("Carregado " + LotteryTickets.Count + " bilhetes de loteria.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the roleplaymanager variables
        /// </summary>
        public static void UpdateRPData()
        {
            LevelCap            = Convert.ToInt32(RoleplayData.GetData("level", "cap"));
            FarmingLevelCap     = Convert.ToInt32(RoleplayData.GetData("farming", "cap"));
            IntelligenceCap     = Convert.ToInt32(RoleplayData.GetData("intelligence", "cap"));
            StrengthCap         = Convert.ToInt32(RoleplayData.GetData("strength", "cap"));
            StaminaCap          = Convert.ToInt32(RoleplayData.GetData("stamina", "cap"));
            DeathTime           = Convert.ToInt32(RoleplayData.GetData("hospital", "deathtime"));
            StunGunRange        = Convert.ToInt32(RoleplayData.GetData("police", "stungunrange"));
            LevelDifference     = Convert.ToBoolean(RoleplayData.GetData("level", "leveldifference"));
            AccurateUserCount   = Convert.ToBoolean(RoleplayData.GetData("server", "accurateusercount"));
            StartWorkInPoliceHQ = Convert.ToBoolean(RoleplayData.GetData("police", "startworkinhq"));
            DayNightSystem      = Convert.ToBoolean(RoleplayData.GetData("server", "daynightsystem"));
            DayNightTaxiTime    = Convert.ToBoolean(RoleplayData.GetData("server", "daynighttaxi"));
            ConfiscateWeapons   = Convert.ToBoolean(RoleplayData.GetData("server", "confiscateweapons"));
            NewVIPAlert         = Convert.ToBoolean(RoleplayData.GetData("server", "newvipalerts"));

            JobCAPTCHABox     = Convert.ToBoolean(RoleplayData.GetData("captcha", "job"));
            WorkoutCAPTCHABox = Convert.ToBoolean(RoleplayData.GetData("captcha", "workout"));
            FarmingCAPTCHABox = Convert.ToBoolean(RoleplayData.GetData("captcha", "farming"));

            DefaultHitCooldown = Convert.ToInt32(RoleplayData.GetData("combat", "defaulthitcooldown"));
            HitCooldown        = Convert.ToInt32(RoleplayData.GetData("combat", "hitcooldown"));
            HitCooldownInEvent = Convert.ToInt32(RoleplayData.GetData("combat", "hitcooldowninevent"));

            UnloadRoomsAutomatically = Convert.ToBoolean(RoleplayData.GetData("server", "autounloadrooms"));
            FollowFriends            = Convert.ToBoolean(RoleplayData.GetData("server", "followfriends"));
            PushPullOnArrows         = Convert.ToBoolean(RoleplayData.GetData("server", "pponarrows"));

            NukeMinutes      = Convert.ToInt32(RoleplayData.GetData("npa", "nukeminutes"));
            BreakDownMinutes = Convert.ToInt32(RoleplayData.GetData("npa", "breakdownminutes"));
            NPACoolDown      = Convert.ToInt32(RoleplayData.GetData("npa", "cooldown"));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Generates the fence for jailbreak
        /// </summary>
        /// <param name="Room"></param>
        public static void GenerateFence(Room Room)
        {
            int X   = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencex"));
            int Y   = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencey"));
            int Rot = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencerotation"));

            if (Room.GetRoomItemHandler().GetFloor.Where(x => x.BaseItem == 8049 && x.GetX == X && x.GetY == Y).ToList().Count <= 0)
            {
                double MaxHeight = 0.0;
                Item   ItemInFront;
                if (Room.GetGameMap().GetHighestItemForSquare(new Point(X, Y), out ItemInFront))
                {
                    if (ItemInFront != null)
                    {
                        MaxHeight = ItemInFront.TotalHeight;
                    }
                }

                RoleplayManager.PlaceItemToRoom(null, 8049, 0, X, Y, MaxHeight, Rot, false, Room.RoomId, false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Begin jailbreak sequence
        /// </summary>
        public static void InitiateJailbreak(GameClient UserJailbreaking)
        {
            #region Message Police Officers
            lock (PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
            {
                foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                {
                    if (client == null || client.GetHabbo() == null || client.GetRoleplay() == null)
                    {
                        continue;
                    }

                    if (!GroupManager.HasJobCommand(client, "radio") && !client.GetHabbo().GetPermissions().HasRight("corporation_rights"))
                    {
                        continue;
                    }

                    if (GroupManager.HasJobCommand(client, "radio"))
                    {
                        if (!client.GetRoleplay().IsWorking)
                        {
                            continue;
                        }

                        if (!client.GetRoleplay().HandlingJailbreaks)
                        {
                            continue;
                        }

                        if (client.GetRoleplay().DisableRadio)
                        {
                            continue;
                        }
                    }

                    client.SendWhisper("[RÁDIO] [Fuga da Prisão] Perigo! Houve uma explosão alta da prisão!", 30);
                }
            }
            #endregion

            List <GameClient> CurrentJailedUsers = PlusEnvironment.GetGame().GetClientManager().GetClients.Where(x => x != null && x.GetHabbo() != null && x.GetRoleplay() != null && x.GetRoleplay().IsJailed&& x != RoleplayManager.Defendant).ToList();

            foreach (GameClient Client in CurrentJailedUsers)
            {
                Client.GetRoleplay().Jailbroken = true;
                RoleplayManager.GetLookAndMotto(Client);
            }
            int X      = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencex"));
            int Y      = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencey"));
            int RoomId = Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid"));

            Room Room = RoleplayManager.GenerateRoom(RoomId);
            if (Room != null && Room.GetRoomItemHandler() != null && Room.GetRoomItemHandler().GetFloor != null)
            {
                List <Item> ItemsToRemove = Room.GetRoomItemHandler().GetFloor.Where(x => x.BaseItem == 3011 || x.BaseItem == 6088).ToList();

                if (ItemsToRemove != null && ItemsToRemove.Count > 0)
                {
                    foreach (Item Remove in ItemsToRemove)
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Remove.Id);
                    }
                }

                Item FenceToRemove = Room.GetRoomItemHandler().GetFloor.FirstOrDefault(x => x.BaseItem == 8049 && x.GetX == X && x.GetY == Y);

                if (FenceToRemove != null)
                {
                    Room.GetRoomItemHandler().RemoveFurniture(null, FenceToRemove.Id);
                    JailbreakManager.FenceBroken = true;
                }
            }

            JailbreakManager.UserJailbreaking = UserJailbreaking;
            RoleplayManager.TimerManager.CreateTimer("jailbreak", 1000, false);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sends the user to desired chair in the room
        /// </summary>
        /// <param name="Client"></param>
        public static void SpawnChairs(GameClient Client, string ChairName, RoomUser Bot = null)
        {
            try
            {
                RoomUser RoomUser;

                if (Client != null)
                {
                    if (Client.GetHabbo().CurrentRoomId != Convert.ToInt32(RoleplayData.GetData("court", "roomid")))
                    {
                        Client.GetHabbo().Look  = Client.GetRoleplay().OriginalOutfit;
                        Client.GetHabbo().Motto = Client.GetRoleplay().Class;
                        Client.GetHabbo().Poof(false);
                    }
                }

                if (Bot != null)
                {
                    RoomUser = Bot;
                }
                else
                {
                    RoomUser = Client.GetRoomUser();
                }

                List <Item> Chairs = new List <Item>();

                if (RoomUser == null)
                {
                    return;
                }

                if (RoomUser.isSitting || RoomUser.Statusses.ContainsKey("sit"))
                {
                    if (RoomUser.Statusses.ContainsKey("sit"))
                    {
                        RoomUser.RemoveStatus("sit");
                    }
                    RoomUser.isSitting    = false;
                    RoomUser.UpdateNeeded = true;
                }

                if (RoomUser.isLying || RoomUser.Statusses.ContainsKey("lay"))
                {
                    if (RoomUser.Statusses.ContainsKey("lay"))
                    {
                        RoomUser.RemoveStatus("lay");
                    }
                    RoomUser.isLying      = false;
                    RoomUser.UpdateNeeded = true;
                }

                RoomUser.CanWalk = false;
                RoomUser.ClearMovement(true);

                lock (RoomUser.GetRoom().GetRoomItemHandler().GetFloor)
                {
                    foreach (Item item in RoomUser.GetRoom().GetRoomItemHandler().GetFloor)
                    {
                        if (item.GetBaseItem().ItemName == ChairName)
                        {
                            if (!Chairs.Contains(item))
                            {
                                Chairs.Add(item);
                            }
                        }
                    }

                    var Chairs2 = new List <Item>();
                    foreach (var chair in Chairs)
                    {
                        if (!chair.GetRoom().GetGameMap().SquareHasUsers(chair.GetX, chair.GetY))
                        {
                            if (!Chairs2.Contains(chair))
                            {
                                Chairs2.Add(chair);
                            }
                        }
                    }

                    Item   LandItem = null;
                    Random Random   = new Random();
                    if (Chairs2.Count >= 1)
                    {
                        if (Chairs2.Count == 1)
                        {
                            LandItem = Chairs2[0];
                        }
                        else
                        {
                            LandItem = Chairs2[Random.Next(0, Chairs2.Count)];
                        }
                    }
                    else if (Chairs2.Count >= 1)
                    {
                        if (Chairs.Count == 1)
                        {
                            LandItem = Chairs[0];
                        }
                        else
                        {
                            LandItem = Chairs[Random.Next(0, Chairs.Count)];
                        }
                    }

                    if (LandItem != null)
                    {
                        if (RoomUser.Statusses.ContainsKey("sit"))
                        {
                            RoomUser.RemoveStatus("sit");
                        }
                        if (RoomUser.Statusses.ContainsKey("lay"))
                        {
                            RoomUser.RemoveStatus("lay");
                        }
                        RoomUser.Statusses.Add("sit", Utilities.TextHandling.GetString(LandItem.GetBaseItem().Height));

                        Point OldCoord = new Point(RoomUser.Coordinate.X, RoomUser.Coordinate.Y);
                        Point NewCoord = new Point(LandItem.GetX, LandItem.GetY);

                        var Room = GenerateRoom(RoomUser.RoomId);

                        if (Room != null)
                        {
                            Room.GetGameMap().UpdateUserMovement(OldCoord, NewCoord, RoomUser);
                        }

                        RoomUser.X       = LandItem.GetX;
                        RoomUser.Y       = LandItem.GetY;
                        RoomUser.Z       = LandItem.GetZ;
                        RoomUser.RotHead = LandItem.Rotation;
                        RoomUser.RotBody = LandItem.Rotation;
                    }
                    RoomUser.CanWalk      = true;
                    RoomUser.UpdateNeeded = true;
                }
            }
            catch { }
        }