HTheAlexitoH
New Member
- Aug 28, 2016
- 3
- 2
Hi, I bring the HideWired code. In the steps that from one emu to another change anything, I will put different spoilers to facilitate everything.
The command hides the wireds of the room. If they enter a room with activated hirewired they will appear hidden. If someone does reload in the room, hidewired is set to 0 and the furnis will be visible. If someone does Floor, it will be the same.
<<<<< This paragraph is explained in the second answer, there is a translation error.
-All this in the emu, with the Microsoft Visual Studio program (latest versions recommended)-
1- Go to emu\HabboHotel\Rooms\Chat\Commands\User and we created a file called HideWiredCommand.cs with the following code:
2- In the previous folder, we opened CommandMananger.cs.
We look for the next line:
and below it we add:
3- We search the file 'GetRoomEntryDataEvent.cs' situated in emu\Communication\Packets\Incoming\Rooms\Engine
We look for the following code:
and below it, we add:
4- Go to emu\Communication\Packets\Incoming\Rooms\Furni\Wired and open SaveWiredConfigEvent.cs
We are looking for:
We add below:
5- Go to ObjetsComposer.cs emu\Communication\Packets\Outgoing\Rooms\Engine
Look:
Add below:
6- Go to emu\Communication\Packets\Outgoing\Rooms\Furni\Wired and we created a file called 'HideWiredConfigComposer.cs' whose code is:
7- Go to emu\HabboHotel\Rooms and open room.cs
Search:
and we add below:
We are looking for:
Below, we add:
Look for:
Above of that code, we add:
8- In that same folder, we open RoomData.cs
Search:
Below, add:
Search:
Below, we add:
9- In that same folder, we open RoomItemHandling.cs
Look for:
Below, we add:
10- We go to our database and execute the following SQL code:
Once ready, we compile and it should work. All the credits of codes to their respective authors (I do not know authorship).
If it has served you, all comments are useful to continue contributing things to this community ^^
The command hides the wireds of the room. If they enter a room with activated hirewired they will appear hidden. If someone does reload in the room, hidewired is set to 0 and the furnis will be visible. If someone does Floor, it will be the same.
<<<<< This paragraph is explained in the second answer, there is a translation error.
-All this in the emu, with the Microsoft Visual Studio program (latest versions recommended)-
1- Go to emu\HabboHotel\Rooms\Chat\Commands\User and we created a file called HideWiredCommand.cs with the following code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Cloud.Communication.Packets.Outgoing.Inventory.Furni;
using System.Globalization;
using Cloud.Database.Interfaces;
using Cloud.Communication.Packets.Outgoing;
using Cloud.HabboHotel.Items;
using Cloud.Communication.Packets.Outgoing.Rooms.Engine;
using Cloud.Communication.Packets.Outgoing.Rooms.Chat;
namespace Cloud.HabboHotel.Rooms.Chat.Commands.User
{
class HideWiredCommand : IChatCommand
{
public string PermissionRequired
{
get { return ""; }
}
public string Parameters
{
get { return ""; }
}
public string Description
{
get { return "Oculta los Wired de la sala."; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (!Room.CheckRights(Session, false, false))
{
Session.SendWhisper("¡No tienes permiso para ocultar wireds en esta sala!");
return;
}
Room.HideWired = !Room.HideWired;
if (Room.HideWired)
Session.SendWhisper("Los Wired han sido ocultados.");
else
Session.SendWhisper("Los Wired son ahora visibles.");
using (IQueryAdapter con = CloudServer.GetDatabaseManager().GetQueryReactor())
{
con.SetQuery("UPDATE `rooms` SET `hide_wired` = @enum WHERE `id` = @id LIMIT 1");
con.AddParameter("enum", CloudServer.BoolToEnum(Room.HideWired));
con.AddParameter("id", Room.Id);
con.RunQuery();
}
List<ServerPacket> list = new List<ServerPacket>();
list = Room.HideWiredMessages(Room.HideWired);
Room.SendMessage(list);
}
}
}
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.Communication.Packets.Outgoing.Inventory.Furni;
using System.Globalization;
using Plus.Database.Interfaces;
using Plus.Communication.Packets.Outgoing;
using Plus.HabboHotel.Items;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
class HideWiredCommand : IChatCommand
{
public string PermissionRequired
{
get { return ""; }
}
public string Parameters
{
get { return ""; }
}
public string Description
{
get { return "Oculta los Wired de la sala."; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (!Room.CheckRights(Session, false, false))
{
Session.SendWhisper("¡No tienes permiso para ocultar wireds en esta sala!");
return;
}
Room.HideWired = !Room.HideWired;
if (Room.HideWired)
Session.SendWhisper("Los Wired han sido ocultados.");
else
Session.SendWhisper("Los Wired son ahora visibles.");
using (IQueryAdapter con = HabboEnvironment.GetDatabaseManager().GetQueryReactor())
{
con.SetQuery("UPDATE `rooms` SET `hide_wired` = @enum WHERE `id` = @id LIMIT 1");
con.AddParameter("enum", HabboEnvironment.BoolToEnum(Room.HideWired));
con.AddParameter("id", Room.Id);
con.RunQuery();
}
List<ServerPacket> list = new List<ServerPacket>();
list = Room.HideWiredMessages(Room.HideWired);
Room.SendMessage(list);
}
}
}
2- In the previous folder, we opened CommandMananger.cs.
We look for the next line:
this.Register("lay", new LayCommand());
and below it we add:
this.Register("hidewired", new HideWiredCommand());
3- We search the file 'GetRoomEntryDataEvent.cs' situated in emu\Communication\Packets\Incoming\Rooms\Engine
We look for the following code:
if (!Room.GetRoomUserManager().AddAvatarToRoom(Session))
{
Room.GetRoomUserManager().RemoveUserFromRoom(Session, false, false);
return;//TODO: Remove?
}
and below it, we add:
Room.SendObjects(Session);
if (Room.HideWired && Room.CheckRights(Session, true, false))
Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "El wired está oculto en la sala."));
4- Go to emu\Communication\Packets\Incoming\Rooms\Furni\Wired and open SaveWiredConfigEvent.cs
We are looking for:
int ItemId = Packet.PopInt();
We add below:
Session.SendMessage(new HideWiredConfigComposer());
5- Go to ObjetsComposer.cs emu\Communication\Packets\Outgoing\Rooms\Engine
Look:
List<Item> l = new List<Item>();
Add below:
if (Room.HideWired)
{
for (int i = 0; i < Objects.Count(); i++)
{
Item it = Objects;
if (it == null)
continue;
if (it.IsWired)
continue;
l.Add(it);
}
Objects = l.ToArray();
base.WriteInteger(Objects.Length);
for (int i = 0; i < Objects.Count(); i++)
{
Item Item = Objects;
WriteFloorItem(Item, Convert.ToInt32(Item.UserID));
}
}
6- Go to emu\Communication\Packets\Outgoing\Rooms\Furni\Wired and we created a file called 'HideWiredConfigComposer.cs' whose code is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cloud.Communication.Packets.Outgoing.Rooms.Furni.Wired
{
class HideWiredConfigComposer : ServerPacket
{
public HideWiredConfigComposer()
: base(ServerPacketHeader.HideWiredConfigMessageComposer)
{
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cloud.Communication.Packets.Outgoing.Rooms.Furni.Wired
{
class HideWiredConfigComposer : ServerPacket
{
public HideWiredConfigComposer()
: base(ServerPacketHeader.HideWiredConfigMessageComposer)
{
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plus.Communication.Packets.Outgoing.Rooms.Furni.Wired
{
class HideWiredConfigComposer : ServerPacket
{
public HideWiredConfigComposer()
: base(ServerPacketHeader.HideWiredConfigMessageComposer)
{
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plus.Communication.Packets.Outgoing.Rooms.Furni.Wired
{
class HideWiredConfigComposer : ServerPacket
{
public HideWiredConfigComposer()
: base(ServerPacketHeader.HideWiredConfigMessageComposer)
{
}
}
}
7- Go to emu\HabboHotel\Rooms and open room.cs
Search:
public int IdleTime { get; set; }
and we add below:
private bool _hideWired;
We are looking for:
this.Landscape = Data.Landscape;
Below, we add:
this._hideWired = Data.HideWired;
Look for:
public List<string> WordFilterList
{
get { return this._wordFilterList; }
set { this._wordFilterList = value; }
}
Above of that code, we add:
public List<ServerPacket> HideWiredMessages(bool hideWired)
{
List<ServerPacket> list = new List<ServerPacket>();
Item[] items = this.GetRoomItemHandler().GetFloor.ToArray();
if (hideWired)
{
for (int i = 0; i < items.Count(); i++)
{
Item item = items;
if (!item.IsWired)
continue;
list.Add(new ObjectRemoveComposer(item, 0));
}
}
else
{
for (int i = 0; i < items.Count(); i++)
{
Item item = items;
if (!item.IsWired)
continue;
list.Add(new ObjectAddComposer(item, this));
}
}
return list;
}
public bool HideWired
{
get { return this._hideWired; }
set { this._hideWired = value; }
}
8- In that same folder, we open RoomData.cs
Search:
public bool PetMorphsAllowed;
Below, add:
public bool HideWired;
Search:
this.PetMorphsAllowed = CloudServer.EnumToBool(Row["pet_morphs_allowed"].ToString());
Below, we add:
this.HideWired = CloudServer.EnumToBool(Row["hide_wired"].ToString());
9- In that same folder, we open RoomItemHandling.cs
Look for:
if (newItem)
if (Item.IsWired)
if (Item.IsWired)
{
Below, we add:
if (_room.HideWired)
{
_room.HideWired = false;
Session.SendWhisper("El Wired está oculto.");
_room.SendMessage(_room.HideWiredMessages(false));
}
10- We go to our database and execute the following SQL code:
ALTER TABLE rooms ADD COLUMN hide_wired enum('0','1') NOT NULL DEFAULT '0';
Once ready, we compile and it should work. All the credits of codes to their respective authors (I do not know authorship).
If it has served you, all comments are useful to continue contributing things to this community ^^
Last edited: