[ TUTORIAL ] Comando desativar eventos


Após muitos pedidos eu resolvi trazer para vocês.



Tutorial:
1- Abra a source do seu emulador e dirija-se até a pasta HabboHotel --> Rooms --> Chat --> Commands --> Users , clique com o botão direito --> ADD --> Class e crie um novo comando com o nome DisableEventsCommand.cs e coloque tudo isso lá dentro:

using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
    class DisableEventsCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_disable_events"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Ativar ou desativar mensagens de eventos."; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowEvents = !Session.GetHabbo().AllowEvents;
            Session.SendWhisper("Você " + (Session.GetHabbo().AllowEvents == true ? "permite" : "não permite") + " receber mensagens de eventos.");

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_events` = @AllowEvents WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowEvents", PlusEnvironment.BoolToEnum(Session.GetHabbo().AllowEvents));
                dbClient.RunQuery();
            }
        }
    }
}

Vá até CommandManager.cs na linha 151 dê enter e adicione:
            
this.Register("eventosoff", new DisableEventsCommand());

2- Agora substitua o seu EventAlert por este:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using System.Linq;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Events
{
    internal class EventAlertCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get
            {
                return "command_event_alert";
            }
        }
        public string Parameters
        {
            get
            {
                return "%message%";
            }
        }
        public string Description
        {
            get
            {
                return "Enviar um alerta de evento";
            }
        }
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Session != null)
            {
                if (Room != null)
                {
                    if (Params.Length == 1)
                    {
                        Session.SendWhisper("Por favor, digite uma mensagem para enviar.");
                        return;
                    }
                    foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                        if (client.GetHabbo().AllowEvents == true)
                        {
                            string Message = CommandManager.MergeParams(Params, 1);

                            client.SendMessage(new RoomNotificationComposer("Está acontecendo um evento!",
                                 "Está acontecendo um novo jogo realizado pela equipe Staff! <br><br>Este, tem o intuito de proporcionar um entretenimento a mais para os usuários!<br><br>Evento: <b>" + Message +
                                 "</b><br>Por: <b>" + Session.GetHabbo().Username +
                                 "</b> <br><br>Caso deseje participar, clique no botão abaixo!",
                                 "/fig/" + Session.GetHabbo().Look + "", "Participar do Evento", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
                        }
                        else
                            client.SendWhisper("Parece que está havendo um novo evento em nosso hotel. Para reativar as mensagens de eventos digite ;eventosoff", 1);

                }
            }
        }
    }
}



ESTE PASSO DEVE SER SEGUIDO COM ATENÇÃO OU PODERÁ BUGAR O SEU HOTEL.

3- Vamos até HabboHotel --> Users --> Habbo, vamos até a linha 80 apertamos enter e adicionamos:

       private bool _allowEvents;


4- No mesmo arquivo vamos até a linha 183 e trocamos está linha por:
int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, bool AllowEvents, int VIPRank)

5- Continuando neste mesmo arquivo (até o fim do tutorial) vamos até a linha 226 apertamos enter e colocamos:
       
           this._allowEvents = AllowEvents;

6- Agora na vamos até a linha 564 apertamos enter e colamos:

public bool AllowEvents
        {
            get { return this._allowEvents; }
            set { this._allowEvents = value; }
        }



7- Vamos até HabboHotel --> Users --> Authenticator --> HabboFactory --> Authenticator.cs , procuramos por rank_vip neste mesmo arquivo e atrás dele colocamos:

PlusEnvironment.EnumToBool(Row["allow_events"].ToString()),




8- Agora vamos até HabboHotel --> Users --> UserDataManagement --> UserDataFactory.cs e na linha 45 atrás de rank_vip adicionamos `allow_events`:


9- E por fim na linha 232 fazemos o mesmo:


10- Agora executamos este SQL:
ALTER TABLE `users`ADD COLUMN `allow_events` ENUM('0','1') NOT NULL DEFAULT '1' AFTER `allow_mimic`;

11- Agora damos debug e testamos.


Créditos:
TOTAIS Á WWW.CRIAHABBOS.GA



EmoticonEmoticon