Exemplo n.º 1
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor insira o código do emblema que deseja dar ao hotel inteiro.", 1);
                return;
            }

            Badges.BadgeDefinition BadgeDefinition = null;
            if (!PlusEnvironment.GetGame().GetBadgeManager().TryGetBadge(Params[1].ToUpper(), out BadgeDefinition))
            {
                Session.SendWhisper("As definições de emblema não contêm este emblema!", 1);
                return;
            }

            foreach (GameClient Client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
            {
                if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().Username == Session.GetHabbo().Username)
                {
                    continue;
                }

                if (!Client.GetHabbo().GetBadgeComponent().HasBadge(Params[1]))
                {
                    Client.GetHabbo().GetBadgeComponent().GiveBadge(Params[1], true, Client);
                    Client.SendNotification("Você acabou de receber um emblema!");
                }
                else
                {
                    Client.SendWhisper(Session.GetHabbo().Username + " tentou lhe dar um emblema, mas você já o possui!", 1);
                }
            }

            Session.SendWhisper("Você deu com sucesso a cada usuário neste hotel o emblema " + Params[1] + "!", 1);
        }
Exemplo n.º 2
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, insira o nome do emblema que gostaria de dar ao quarto.", 1);
                return;
            }

            Badges.BadgeDefinition BadgeDefinition = null;
            if (!PlusEnvironment.GetGame().GetBadgeManager().TryGetBadge(Params[1].ToUpper(), out BadgeDefinition))
            {
                Session.SendWhisper("As definições não possuem este emblema!", 1);
                return;
            }

            foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null)
                {
                    continue;
                }

                if (!User.GetClient().GetHabbo().GetBadgeComponent().HasBadge(Params[1]))
                {
                    User.GetClient().GetHabbo().GetBadgeComponent().GiveBadge(Params[1], true, User.GetClient());
                    User.GetClient().SendNotification("Você acabou de receber um emblema!");
                }
                else
                {
                    User.GetClient().SendWhisper(Session.GetHabbo().Username + " tentou lhe dar um emblema, mas você já o possui!", 1);
                }
            }

            Session.SendWhisper("Você forneceu com sucesso a cada usuário nesta sala o emblema " + Params[1] + "!", 1);
        }
Exemplo n.º 3
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 3)
            {
                Session.SendWhisper("Digite um usuário e o código do emblema que você gostaria de dar!", 1);
                return;
            }

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

            Badges.BadgeDefinition BadgeDefinition = null;
            if (!PlusEnvironment.GetGame().GetBadgeManager().TryGetBadge(Params[2].ToUpper(), out BadgeDefinition))
            {
                Session.SendWhisper("Emblema não encontrado!", 1);
                return;
            }

            if (TargetClient != null)
            {
                if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))
                {
                    TargetClient.GetHabbo().GetBadgeComponent().GiveBadge(Params[2], true, TargetClient);
                    if (TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
                    {
                        TargetClient.SendNotification("Você acabou de receber um emblema!");
                        Session.SendWhisper("Sucesso! " + TargetClient.GetHabbo().Username + " recebeu o emblema " + Params[2].ToUpper() + "!", 1);
                    }
                    else
                    {
                        Session.SendWhisper("Você se deu com sucesso o emblema " + Params[2].ToUpper() + "!", 1);
                    }
                }
                else
                {
                    Session.SendWhisper("Opa, esse usuário já possui este emblema (" + Params[2].ToUpper() + ") !", 1);
                }
                return;
            }
            else
            {
                Session.SendWhisper("Opa, não conseguimos encontrar esse usuário!", 1);
                return;
            }
        }