[PLUS EMU] Super Wired: Give Diamonds [R2]

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Hello anyone,
Today I will share with you my creation. A simple wired effect can send an amount of diamonds. The amount could be positive and negative.

1) Open your Emulator solution, go to HabboHotel\Items\Wired\Boxes\Effects and create a new class with this name: GiveDiamondsBox.cs and inside this class paste this content:
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Collections.Concurrent;

using Plus.Communication.Packets.Incoming;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Users;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;

namespace Plus.HabboHotel.Items.Wired.Boxes.Effects
{
    class GiveDiamondsBox : IWiredItem
    {
        public Room Instance { get; set; }

        public Item Item { get; set; }

        public WiredBoxType Type { get { return WiredBoxType.EffectGiveDiamonds; } }

        public ConcurrentDictionary<int, Item> SetItems { get; set; }

        public string StringData { get; set; }

        public bool BoolData { get; set; }

        public string ItemsData { get; set; }

        public GiveDiamondsBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();
        }

        public void HandleSave(ClientPacket Packet)
        {
            int Unknown = Packet.PopInt();
            string Coin = Packet.PopString();

            this.StringData = Coin;
        }

        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
                return false;

            Habbo Owner = PlusEnvironment.GetHabboById(Item.UserID);
            if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards"))
                return false;

            Habbo Player = (Habbo)Params[0];
            if (Player == null || Player.GetClient() == null)
                return false;

            RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username);
            if (User == null)
                return false;

            if (String.IsNullOrEmpty(StringData))
                return false;

            int Amount;
            Amount = Convert.ToInt32(StringData);
            if (Amount > 100)
            {
                Player.GetClient().SendNotification("You can't send +100 diamonds.");
                return false;
            }
            else
            {
                Player.GetClient().GetHabbo().Diamonds += Amount;
                Player.GetClient().SendPacket(new HabboActivityPointNotificationComposer(Player.GetClient().GetHabbo().Diamonds, Amount, 5));
                Player.GetClient().SendWhisper("Amazing! You've obtained " + Amount.ToString() + " diamonds!", 34); //Marko97

                return true;
            }
        }
    }
}

2) Go to HabboHotel\Items\Wired and inside the class WiredBoxType.cs after this line
Code:
EffectExecuteWiredStacks,
add
Code:
EffectGiveDiamonds,

3) Go to HabboHotel\Items\Wired and inside the class WiredBoxTypeUtility.cs after this line
Code:
case 61:
return WiredBoxType.EffectGiveUserBadge;
add
Code:
case 62:
return WiredBoxType.EffectGiveDiamonds;
AND after this line (return 7)
Code:
case WiredBoxType.EffectSetRollerSpeed:
add
Code:
case WiredBoxType.EffectGiveDiamonds:

4)
Go to HabboHotel\Rooms\Instance and inside the class WiredComponent.cs after this line
Code:
case WiredBoxType.EffectMuteTriggerer:
return new MuteTriggererBox(_room, Item);
add
Code:
case WiredBoxType.EffectGiveDiamonds:
return new GiveDiamondsBox(_room, Item);

You need to download the SQL and SWF file. For download .
VirusTotal: .

SECURITY ISSUE:
All users can modify and use this wired! Follow this fix:
Go to SaveWiredConfigEvent.cs and search this (row 39)
Code:
            if (Box.Type == WiredBoxType.EffectGiveUserBadge && !Session.GetHabbo().GetPermissions().HasRight("room_item_wired_rewards"))
            {
                Session.SendNotification("You don't have the correct permissions to do this.");
                return;
            }
Add under this:
Code:
            if (Box.Type == WiredBoxType.EffectGiveDiamonds && !Session.GetHabbo().GetPermissions().HasRight("room_item_wired_rewards"))
            {
                Session.SendNotification("You don't have the correct permissions to do this.");
                return;
            }
fix.png

SCREENSHOT AND GIF
Ms9T1Jp.png
y7KB2RE.png
CIevQ3g.png
GIF: .

If I helped you, send a like :)
 
