Emberveil source

tests/BlackGoldPartyhatAssets.java

import java.io.*;
public final class BlackGoldPartyhatAssets {
 public static void main(String[]args)throws Exception {
  String root="runtime/ammunition-stage/cache/";
  try(RandomAccessFile dat=new RandomAccessFile(root+"main_file_cache.dat","r");RandomAccessFile i0=new RandomAccessFile(root+"main_file_cache.idx0","r");RandomAccessFile i1=new RandomAccessFile(root+"main_file_cache.idx1","r")){
   Decompressor config=new Decompressor(dat,i0,1),models=new Decompressor(dat,i1,2);
   ItemDef.unpackConfig(new StreamLoader(config.decompress(2)));Model.method459(65000,new OnDemandFetcher());
   Stream versions=new Stream(new StreamLoader(config.decompress(5)).getDataForName("model_version"));
   for(int id=0;id<versions.buffer.length/2;id++)if(versions.readUnsignedWord()!=0)Model.method460(GodWarsAssetCheck.inflate(models.decompress(id)),id);
   ItemDef red=ItemDef.forID(14999);if(!red.name.toLowerCase().contains("black-gold"))throw new AssertionError("Red hat definition mismatch");
   if(red.method196(0)==null||red.method196(1)==null||red.method194(0)==null||red.method194(1)==null)throw new AssertionError("Hat equipment/head models missing");
   for(int color:red.method196(0).anIntArray1640)if(color!=8)throw new AssertionError("Hat must be black: "+color);
   DrawingArea.initDrawingArea(64,64,new int[4096]);Texture.method364();Texture.method372(0.8);
   if(ItemDef.getSprite(14999,1,0)==null)throw new AssertionError("Bank sprite missing");
   DrawingArea.initDrawingArea(64,64,new int[4096]);Texture.method364();
   Sprite icon=ItemDef.getSprite(14999,1,0);java.awt.image.BufferedImage image=new java.awt.image.BufferedImage(icon.width,icon.height,java.awt.image.BufferedImage.TYPE_INT_RGB);image.setRGB(0,0,icon.width,icon.height,icon.pixels,0,icon.width);javax.imageio.ImageIO.write(image,"png",new File("runtime/blackgold-partyhat-icon.png"));
   if(!ItemDef.forID(1038).name.toLowerCase().contains("red partyhat"))throw new AssertionError("Ordinary red hat changed");
   System.out.println("PASS custom14999 black hat, male/female wearable and dialogue models, bank sprite; ordinary red hat unchanged");
  }
 }
}