Thread: [No-Doze] Better way to process shops [Stability]

Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1 [No-Doze] Better way to process shops [Stability] 
    Registered Member

    Join Date
    Mar 2008
    Posts
    2,591
    Thanks given
    71
    Thanks received
    7
    Rep Power
    1741
    Current way they used to load shops was - running an events for EVERY shop your server has, each shop event looped through all server players, which did cause lag.
    Code:
    	/**
    	 * We've updated.
    	 */
    	public void updated() {
    		for (Player p : GameEngine.getPlayerManager().getPlayers()) {
    			if (p == null)
    				continue;
    			if (p.isActive && !p.disconnected) {
    				Client c = (Client) p;
    				if (c.getExtraData().containsKey("shop")) {
    					if (((Integer) c.getExtraData().get("shop")) == id) {
    						c.getActionSender().sendShopReset(this);
    					}
    				}
    			}
    		}
    	}
    The method they used to update all players, was just dumb.

    There's a simple way of improving it, making every player checking if he uses shop, if yes - update his shop window.

    Step 1.
    Open Shop.java (src/com/rs2/model/)
    find this line:
    Code:
    updated();
    comment it out. So it will be like
    Code:
    //updated();
    Step 2.
    Open PlayerManager.java (src/com/rs2/World/)
    Find these lines:
    Code:
    players[i].getNextPlayerMovement();
    right bellow add:
    Code:
    			if (client.getExtraData().containsKey("shop")) {
    				Shop shop = (Shop) client.getExtraData().get("shop");
    				if (shop != null) {
    						client.getActionSender().sendShopReset(shop);
    				}
    			}
    add this import at the top of class.
    import com.rs2.model.Shop;
    Easy as that.

    REP for release and work appreciated.

    Credits: R0cky 0wnz
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    Join Date
    Jul 2008
    Posts
    3,163
    Thanks given
    235
    Thanks received
    74
    Rep Power
    209
    good job rocky! i will test tommorrow!
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Feb 2011
    Posts
    562
    Thanks given
    46
    Thanks received
    26
    Rep Power
    4
    Just finished adding, work's wonder's

    Thanks for this
    For my Vouches:
    Spoiler for Vouches:
    Quote Originally Posted by DMllrDvd14 View Post
    bought 102off, i went first and got the gold, thanks
    Quote Originally Posted by i rushin View Post
    Vouch! Did vote4cash for me!
    Quote Originally Posted by Vindication View Post
    VOUCH FOR HIM DID LOTTERY SYSTEM AND IM LOVING IT GOOD JoB LUCAS!
    Quote Originally Posted by Forsaken Fury View Post
    Thanks dude looks neat rep++ and vouch!
    Quote Originally Posted by Nano View Post
    Vouch, he went first, went very smooth
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    Registered Member
    Join Date
    Jul 2008
    Posts
    3,163
    Thanks given
    235
    Thanks received
    74
    Rep Power
    209
    Code:
    [00:06:43]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:06:43]: 	at com.rs2.Process.run(Process.java:68)
    [00:06:43]: 	at java.lang.Thread.run(Unknown Source)
    [00:06:43]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:06:43]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:06:43]: 	at com.rs2.Process.run(Process.java:68)
    [00:06:43]: 	at java.lang.Thread.run(Unknown Source)
    [00:06:43]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:06:43]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:06:43]: 	at com.rs2.Process.run(Process.java:68)
    [00:06:43]: 	at java.lang.Thread.run(Unknown Source)
    [00:06:43]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:06:43]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:06:43]: 	at com.rs2.Process.run(Process.java:68)
    [00:06:43]: 	at java.lang.Thread.run(Unknown Source)
    [00:06:43]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:06:43]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:06:43]: 	at com.rs2.Process.run(Process.java:68)
    [00:06:43]: 	at java.lang.Thread.run(Unknown Source)

    Code:
    line 235     				Shop shop = (Shop) client.getExtraData().get("shop");
    Code:
    line 68  				getPlayerManager().process();
    dc if u try to use shops
    Reply With Quote  
     

  7. #5  
    Registered Member

    Join Date
    Mar 2008
    Posts
    2,591
    Thanks given
    71
    Thanks received
    7
    Rep Power
    1741
    You did something wrong
    Reply With Quote  
     

  8. #6  
    Registered Member
    Join Date
    Feb 2011
    Posts
    562
    Thanks given
    46
    Thanks received
    26
    Rep Power
    4
    Quote Originally Posted by R0cky 0wnz View Post
    You did something wrong
    This just complete's my shops
    For my Vouches:
    Spoiler for Vouches:
    Quote Originally Posted by DMllrDvd14 View Post
    bought 102off, i went first and got the gold, thanks
    Quote Originally Posted by i rushin View Post
    Vouch! Did vote4cash for me!
    Quote Originally Posted by Vindication View Post
    VOUCH FOR HIM DID LOTTERY SYSTEM AND IM LOVING IT GOOD JoB LUCAS!
    Quote Originally Posted by Forsaken Fury View Post
    Thanks dude looks neat rep++ and vouch!
    Quote Originally Posted by Nano View Post
    Vouch, he went first, went very smooth
    Reply With Quote  
     

  9. #7  
    Registered Member

    Join Date
    Mar 2008
    Posts
    2,591
    Thanks given
    71
    Thanks received
    7
    Rep Power
    1741
    Quote Originally Posted by Master Lucas View Post
    This just complete's my shops
    What you mean?
    Reply With Quote  
     

  10. #8  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    Lol, thank you for the contribution, I shall test it now.
    Reply With Quote  
     

  11. #9  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    I also get:
    Code:
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    [00:02:17]: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.rs2.model.Shop
    [00:02:17]: 	at com.rs2.world.PlayerManager.process(PlayerManager.java:235)
    [00:02:17]: 	at com.rs2.Process.run(Process.java:68)
    [00:02:17]: 	at java.lang.Thread.run(Unknown Source)
    Reply With Quote  
     

  12. #10  
    Officially Retired

    Huey's Avatar
    Join Date
    Jan 2008
    Age
    22
    Posts
    16,478
    Thanks given
    3,385
    Thanks received
    7,727
    Rep Power
    5000
    Thanks rocky, i have no use for it tho
    Attached image
    Listen children don't become this guy.
    Quote Originally Posted by Owner Spikey View Post
    Why can I attack lower level npc's in a matter of a mouse hover but for a higher level npc the only choice to attack is by right clicking option attack?

    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Project No-Doze npc following bug update
    By killamess in forum Snippets
    Replies: 8
    Last Post: 06-22-2014, 06:36 PM
  2. [No-Doze] Buy 20
    By R0cky 0wnz in forum Snippets
    Replies: 2
    Last Post: 06-29-2011, 09:52 AM
  3. Project No-Doze -- 1 Connection Only
    By mandorfunz in forum Help
    Replies: 5
    Last Post: 06-02-2011, 02:18 AM
  4. [Shard/no-doze]
    By Konceal in forum Help
    Replies: 5
    Last Post: 04-11-2011, 05:43 AM
  5. Process, EventManager... STABILITY?
    By Runite in forum RS2 Server
    Replies: 18
    Last Post: 02-07-2009, 10:48 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •