[Add-on] [All versions] Faster Cash Shop

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Account Upgraded | Title Enabled! AuroX is offline
    True MemberRank
    Sep 2008 Join Date
    1,435Posts

    [Add-on] [All versions] Faster Cash Shop


    RaGEZONE Recommends

    RaGEZONE Recommends

    This is just a mini release. I found that whenever you start the server and enters cash shop to buy an item, it takes a while before you can buy that item. So, what i'm posting below is a method to load all cash items when you start the channel server. By doing this, you'll have a faster cash shop when you buy items. I found this method by browsing through CelinoSRC, wonder why nobody is using this.

    Ok, I assume most of them is using LocalMs source. So this method is basically for LocalMS source but it will also work others. As for Moople, you'll have to edit a bit as the cash shop part is different.

    If you didn't edit anything to your CashItemFactory, then you can just replace your old CashItemFactory.java with this. Else, just check the difference and edit it.
    Code:
    public class CashItemFactory {
    
    	private static CashItemFactory instance = new CashItemFactory();
    	private Map<Integer, CashItemInfo> itemStats = new HashMap<Integer, CashItemInfo>();
    	private MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Etc.wz"));
    
    	public static CashItemFactory getInstance() {
    		return instance;
    	}
    
    	protected CashItemFactory() {
    		System.out.println("Loading CashItemFactory :::");
    
    		for (MapleData field : data.getData("Commodity.img").getChildren()) {
    			boolean onSale = MapleDataTool.getIntConvert("OnSale", field, 0) > 0;
    			if (onSale) {
    				final CashItemInfo stats = new CashItemInfo(
    				MapleDataTool.getIntConvert("ItemId", field),
    				MapleDataTool.getIntConvert("Count", field, 1),
    				MapleDataTool.getIntConvert("Price", field, 0),
    				MapleDataTool.getIntConvert("SN", field, 0));
    
    				itemStats.put(MapleDataTool.getIntConvert("SN", field, 0), stats);
    			}
    		}
    	}
    
    	public CashItemInfo getItem(int sn) {
    		CashItemInfo stats = itemStats.get(sn);
    		if (stats == null) {
    			return null;
    		}
    		return stats;
    	}
    
    	public List<Integer> getPackageItems(int itemId) {
    		List<Integer> packageItems = new ArrayList<Integer>();
    
    		for (MapleData b : data.getData("CashPackage.img").getChildren()) {
    			if (itemId == Integer.parseInt(b.getName())) {
    				for (MapleData c : b.getChildren()) {
    					for (MapleData d : c.getChildren()) {
    						packageItems.add(getItem(MapleDataTool.getIntConvert("" + Integer.parseInt(d.getName()), c)).getId());
    					}
    				}
    				break;
    			}
    		}
    		return packageItems;
    	}
    }
    Then, Go to ChannelServer.java, find
    Code:
    tMan.start();
    Add this under it,
    Code:
    CashItemFactory.getInstance();
    Compile and you're done. You'll buy items from Cash Shop faster after this.

    Credits: CelinoSRC, I just took out the method from there.

    PS* To LightPepsi, If you see this and want this down, let me know, I'll remove it.
    Last edited by AuroX; 17-12-10 at 07:38 AM.


  2. #2
    Account Inactive xkelvin94 is offline
    InactiveRank
    Nov 2010 Join Date
    ::Malaysia::Location
    235Posts

    Re: [All versions] Faster Cash Shop

    the different is the
    Spoiler:
    private static CashItemFactory instance = new CashItemFactory();


    and

    Spoiler:
    public static CashItemFactory getInstance() {
    return instance;
    }

  3. #3
    Account Upgraded | Title Enabled! AuroX is offline
    True MemberRank
    Sep 2008 Join Date
    1,435Posts

    Re: [All versions] Faster Cash Shop

    Then I guess just replace it with the one I posted above if you didn't edited it.

    EDIT* Oh and, if you're using Moople, you'll have to use another way as you can't reference a non-static object from a static object.
    Last edited by AuroX; 17-12-10 at 07:51 AM.

  4. #4
    Gamma Sparrow is offline
    GammaRank
    Mar 2009 Join Date
    SydneyLocation
    2,968Posts

    Re: [All versions] Faster Cash Shop

    Pretty cool!
    Would this increase the starting time by heaps?
    Last edited by Sparrow; 17-12-10 at 11:13 AM.

  5. #5
    Account Inactive MapleKFC is offline
    InactiveRank
    May 2010 Join Date
    120Posts

    Re: [All versions] Faster Cash Shop

    Good luck benefiting from it, Celino v82 source is free.

  6. #6
    Custom title enabled Vakarian is offline
    Apr 2008 Join Date
    Ohio, USALocation
    2,261Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by MapleKFC View Post
    Good luck benefiting from it, Celino v82 source is free.
    It also happens to be an MSEA source.

  7. #7
    I'm overrated. Fraysa is offline
    GammaRank
    Apr 2008 Join Date
    4,763Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by yenpooh View Post
    Then I guess just replace it with the one I posted above if you didn't edited it.

    EDIT* Oh and, if you're using Moople, you'll have to use another way as you can't reference a non-static object from a static object.
    Then just remove the "static" from getInstance..

  8. #8
    Account Upgraded | Title Enabled! jadeling is offline
    True MemberRank
    Jul 2008 Join Date
    706Posts

    Re: [All versions] Faster Cash Shop

    oh noooo,this will caused buying package not working.

  9. #9
    I'm overrated. Fraysa is offline
    GammaRank
    Apr 2008 Join Date
    4,763Posts

    Re: [All versions] Faster Cash Shop

    Hooray for the copy pasta.

  10. #10
    Account Upgraded | Title Enabled! AuroX is offline
    True MemberRank
    Sep 2008 Join Date
    1,435Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by jadeling View Post
    oh noooo,this will caused buying package not working.
    Lol, don't copy and paste blindly.

  11. #11
    Account Inactive LikeReally is offline
    InactiveRank
    Jul 2010 Join Date
    hereLocation
    210Posts

    Re: [All versions] Faster Cash Shop

    Since when is loading by MySQL faster?

  12. #12
    may web.very maple.pls. iAkira is offline
    Alpha MaleRank
    Aug 2009 Join Date
    somewhere..Location
    2,383Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by LikeReally View Post
    Since when is loading by MySQL faster?
    This is loading from the xml files is it not? o.O

  13. #13
    Account Upgraded | Title Enabled! AuroX is offline
    True MemberRank
    Sep 2008 Join Date
    1,435Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by iAkira View Post
    This is loading from the xml files is it not? o.O
    Yea, you're right. This allows cash items to be loaded from XMLs when you start the channel server.

  14. #14
    Account Upgraded | Title Enabled! jadeling is offline
    True MemberRank
    Jul 2008 Join Date
    706Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by yenpooh View Post
    Lol, don't copy and paste blindly.
    I didn't copy and paste :o,I'm just telling that if you use this,will caused package not working.

  15. #15
    Account Inactive ProGamerForLife is offline
    InactiveRank
    Sep 2008 Join Date
    iTouchMsLocation
    1,205Posts

    Re: [All versions] Faster Cash Shop

    Quote Originally Posted by LikeReally View Post
    Since when is loading by MySQL faster?
    Since when is not knowing what you're talking about, then posting shit which blatantly shows that you don't know shit good?




Page 1 of 2 12 LastLast

Advertisement