Emberveil sourcetests/OwnerBankCatalog.java
import java.io.*;
import java.util.*;
/** Validates the owner's requested bank stock against the actual shipped client cache. */
public final class OwnerBankCatalog {
public static void main(String[] args)throws Exception {
String root="runtime/client-cache/";
try(RandomAccessFile dat=new RandomAccessFile(root+"main_file_cache.dat","r"); RandomAccessFile idx=new RandomAccessFile(root+"main_file_cache.idx0","r")) {
ItemDef.unpackConfig(new StreamLoader(new Decompressor(dat,idx,1).decompress(2)));
Map<Integer,Integer> stock=new LinkedHashMap<>();
int[] gear={11694,11696,11698,11700,11716,11718,11720,11722,11724,11726,11728,11730,11732,4151,5698,4587,1305,1377,1434,7158,3140,4087,4585,1149,1187,6570,6585,6737,6733,6731,6735,7462,8850,3749,3751,3755,4212,4224,861,859,9185,2491,2497,2503,4675,1409,2415,2416,2417,1381,1383,1385,1387,1391,1393,1395,1397,1399,1401,1403,1405,1407,4099,4101,4103,4105,4107,6914,6916,6918,6920,6922,6924,4131,3105,1837,1712,1725,1727,1729,1731};
for(int id:gear)stock.put(id,10);
for(int id=4708;id<=4738;id+=2)stock.put(id,10);
for(int id:new int[]{4745,4747,4749,4751,4753,4755,4757,4759,6524,6568})stock.put(id,10);
for(int id:new int[]{2436,2440,2442,2444,3040,3024,6685,2434,2448,2452})stock.put(id,1000);
for(int id:new int[]{385,391,3144,379})stock.put(id,10000);
for(int id:new int[]{554,555,556,557,558,559,560,561,562,563,564,565,566,892,9144,9244,4740})stock.put(id,100000);
try(PrintWriter json=new PrintWriter("runtime/bonds-bank-stock.json","UTF-8"); PrintWriter report=new PrintWriter("runtime/bonds-bank-stock.tsv","UTF-8")) {
json.print("["); boolean first=true; int count=0;
for(Map.Entry<Integer,Integer> entry:stock.entrySet()) {
int id=entry.getKey(); ItemDef def=ItemDef.forID(id);
if(def.name==null || def.name.equalsIgnoreCase("null") || def.certTemplateID!=-1) { System.out.println("Excluded unavailable item: "+id); continue; }
if(!first)json.print(","); first=false;
json.print("{\"id\":"+id+",\"amount\":"+entry.getValue()+"}");
report.println(id+"\t"+def.name+"\t"+entry.getValue()); count++;
}
json.println("]"); System.out.println("Validated "+count+" owner-bank item types against shipped cache.");
}
}
}
}