Core
Member
- Nov 10, 2016
- 356
- 138
A lot of retros lately say they're 'casino orientated', etc. So I made a really simple command which may help some of the users. It will simply close all the dice in their booth; this way they don't have to click each of them one by one. Also prevents cheating as in the past I have experienced people claiming that they rolled the dice when it was the same as last time; the common excuse is 'lag'. Closing dice will often get rid of this .
Go to Gamemap.cs and find
above that put the following
Go to RoomUser.cs and find
Below that put
Create a new file called CloseDiceCommand.cs in HabboHotel/Rooms/Chat/Commands/User and put the following content;
and next you want to register the command so go to CommandManager.cs and find
Below this you will want to add
Configuration Options
You can easily remove the 5 die limit by removing the following lines in the CloseDiceCommand;
You can also create other commands like :rollall which will roll all the dice around you. Just modify;
An example would be
Go to Gamemap.cs and find
Code:
public static bool TilesTouching(int X1, int Y1, int X2, int Y2)
Code:
public static bool TilesTouching(Point p1, Point p2)
{
return TilesTouching(p1.X, p1.Y, p2.X, p2.Y);
}
Go to RoomUser.cs and find
Code:
public int VirtualId;
Code:
public Point Point => new Point(Position.X, Position.Y);
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
class CloseDiceCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_close_dice"; }
}
public string Parameters
{
get { return ""; }
}
public string Description
{
get { return "Closes your dice when in a tradition 5 die booth."; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
RoomUser roomUser = Room?.GetRoomUserManager()?.GetRoomUserByHabbo(Session.GetHabbo().Id);
if (roomUser == null)
{
return;
}
List<Items.Item> userBooth = Room.GetRoomItemHandler().GetFloor.Where(x => x != null && Gamemap.TilesTouching(
x.Coordinate, roomUser.Point) && x.Data.InteractionType == Items.InteractionType.DICE).ToList();
if(userBooth.Count != 5)
{
Session.SendWhisper("You must be in a booth with 5 dice.");
return;
}
userBooth.ForEach(x => {
x.ExtraData = "0";
x.UpdateState();
});
Session.SendWhisper("Your booth dice have been closed");
}
}
}
and next you want to register the command so go to CommandManager.cs and find
Code:
this.Register("disablemimic", new DisableMimicCommand());
Code:
this.Register("closedice", new CloseDiceCommand());
Configuration Options
You can easily remove the 5 die limit by removing the following lines in the CloseDiceCommand;
Code:
if(userBooth.Count != 5)
{
Session.SendWhisper("You must be in a booth with 5 dice.");
return;
}
You can also create other commands like :rollall which will roll all the dice around you. Just modify;
Code:
userBooth.ForEach(x => {
x.ExtraData = "0";
x.UpdateState();
});
An example would be
Code:
userBooth.ForEach(x => {
x.ExtraData = Rand.SeedNext(1, 6).ToString();
x.UpdateState();
});
Other Commands
:rig <number> - Allows you to rig the next dice roll.Here is :rig <number> command. Not a fan of rigging but can be used for staff to set dice for events; e.g. rare grabber, etc. This was a request.
First go to InteractorDice.cs and find
and replace it with
Next go to Habbo.cs and find
and below this put
Then create a new command called RigCommand.cs and put the following
Next go to ChatManager.cs and find
and then below this add
First go to InteractorDice.cs and find
Code:
Item.ExtraData = "-1";
Code:
Item.ExtraData = Session.GetHabbo().riggedRoll;
Session.GetHabbo().riggedRoll = "-1";
Next go to Habbo.cs and find
Code:
private static readonly ILog log = LogManager.GetLogger("Plus.HabboHotel.Users");
Code:
public string riggedRoll { get; set; } = "-1";
Then create a new command called RigCommand.cs and put the following
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
class RigCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_rig_dice"; }
}
public string Parameters
{
get { return "%number%"; }
}
public string Description
{
get { return "Rig a die roll."; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
int RollId = 0;
if (Params.Length == 0 && !int.TryParse(Params[0], out RollId))
{
Session.SendWhisper("Please enter a valid roll id.");
return;
}
Session.GetHabbo().riggedRoll = Params[0];
Session.SendWhisper($"Your next die roll will be {Params[0]}");
}
}
}
Next go to ChatManager.cs and find
Code:
this.Register("disablemimic", new DisableMimicCommand());
Code:
this.Register("rig", new RigCommand());
Last edited: