Ejemplo n.º 1
0
        public override bool Execute(GameClient session, string[] pms)
        {
            if (ExtraSettings.NewPageCommands)
            {
                session.SendMessage(StaticMessage.NewWayToOpenCommandsList);
                return true;
            }

            string commandList;
            if (pms.Length == 0)
            {
                commandList =
                    CommandsManager.CommandsDictionary.Where(
                        command => CommandsManager.CanUse(command.Value.MinRank, session))
                        .Aggregate(string.Empty,
                            (current, command) =>
                                current + (command.Value.Usage + " - " + command.Value.Description + "\n"));
            }
            else
            {
                if (pms[0].Length == 1)
                {
                    commandList =
                        CommandsManager.CommandsDictionary.Where(
                            command =>
                                command.Key.StartsWith(pms[0]) && CommandsManager.CanUse(command.Value.MinRank, session))
                            .Aggregate(string.Empty,
                                (current, command) =>
                                    current + (command.Value.Usage + " - " + command.Value.Description + "\n"));
                }
                else
                {
                    commandList =
                        CommandsManager.CommandsDictionary.Where(
                            command =>
                                command.Key.Contains(pms[0]) && CommandsManager.CanUse(command.Value.MinRank, session))
                            .Aggregate(string.Empty,
                                (current, command) =>
                                    current + (command.Value.Usage + " - " + command.Value.Description + "\n"));
                }
            }
            session.SendNotifWithScroll(commandList);

            return true;
        }
Ejemplo n.º 2
0
        private static bool GetInfo(GameClient session, IReadOnlyList<string> pms)
        {
            var type = pms[0];

            var user =
                session.GetHabbo()
                    .CurrentRoom.GetRoomUserManager()
                    .GetRoomUserByHabbo(session.GetHabbo().UserName);
            var text = new StringBuilder();
            switch (type)
            {
                case "cache":
                    {
                        text.AppendLine("Displaying info of all cached data avaible");
                        text.Append("Users: " + Azure.UsersCached.Count + '\r');
                        text.Append("Rooms: " + Azure.GetGame().GetRoomManager().LoadedRooms.Count + '\r');
                        text.Append("Rooms Data: " + Azure.GetGame().GetRoomManager().LoadedRoomData.Count + '\r');
                        text.Append("Groups: " + Azure.GetGame().GetGroupManager().Groups.Count + '\r');
                        text.Append("Items: " + Azure.GetGame().GetItemManager().CountItems() + '\r');
                        text.Append("Catalog Items: " + Azure.GetGame().GetCatalog().Offers.Count + '\r');

                        session.SendNotifWithScroll(text.ToString());
                        break;
                    }
                case "users":
                    {
                        text.AppendLine("Displaying info of all users of this room");

                        foreach (var roomUser in session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers())
                            AppendUserInfo(roomUser, text);

                        session.SendNotifWithScroll(text.ToString());
                        break;
                    }
                case "user":
                    {
                        var roomUser =
                            session.GetHabbo()
                                .CurrentRoom.GetRoomUserManager()
                                .GetRoomUserByHabbo(session.GetHabbo().LastSelectedUser);
                        if (roomUser == null || roomUser.IsBot || roomUser.GetClient() == null)
                            text.Append("User not found");
                        else AppendUserInfo(roomUser, text);

                        session.SendNotifWithScroll(text.ToString());
                        break;
                    }
                case "items":
                    {
                        text.AppendLine(string.Format("Displaying info of coordinates: (X/Y)  {0}/{1}", user.LastSelectedX,
                            user.LastSelectedY));

                        foreach (
                            var item in
                                session.GetHabbo()
                                    .CurrentRoom.GetGameMap()
                                    .GetAllRoomItemForSquare(user.LastSelectedX, user.LastSelectedY))
                        {
                            text.Append(string.Format("## itemId: {0}  itemBaseId: {1} \r", item.Id,
                                item.GetBaseItem().ItemId));
                            text.Append(string.Format("itemName: {0}  itemSpriteId: {1} \r", item.GetBaseItem().Name,
                                item.GetBaseItem().SpriteId));
                            text.Append(string.Format("itemInteraction: {0} \r", item.GetBaseItem().InteractionType));
                            text.Append(string.Format("itemInteractionCount: {0} \r", item.GetBaseItem().Modes));
                            text.Append(string.Format("itemPublicName: {0} \r", item.GetBaseItem().PublicName));
                            text.Append(string.Format("X/Y/Z/Rot:  {0}/{1}/{2}/{3}  Height: {4} \r", item.X, item.Y, item.Z,
                                item.Rot, item.Height));
                            if (item.GetBaseItem().StackMultipler)
                                text.Append("Heights: " + string.Join("  -  ", item.GetBaseItem().ToggleHeight) + '\r');
                            text.AppendLine(string.Format("Can: {0}  {1}  {2}",
                                item.GetBaseItem().Walkable ? "walk" : string.Empty,
                                item.GetBaseItem().IsSeat ? "sit" : string.Empty,
                                item.GetBaseItem().Stackable ? "stack" : string.Empty));
                        }

                        session.SendNotifWithScroll(text.ToString());
                        break;
                    }
            }

            return true;
        }