Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[PlusEMU] Close Dice Wired (and more)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="ZealousOtter" data-source="post: 405803" data-attributes="member: 74321"><p>Hey all. As title suggests, this is a new wired box to close dicemasters. Just like it sounds it will do this:</p><p></p><p>[MEDIA=gfycat]</p><p>height=150;id=AridHauntingAfricanmolesnake;width=300[/MEDIA]</p><p></p><p></p><p>First, we're going to want to add the CloseDice wired effect. Create a new file <em>CloseDiceBox.cs </em>in the <em>/HabboHotel/Items/Wired/Boxes/Effects/ </em>directory, and add the following:</p><p></p><p><em>(CloseDiceBox.cs)</em></p><p>[CODE]</p><p>using System;</p><p>using System.Linq;</p><p>using System.Collections.Concurrent;</p><p></p><p>using Plus.Communication.Packets.Incoming;</p><p>using Plus.HabboHotel.Rooms;</p><p></p><p>namespace Plus.HabboHotel.Items.Wired.Boxes.Effects</p><p>{</p><p> class CloseDiceBox : IWiredItem, IWiredCycle</p><p> {</p><p> public Room Instance { get; set; }</p><p> public Item Item { get; set; }</p><p> public WiredBoxType Type { get { return WiredBoxType.EffectCloseDice; } }</p><p> public ConcurrentDictionary<int, Item> SetItems { get; set; }</p><p> public int TickCount { get; set; }</p><p> public string StringData { get; set; }</p><p> public bool BoolData { get; set; }</p><p> public int Delay { get { return this._delay; } set { this._delay = value; this.TickCount = value; } }</p><p> public string ItemsData { get; set; }</p><p></p><p> private long _next;</p><p> private int _delay = 0;</p><p> private bool Requested = false;</p><p></p><p> public CloseDiceBox(Room Instance, Item Item)</p><p> {</p><p> this.Instance = Instance;</p><p> this.Item = Item;</p><p> this.SetItems = new ConcurrentDictionary<int, Item>();</p><p> }</p><p></p><p> public void HandleSave(ClientPacket Packet)</p><p> {</p><p> this.SetItems.Clear();</p><p> int Unknown = Packet.PopInt();</p><p> string Unknown2 = Packet.PopString();</p><p></p><p> int FurniCount = Packet.PopInt();</p><p> for (int i = 0; i < FurniCount; i++)</p><p> {</p><p> Item SelectedItem = Instance.GetRoomItemHandler().GetItem(Packet.PopInt());</p><p> if (SelectedItem != null)</p><p> SetItems.TryAdd(SelectedItem.Id, SelectedItem);</p><p> }</p><p></p><p> int Delay = Packet.PopInt();</p><p> this.Delay = Delay;</p><p> }</p><p></p><p> public bool Execute(params object[] Params)</p><p> {</p><p> if (this._next == 0 || this._next < PlusEnvironment.Now())</p><p> this._next = PlusEnvironment.Now() + this.Delay;</p><p></p><p> this.Requested = true;</p><p> this.TickCount = Delay;</p><p> return true;</p><p> }</p><p></p><p> public bool OnCycle()</p><p> {</p><p> if (this.SetItems.Count == 0 || !Requested)</p><p> return false;</p><p></p><p> long Now = PlusEnvironment.Now();</p><p> if (_next < Now)</p><p> {</p><p> foreach (Item Item in this.SetItems.Values.ToList())</p><p> {</p><p> if (Item == null)</p><p> continue;</p><p></p><p> if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item))</p><p> {</p><p> Item n = null;</p><p> SetItems.TryRemove(Item.Id, out n);</p><p> continue;</p><p> }</p><p></p><p> Item.ExtraData = "0";</p><p> Item.UpdateState();</p><p> }</p><p></p><p> Requested = false;</p><p></p><p> this._next = 0;</p><p> this.TickCount = Delay;</p><p> </p><p> }</p><p> return true;</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p></p><p>Next, adding the effect we just created to the <em>WiredBoxType.cs</em> file, located in the <em>/HabboHotel/Items/Wired/ </em>directory.</p><p></p><p>Right below the line:</p><p>(<em>WiredBoxType.cs)</em></p><p>[CODE]</p><p>EffectExecuteWiredStacks,</p><p>[/CODE]</p><p></p><p>Add the new effect:</p><p>(<em>WiredBoxType.cs)</em></p><p>[CODE]</p><p>EffectCloseDice,</p><p>[/CODE]</p><p></p><p></p><p>We will also need to update the<em> WiredBoxTypeUtility.cs </em>file, found in the <em>/HabboHotel/Items/Wired/</em> directory:</p><p></p><p>In the FromWiredId method, below the lines:</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case 61:</p><p> return WiredBoxType.EffectGiveUserBadge;</p><p>[/CODE]</p><p></p><p>Add a new switch for the close dice effect:</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case 62:</p><p> return WiredBoxType.EffectCloseDice;</p><p>[/CODE]</p><p></p><p></p><p>Then, in the GetWiredId method, below the line:</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.TriggerStateChanges:</p><p>[/CODE]</p><p></p><p>Add a new case so that will return '4':</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectCloseDice:</p><p>[/CODE]</p><p></p><p></p><p>Finally, update the <em>WiredComponent.cs</em> file in the <em>/HabboHotel/Rooms/Instance/ </em>directory:</p><p></p><p>In the GenerateNewBox method, below the lines:</p><p>(<em>WiredComponent.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectMuteTriggerer:</p><p> return new MuteTriggererBox(_room, Item);</p><p>[/CODE]</p><p></p><p>Add the lines:</p><p>(<em>WiredComponent.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectCloseDice:</p><p> return new CloseDiceBox(_room, Item);</p><p>[/CODE]</p><p></p><p></p><p>Now, just make the effect is being compiled by adding it to <em>Plus Emulator.csproj</em>:</p><p></p><p>(<em>Plus Emulator.csproj)</em></p><p>[CODE]</p><p><Compile Include="HabboHotel\Items\Wired\Boxes\Effects\CloseDiceBox.cs" /></p><p>[/CODE]</p><p></p><p></p><p>Now that the code of the feature is setup, we will just need the furniture for the new wired box. I have made a very simple custom SWF for the necessary functionality (it's not the prettiest thing, but hey, I never claimed to be a designer). Download all of the furni files here:</p><p><a href="http://www.mediafire.com/file/dzoa54b8p1dbzw8/wf_act_closes_dices.zip" target="_blank">http://www.mediafire.com/file/dzoa54b8p1dbzw8/wf_act_closes_dices.zip</a></p><p></p><p>Add the SWF file to your <em>/dcr/hof_furni/ </em>directory, and add the icon file to the <em>/dcr/hof_furni/icons/ </em>folder. You will also need to add the furnidata provided to your <em>furnidata.xml </em>file, add the productdata to your <em>productdata.txt</em>, and then add the records to the furniture and catalog_items tables in the DB using the SQL inserts. That's all in the download, but here they are as well:</p><p>[SPOILER]</p><p>(<em>furnidata.xml</em>)</p><p><em>[CODE]</em></p><p><em><furnitype id="49249" classname="wf_act_closes_dices"></em></p><p><em> <revision>50950</revision></em></p><p><em> <defaultdir>0</defaultdir></em></p><p><em> <xdim>1</xdim></em></p><p><em> <ydim>1</ydim></em></p><p><em> <partcolors/></em></p><p><em> <name>WIRED Effect: Close Dice</name></em></p><p><em> <description>This effect closes the selected Dicemasters.</description></em></p><p><em> <adurl></adurl></em></p><p><em> <offerid>49249</offerid></em></p><p><em> <buyout>1</buyout></em></p><p><em> <rentofferid>-1</rentofferid></em></p><p><em> <rentbuyout>0</rentbuyout></em></p><p><em> <bc>0</bc></em></p><p><em> <excludeddynamic>0</excludeddynamic></em></p><p><em> <customparams>0</customparams></em></p><p><em> <specialtype>1</specialtype></em></p><p><em> <canstandon>1</canstandon></em></p><p><em> <cansiton>0</cansiton></em></p><p><em> <canlayon>0</canlayon></em></p><p><em> <furniline>wired</furniline></em></p><p><em></furnitype></em></p><p><em>[/CODE]</em></p><p>(<em>productdata.txt</em>)</p><p><em>[CODE]</em></p><p><em>["wf_act_closes_dices","WIRED Effect: Close Dice","This effect closes the selected Dicemasters."]</em></p><p><em>[/CODE]</em></p><p>(<em>SQL)</em></p><p><em>[CODE]</em></p><p><em>INSERT INTO `furniture` (`id`, `item_name`, `public_name`, `type`, `width`, `length`, `stack_height`, `can_stack`, `can_sit`, `is_walkable`, `sprite_id`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `interaction_modes_count`, `vending_ids`, `height_adjustable`, `effect_id`, `wired_id`, `is_rare`, `clothing_id`, `extra_rot`)</em></p><p><em>VALUES</em></p><p><em> (49249, 'wf_act_closes_dices', 'WIRED Effect: Close Dice', 's', 1, 1, 0.65, '1', '0', '1', 49249, '1', '1', '1', '1', '1', 'wired_effect', 2, '0', '0', 0, 62, '0', 0, '0');</em></p><p><em></em></p><p><em>INSERT INTO `catalog_items` (`id`, `page_id`, `item_id`, `catalog_name`, `cost_credits`, `cost_pixels`, `cost_diamonds`, `amount`, `limited_sells`, `limited_stack`, `offer_active`, `extradata`, `badge`, `offer_id`)</em></p><p><em>VALUES</em></p><p><em> (49249, 303, '49249', 'WIRED Effect: Close Dice', 3, 0, 0, 1, 0, 0, '1', '', '', 49249);</em></p><p><em>[/CODE]</em></p><p>[/SPOILER]</p><p><em></em></p><p><em>All feedback appreciated. Feel free to edit the code and SWF as needed to your liking.</em></p><p><em><img src="http://i.imgur.com/qwEO52H.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </em></p><p><em></em></p><p><em></em></p><p></p><p>---------</p><p>EDIT: Here is also wired for Freeze and Unfreeze User</p><p>[SPOILER]</p><p>Here are 2 wireds for Freeze User and Unfreeze User.</p><p></p><p>Screenshots and gif:</p><p>[SPOILER]</p><p>[MEDIA=gfycat]height=304;id=RareTheseFlyingsquirrel;width=289[/MEDIA]</p><p><img src="https://i.imgur.com/78Zyy9s.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p>[/SPOILER]</p><p></p><p>Adding the code for these are similar to what we just did for the close dice wired.</p><p></p><p>Create two new files <em>FreezeUserBox.cs and Unf<em>eezeUserBox.cs</em> </em>in the <em>/HabboHotel/Items/Wired/Boxes/Effects/ </em>directory, and add the following:</p><p></p><p><em>(<em>FreezeUserBox</em>.cs)</em></p><p>[CODE]</p><p>using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Concurrent;</p><p></p><p>using Plus.Communication.Packets.Incoming;</p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.Users;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p></p><p>namespace Plus.HabboHotel.Items.Wired.Boxes.Effects</p><p>{</p><p> class FreezeUserBox : IWiredItem</p><p> {</p><p> public Room Instance { get; set; }</p><p> public Item Item { get; set; }</p><p> public WiredBoxType Type { get { return WiredBoxType.EffectFreezeUser; } }</p><p> public ConcurrentDictionary<int, Item> SetItems { get; set; }</p><p> public string StringData { get; set; }</p><p> public bool BoolData { get; set; }</p><p> public string ItemsData { get; set; }</p><p></p><p> public FreezeUserBox(Room Instance, Item Item)</p><p> {</p><p> this.Instance = Instance;</p><p> this.Item = Item;</p><p> this.SetItems = new ConcurrentDictionary<int, Item>();</p><p></p><p> if (this.SetItems.Count > 0)</p><p> this.SetItems.Clear();</p><p> }</p><p></p><p> public void HandleSave(ClientPacket Packet)</p><p> {</p><p> if (this.SetItems.Count > 0)</p><p> this.SetItems.Clear();</p><p></p><p> int Unknown = Packet.PopInt();</p><p> string Message = Packet.PopString();</p><p></p><p> this.StringData = Message;</p><p> Console.Write(Packet.PopInt());</p><p></p><p> }</p><p></p><p> public bool Execute(params object[] Params)</p><p> {</p><p> if (Params.Length != 1)</p><p> return false;</p><p></p><p> Habbo Player = (Habbo)Params[0];</p><p> </p><p> if (Player == null)</p><p> return false;</p><p></p><p> RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id);</p><p> Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0));</p><p> User.Frozen = true;</p><p></p><p> return true;</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p><em></em></p><p><em><em>(Unf<em>reezeUserBox</em>.cs)</em></em></p><p>[CODE]</p><p>using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Concurrent;</p><p></p><p>using Plus.Communication.Packets.Incoming;</p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.Users;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p></p><p>namespace Plus.HabboHotel.Items.Wired.Boxes.Effects</p><p>{</p><p> class UnfreezeUserBox : IWiredItem</p><p> {</p><p> public Room Instance { get; set; }</p><p> public Item Item { get; set; }</p><p> public WiredBoxType Type { get { return WiredBoxType.EffectUnfreezeUser; } }</p><p> public ConcurrentDictionary<int, Item> SetItems { get; set; }</p><p> public string StringData { get; set; }</p><p> public bool BoolData { get; set; }</p><p> public string ItemsData { get; set; }</p><p></p><p> public UnfreezeUserBox(Room Instance, Item Item)</p><p> {</p><p> this.Instance = Instance;</p><p> this.Item = Item;</p><p> this.SetItems = new ConcurrentDictionary<int, Item>();</p><p></p><p> if (this.SetItems.Count > 0)</p><p> this.SetItems.Clear();</p><p> }</p><p></p><p> public void HandleSave(ClientPacket Packet)</p><p> {</p><p> int Unknown = Packet.PopInt();</p><p> string Message = Packet.PopString();</p><p></p><p> this.StringData = Message;</p><p> }</p><p></p><p> public bool Execute(params object[] Params)</p><p> {</p><p> if (Params.Length != 1)</p><p> return false;</p><p></p><p> Habbo Player = (Habbo)Params[0];</p><p> </p><p> if (Player == null)</p><p> return false;</p><p></p><p> RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id);</p><p> Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0));</p><p> User.Frozen = false;</p><p></p><p> return true;</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p><em></em></p><p><em></em></p><p>Once you have those two files created, do the same changes we did before. In the <em>WiredBoxType.cs</em> file, located in the <em>/HabboHotel/Items/Wired/ </em>directory.</p><p>Right below the line (or any line):</p><p><em>(WiredBoxType.cs)</em></p><p>[CODE]</p><p>EffectCloseDice,</p><p>[/CODE]</p><p></p><p>Add the new effects:</p><p><em>(WiredBoxType.cs)</em></p><p>[CODE]</p><p>EffectFreezeUser,</p><p>EffectUnfreezeUser,</p><p>[/CODE]</p><p></p><p></p><p>Go to the <em>WiredBoxTypeUtility.cs </em>file, in the <em>/HabboHotel/Items/Wired/</em> directory.</p><p>In the FromWiredId method, below the lines (or would be under EffectGiveUserBadge if close dice isn't added):</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case 62:</p><p> return WiredBoxType.EffectCloseDice;</p><p>[/CODE]</p><p></p><p>Add these lines:</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case 63:</p><p> return WiredBoxType.EffectFreezeUser;</p><p>case 64:</p><p> return WiredBoxType.EffectUnfreezeUser;</p><p>[/CODE]</p><p></p><p></p><p>Then, in the same file in the GetWiredId method, below the line:</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectSetRollerSpeed:</p><p>[/CODE]</p><p></p><p>Add the two new box types:</p><p>(<em>WiredBoxTypeUtility.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectFreezeUser:</p><p>case WiredBoxType.EffectUnfreezeUser:</p><p>[/CODE]</p><p></p><p></p><p>Update the <em>WiredComponent.cs</em> file in the <em>/HabboHotel/Rooms/Instance/ </em>directory:</p><p>In the GenerateNewBox method, below the lines:</p><p>(<em>WiredComponent.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectMuteTriggerer:</p><p> return new MuteTriggererBox(_room, Item);</p><p>[/CODE]</p><p></p><p>Add the lines:</p><p>(<em>WiredComponent.cs)</em></p><p>[CODE]</p><p>case WiredBoxType.EffectFreezeUser:</p><p> return new FreezeUserBox(_room, Item);</p><p>case WiredBoxType.EffectUnfreezeUser:</p><p> return new UnfreezeUserBox(_room, Item);</p><p>[/CODE]</p><p></p><p></p><p>Again, make sure these effects are being compiled by adding them to <em>Plus Emulator.csproj</em>:</p><p>(<em>Plus Emulator.csproj)</em></p><p>[CODE]</p><p><Compile Include="HabboHotel\Items\Wired\Boxes\Effects\FreezeUserBox.cs" /></p><p><Compile Include="HabboHotel\Items\Wired\Boxes\Effects\UnfreezeUserBox.cs" /></p><p>[/CODE]</p><p></p><p></p><p></p><p>And again, here are the productdata and SQL inserts for creating the necessary furni. Also, the SWFs that I threw together quickly. Add all this stuff the same way mentioned in the original post.</p><p><a href="http://www.mediafire.com/file/x21uoxrwtiz4n87/freeze+and+unfreeze+wired.zip" target="_blank">http://www.mediafire.com/file/x21uoxrwtiz4n87/freeze+and+unfreeze+wired.zip</a></p><p></p><p>[SPOILER]</p><p>wf_act_freeze_user</p><p>[CODE]</p><p>--SQL--</p><p></p><p>INSERT INTO `furniture` (`id`, `item_name`, `public_name`, `type`, `width`, `length`, `stack_height`, `can_stack`, `can_sit`, `is_walkable`, `sprite_id`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `interaction_modes_count`, `vending_ids`, `height_adjustable`, `effect_id`, `wired_id`, `is_rare`, `clothing_id`, `extra_rot`)</p><p>VALUES</p><p> (49248, 'wf_act_freeze_user', 'WIRED Effect: Freeze User', 's', 1, 1, 0.65, '1', '0', '1', 49248, '1', '1', '1', '1', '1', 'wired_effect', 2, '0', '0', 0, 63, '0', 0, '0');</p><p></p><p></p><p>INSERT INTO `catalog_items` (`id`, `page_id`, `item_id`, `catalog_name`, `cost_credits`, `cost_pixels`, `cost_diamonds`, `amount`, `limited_sells`, `limited_stack`, `offer_active`, `extradata`, `badge`, `offer_id`)</p><p>VALUES</p><p> (49248, 303, '49248', 'WIRED Effect: Freeze User', 3, 0, 0, 1, 0, 0, '1', '', '', 49248);</p><p></p><p>--furnidata.xml--</p><p></p><p><furnitype id="49248" classname="wf_act_freeze_user"></p><p> <revision>50950</revision></p><p> <defaultdir>0</defaultdir></p><p> <xdim>1</xdim></p><p> <ydim>1</ydim></p><p> <partcolors/></p><p> <name>WIRED Effect: Freeze User</name></p><p> <description>This effect freezes a user depending on the triggering criteria.</description></p><p> <adurl></adurl></p><p> <offerid>-1</offerid></p><p> <buyout>1</buyout></p><p> <rentofferid>-1</rentofferid></p><p> <rentbuyout>0</rentbuyout></p><p> <bc>0</bc></p><p> <excludeddynamic>0</excludeddynamic></p><p> <customparams>0</customparams></p><p> <specialtype>1</specialtype></p><p> <canstandon>1</canstandon></p><p> <cansiton>0</cansiton></p><p> <canlayon>0</canlayon></p><p> <furniline>wired</furniline></p><p></furnitype></p><p></p><p>--productdata.txt--</p><p></p><p>["wf_act_freeze_user","WIRED Effect: Freeze User","This effect freezes a user depending on the triggering criteria."]</p><p>[/CODE]</p><p></p><p></p><p>wf_act_unfreeze_us</p><p>[CODE]</p><p>--SQL--</p><p></p><p>INSERT INTO `furniture` (`id`, `item_name`, `public_name`, `type`, `width`, `length`, `stack_height`, `can_stack`, `can_sit`, `is_walkable`, `sprite_id`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `interaction_modes_count`, `vending_ids`, `height_adjustable`, `effect_id`, `wired_id`, `is_rare`, `clothing_id`, `extra_rot`)</p><p>VALUES</p><p> (49247, 'wf_act_unfreeze_us', 'WIRED Effect: Unfreeze User', 's', 1, 1, 0.65, '1', '0', '1', 49247, '1', '1', '1', '1', '1', 'wired_effect', 2, '0', '0', 0, 64, '0', 0, '0');</p><p></p><p>INSERT INTO `catalog_items` (`id`, `page_id`, `item_id`, `catalog_name`, `cost_credits`, `cost_pixels`, `cost_diamonds`, `amount`, `limited_sells`, `limited_stack`, `offer_active`, `extradata`, `badge`, `offer_id`)</p><p>VALUES</p><p> (49247, 303, '49247', 'WIRED Effect: Unfreeze User', 3, 0, 0, 1, 0, 0, '1', '', '', 49247);</p><p></p><p>--furnidata.xml--</p><p></p><p><furnitype id="49247" classname="wf_act_unfreeze_us"></p><p> <revision>50950</revision></p><p> <defaultdir>0</defaultdir></p><p> <xdim>1</xdim></p><p> <ydim>1</ydim></p><p> <partcolors/></p><p> <name>WIRED Effect: Unfreeze User</name></p><p> <description>This effect unfreezes a user depending on the triggering criteria.</description></p><p> <adurl></adurl></p><p> <offerid>-1</offerid></p><p> <buyout>1</buyout></p><p> <rentofferid>-1</rentofferid></p><p> <rentbuyout>0</rentbuyout></p><p> <bc>0</bc></p><p> <excludeddynamic>0</excludeddynamic></p><p> <customparams>0</customparams></p><p> <specialtype>1</specialtype></p><p> <canstandon>1</canstandon></p><p> <cansiton>0</cansiton></p><p> <canlayon>0</canlayon></p><p> <furniline>wired</furniline></p><p></furnitype></p><p></p><p>--productdata.txt--</p><p></p><p>["wf_act_unfreeze_us","WIRED Effect: Unfreeze User","This effect unfreezes a user depending on the triggering criteria."]</p><p>[/CODE][/SPOILER]</p><p>[/SPOILER]</p></blockquote><p></p>
[QUOTE="ZealousOtter, post: 405803, member: 74321"] Hey all. As title suggests, this is a new wired box to close dicemasters. Just like it sounds it will do this: [MEDIA=gfycat] height=150;id=AridHauntingAfricanmolesnake;width=300[/MEDIA] First, we're going to want to add the CloseDice wired effect. Create a new file [I]CloseDiceBox.cs [/I]in the [I]/HabboHotel/Items/Wired/Boxes/Effects/ [/I]directory, and add the following: [I](CloseDiceBox.cs)[/I] [CODE] using System; using System.Linq; using System.Collections.Concurrent; using Plus.Communication.Packets.Incoming; using Plus.HabboHotel.Rooms; namespace Plus.HabboHotel.Items.Wired.Boxes.Effects { class CloseDiceBox : IWiredItem, IWiredCycle { public Room Instance { get; set; } public Item Item { get; set; } public WiredBoxType Type { get { return WiredBoxType.EffectCloseDice; } } public ConcurrentDictionary<int, Item> SetItems { get; set; } public int TickCount { get; set; } public string StringData { get; set; } public bool BoolData { get; set; } public int Delay { get { return this._delay; } set { this._delay = value; this.TickCount = value; } } public string ItemsData { get; set; } private long _next; private int _delay = 0; private bool Requested = false; public CloseDiceBox(Room Instance, Item Item) { this.Instance = Instance; this.Item = Item; this.SetItems = new ConcurrentDictionary<int, Item>(); } public void HandleSave(ClientPacket Packet) { this.SetItems.Clear(); int Unknown = Packet.PopInt(); string Unknown2 = Packet.PopString(); int FurniCount = Packet.PopInt(); for (int i = 0; i < FurniCount; i++) { Item SelectedItem = Instance.GetRoomItemHandler().GetItem(Packet.PopInt()); if (SelectedItem != null) SetItems.TryAdd(SelectedItem.Id, SelectedItem); } int Delay = Packet.PopInt(); this.Delay = Delay; } public bool Execute(params object[] Params) { if (this._next == 0 || this._next < PlusEnvironment.Now()) this._next = PlusEnvironment.Now() + this.Delay; this.Requested = true; this.TickCount = Delay; return true; } public bool OnCycle() { if (this.SetItems.Count == 0 || !Requested) return false; long Now = PlusEnvironment.Now(); if (_next < Now) { foreach (Item Item in this.SetItems.Values.ToList()) { if (Item == null) continue; if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item)) { Item n = null; SetItems.TryRemove(Item.Id, out n); continue; } Item.ExtraData = "0"; Item.UpdateState(); } Requested = false; this._next = 0; this.TickCount = Delay; } return true; } } } [/CODE] Next, adding the effect we just created to the [I]WiredBoxType.cs[/I] file, located in the [I]/HabboHotel/Items/Wired/ [/I]directory. Right below the line: ([I]WiredBoxType.cs)[/I] [CODE] EffectExecuteWiredStacks, [/CODE] Add the new effect: ([I]WiredBoxType.cs)[/I] [CODE] EffectCloseDice, [/CODE] We will also need to update the[I] WiredBoxTypeUtility.cs [/I]file, found in the [I]/HabboHotel/Items/Wired/[/I] directory: In the FromWiredId method, below the lines: ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case 61: return WiredBoxType.EffectGiveUserBadge; [/CODE] Add a new switch for the close dice effect: ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case 62: return WiredBoxType.EffectCloseDice; [/CODE] Then, in the GetWiredId method, below the line: ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case WiredBoxType.TriggerStateChanges: [/CODE] Add a new case so that will return '4': ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case WiredBoxType.EffectCloseDice: [/CODE] Finally, update the [I]WiredComponent.cs[/I] file in the [I]/HabboHotel/Rooms/Instance/ [/I]directory: In the GenerateNewBox method, below the lines: ([I]WiredComponent.cs)[/I] [CODE] case WiredBoxType.EffectMuteTriggerer: return new MuteTriggererBox(_room, Item); [/CODE] Add the lines: ([I]WiredComponent.cs)[/I] [CODE] case WiredBoxType.EffectCloseDice: return new CloseDiceBox(_room, Item); [/CODE] Now, just make the effect is being compiled by adding it to [I]Plus Emulator.csproj[/I]: ([I]Plus Emulator.csproj)[/I] [CODE] <Compile Include="HabboHotel\Items\Wired\Boxes\Effects\CloseDiceBox.cs" /> [/CODE] Now that the code of the feature is setup, we will just need the furniture for the new wired box. I have made a very simple custom SWF for the necessary functionality (it's not the prettiest thing, but hey, I never claimed to be a designer). Download all of the furni files here: [URL]http://www.mediafire.com/file/dzoa54b8p1dbzw8/wf_act_closes_dices.zip[/URL] Add the SWF file to your [I]/dcr/hof_furni/ [/I]directory, and add the icon file to the [I]/dcr/hof_furni/icons/ [/I]folder. You will also need to add the furnidata provided to your [I]furnidata.xml [/I]file, add the productdata to your [I]productdata.txt[/I], and then add the records to the furniture and catalog_items tables in the DB using the SQL inserts. That's all in the download, but here they are as well: [SPOILER] ([I]furnidata.xml[/I]) [I][CODE] <furnitype id="49249" classname="wf_act_closes_dices"> <revision>50950</revision> <defaultdir>0</defaultdir> <xdim>1</xdim> <ydim>1</ydim> <partcolors/> <name>WIRED Effect: Close Dice</name> <description>This effect closes the selected Dicemasters.</description> <adurl></adurl> <offerid>49249</offerid> <buyout>1</buyout> <rentofferid>-1</rentofferid> <rentbuyout>0</rentbuyout> <bc>0</bc> <excludeddynamic>0</excludeddynamic> <customparams>0</customparams> <specialtype>1</specialtype> <canstandon>1</canstandon> <cansiton>0</cansiton> <canlayon>0</canlayon> <furniline>wired</furniline> </furnitype> [/CODE][/I] ([I]productdata.txt[/I]) [I][CODE] ["wf_act_closes_dices","WIRED Effect: Close Dice","This effect closes the selected Dicemasters."] [/CODE][/I] ([I]SQL) [CODE] INSERT INTO `furniture` (`id`, `item_name`, `public_name`, `type`, `width`, `length`, `stack_height`, `can_stack`, `can_sit`, `is_walkable`, `sprite_id`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `interaction_modes_count`, `vending_ids`, `height_adjustable`, `effect_id`, `wired_id`, `is_rare`, `clothing_id`, `extra_rot`) VALUES (49249, 'wf_act_closes_dices', 'WIRED Effect: Close Dice', 's', 1, 1, 0.65, '1', '0', '1', 49249, '1', '1', '1', '1', '1', 'wired_effect', 2, '0', '0', 0, 62, '0', 0, '0'); INSERT INTO `catalog_items` (`id`, `page_id`, `item_id`, `catalog_name`, `cost_credits`, `cost_pixels`, `cost_diamonds`, `amount`, `limited_sells`, `limited_stack`, `offer_active`, `extradata`, `badge`, `offer_id`) VALUES (49249, 303, '49249', 'WIRED Effect: Close Dice', 3, 0, 0, 1, 0, 0, '1', '', '', 49249); [/CODE][/I] [/SPOILER] [I] All feedback appreciated. Feel free to edit the code and SWF as needed to your liking. [IMG]http://i.imgur.com/qwEO52H.png[/IMG] [/I] --------- EDIT: Here is also wired for Freeze and Unfreeze User [SPOILER] Here are 2 wireds for Freeze User and Unfreeze User. Screenshots and gif: [SPOILER] [MEDIA=gfycat]height=304;id=RareTheseFlyingsquirrel;width=289[/MEDIA] [IMG]https://i.imgur.com/78Zyy9s.png[/IMG] [/SPOILER] Adding the code for these are similar to what we just did for the close dice wired. Create two new files [I]FreezeUserBox.cs and Unf[I]eezeUserBox.cs[/I] [/I]in the [I]/HabboHotel/Items/Wired/Boxes/Effects/ [/I]directory, and add the following: [I]([I]FreezeUserBox[/I].cs)[/I] [CODE] using System; using System.Linq; using System.Text; using System.Collections.Concurrent; using Plus.Communication.Packets.Incoming; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.Users; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Items.Wired.Boxes.Effects { class FreezeUserBox : IWiredItem { public Room Instance { get; set; } public Item Item { get; set; } public WiredBoxType Type { get { return WiredBoxType.EffectFreezeUser; } } public ConcurrentDictionary<int, Item> SetItems { get; set; } public string StringData { get; set; } public bool BoolData { get; set; } public string ItemsData { get; set; } public FreezeUserBox(Room Instance, Item Item) { this.Instance = Instance; this.Item = Item; this.SetItems = new ConcurrentDictionary<int, Item>(); if (this.SetItems.Count > 0) this.SetItems.Clear(); } public void HandleSave(ClientPacket Packet) { if (this.SetItems.Count > 0) this.SetItems.Clear(); int Unknown = Packet.PopInt(); string Message = Packet.PopString(); this.StringData = Message; Console.Write(Packet.PopInt()); } public bool Execute(params object[] Params) { if (Params.Length != 1) return false; Habbo Player = (Habbo)Params[0]; if (Player == null) return false; RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0)); User.Frozen = true; return true; } } } [/CODE] [I] [I](Unf[I]reezeUserBox[/I].cs)[/I][/I] [CODE] using System; using System.Linq; using System.Text; using System.Collections.Concurrent; using Plus.Communication.Packets.Incoming; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.Users; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Items.Wired.Boxes.Effects { class UnfreezeUserBox : IWiredItem { public Room Instance { get; set; } public Item Item { get; set; } public WiredBoxType Type { get { return WiredBoxType.EffectUnfreezeUser; } } public ConcurrentDictionary<int, Item> SetItems { get; set; } public string StringData { get; set; } public bool BoolData { get; set; } public string ItemsData { get; set; } public UnfreezeUserBox(Room Instance, Item Item) { this.Instance = Instance; this.Item = Item; this.SetItems = new ConcurrentDictionary<int, Item>(); if (this.SetItems.Count > 0) this.SetItems.Clear(); } public void HandleSave(ClientPacket Packet) { int Unknown = Packet.PopInt(); string Message = Packet.PopString(); this.StringData = Message; } public bool Execute(params object[] Params) { if (Params.Length != 1) return false; Habbo Player = (Habbo)Params[0]; if (Player == null) return false; RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0)); User.Frozen = false; return true; } } } [/CODE] [I] [/I] Once you have those two files created, do the same changes we did before. In the [I]WiredBoxType.cs[/I] file, located in the [I]/HabboHotel/Items/Wired/ [/I]directory. Right below the line (or any line): [I](WiredBoxType.cs)[/I] [CODE] EffectCloseDice, [/CODE] Add the new effects: [I](WiredBoxType.cs)[/I] [CODE] EffectFreezeUser, EffectUnfreezeUser, [/CODE] Go to the [I]WiredBoxTypeUtility.cs [/I]file, in the [I]/HabboHotel/Items/Wired/[/I] directory. In the FromWiredId method, below the lines (or would be under EffectGiveUserBadge if close dice isn't added): ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case 62: return WiredBoxType.EffectCloseDice; [/CODE] Add these lines: ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case 63: return WiredBoxType.EffectFreezeUser; case 64: return WiredBoxType.EffectUnfreezeUser; [/CODE] Then, in the same file in the GetWiredId method, below the line: ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case WiredBoxType.EffectSetRollerSpeed: [/CODE] Add the two new box types: ([I]WiredBoxTypeUtility.cs)[/I] [CODE] case WiredBoxType.EffectFreezeUser: case WiredBoxType.EffectUnfreezeUser: [/CODE] Update the [I]WiredComponent.cs[/I] file in the [I]/HabboHotel/Rooms/Instance/ [/I]directory: In the GenerateNewBox method, below the lines: ([I]WiredComponent.cs)[/I] [CODE] case WiredBoxType.EffectMuteTriggerer: return new MuteTriggererBox(_room, Item); [/CODE] Add the lines: ([I]WiredComponent.cs)[/I] [CODE] case WiredBoxType.EffectFreezeUser: return new FreezeUserBox(_room, Item); case WiredBoxType.EffectUnfreezeUser: return new UnfreezeUserBox(_room, Item); [/CODE] Again, make sure these effects are being compiled by adding them to [I]Plus Emulator.csproj[/I]: ([I]Plus Emulator.csproj)[/I] [CODE] <Compile Include="HabboHotel\Items\Wired\Boxes\Effects\FreezeUserBox.cs" /> <Compile Include="HabboHotel\Items\Wired\Boxes\Effects\UnfreezeUserBox.cs" /> [/CODE] And again, here are the productdata and SQL inserts for creating the necessary furni. Also, the SWFs that I threw together quickly. Add all this stuff the same way mentioned in the original post. [URL]http://www.mediafire.com/file/x21uoxrwtiz4n87/freeze+and+unfreeze+wired.zip[/URL] [SPOILER] wf_act_freeze_user [CODE] --SQL-- INSERT INTO `furniture` (`id`, `item_name`, `public_name`, `type`, `width`, `length`, `stack_height`, `can_stack`, `can_sit`, `is_walkable`, `sprite_id`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `interaction_modes_count`, `vending_ids`, `height_adjustable`, `effect_id`, `wired_id`, `is_rare`, `clothing_id`, `extra_rot`) VALUES (49248, 'wf_act_freeze_user', 'WIRED Effect: Freeze User', 's', 1, 1, 0.65, '1', '0', '1', 49248, '1', '1', '1', '1', '1', 'wired_effect', 2, '0', '0', 0, 63, '0', 0, '0'); INSERT INTO `catalog_items` (`id`, `page_id`, `item_id`, `catalog_name`, `cost_credits`, `cost_pixels`, `cost_diamonds`, `amount`, `limited_sells`, `limited_stack`, `offer_active`, `extradata`, `badge`, `offer_id`) VALUES (49248, 303, '49248', 'WIRED Effect: Freeze User', 3, 0, 0, 1, 0, 0, '1', '', '', 49248); --furnidata.xml-- <furnitype id="49248" classname="wf_act_freeze_user"> <revision>50950</revision> <defaultdir>0</defaultdir> <xdim>1</xdim> <ydim>1</ydim> <partcolors/> <name>WIRED Effect: Freeze User</name> <description>This effect freezes a user depending on the triggering criteria.</description> <adurl></adurl> <offerid>-1</offerid> <buyout>1</buyout> <rentofferid>-1</rentofferid> <rentbuyout>0</rentbuyout> <bc>0</bc> <excludeddynamic>0</excludeddynamic> <customparams>0</customparams> <specialtype>1</specialtype> <canstandon>1</canstandon> <cansiton>0</cansiton> <canlayon>0</canlayon> <furniline>wired</furniline> </furnitype> --productdata.txt-- ["wf_act_freeze_user","WIRED Effect: Freeze User","This effect freezes a user depending on the triggering criteria."] [/CODE] wf_act_unfreeze_us [CODE] --SQL-- INSERT INTO `furniture` (`id`, `item_name`, `public_name`, `type`, `width`, `length`, `stack_height`, `can_stack`, `can_sit`, `is_walkable`, `sprite_id`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `interaction_modes_count`, `vending_ids`, `height_adjustable`, `effect_id`, `wired_id`, `is_rare`, `clothing_id`, `extra_rot`) VALUES (49247, 'wf_act_unfreeze_us', 'WIRED Effect: Unfreeze User', 's', 1, 1, 0.65, '1', '0', '1', 49247, '1', '1', '1', '1', '1', 'wired_effect', 2, '0', '0', 0, 64, '0', 0, '0'); INSERT INTO `catalog_items` (`id`, `page_id`, `item_id`, `catalog_name`, `cost_credits`, `cost_pixels`, `cost_diamonds`, `amount`, `limited_sells`, `limited_stack`, `offer_active`, `extradata`, `badge`, `offer_id`) VALUES (49247, 303, '49247', 'WIRED Effect: Unfreeze User', 3, 0, 0, 1, 0, 0, '1', '', '', 49247); --furnidata.xml-- <furnitype id="49247" classname="wf_act_unfreeze_us"> <revision>50950</revision> <defaultdir>0</defaultdir> <xdim>1</xdim> <ydim>1</ydim> <partcolors/> <name>WIRED Effect: Unfreeze User</name> <description>This effect unfreezes a user depending on the triggering criteria.</description> <adurl></adurl> <offerid>-1</offerid> <buyout>1</buyout> <rentofferid>-1</rentofferid> <rentbuyout>0</rentbuyout> <bc>0</bc> <excludeddynamic>0</excludeddynamic> <customparams>0</customparams> <specialtype>1</specialtype> <canstandon>1</canstandon> <cansiton>0</cansiton> <canlayon>0</canlayon> <furniline>wired</furniline> </furnitype> --productdata.txt-- ["wf_act_unfreeze_us","WIRED Effect: Unfreeze User","This effect unfreezes a user depending on the triggering criteria."] [/CODE][/SPOILER] [/SPOILER] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[PlusEMU] Close Dice Wired (and more)
Top