Last edited:

Darkle

Member
Jul 13, 2017
52
15
if you'd like to make it a little more noob friendly add to do after you add it. e.g emu restart update furni update cata, but thank you for this saved me the hassle.
 

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
if you'd like to make it a little more noob friendly add to do after you add it. e.g emu restart update furni update cata, but thank you for this saved me the hassle.
No because if you change the code of your emulator you're bound to restart the emulator with the new source, if anything you need to clear the cache for furnidata.xml :)
 
EDIT: APPLIED FIX FOR SECURITY ISSUE!
 

LukeFosterZ

Member
Dec 22, 2016
89
11
Namespace error? any help?
 
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'GiveDiamondsBox' could not be found (are you missing a using directive or an assembly reference?) Plus Emulator C:\Users\Administrator\Desktop\Emulator Source\HabboHotel\Rooms\Instance\WiredComponent.cs 173 Active
 

Queso

echo 'Web Developer';
Nov 29, 2016
232
72
@LukeFosterZ Go to HabboHotel\Rooms\Instance\WiredComponent.cs
In that class, search for this
case WiredBoxType.EffectMuteTriggerer:
Under
return new MuteTriggererBox(_room, Item);
Add this
Code:
case WiredBoxType.EffectGiveDiamonds:
return new GiveDiamondsBox(_room, Item);
 

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Search in GiveDiamondsBox.cs if you have this code:
Code:
        public GiveDiamondsBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();
        }
If you haven't GiveDiamondsBox (in public [...]) but another name you need to insert the correct name in WiredBoxComponent.cs for example
Code:
case WiredBoxType.EffectGiveDiamonds:
return new NAME(_room, Item);
In new NAME insert the correct name founded in GiveDiamondsBox.cs
 
Last edited:

cammy

Member
May 15, 2014
481
237
I have plus emu R1 My bad Hahahaha @Queso
This worked for me and I'm using R1.

Great release, thanks!
 
Can anyone help me? I tried changing it to give credits, it doesn't throw any errors however it's still giving me Diamonds.
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Collections.Concurrent;

using Plus.Communication.Packets.Incoming;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Users;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;

namespace Plus.HabboHotel.Items.Wired.Boxes.Effects
{
class GiveCreditsBox : IWiredItem
{
public Room Instance { get; set; }

public Item Item { get; set; }

public WiredBoxType Type { get { return WiredBoxType.EffectGiveCredits; } }

public ConcurrentDictionary<int, Item> SetItems { get; set; }

public string StringData { get; set; }

public bool BoolData { get; set; }

public string ItemsData { get; set; }

public GiveCreditsBox(Room Instance, Item Item)
{
this.Instance = Instance;
this.Item = Item;
this.SetItems = new ConcurrentDictionary<int, Item>();
}

public void HandleSave(ClientPacket Packet)
{
int Unknown = Packet.PopInt();
string Coin = Packet.PopString();

this.StringData = Coin;
}

public bool Execute(params object[] Params)
{
if (Params == null || Params.Length == 0)
return false;

Habbo Owner = PlusEnvironment.GetHabboById(Item.UserID);
if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards"))
return false;

Habbo Player = (Habbo)Params[0];
if (Player == null || Player.GetClient() == null)
return false;

RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username);
if (User == null)
return false;

if (String.IsNullOrEmpty(StringData))
return false;

int Amount;
Amount = Convert.ToInt32(StringData);
if (Amount > 10001)
{
Player.GetClient().SendNotification("You can't send +10000 credits.");
return false;
}
else
{
Player.GetClient().GetHabbo().Credits += Amount;
Player.GetClient().SendMessage(new CreditBalanceComposer(Player.GetClient().GetHabbo().Credits));

return true;
}
}
}
}
EDIT: nvm I'm an idiot. :)
 
Last edited:

tobi3591

Member
Mar 16, 2018
79
19
Okay, i got the wired inside my client, and i can place it in the room, but the UI isn't opening.
I have done all your steps, anyone have the same issue?
Thanks
 

Users who are viewing this thread

Top