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 Q&A
HabboEMU - Furniture owner issue
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="Daltron" data-source="post: 447230" data-attributes="member: 61885"><p>[CODE]class ObjectsComposer : ServerPacket</p><p> {</p><p> public ObjectsComposer(Item[] Objects, Room Room)</p><p> : base(ServerPacketHeader.ObjectsMessageComposer)</p><p> {</p><p> base.WriteInteger(1);</p><p> base.WriteInteger(Room.OwnerId);</p><p> base.WriteString(Room.OwnerName);</p><p></p><p> List<Item> l = new List<Item>();</p><p> if (Room.HideWired)</p><p> {</p><p> for (int i = 0; i < Objects.Count(); i++)</p><p> {</p><p> Item it = Objects[i];</p><p> if (it == null)</p><p> continue;</p><p></p><p> if (it.IsWired)</p><p> continue;</p><p></p><p> l.Add(it);</p><p> }</p><p> Objects = l.ToArray();</p><p> base.WriteInteger(Objects.Length);</p><p> for (int i = 0; i < Objects.Count(); i++)</p><p> {</p><p> Item Item = Objects[i];</p><p> WriteFloorItem(Item, Convert.ToInt32(Item.UserID));</p><p> }</p><p> }</p><p> else</p><p> {</p><p> base.WriteInteger(Objects.Length);</p><p> for (int i = 0; i < Objects.Count(); i++)</p><p> {</p><p> Item Item = Objects[i];</p><p> WriteFloorItem(Item, Convert.ToInt32(Item.UserID));</p><p> }</p><p> }</p><p> }</p><p></p><p> private void WriteFurniOwners(Item[] Objects)</p><p> {</p><p> Dictionary<int, string> furniOwners = new Dictionary<int, string>();</p><p> foreach (Item Item in Objects)</p><p> {</p><p> if (!furniOwners.ContainsKey(Item.UserID))</p><p> furniOwners.Add(Item.UserID, Item.Username);</p><p> }</p><p></p><p> WriteInteger(furniOwners.Count);</p><p> foreach (var furniOwner in furniOwners)</p><p> {</p><p> WriteInteger(furniOwner.Key);</p><p> WriteString(furniOwner.Value);</p><p> }</p><p> }[/CODE]</p><p></p><p>I must be writing it wrong, How do I replace the first loop so it doesn't mess up my HideWired command?</p><p>[USER=72299]@Damien[/USER]</p><p>My entire class is below.</p><p>[CODE=csharp]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Emulator.Utilities;</p><p>using Emulator.HabboHotel.Rooms;</p><p>using Emulator.HabboHotel.Items;</p><p>using Emulator.HabboHotel.Groups;</p><p>using Emulator.HabboHotel.Users;</p><p></p><p>namespace Emulator.Communication.Packets.Outgoing.Rooms.Engine</p><p>{</p><p> class ObjectsComposer : ServerPacket</p><p> {</p><p> public ObjectsComposer(Item[] Objects, Room Room)</p><p> : base(ServerPacketHeader.ObjectsMessageComposer)</p><p> {</p><p> base.WriteInteger(1);</p><p> base.WriteInteger(Room.OwnerId);</p><p> base.WriteString(Room.OwnerName);</p><p></p><p> List<Item> l = new List<Item>();</p><p> if (Room.HideWired)</p><p> {</p><p> for (int i = 0; i < Objects.Count(); i++)</p><p> {</p><p> Item it = Objects[i];</p><p> if (it == null)</p><p> continue;</p><p></p><p> if (it.IsWired)</p><p> continue;</p><p></p><p> l.Add(it);</p><p> }</p><p> Objects = l.ToArray();</p><p> base.WriteInteger(Objects.Length);</p><p> for (int i = 0; i < Objects.Count(); i++)</p><p> {</p><p> Item Item = Objects[i];</p><p> WriteFloorItem(Item, Convert.ToInt32(Item.UserID));</p><p> }</p><p> }</p><p> else</p><p> {</p><p> base.WriteInteger(Objects.Length);</p><p> for (int i = 0; i < Objects.Count(); i++)</p><p> {</p><p> Item Item = Objects[i];</p><p> WriteFloorItem(Item, Convert.ToInt32(Item.UserID));</p><p> }</p><p> }</p><p> }</p><p></p><p> private void WriteFurniOwners(Item[] Objects)</p><p> {</p><p> Dictionary<int, string> furniOwners = new Dictionary<int, string>();</p><p> foreach (Item Item in Objects)</p><p> {</p><p> if (!furniOwners.ContainsKey(Item.UserID))</p><p> furniOwners.Add(Item.UserID, Item.Username);</p><p> }</p><p></p><p> WriteInteger(furniOwners.Count);</p><p> foreach (var furniOwner in furniOwners)</p><p> {</p><p> WriteInteger(furniOwner.Key);</p><p> WriteString(furniOwner.Value);</p><p> }</p><p> }</p><p></p><p> private void WriteFloorItem(Item Item, int UserID)</p><p> {</p><p> base.WriteInteger(Item.Id);</p><p> base.WriteInteger(Item.GetBaseItem().SpriteId);</p><p> base.WriteInteger(Item.GetX);</p><p> base.WriteInteger(Item.GetY);</p><p> base.WriteInteger(Item.Rotation);</p><p> base.WriteString(String.Format("{0:0.00}", TextHandling.GetString(Item.GetZ)));</p><p> base.WriteString(String.Empty);</p><p></p><p> if (Item.LimitedNo > 0)</p><p> {</p><p> base.WriteInteger(1);</p><p> base.WriteInteger(256);</p><p> base.WriteString(Item.ExtraData);</p><p> base.WriteInteger(Item.LimitedNo);</p><p> base.WriteInteger(Item.LimitedTot);</p><p> }</p><p> else if (Item.Data.InteractionType == InteractionType.FX_PROVIDER)</p><p> {</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(1);</p><p> base.WriteInteger(1);</p><p> base.WriteString("effectId");</p><p> base.WriteString(Item.ExtraData);</p><p> }</p><p> else if (Item.Data.InteractionType == InteractionType.PINATA)</p><p> {</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(7);</p><p> base.WriteString("6");</p><p> if (Item.ExtraData.Length <= 0) base.WriteInteger(0);</p><p> else base.WriteInteger(int.Parse(Item.ExtraData));</p><p> base.WriteInteger(100);</p><p> }</p><p> else if (Item.Data.InteractionType == InteractionType.PINATATRIGGERED)</p><p> {</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(7); // miran2 grafic xq no c acuerda xdddddd kva men xDDDDDDDD esk me mandaron un guasap menju eeeer xqude popddddduddddddddddddddddxdd</p><p> base.WriteString("0");</p><p> if (Item.ExtraData.Length <= 0) base.WriteInteger(0);</p><p> else base.WriteInteger(int.Parse(Item.ExtraData));</p><p> base.WriteInteger(1);</p><p> }</p><p> else if (Item.Data.InteractionType == InteractionType.MAGICEGG)</p><p> {</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(7);</p><p> base.WriteString(Item.ExtraData);</p><p> if (Item.ExtraData.Length <= 0)</p><p> {</p><p> base.WriteInteger(0);</p><p> }</p><p> else</p><p> {</p><p> base.WriteInteger(int.Parse(Item.ExtraData));</p><p> }</p><p> base.WriteInteger(23);</p><p> }</p><p> else if (Item.Data.InteractionType == InteractionType.MAGICCHEST)</p><p> {</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(7);</p><p> base.WriteString(Item.ExtraData);</p><p> if (Item.ExtraData.Length <= 0)</p><p> {</p><p> base.WriteInteger(0);</p><p> }</p><p> else</p><p> {</p><p> base.WriteInteger(int.Parse(Item.ExtraData));</p><p> }</p><p> base.WriteInteger(1);</p><p> }</p><p> else</p><p> {</p><p> ItemBehaviourUtility.GenerateExtradata(Item, this);</p><p> }</p><p></p><p> base.WriteInteger(-1); // to-do: check</p><p> base.WriteInteger((Item.GetBaseItem().Modes > 1) ? 1 : 0);</p><p> base.WriteInteger(UserID);</p><p> }</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="Daltron, post: 447230, member: 61885"] [CODE]class ObjectsComposer : ServerPacket { public ObjectsComposer(Item[] Objects, Room Room) : base(ServerPacketHeader.ObjectsMessageComposer) { base.WriteInteger(1); base.WriteInteger(Room.OwnerId); base.WriteString(Room.OwnerName); List<Item> l = new List<Item>(); if (Room.HideWired) { for (int i = 0; i < Objects.Count(); i++) { Item it = Objects[i]; 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[i]; WriteFloorItem(Item, Convert.ToInt32(Item.UserID)); } } else { base.WriteInteger(Objects.Length); for (int i = 0; i < Objects.Count(); i++) { Item Item = Objects[i]; WriteFloorItem(Item, Convert.ToInt32(Item.UserID)); } } } private void WriteFurniOwners(Item[] Objects) { Dictionary<int, string> furniOwners = new Dictionary<int, string>(); foreach (Item Item in Objects) { if (!furniOwners.ContainsKey(Item.UserID)) furniOwners.Add(Item.UserID, Item.Username); } WriteInteger(furniOwners.Count); foreach (var furniOwner in furniOwners) { WriteInteger(furniOwner.Key); WriteString(furniOwner.Value); } }[/CODE] I must be writing it wrong, How do I replace the first loop so it doesn't mess up my HideWired command? [USER=72299]@Damien[/USER] My entire class is below. [CODE=csharp]using System; using System.Linq; using System.Text; using System.Collections.Generic; using Emulator.Utilities; using Emulator.HabboHotel.Rooms; using Emulator.HabboHotel.Items; using Emulator.HabboHotel.Groups; using Emulator.HabboHotel.Users; namespace Emulator.Communication.Packets.Outgoing.Rooms.Engine { class ObjectsComposer : ServerPacket { public ObjectsComposer(Item[] Objects, Room Room) : base(ServerPacketHeader.ObjectsMessageComposer) { base.WriteInteger(1); base.WriteInteger(Room.OwnerId); base.WriteString(Room.OwnerName); List<Item> l = new List<Item>(); if (Room.HideWired) { for (int i = 0; i < Objects.Count(); i++) { Item it = Objects[i]; 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[i]; WriteFloorItem(Item, Convert.ToInt32(Item.UserID)); } } else { base.WriteInteger(Objects.Length); for (int i = 0; i < Objects.Count(); i++) { Item Item = Objects[i]; WriteFloorItem(Item, Convert.ToInt32(Item.UserID)); } } } private void WriteFurniOwners(Item[] Objects) { Dictionary<int, string> furniOwners = new Dictionary<int, string>(); foreach (Item Item in Objects) { if (!furniOwners.ContainsKey(Item.UserID)) furniOwners.Add(Item.UserID, Item.Username); } WriteInteger(furniOwners.Count); foreach (var furniOwner in furniOwners) { WriteInteger(furniOwner.Key); WriteString(furniOwner.Value); } } private void WriteFloorItem(Item Item, int UserID) { base.WriteInteger(Item.Id); base.WriteInteger(Item.GetBaseItem().SpriteId); base.WriteInteger(Item.GetX); base.WriteInteger(Item.GetY); base.WriteInteger(Item.Rotation); base.WriteString(String.Format("{0:0.00}", TextHandling.GetString(Item.GetZ))); base.WriteString(String.Empty); if (Item.LimitedNo > 0) { base.WriteInteger(1); base.WriteInteger(256); base.WriteString(Item.ExtraData); base.WriteInteger(Item.LimitedNo); base.WriteInteger(Item.LimitedTot); } else if (Item.Data.InteractionType == InteractionType.FX_PROVIDER) { base.WriteInteger(0); base.WriteInteger(1); base.WriteInteger(1); base.WriteString("effectId"); base.WriteString(Item.ExtraData); } else if (Item.Data.InteractionType == InteractionType.PINATA) { base.WriteInteger(0); base.WriteInteger(7); base.WriteString("6"); if (Item.ExtraData.Length <= 0) base.WriteInteger(0); else base.WriteInteger(int.Parse(Item.ExtraData)); base.WriteInteger(100); } else if (Item.Data.InteractionType == InteractionType.PINATATRIGGERED) { base.WriteInteger(0); base.WriteInteger(7); // miran2 grafic xq no c acuerda xdddddd kva men xDDDDDDDD esk me mandaron un guasap menju eeeer xqude popddddduddddddddddddddddxdd base.WriteString("0"); if (Item.ExtraData.Length <= 0) base.WriteInteger(0); else base.WriteInteger(int.Parse(Item.ExtraData)); base.WriteInteger(1); } else if (Item.Data.InteractionType == InteractionType.MAGICEGG) { base.WriteInteger(0); base.WriteInteger(7); base.WriteString(Item.ExtraData); if (Item.ExtraData.Length <= 0) { base.WriteInteger(0); } else { base.WriteInteger(int.Parse(Item.ExtraData)); } base.WriteInteger(23); } else if (Item.Data.InteractionType == InteractionType.MAGICCHEST) { base.WriteInteger(0); base.WriteInteger(7); base.WriteString(Item.ExtraData); if (Item.ExtraData.Length <= 0) { base.WriteInteger(0); } else { base.WriteInteger(int.Parse(Item.ExtraData)); } base.WriteInteger(1); } else { ItemBehaviourUtility.GenerateExtradata(Item, this); } base.WriteInteger(-1); // to-do: check base.WriteInteger((Item.GetBaseItem().Modes > 1) ? 1 : 0); base.WriteInteger(UserID); } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
HabboEMU - Furniture owner issue
Top