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
Bug with the Wired Chase (MoveFurniToUserBox)
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="N30_C0R73X" data-source="post: 452325" data-attributes="member: 87490"><p><span style="font-size: 18px"><strong>Hello, my users complain a lot about the Wired of hunting users, he only follows the user if he is 1 square away from him, I have already looked at all the code I could not find anything, does anyone have the fix for that problem? When it is not close to the user, it randomly turns around the room.</strong></span></p><p></p><p><span style="font-size: 15px"><strong>I use the UFO.Server</strong></span></p><p></p><p><strong>Code MoveFurniToUserBox:</strong></p><p>[CODE=cpp]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p>using System.Collections.Concurrent;</p><p></p><p>using Yezz.Communication.Packets.Incoming;</p><p>using Yezz.HabboHotel.Rooms;</p><p>using Yezz.HabboHotel.Users;</p><p>using System.Drawing;</p><p>using System.Security.Cryptography;</p><p>using Yezz.Communication.Packets.Outgoing.Rooms.Engine;</p><p>using Yezz.Utilities;</p><p></p><p></p><p>namespace Yezz.HabboHotel.Items.Wired.Boxes.Effects</p><p>{</p><p> internal class MoveFurniToUserBox : IWiredItem, IWiredCycle</p><p> {</p><p> public Room Instance { get; set; }</p><p> public Item Item { get; set; }</p><p></p><p> public WiredBoxType Type</p><p> {</p><p> get { return WiredBoxType.EffectMoveFurniToNearestUser; }</p><p> }</p><p></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></p><p> public int Delay</p><p> {</p><p> get { return this._delay; }</p><p> set</p><p> {</p><p> this._delay = value;</p><p> this.TickCount = value + 1;</p><p> }</p><p> }</p><p></p><p> public int TickCount { get; set; }</p><p> public string ItemsData { get; set; }</p><p> private bool Requested;</p><p> private int _delay = 0;</p><p> private long _next = 0;</p><p></p><p> public MoveFurniToUserBox(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> this.TickCount = Delay;</p><p> this.Requested = false;</p><p> }</p><p></p><p> public void HandleSave(ClientPacket Packet)</p><p> {</p><p> int Unknown = Packet.PopInt();</p><p> string Unknown2 = Packet.PopString();</p><p></p><p> if (this.SetItems.Count > 0)</p><p> this.SetItems.Clear();</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></p><p> if (SelectedItem != null && !Instance.GetWired().OtherBoxHasItem(this, SelectedItem.Id))</p><p> SetItems.TryAdd(SelectedItem.Id, SelectedItem);</p><p> }</p><p></p><p> int Delay = Packet.PopInt();</p><p> this.Delay = Delay;</p><p> TickCount = Delay / 2;</p><p> }</p><p></p><p> public bool Execute(params object[] Params)</p><p> {</p><p> if (this.SetItems.Count == 0)</p><p> return false;</p><p></p><p></p><p> if (this._next == 0 || this._next < YezzEnvironment.Now())</p><p> this._next = YezzEnvironment.Now() + this.Delay;</p><p></p><p> if (!Requested)</p><p> {</p><p> this.TickCount = this.Delay;</p><p> this.Requested = true;</p><p> }</p><p> return true;</p><p> }</p><p></p><p> public bool OnCycle()</p><p> {</p><p> if (Instance == null || !Requested || _next == 0)</p><p> return false;</p><p></p><p> long Now = YezzEnvironment.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> continue;</p><p></p><p> Item toRemove = null;</p><p></p><p> if (Instance.GetWired().OtherBoxHasItem(this, Item.Id))</p><p> this.SetItems.TryRemove(Item.Id, out toRemove);</p><p></p><p> Point Point = Instance.GetGameMap().GetChaseMovement(Item);</p><p></p><p> Instance.GetWired().onUserFurniCollision(Instance, Item);</p><p></p><p> if (!Instance.GetGameMap().ItemCanMove(Item, Point))</p><p> continue;</p><p></p><p> if (Instance.GetGameMap().CanRollItemHere(Point.X, Point.Y) && !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y))</p><p> {</p><p> Double NewZ = Item.GetZ;</p><p> Boolean CanBePlaced = true;</p><p></p><p> List<Item> Items = Instance.GetGameMap().GetCoordinatedItems(Point);</p><p> foreach (Item IItem in Items.ToList())</p><p> {</p><p> if (IItem == null || IItem.Id == Item.Id)</p><p> continue;</p><p></p><p> if (!IItem.GetBaseItem().Walkable)</p><p> {</p><p> _next = 0;</p><p> CanBePlaced = false;</p><p> break;</p><p> }</p><p></p><p> if (IItem.TotalHeight > NewZ)</p><p> NewZ = IItem.TotalHeight;</p><p></p><p> if (CanBePlaced == true && !IItem.GetBaseItem().Stackable)</p><p> CanBePlaced = false;</p><p> }</p><p></p><p> if (CanBePlaced && Point != Item.Coordinate)</p><p> {</p><p> Instance.SendMessage(new SlideObjectBundleComposer(Item.GetX, Item.GetY, Item.GetZ, Point.X,</p><p> Point.Y, NewZ, 0, 0, Item.Id));</p><p> Instance.GetRoomItemHandler().SetFloorItem(Item, Point.X, Point.Y, NewZ);</p><p> }</p><p> }</p><p> }</p><p></p><p> _next = 0;</p><p> return true;</p><p> }</p><p> return false;</p><p> }</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="N30_C0R73X, post: 452325, member: 87490"] [SIZE=5][B]Hello, my users complain a lot about the Wired of hunting users, he only follows the user if he is 1 square away from him, I have already looked at all the code I could not find anything, does anyone have the fix for that problem? When it is not close to the user, it randomly turns around the room.[/B][/SIZE] [SIZE=4][B]I use the UFO.Server[/B][/SIZE] [B]Code MoveFurniToUserBox:[/B] [CODE=cpp]using System; using System.Linq; using System.Text; using System.Collections.Generic; using System.Collections.Concurrent; using Yezz.Communication.Packets.Incoming; using Yezz.HabboHotel.Rooms; using Yezz.HabboHotel.Users; using System.Drawing; using System.Security.Cryptography; using Yezz.Communication.Packets.Outgoing.Rooms.Engine; using Yezz.Utilities; namespace Yezz.HabboHotel.Items.Wired.Boxes.Effects { internal class MoveFurniToUserBox : IWiredItem, IWiredCycle { public Room Instance { get; set; } public Item Item { get; set; } public WiredBoxType Type { get { return WiredBoxType.EffectMoveFurniToNearestUser; } } public ConcurrentDictionary<int, Item> SetItems { 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 + 1; } } public int TickCount { get; set; } public string ItemsData { get; set; } private bool Requested; private int _delay = 0; private long _next = 0; public MoveFurniToUserBox(Room Instance, Item Item) { this.Instance = Instance; this.Item = Item; this.SetItems = new ConcurrentDictionary<int, Item>(); this.TickCount = Delay; this.Requested = false; } public void HandleSave(ClientPacket Packet) { int Unknown = Packet.PopInt(); string Unknown2 = Packet.PopString(); if (this.SetItems.Count > 0) this.SetItems.Clear(); int FurniCount = Packet.PopInt(); for (int i = 0; i < FurniCount; i++) { Item SelectedItem = Instance.GetRoomItemHandler().GetItem(Packet.PopInt()); if (SelectedItem != null && !Instance.GetWired().OtherBoxHasItem(this, SelectedItem.Id)) SetItems.TryAdd(SelectedItem.Id, SelectedItem); } int Delay = Packet.PopInt(); this.Delay = Delay; TickCount = Delay / 2; } public bool Execute(params object[] Params) { if (this.SetItems.Count == 0) return false; if (this._next == 0 || this._next < YezzEnvironment.Now()) this._next = YezzEnvironment.Now() + this.Delay; if (!Requested) { this.TickCount = this.Delay; this.Requested = true; } return true; } public bool OnCycle() { if (Instance == null || !Requested || _next == 0) return false; long Now = YezzEnvironment.Now(); if (_next < Now) { foreach (Item Item in this.SetItems.Values.ToList()) { if (Item == null) continue; if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item)) continue; Item toRemove = null; if (Instance.GetWired().OtherBoxHasItem(this, Item.Id)) this.SetItems.TryRemove(Item.Id, out toRemove); Point Point = Instance.GetGameMap().GetChaseMovement(Item); Instance.GetWired().onUserFurniCollision(Instance, Item); if (!Instance.GetGameMap().ItemCanMove(Item, Point)) continue; if (Instance.GetGameMap().CanRollItemHere(Point.X, Point.Y) && !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y)) { Double NewZ = Item.GetZ; Boolean CanBePlaced = true; List<Item> Items = Instance.GetGameMap().GetCoordinatedItems(Point); foreach (Item IItem in Items.ToList()) { if (IItem == null || IItem.Id == Item.Id) continue; if (!IItem.GetBaseItem().Walkable) { _next = 0; CanBePlaced = false; break; } if (IItem.TotalHeight > NewZ) NewZ = IItem.TotalHeight; if (CanBePlaced == true && !IItem.GetBaseItem().Stackable) CanBePlaced = false; } if (CanBePlaced && Point != Item.Coordinate) { Instance.SendMessage(new SlideObjectBundleComposer(Item.GetX, Item.GetY, Item.GetZ, Point.X, Point.Y, NewZ, 0, 0, Item.Id)); Instance.GetRoomItemHandler().SetFloorItem(Item, Point.X, Point.Y, NewZ); } } } _next = 0; return true; } return false; } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Bug with the Wired Chase (MoveFurniToUserBox)
Top