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.
Then, Go to ChannelServer.java, find
Add this under it,
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.
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: