Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Plus/Cloud/Osore] HideWired Command

Initiate Mage
Joined
Aug 7, 2018
Messages
1
Reaction score
0
Hi, I bring the HideWired code. In the steps that from one emu to another change anything, I will put different codes 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.

-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:
CLOUD:
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); } }}
PLUS:
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 in 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:
CLOUD:
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) { } }}
PLUS:
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) { } }}
7- Go to emu\HabboHotel\Rooms and open room.csSearch:
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.csSearch:
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.csLook 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:
Newbie Spellweaver
Joined
Feb 7, 2014
Messages
58
Reaction score
25
HideWired for Comet Emulator
package com.cometproject.server.game.commands.user.room;
import com.cometproject.server.config.Locale;
import com.cometproject.server.game.commands.ChatCommand;
import com.cometproject.server.game.rooms.objects.items.RoomItemFloor;
import com.cometproject.server.game.rooms.objects.items.types.floor.wired.WiredFloorItem;
import com.cometproject.server.game.rooms.types.Room;
import com.cometproject.server.network.messages.outgoing.room.items.RemoveFloorItemMessageComposer;
import com.cometproject.server.network.messages.outgoing.room.items.SendFloorItemMessageComposer;
import com.cometproject.server.network.sessions.Session;

public class HideWiredCommand extends ChatCommand {
@Override
public void execute(Session client, String[] params) {
final Room room = client.getPlayer().getEntity().getRoom();

if(!client.getPlayer().getPermissions().getRank().roomFullControl() && !client.getPlayer().getEntity().getRoom().getRights().hasRights(client.getPlayer().getId())) {
return;
}

String msg = "";


if(client.getPlayer().getEntity().getRoom().getData().isWiredHidden()) {
room.getData().setIsWiredHidden(false);
msg = Locale.getOrDefault("command.hidewired.shown", "Wired is now visible.");

for(RoomItemFloor floorItem : room.getItems().getFloorItems().values()) {
if (floorItem instanceof WiredFloorItem) {
room.getEntities().broadcastMessage(new SendFloorItemMessageComposer(floorItem));
}
}

} else {
room.getData().setIsWiredHidden(true);
msg = Locale.getOrDefault("command.hidewired.hidden", "Wired is now hidden.");

for(RoomItemFloor floorItem : room.getItems().getFloorItems().values()) {

if(floorItem instanceof WiredFloorItem) {
room.getEntities().broadcastMessage(new RemoveFloorItemMessageComposer(floorItem.getVirtualId(),
client.getPlayer().getId()));
}
}
}

sendNotif(msg, client);
room.getData().save();
}

@Override
public String getPermission() {
return "hidewired_command";
}

@Override
public String getDescription() {
return Locale.get("command.hidewired.description");
}
}
 
Elite Diviner
Joined
Apr 5, 2014
Messages
464
Reaction score
223
ah how i've missed seeing

in xxx.cs find

below add:
someCode

look for xxxx

above add:
someCode

reminds me of when plus was originally released and everyone posted small fixes/changes in the thread in that format

----------

maybe this should be in the tutorial section instead? :)
 
Newbie Spellweaver
Joined
Sep 13, 2013
Messages
23
Reaction score
2
step 5 is not working and i get these errors when i fill everything correct in




how to fix?
 
Back
Top