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
WiredEffect MoveFurniToUserBox Lag
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="Hahn" data-source="post: 451919" data-attributes="member: 73428"><p>I already have put the code OnCycle, don't this is?</p><p>my code wired:</p><p>[CODE=csharp] internal class MoveFurniToUserBox : IWiredItem, IWiredCycle</p><p> {</p><p> private double _delay;</p><p> private double _next;</p><p> private bool Requested;</p><p></p><p> public MoveFurniToUserBox(Room Instance, Item Item)</p><p> {</p><p> this.Instance = Instance;</p><p> this.Item = Item;</p><p> SetItems = new ConcurrentDictionary<int, Item>();</p><p> TickCount = Delay;</p><p> Requested = false;</p><p> }</p><p></p><p> public double Delay</p><p> {</p><p> get { return _delay; }</p><p> set</p><p> {</p><p> _delay = value;</p><p> TickCount = value + 1;</p><p> }</p><p> }</p><p></p><p> public double TickCount { get; set; }</p><p></p><p> public bool OnCycle()</p><p> {</p><p> if (Instance == null || !Requested || _next < 1)</p><p> return false;</p><p> var time = OreoServer.GetUnixTimestamp(); </p><p> if (_next <= time)</p><p> {</p><p> foreach (</p><p> var Item in</p><p> SetItems.Values.ToList()</p><p> .Where(Item => Item != null)</p><p> .Where(Item => Instance.GetRoomItemHandler().GetFloor.Contains(Item)))</p><p> {</p><p> Item toRemove;</p><p></p><p> if (Instance.GetWired().OtherBoxHasItem(this, Item.Id))</p><p> SetItems.TryRemove(Item.Id, out toRemove);</p><p></p><p> var 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) &&</p><p> !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y))</p><p> {</p><p> var NewZ = Item.GetZ;</p><p> var CanBePlaced = true;</p><p></p><p> var Items = Instance.GetGameMap().GetCoordinatedItems(Point);</p><p> foreach (var IItem in Items.ToList().Where(IItem => IItem != null && IItem.Id != Item.Id))</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 && !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> public Room Instance { get; set; }</p><p> public Item Item { get; set; }</p><p></p><p> public WiredBoxType Type => WiredBoxType.EffectMoveFurniToNearestUser;</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> public string ItemsData { get; set; }</p><p></p><p> public void HandleSave(ClientPacket Packet)</p><p> {</p><p> var Unknown = Packet.PopInt();</p><p> var Unknown2 = Packet.PopString();</p><p></p><p> SetItems.Clear();</p><p></p><p> var FurniCount = Packet.PopInt();</p><p> for (var i = 0; i < FurniCount; i++)</p><p> {</p><p> var 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> var 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 (SetItems.Count == 0)</p><p> return false;</p><p></p><p></p><p> if (_next < 1 || _next < OreoServer.GetUnixTimestamp())</p><p> {</p><p> _next = OreoServer.GetUnixTimestamp() + Delay;</p><p> }</p><p> if (!Requested)</p><p> {</p><p> TickCount = Delay;</p><p> Requested = true;</p><p> }</p><p> return true;</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="Hahn, post: 451919, member: 73428"] I already have put the code OnCycle, don't this is? my code wired: [CODE=csharp] internal class MoveFurniToUserBox : IWiredItem, IWiredCycle { private double _delay; private double _next; private bool Requested; public MoveFurniToUserBox(Room Instance, Item Item) { this.Instance = Instance; this.Item = Item; SetItems = new ConcurrentDictionary<int, Item>(); TickCount = Delay; Requested = false; } public double Delay { get { return _delay; } set { _delay = value; TickCount = value + 1; } } public double TickCount { get; set; } public bool OnCycle() { if (Instance == null || !Requested || _next < 1) return false; var time = OreoServer.GetUnixTimestamp(); if (_next <= time) { foreach ( var Item in SetItems.Values.ToList() .Where(Item => Item != null) .Where(Item => Instance.GetRoomItemHandler().GetFloor.Contains(Item))) { Item toRemove; if (Instance.GetWired().OtherBoxHasItem(this, Item.Id)) SetItems.TryRemove(Item.Id, out toRemove); var 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)) { var NewZ = Item.GetZ; var CanBePlaced = true; var Items = Instance.GetGameMap().GetCoordinatedItems(Point); foreach (var IItem in Items.ToList().Where(IItem => IItem != null && IItem.Id != Item.Id)) { if (!IItem.GetBaseItem().Walkable) { _next = 0; CanBePlaced = false; break; } if (IItem.TotalHeight > NewZ) NewZ = IItem.TotalHeight; if (CanBePlaced && !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; } public Room Instance { get; set; } public Item Item { get; set; } public WiredBoxType Type => WiredBoxType.EffectMoveFurniToNearestUser; public ConcurrentDictionary<int, Item> SetItems { get; set; } public string StringData { get; set; } public bool BoolData { get; set; } public string ItemsData { get; set; } public void HandleSave(ClientPacket Packet) { var Unknown = Packet.PopInt(); var Unknown2 = Packet.PopString(); SetItems.Clear(); var FurniCount = Packet.PopInt(); for (var i = 0; i < FurniCount; i++) { var SelectedItem = Instance.GetRoomItemHandler().GetItem(Packet.PopInt()); if (SelectedItem != null && !Instance.GetWired().OtherBoxHasItem(this, SelectedItem.Id)) SetItems.TryAdd(SelectedItem.Id, SelectedItem); } var Delay = Packet.PopInt(); this.Delay = Delay; } public bool Execute(params object[] Params) { if (SetItems.Count == 0) return false; if (_next < 1 || _next < OreoServer.GetUnixTimestamp()) { _next = OreoServer.GetUnixTimestamp() + Delay; } if (!Requested) { TickCount = Delay; Requested = true; } return true; } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
WiredEffect MoveFurniToUserBox Lag
Top